Loading...
 

Padding

Padding an image is adding a border around it. This can be necessary for a number of reasons:
  • The image is going to be rotated and you do not want the corners to be cut off.

Quite some operations in Huygens Pro are based on Discrete Fourier Transforms (DFT). The use of these has many advantages but also results in the need to change the image size to avoid:
  • One or more dimensions of the image hamper efficient computation of its Fourier transform. Dimensions which allow efficient computation of the DFT are composed of small primes like 2, 3, 5, 7, depending on the type of DFT.
  • 'Wrap around' effects which are caused by the property of DFTs that the image is interpreted as periodic, i.e. the image is continued on all sides by exact copies of itself.

The borders are usually filled to allow for a smooth transition when going from one side of the padded image to the opposing side.

In Huygens Essential padding occurs automatically during the Image Restoration if necessary. In Huygens Professional, the user has more control on the padding, see below.

Padding and restoration functions

All restoration functions use padding. The type of padding actually used depends on the microscope type and on whether the border is in the lateral or axial direction. Different padding strategies can be chosen:
  • AUTOMATIC: The padding depends on the image size and microscope type.
  • OFF (parent): Takes the size of the parent image, so in fact no padding is made. If the sizes can be factored into small primes, powers of 2, and the object in the image is surrounded by empty space, OFF can very well be used.
  • PADDED PARENT: In this mode extra volume is added to the image. The border size computed by the software is a trade-off between FFT compute efficiency and the size of the original image. The size of the border therefore depends on the size of the original image.
As an example: consider a image with 31 layers. The next size, 32, would allow efficient Fourier transforms because it is a power of two. However, to avoid wrap around effects a single extra layer is not enough. In this case the software will select a total of 40 slices as compromise between compute efficiency, image size and wrap around effects.
  • FULLY PADDED PARENT: This mode is especially relevant for widefield images; for other microscope types it is equivalent to PADDED PARENT.

Padding and Widefield images

In restoring Widefield images the software must remove the contributions (blur!!!) of all XY slices of the object to each slice of the object. This means that to compute the top slice of the object everything below must be taken into account, using the bottom half of the PSF. For the bottom part of the object the top part of the PSF is needed. Thus the full PSF must be twice as high as the object. Worst case the object is just contained in the image, so in that case the PSF
must be twice as high as the image. Since the use of Fourier transforms requires the PSF and the image to be of the same size the image must be padded to double its size. In practice however, objects are usually generously contained in the image. In that case the AUTOMATIC padding mode will be sufficient.

Manual padding

The Add/Remove border function allows you to add padding manually. Filling mode and shape can be controlled manually. The size of the pads can be computed automatically or be set manually.

Shallow pancake images

If images with a low number of XY planes are padded the padding in the Z-direction will significantly increase the data size. If the image is already large with respect to the available system resources it is usually a good idea to do manual padding to avoid a prime number in the Z-dimension. However, widefield images should not be padded manually.

Filling mode

Added borders can be filled in the following manners:
  • Empty (default)
  • Linear. Linear interpolation is used between the value of the first original image voxels in both directions perpendicular to the border.
  • Quadratic. The voxel value is determined by quadratic interpolating in a direction perpendicular to the border between a control point with value zero and the nearest original image voxel. When Shape scale set to 1.0 the control point is at the padded image border. In that case the interpolated voxel values follow a parabolic shape from zero at the edge to the value of the nearest original image voxel. In the case with Shape scale > 1.0 the parabolas overlap and the contributions from both sides are summed.
  • Sinusoid. The contributions of the nearest voxel values are now weighted with a cos^2>(x) function, with x = (π/2 * distance)/(total border size). This ensures a very smooth fit.
  • Gaussian. Same as above but now using a Gaussian weighting function. Shape scale controls the width of the Gaussian; with Shape scale = 1.0 the Gaussian weighting function is 1/e at the borders of the padded image.