Utilities for stack creation with the Hagen scheme

From Dynamo
Jump to: navigation, search

Here we describe some parsers we frequently use to organize the data folders delivered by the microscope operators into single stack files. The Hagen scheme collects the data in the order 0,angle1,-angle1,angle2,-angle2,..., which frequently leads to inconveniently formatted raw data folders after a data collection session.

This utility just:

  • parses the structure of the input folder
  • creates a correctly formatted input for the Imod command alignframes
  • creates the corresponding Imod order and
  • submits it to Imod

Thus, you'll need to have Imod activated in your session to use this parser

Input raw data folder

A typical input raw data folder contains

  • a gain reference file (with extension .dm4)
  • a defect file (with extension .txt)
  • a series of files, each one for each tilt angle.

An example:

CountRef_FtsH_23_000_-0.0_Sep07.dm4
defects_FtsH_000_0.0_Sep06.txt
FtsH_23_000_-0.0_Sep07.mrc
FtsH_23_001_3.0_Sep07.mrc
FtsH_23_002_-3.0_Sep07.mrc
  . . . .
FtsH_23_027_-42.0_Sep07.mrc
FtsH_23_028_42.0_Sep07.mrc
FtsH_23_029_45.0_Sep07.mrc
FtsH_23_030_-45.0_Sep07.mrc

Imod wrappers

Creates the wrapper object

p = <full path to your directory>;
a = dpcomp.hagen.StackConverter();
a.parseSourcePath(p); 

It will detect the contents of the file, and check that it can understand the ordering of the micrographs.

Order the projection files

You can display if the files where correctly parsed:

a.listFiles();

and, if so, you can then create a text file for them

a.writeList();

which will be called by default orderedFiles.list and will be located on the same directory. You can also create text file for the tilt angles with a.writeTiltList(); This will create by default the file stack.tlt

Align the frames

Imod order

The created order for imod will have the structure:

alignframes -gain GAINFILE -defect DEFECTFILE -mode 2 -list LIST STACK

By default, the target STACK will be called stack.mcr.

To create and run it, type:

a.imodAlignFrames('execute',1);

If the target STACK already exist in disk, Dynamo will show the formatted order, but will abort before submitting it to Imod. The 'execute' flag indicates Dynamo to submit the order (not only create the string). Other default values can be changed with the flags 'gain','defect','list','mode','target'

Troubleshouting

You need to activate Imod before opening Matlab (or before starting the Dynamo standalone session).

Batched operation

Single folder

To operate all the steps with default values on a single folder, use:

 check = dpcomp.hagen.StackConverter.processFolder(path) 

Cell array of folders

If you have the names of identically structured folders in a array (say, myFolders), you can operate the order:

 check = dpcomp.hagen.StackConverter.processFolderArray(myFolders) 

to create the stacks for all of them.