Difference: CemFibSEMProcessing (17 vs. 18)

Revision 1817 Aug 2015 - Main.BillRice

 
META TOPICPARENT name="CemITApplications"
Contents

Slice and View Images

  • Images collected using slice and view are saved as a series of 8-bit tiffs
  • Since contrast on SEM is inverted from usual TEM images, I usually have the microscope invert the contrast before saving
    • this can also be done in the processign stage of course
  • Images are saved in a TiffImages? subdirectory on the microscope computer
  • These must be manually moved to the accessory computer
  • Images are coped nightly from the accesory computer to the sftp server, and can be manually coped to local workstations using winscp
  • Note that images on the accessory computer are automatically deleted after ~ 1 month

Processing of images using IMOD

  • Initial stacking and alignment can be done using command-line tools in imod
  • From there, the stack can be segmented with imod or other tools
  • Other useful programs are ImageJ, Amira, Fiji, ...

Stacking of tiffs

  • Copy the series of images to a workstation and put in their own subdirectory
  • Images can be converted to a mrc stack using tif2mrc:
      > tif2mrc Image*.tif rawstack.mrc

  • man tif2mrc for details and other options.

Remove a slice from a stack

      > newstack -secs 0-1198,1200-1282 rawstack.mrc rawstack-1.mrc

  • Note that IMOD displays from 1, but numbering for secs begins at 0

Alignment of stack

  • use xfalign to align shifts and rotation and work on unbinned images
    • -params 3 -reduce 1 does this
      >xfalign -params 3 -reduce 1 rawstack.mrc rawstack.xf
  • Alignment params saved in output file rawstack.xf
  • Other options are :
    • -size , -- to consider a subarea (2 integers), good to avoid constant density or featureless areas
    • -offset , -- to offset this subarea from the center (positive offsets means up and to the right)
    • -bilinear -- use bilinear interpolation, this is usually better
    • -sobel -- apply Sobel filter. This is an edge detecting filter, and often helps with alignments. Preview what it does using Imod.
  • man xfalign for more details an options, especially filtering options
  • a very good method:
         > xfalign -matt 0.25 -reduce 1 -bilinear -params 3 -sobel stack1_sm.mrc stack1_sm.xf 
 [eliminate outer 25%, no binning, bilinear interp, xy translation and rotation, apply sobel (edge detecting) filter before alignment]
  • note: Applying median filter followed by calculating alignment of filtered stack works quite well
    • Need to use -2d option!
    • alignments can be applied to unfiltered stack, which can then be median filtered in 3d if desired.
    • I generally apply the alignments to the filtered stack, and then often bin 2X
    • following command applies the default (size 3) median filter to each section in 2D:
    clip median -2d stack1.mrc stack1_m.mrc
  • To do a second round with warping and optional boundary model:
    xfalign -initial rawstack.xf -warp 2048,512 -boundary rawstack_bound.mod rawstack.mrc rawstack_man.xf

Dewarping a stack

  • Sometimes GUI doesn't work well -- get a lot of nan's in result
  • sample command line dewarp:
xfalign -bi -red 1 -prexcorr -params -1 -warp 512,512 alstack_ali.mrc alstack_ali.xf
xftoxg -n 0  alstack_ali.xf  alstack_ali.xg
Added:
>
>
  • Note: doing warping this way is sometimes less satisfactory than doing it the previous way (with xfalign -initial)
  • Doing it in a second complete set can result in bad edge effects
 
Changed:
<
<
d252 3
>
>
  • dewarping with -initial:
Added:
>
>
dewarp1.png

  • dewarping in 2 steps:
    dewarp2.png
 

Apply Alignments

  • first the alignments found must be converted from local (image to image) to global (overall)
  • use xftoxg
      > xftoxg rawstack.xf rawstack.xg
  • next use newstack to apply these alignments
      >newstack -xform rawstack.xg rawstack.mrc alstack.mrc

For data collected at a non-orthogonal viewing angle (e.g. 38 degrees), use -n 0 option to eliminate sample drift

  • afterwards, view the beginning and the end of the file to determine how much padding will need to be added in y to allow for drift
      > xftoxg -n 0 rawstack.xf rawstack.xg

  • Use newstack to apply these alignments, with final size adjustment due to shifting of images
  • Example: if top image has shift of -400, and bottom image has shift +400, need to adjust y-size by 800. 3536 + 800 = 4336

   >newstack -size 4096,4336 -xform rawstack.xg rawstack.mrc alstack.mrc
  • other options are to invert the contrast at this point, though generally images are collected with contrast inverted

Manual alignment using MIDAS

      > midas rawstack.mrc rawstack.xf
  • In midas find slice and move, save as rawstack.xfm
      > xftoxg -n 0 rawstack.xfm rawstack.xgm
  • for data collected at 38 degree converted from local (image to image) to global (overall) alignment

Squeeze Volume

  • Images taken at non-orthogonal viewing angle will have non-equal x and y pixels
  • Specifically, -38 degrees imaging angle corresponds to y-pixel = x-pixel/(cos 38) = 1.269 * y-pixel
  • Use squeezevol to stretch y-pixels
   > squeezevol  -e 1 -x 1 -y 0.788 -z 1 stack1m_al.mrc stack1_alsq.mrc
  • Note that z-pixel size will still likely be different

Shrink Volume

  • Final step is often to shrink by a factor of 2, to make data easier to handle and because full (2-pixel) resolution may not have been obtained
  • -shrink option in newstack does this well, using filter to avoid artifact effects
   > newstack -shrink 2  stack1_alsq.mrc stack1_alsqsh.mrc

Crop volume

  • Top or bottom of image may contain no data
  • to remove use the resize process in clip
  • following example resizes in y using an different output y size (oy) and a defined center (cy)
   > clip resize -oy 660 -cy 330 40_cell1_sm.mrc 40_cell1_sm_clipped.mrc

Montaging

  • Montage pairs can be collected
  • Save each set to a separate stack
  • Align each stack individually
  • After aligning, interleave stacks with script interleave.pl
    • the leftmost image must be the SECOND stack (so out stack will be R1,L1,R2,L2,...)
  • Determine alignment by cc:
    • make newtsacks by selecting 600 pixels ov overlapping edges from each stack
  • shrink stacks by factor of 2
  • get edges
   newstack -size 600,1768 -offset -800,0 stack1malsh0.mrc s1.mrc
   newstack -size 600,1768 -offset 800,0 stack2malsh0.mrc s2.mrc
  • interleave stacks into a third stack
  • get alignments of pairs:
   xfalign -reduce 1 -params 2 -bilinear -bpair s3.mrc s3.xf
  • xfalign may not work well; use midas to check (or do it all in midas)
   midas s3.mrc s3.xf

  • With above params, assuming stack is 2048 pixels across, 800 will needed to be added to the offsets in the output
  • combinemrc.pl will apply these alignments to make a new stack
    • Use the original 2 stacks as input, the xf file as xf file, and 800 as the offset when prompted
    • For adding noise to blank regions, box out a cube of pure noise and determine the stats on it with header or equivalent

Vertical Montaging

  • Some sets also have a third or fourth image
  • Join the top 2 images as described above
  • If there are 2 images on the bottom, join them as well
  • for the protocol, call the top stack "top.mrc" and the bottom "bottom.mrc"

step 1: get a rough alignment

  • Get the first dozen or so images from each stack and interleave them:
   newstack -secs 0-11 top.mrc top12.mrc
   newstack -secs 0-11 bottom.mrc bottom12.mrc
   /cryoem/script/interleave.pl top11.mrc bottom11.mrc il11.mrc
  • Manually determine a rough alignment using midas:
   midas il11.mrc il11.xf
  • Using this initial alignment, make a full initial alignment for all sections:
   /cryoem/script/make_init_xf.pl
---+++ step 2: get a full alignment
  • interleave the full stacks
   /cryoem/script/interleave.pl top.mrc bottom.mrc il_full.mrc
  • Align using xfalign starting with roughly determined alignments
    • options to try: -reduce 1 ; -bilinear
   xfalign -initial initial.xf -bpair -params 2 -bilinear il_full.mrc il_full.xf
  • test the alignment on the first severa sections to see if it is good and if mag needs adjustment
  • first,apply it to a subset, then check in midas
   newstack -secs 0-23 -xform il_full.xf il_full.mrc il_full_ali.mrc
   midas il_full_ali.mrc

Step 3: magnification correction

  • if the images align but then differ towards edge, mag of bottom image needs adjustment
  • first, image the aligned interleaved stack with 3dmod and determine the x and y ranges which cover the overlap
  • next, make a full interlevaed file and box out the overalpping areas
   newstack  -xform il_full.xf il_full.mrc il_full_ali.mrc
   clip resize -x N,N -y N,N full_ali.mrc full_overlap.mrc

Handedness

  • In the above scheme, the first image is the "top" of the physical sample, but it is located at the bottom of the stack
    • MRC convention: the first Z slice in a stack is the bottom slice
  • Therefore the stacks must be swapped in one dimension to preserve correct chirality
  • following will reverse the Z-order of stacks:
   clip flipz stack_al.mrc stack_al_flipped.mrc
  • This can also be done in Amira by using the cropping tool

Curtain Removal

  • Curtaining seems to be caused by surface damage, or milling a rough surface
  • Best way is to prevent them from happening at all by minimizing viewing with ion-beam, particularly at high current (>80 pA)
  • Also pre-coat with Pt using e-beam, then coat with ion beam at minimum reasonable current (>10 min per area)

To remove using ImageJ?:

  • Manually design a filter
    • Do FFT of a sample image in stack
    • In FFT, box out small rectangles along middle of image
      • Example: FFT is 2048x2048: box out x-sixe=374, y-size= 14; xcenter = 1116 or 578; ycenter=1016
      • Need to box both sides
    • For each box, choose to Fill with black
    • Do inverse FFT
    • Should see reduction in curtains. Will need to play with size and positioning to optimize curtain removal and minimize artifacts
  • Make the filter
    • Make a new blank image: 8 bit; white background. Size should be 2Kx2K (all dimensions <2K pixels)or 4K x 4K (if any dimension > 2K pixels)
    • Mark out same boxes as above. If scale doubled, adjust accordingly
    • Save as Filter.tif * sample decurtaining filter:
      sample_filter.png
  • Apply Filter:
    • Choosr Proxess -> FFT --> Cursotm filter
    • Choose Ffilter.tif as input
    • BUG: Choose to process entire stack. Only one image is processed. Then choose again, deselect entire stack. Entire stack will be processed
  • NOTE: top and bottom edges will not be filtered, so it is best to do this on an uncropped image

  • Set ALLOWTOPICVIEW =

-- BillRice - 20 Nov 2012

Changed:
<
<
* dewarping with -initial:
>
>
Deleted:
<
<
dewarp1.png
 
Changed:
<
<
META FILEATTACHMENT attachment="sample_filter.png" attr="" comment="sample decurtaining filter" date="1407178774" name="sample_filter.png" path="sample_filter.png" size="3186" stream="sample_filter.png" user="Main.BillRice" version="1"
>
>
META FILEATTACHMENT attr="" autoattached="1" comment="dewarping with -initial" date="1439830067" name="dewarp1.png" path="dewarp1.png" size="274487" user="Main.BillRice" version="1"
Added:
>
>
META FILEATTACHMENT attr="" autoattached="1" comment="dewarping in 2 steps" date="1439830087" name="dewarp2.png" path="dewarp2.png" size="289588" user="Main.BillRice" version="1"
META FILEATTACHMENT attr="" autoattached="1" comment="sample decurtaining filter" date="1407178774" name="sample_filter.png" path="sample_filter.png" size="3186" user="Main.BillRice" version="1"
 
 
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding this intranet, Send feedback