Skip to content

MicrographDownSample

Adrian Quintana edited this page Dec 11, 2017 · 1 revision

Micrograph_downsample

Purpose

This utility allows you to downsample raw images. For doing so you will pick one sample every Xstep x Ystep pixels respectively in each direction. But the pixel you pick is not the pixel alone but a weighted average of its neighbourhood. This weighting is given by the kernel and that is why the output image should have more bits than the input one.

Usage


$ micrograph_downsample -i [image in] -o [image out] -Xstep [x step] -Ystep [y step]


Parameters

  • `` Input raw file, the corresponding.inf must exist

  • `` Output raw file, must be different from input. A file[image_out].inf is created.

    • -output_bits [bits32] = You can supply the number of bits for output, either 8, 16 or 32
  • `` See drawing above

    • -Ystep [ystepxstep] =
  • `` Interpolation made in Fourier space. This option does NOT require akernel o`step`

  • `` The image is reduced using the smoothing algorithm of XV. The output number of bits is always 8

  • `` The kernel is a rectangle of this size

  • `` The kernel is a binary circle of this radius

  • `` The kernel is a gaussian with the given sigma and of size 2r x 2r

  • `` The kernel is a 1x1 rectangle, ie, the algorithm just pick the pixel at that position

  • -kernel sinc [delta0.02] [Deltaw=0.1] of the total frequency range).

  • `` The endianness of the micrograph is reversed with respect to the local machine endianness

Examples and notes

  • The Blackman window is

  • 42+0.5cos(2PIx/(N-1))+0.08cos(4PIx/(N-1)) if ABS(x)<N/2 0 otherwise

  • The Sinc function is defined as sinc(x/Ts)sin(PI*x/Ts)/(PI*x/Ts) </verbatim> It becomes 0 at k*Ts/2, where k1,2,3,..., and in frequency it is a perfect step with cutoff frequency w0=1/Ts

  • If you are downsampling a function which you expect to have Ts A of resolution, from an image which was taken at Tm A/pixel, the maximum downsampling factor you can apply must meet:

 M<=Ts/(2*Tm) 
  • The Sinc-Blackman filter is designed to have a cutoff frequency of 1/(2MTm). The ripple of the filter is determined by the threshold applied to the sinc, the more values passing, the less the ripple.

  • If the size of the original image is not a multiple of the downsampling factor, then you will experience problems when marking particles in the downsampled image and cutting from the original. The particles will be moved by [xstep]*([Xdim] mod [xstep]). See micrograph_window for a solution

  • The output has more useful bits than the input image. For instance, if the input image is 8 bits and a 2x2 rectangular kernel is applied, then the output has 10 significant bits. You might choose to save it in 8 or 16 bits as you wish.

  • If the input image size is not an exact multiple of the Xstep, then the output image size rounds towards 0 the Xdim/Xstep ratio.

A normal downsampling would be:


$ micrograph_downsample -i g0ta.tot -o g0ta_down.tot -Xstep 2 -kernel sinc 95 40

$ micrograph_downsample -i g0ta.tot -o g0ta_down.tot -fourier 0.3333 


USER's COMMENTS

the kernel used by default (kernel sinc I think) introduces and artifact in the images. I recomend using kernel rectangle. Main.RafaelNunezRamirez 16 Mar 2007 - 17:45
This problem has been solved for version 1.2. The rectangular kernel is the poor man's lowpass filtration, if you can afford, use the new sinc. Main.CoSS 02 Apr 2007 - 15:11

--Main.CoSS - 02 Apr 2007

Clone this wiki locally