Simple Image Processing
IV Image Processing using Eos All Eos commands have the -h option as a reserved word, and the online help showing the easy usage of that command is displayed.
IV-1. A tool to observe an image A command to display a 2D image is Display2. Ex. This command can be executed like below:
$ Display2 -i filename
IV-2. Viewing image information As commands to view image information, mrcInfo and mrcImageInfo are often used. mrcInfo is used to view header and footer (trailer) information of the image. The size and format of the image can be viewed. Ex.
$ mrcInfo -i filename
mrcImageInfo is used to analyze and observe information on an entire image or peripheral areas. This shows statistical values of an entire image or peripheral areas, such as the value of maximum, minimum, average, or variance. Ex.
$ mrcImageInfo -i filename -I
IV-3. A tool to make images easy to observe IV-3.(1) Smoothing The (phase) contrast of transmission-type electron microscopes (hereinafter simply called TEM) is small on the low resolution side. Therefore, the shot image is harder to see seemingly as information is collected in higher resolution by shooting photographs in a better condition. So, molecular information becomes easy to observe by performing CTF compensation, simply eliminating low-frequency components, or reducing high-frequency noises or signals. The command applying the low-pass filter according to space resolution is mrcImageLowPassFilter. By typing like below,
$ mrcImageLowPassFilter -h
an easy help will appear, and you will understand the meaning of the low-pass filter mode. For example, if the low-pass filter is based on the Gauss function, the command line is as follows:
$ mrcImageLowPassFilter -i input -o output -m 4 -hvp 0.1
Exercise: Apply a low-pass filter, which is based on an exponential function by which 2nm is handled as a half value, to the given image. The command with a non-linear filter is mrcImageSmoothing. The median filter is often used. This filter is suitable for eliminating salt-and-pepper noises. For the kernel shape, rectangle (cuboid) and circle (sphere) can be selected. For example, if the filter takes the median in the circular range with a radius of 3 pixels, the command line is as follows: $ mrcImageSmoothing -i input -o output -r 3 -m 1 -M 1
Exercise: Apply a median filter with a radius of 2 pixels to the given image.
IV-3.(2) Histogram conversion This is a tool to change contrast to make the image easy to see by converting the image’s histogram. The mrcImageHighlighting command supports conversion and smoothing of histogram using the arctan function.
$ mrcImageHighlighting -i input -o output -m 2
$ mrcImageHighlighting -i input -o output -m 1 -b 0 -g 1
IV-3.(3) Edge emphasis Images shot by TEM have edge emphasis originally. If emphasizing the edge additionally, for example, if you wish to perform fitting between the images with emphasized edges, apply edge emphasis. The command applying the high-pass filter according to space resolution is mrcImageHighPassFilter.
IV-4. Conversion of image’s space direction IV-4.(1) Transposition This command rotates the image by 90 degrees. Note that this is not the transposition in the sense of mathematics. To perform such transposition, it is necessary to perform this command together with next command, mirroring.
$ mrcImageTranspose -i input -o output
IV-4.(2) Mirroring The mrcImageMirroring command is used to obtain a mirror image to the y axis of the image. A mirror image can be obtained by performing this command together with the rotation mentioned above. $ mrcImageMirroring -i input -o output IV-4.(3) Rotation and transfer The mrcImageRotation, mrcImageShift, and mrcImageTrans commands express image rotation and transfer. Now, interpolation of the image plays a very important role.
Rotation The mrcImageRotation command rotates the image basically around the Z axis. The mrcImageRotation3D command can express any rotation. Use the former basically like below when rotating a 2D image:
$ mrcImageRotation -i input -o output -a angle -Periodic
“angle” means a rotation angle [degrees]. “-Periodic” shows handling the peripheral area. To rotate a 3D image, use mrcImageRotation3D like below:
$ mrcImageRotation3D -i input -o output -EA YOYS 30 20 10 -M 2
Free rotation of Euler angle expression can be defined using -EA. “-M” means the interpolation method of the image.
Transfer The mrcImageShift and mrcImageMove commands are used to perform affine mapping using a matrix. Use them like below: $ mrcImageShift -i input -o output -x 10 -y 10 -z 0 -m 2 The numbers indicated by arguments such as -x, -y, or -z are specified by the pixel. In addition, “-m” specifies image interpolation here. This shows the same mode as mrcImageROI.
Affine mapping (rotation and transfer) The mrcImageTrans command is used to perform affine mapping using a matrix. Use this command like below:
$ mrcImageTrans -i input -o output -M matrix -m 2
“-m” specifies image interpolation. This command line shows the same mode as mrcImageROI. Matrix values are specified by the pixel.
IV-5. Conversion of image peripheral areas IV-5.(1) Window function A command to reduce peripheral contrast gradually is mrcImageWindowing. In digital image processing, real images appear repeatedly, and a problem occurs if contrast is greatly different between the right and left areas or the upper and lower areas. This command performs pre-processing to avoid this problem. For example, to reduce the contrast of more than 90% external area of the peripheral image, and define the contrast value as the average value of the image, the command line is as follows:
$ mrcImageWindowing -i input -o output -m 16
IV-5.(2) Padding This command covers the peripheral areas of an image with a window without signals. In digital image processing, images appear repeatedly, so that peripheral images influence peripheral areas on the opposite side. So, the peripheral areas must be covered with windows without signals as much as possible. It is desirable to make the values three times or more larger than those of the original image. The command to execute this processing is mrcImagePad. For example, to fill in the areas with the average value of the peripheral ones so that the image size becomes 256 x 256, it is enough to execute processing like below:
$ mrcImagePad -i input -o output -H 256 -W 256 -m 3
IV-6. Binarization There are various image processing methods utilizing binarized images. These commands described in this section can be executed for 3D images, too.
IV-6.(1) Binarization of a gray image The mrcImageBinalization command is used to binarize a gray image. $ mrcImageBinalization -i input -o output -m 32 By specifying like above, this command binarizes the image by the automatic threshold determination method utilizing the Otsu method.
IV-6.(2) Labeling of a binarized image The mrcImageLabeling command is used to label a binarized image. $ mrcImageLabeling -i input -o output By specifying like above, this command labels each particle image (connected component) in the binarized image.
IV-6.(3) Area calculation of a binarized image
The mrcImageAreaCalc command is used to calculate the area of the particle image in the binarized image.
$ mrcImageAreaCalc -i input -o output
By specifying like above, this command calculates area for each particle image (connected component) in the binarized image. This command is also used when cutting signals out of noises by cutting out only particle images with the largest volume or leaving only connected components with a volume above a certain level.
IV-7. Image deformation IV-7.(1) Conversion along a spline curve The mrcImageUnbentROI command is used for structure analysis utilizing spiral symmetry. This command sets up and interpolates a spline curve by defining the curve as the direction parallel to the y axis and the direction perpendicular to the curve as that parallel to the x axis. This command is suitable for correcting a slightly skewed spiral. This spline curve can be set up using Display2.
IV-7.(2) Prediction of an inclined image The mrcImageEstimateTiltImage command is used to predict an inclined image from a non-inclined image without any tilt and vice versa. Prediction is difficult of course because the image is actually three-dimensional. This command functions effectively if the image is close to a 2D image.
IV-8. Image processing of more than one pieces of images Commands supporting more than one images are also available. IV-8.(1) Statistic processing of images
To average two images, the following command can be used:
In this case, position transfer or rotation is not considered. However, the weight of the real or Fourier space can be handled. For example, values can be added between two 3D structures using the DoubleCounter output by mrc2Dto3D, which is the main program for 3D reconfiguration. This also makes it possible to average sub-tomograms as considering missing wedges. In addition to this, statistical information can be obtained from more than one images. For example, average and SD can be calculated using the following command:
To perform PCA (principle component analysis),
To conduct the Student-t test,
In addition to this, analysis such as ANOVA is usable.
IV-8.(2) Correlation between images These commands are programs to calculate the correlation between two images and show to what extent those are similar to each other.
To consider correlation by providing only parallel transfer to the images,
is effective. This command can output an average image or an image aligned with a position of an either image.
To consider correlation as taking image rotation into account,
is effective. This command can also output an average image or an image aligned with a position of an either image. This program is also used to determine the projection angle using reference images or perform cluster analysis.
The 3D version of this program is:
There is a method called FSC, which uses similarity among the images to evaluate their Resolutions. When using this method, the command below is used.
There are many commands available in addition to these ones. Confirm the overall functional command list.