Difference between revisions of "Utilities for stack creation with the Hagen scheme"

From Dynamo
Jump to navigation Jump to search
(Created page with "Here we describe some parsers we frequently use to organize the data folders delivered by the microscope operators into single stack files. This utility just: * parses the st...")
 
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
Here we describe some parsers we frequently use to organize the data folders delivered by the microscope operators into single stack files.  
+
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 <tt>0,angle1,-angle1,angle2,-angle2,...</tt>, which frequently leads to inconveniently formatted raw data folders after a data collection session.
 +
 
 
This utility just:
 
This utility just:
 
* parses the structure of the input folder
 
* parses the structure of the input folder
Line 7: Line 9:
  
 
Thus, you'll need to have Imod activated in your session to use this parser
 
Thus, you'll need to have Imod activated in your session to use this parser
 
  
 
== Input raw data folder ==
 
== Input raw data folder ==
Line 16: Line 17:
 
* a series of files, each one for each tilt angle.  
 
* a series of files, each one for each tilt angle.  
  
 +
An example:
 
  <nowiki>
 
  <nowiki>
 
CountRef_FtsH_23_000_-0.0_Sep07.dm4
 
CountRef_FtsH_23_000_-0.0_Sep07.dm4
Line 22: Line 24:
 
FtsH_23_001_3.0_Sep07.mrc
 
FtsH_23_001_3.0_Sep07.mrc
 
FtsH_23_002_-3.0_Sep07.mrc
 
FtsH_23_002_-3.0_Sep07.mrc
FtsH_23_003_-6.0_Sep07.mrc
+
  . . . .
FtsH_23_004_6.0_Sep07.mrc
 
FtsH_23_005_9.0_Sep07.mrc
 
FtsH_23_006_-9.0_Sep07.mrc
 
FtsH_23_007_-12.0_Sep07.mrc
 
FtsH_23_008_12.0_Sep07.mrc
 
FtsH_23_009_15.0_Sep07.mrc
 
FtsH_23_010_-15.0_Sep07.mrc
 
FtsH_23_011_-18.0_Sep07.mrc
 
FtsH_23_012_18.0_Sep07.mrc
 
FtsH_23_013_21.0_Sep07.mrc
 
FtsH_23_014_-21.0_Sep07.mrc
 
FtsH_23_015_-24.0_Sep07.mrc
 
FtsH_23_016_24.0_Sep07.mrc
 
FtsH_23_017_27.0_Sep07.mrc
 
FtsH_23_018_-27.0_Sep07.mrc
 
FtsH_23_019_-30.0_Sep07.mrc
 
FtsH_23_020_30.0_Sep07.mrc
 
FtsH_23_021_33.0_Sep07.mrc
 
FtsH_23_022_-33.0_Sep07.mrc
 
FtsH_23_023_-36.0_Sep07.mrc
 
FtsH_23_024_36.0_Sep07.mrc
 
FtsH_23_025_39.0_Sep07.mrc
 
FtsH_23_026_-39.0_Sep07.mrc
 
 
FtsH_23_027_-42.0_Sep07.mrc
 
FtsH_23_027_-42.0_Sep07.mrc
 
FtsH_23_028_42.0_Sep07.mrc
 
FtsH_23_028_42.0_Sep07.mrc
Line 51: Line 30:
 
FtsH_23_030_-45.0_Sep07.mrc
 
FtsH_23_030_-45.0_Sep07.mrc
 
</nowiki>
 
</nowiki>
 
  
 
== Imod wrappers ==
 
== Imod wrappers ==
Line 57: Line 35:
 
== Creates the wrapper object ==
 
== Creates the wrapper object ==
  
</tt>p = <full path to your directory>;
+
<nowiki>p = <full path to your directory>;
 
a = dpcomp.hagen.StackConverter();
 
a = dpcomp.hagen.StackConverter();
a.parseSourcePath(p); </tt>
+
a.parseSourcePath(p); </nowiki>
  
 
It will detect the contents of the file, and check that it can understand the ordering of the micrographs.
 
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:
 +
 +
<tt>a.listFiles();</tt>
 +
 +
and, if so, you can then create a text file for them
 +
<tt>a.writeList();</tt>
 +
 +
which will be called by default <tt>orderedFiles.list</tt> and will be located on the same directory. You can also create text file for the tilt angles with
 +
<tt>a.writeTiltList();</tt>
 +
This will create by default the file <tt>stack.tlt</tt>
 +
 +
== Align the frames ==
 +
 +
=== Imod order ===
 +
 +
The created order for imod will have the structure:
 +
 +
<tt>alignframes -gain GAINFILE -defect DEFECTFILE -mode 2 -list LIST STACK</tt>
 +
 +
By default, the target <tt>STACK</tt> will be called <tt>stack.mcr</tt>.
 +
 +
To create and run it, type:
 +
 +
<tt>a.imodAlignFrames('execute',1);</tt>
 +
 +
If the target <tt>STACK</tt> 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 <tt> 'gain','defect','list','mode','target'</tt>
 +
 +
=== 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:
 +
<tt> check = dpcomp.hagen.StackConverter.processFolder(path) </tt>
 +
 +
=== Cell array of folders ===
 +
 +
If you have the names of identically structured folders in a [[Matlab cell array | array]] (say, <tt>myFolders</tt>), you can operate the order:
 +
<tt> check = dpcomp.hagen.StackConverter.processFolderArray(myFolders) </tt>
 +
to create the stacks for all of them.

Latest revision as of 12:52, 10 March 2017

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.