Difference between revisions of "Operations on volumes"

From Dynamo
Jump to navigation Jump to search
Line 67: Line 67:
====Equivalent in Imod====
====Equivalent in Imod====
Imod provides the <tt>flipyz</tt> option in its command for flipping files, with the syntax:   
For flipping tomograms, Imod provides the <tt>flipyz</tt> option in its command [http://bio3d.colorado.edu/imod/doc/man/clip.html clip], with the syntax:   
<tt>clip flipyz original.mrc flipped.mrc</tt>
<tt>clip flipyz original.mrc flipped.mrc</tt>

Revision as of 17:56, 12 April 2017

There are different operations that are frequently required when processing 3d data, both for small volumes (as templates, averages and particle) or tomograms. Dynamo and Matlab itself provide several commands.

Using the functions

In general, volumes need to be read into the worskpace, creating a variable. The operator can then be used onto the variable and then the result is written back into a file. For instance, to bin the contents of the file myFile.mrc and write the result into the file binned.mrc

 a = dread('myFile.mrc'); 
 b = dbin(a,2);  

Most processing options accept as input indistinctly a filename or a variable. Note also that dread accepts the alternative command line syntax:

 dread myFile.mrc a 

Dealing with large tomograms

Reading full tomograms into the worskpace might be a bad idea, leading to overcrowding you RAM memory and freezing your system. In these situations, it is frequently a good approach to let Dynamo divide automatically the tomogram and operate separately on the chunks (we call this "chunk partition" in the documentation). There are two different devices for this task:

Commands oriented to chunk processing

Some tasks already integrate the operation through a chunk partition operated on the fly, for instance the binning of tomograms, which allows the command dpktomo.partition.bin

Partition objects

Technical information

For operations that you want to define yourself, you can use the class behind dpktomo.partition.bin, i.e. mbgeom.partition.GridPartition



Command dbin. See also dpktomo.tools.flipYZ for larger volumes.

Equivalent in Imod

Imod provides the binvol command. The binning factor follows a different convention. In Imod, the syntax:

binvol -i original.mrc -o binned.mrc -b 4

would correspond to a binning factor of 2 in dbin (or any other binning tool inisde Dynamo).


Command dynamo_normalize_roi. You can also pass a mask, so that the normalization will ensure zero mean and std=1 inside the mask.


The bandpass filter can be performed with the command dynamo_bandpass .html dbandpass. The extent of the band is given in fourier pixels.

Median filtering is available through dynamo_median.html dmedian.

Contrast inversion

You can just use the minus operator in Matlab:

 dread file.mrc a 
 b = -a;

possibly normalizing again.

Flipping along a direction

You can use the Matlab command flip. This requires using dread to bring the contents of a file into the Matlab workspace.

Also, you can use the Dynamo command dpktomo.tools.flipYZ to flip the contains of a file controlling the maximum amount of memory used as a given time.

Flipping two directions

You can use the Matlab commad permute to interchange two directions in a volume. Take into account that this causes a swap of handedness.

Equivalent in Imod

For flipping tomograms, Imod provides the flipyz option in its command clip, with the syntax:

clip flipyz original.mrc flipped.mrc

This command will change the handedness of the tomogram.

Rotations and shifts

dynamo_rot.html drot,dynamo_move .html dmove


The general function is dynamo_sym.html dsym. The notation for the symmetry operators in this command is the one used when defining project parameters.

Advanced functions

A (somewhat) GUI version is available as the command dvolume. The command line counterpart is dynamo_particle.html dparticle, which accepts several operators (binning, symmetrization, etc). The notation of the operators in dparticle is the same used in other instances of Dynamo (normally under the name actions or particle actions) when volumetric transformations are operated on the fly. For instance when depicting the contents of data folders with ddbrowse.