sampilcopy2d.py

(Last update 07/27/2013, Maofu Liao)

===> Usage: sampilcopy2d.py Input(#) Output(#) Selection [Process(clip,inv,bin,norm)]
     NOTE: (1) One set of 2D images: Input has #, Selection = list(file)
      One single 2D image : Input no  #, Selection = "single"
      One        2D stack : Input no  #, Selection = "all" or list(file)
  (2) Input any format. Output must be SPIDER(*.dat) or MRC(*.mrc)
  (3) "Process": SIG_range_outliner,Invert_contrast,Binning,SIG_multiplier_normalization.
      Use 0 : skip certain options. 
      Binning : [A]verage pixels, [M]edian pixel value, [F]ourier interpolation.
      Example : "5,1,A4,1": Remove SIG5 outliner, invert contrast, 4-bin by avg, normalization.

This script uses python libraries for I/O and computation, without using SPIDER or em2em. It can do almost all processing jobs for 2D images. It reads all formats, and outputs SPIDER or MRC files.
(1) Convert a single 2D image:
    sampilcopy2d.py image.dm3 image.mrc single
(2) Convert a set of 2D images, with 2 X 2 binning by averaging neighboring pixels:
    sampilcopy2d.py image_####.dm3 image_####.dat 1-10 0,0,A2,0
(3) Convert a particle stack:
    sampilcopy2d.py stack.mrc stack.dat all
(4) Extract a subset of the particle stack:
    sampilcopy2d.py stack.mrc stack_sel01.dat sel01.plt
(5) Process a particle stack:
    sampilcopy2d.py stack.mrc stack.mrc all 5,1,F64,1
    (This will remove SIGMA=5 outliners, invert contrast, Fourier binning to 64 box size, and do normalization with multiplier=1.)
    (Note that although the provided output name is the same as input name, the actual output file is named as "stack_fixs5_i_fp64_n1.mrc".)