4 Post-Processing: Decompress, Unpack and Apply Gain Reference

4.1 Decompress

Decompressing the compressed TIFF file is straightforward. IMOD program tif2mrc takes input of compressed AND uncompressed TIFF(the property of compression is hidden).

% tif2mrc FrameStack.tif FrameStack.mrc

If it is also packed, you can unpack it as this:

% clip unpack FrameStack.mrc UnpackedFrameStack.mrc

In either above case, the MRC output file has 8-bit integer data type.

4.2 Apply gain reference to frames with standard orientation

The gain software gain reference is not rotated or flipped.

If the box next to "Save frames wothout rotation/flip to standard orientation" IS checked, the frames are saved as is - no rotation and/or flip. In this case, to apply Gatan gain reference file is straightforward.

  1. Convert Gatan reference from dm4 to mrc format.

    % dm2mrc gatanRef.dm4 gatanRef.mrc 
    
  2. Apply reference file. Depending on wether frames are saved as packed or not, using one of the following commands.

    • For packed frames, unpacking them and applying gain reference file can be made with a single command.

      % clip unpack fileWithFrames_packed.mrc gatanRef.mrc normalizedFrames.mrc
      
    • For unpacked,

      % clip mult -n 16 fileWithFrames.mrc gatanRef.mrc normalizedFrames.mrc
      

      Here, after gain reference applied, the result is multiplied by 16 first, then rounded to integer. In theory, any rounding will cause information loss. In this case, the 4-bit data are scaled up by 16 before rounding, the loss is very small.

      If one does want full precision without any rounding, then it is better to use floats as output.

      % clip mult -m 2 fileWithFrames.mrc gatanRef.mrc normalizedFrames.mrc
      

      From DM 2.31, there is also a defects.txt saved along with gain reference file. The correction for this defects can be done by adding "-D defects.txt" before fileWithFrames.mrc, like following

      % clip mult -m 2 -D defects.txt fileWithFrames.mrc gatanRef.mrc normalizedFrames.mrc
      

4.3 Apply gain reference to frames with rotated/fliped orientation

If the box next to "Save frames wothout rotation/flip to standard orientation" is NOT checked, the frames are saved with rotation and/or flip. In this case, in order to apply gain reference to image or frames, Gatan gain reference file has to be converted to MRC first and then ALSO rotated and flipped accordingly. IMOD commands newstack -rot and clip flipx will do rotation and flip.

If in DigitalMicrograph camera configuration windows, the rotation is 270 degree and "flip along Y" is checked, that means that frames are rotated to 270 and flipped along Y axis. We need to rotate Gatan gain reference file in opposite way.

The following IMOD command requires version 4.6.26 or higher.

Here are step to process Gatan gain reference file. The order of the actions is required.

  1. Convert Gatan reference from dm4 to mrc.

    % dm2mrc gatanRef.dm4 gatanRef.mrc 
    
  2. Rotate -270 degree.

    % newstack -rot -270 gatanRef.mrc gatanRef_rot-270.mrc
    
  3. Flip image around Y.

    % clip flipy gatanRef_rot-270.mrc  gatanRef_rot-270_flipy.mrc 
    

Now, gain reference is ready to be applied on our frame stacks. Using one of the follows commands, depending on frames being saved with packing or not.

  1. For packed frames, unpacking them and applying gain reference file can be made with a singple caolland.

    % clip unpack fileWithFrames_packed.mrc gatanRef_rot-270_flipy.mrc  normalizedFrames.mrc
    
  2. For unpacked,

    % clip mult -n 16 fileWithFrames.mrc gatanRef_rot-270_flipy.mrc normalizedFrames.mrc
    

For more details, please see SerialEM HelpFile.