Difference between revisions of "Construction of masks"

From Dynamo
Jump to navigation Jump to search
Line 50: Line 50:
 
When you design a mask, it is frequently useful to check how it relates to a given template. This can be done with the command {{t|dslices}}, using the flags {{t|overlay}}, {{t|overlay_as}}
 
When you design a mask, it is frequently useful to check how it relates to a given template. This can be done with the command {{t|dslices}}, using the flags {{t|overlay}}, {{t|overlay_as}}
  
For instance, if you have  
+
For instance, if you have a template {{t|template.em}} and want to see how a sphere of radius=16 would act on it, you can type:
  
 
  <tt>dwrite(dynamo_sphere(16,64),'mask.em');</tt>
 
  <tt>dwrite(dynamo_sphere(16,64),'mask.em');</tt>
 
  <tt>dslices template.em y -ov mask.em -ovas mask -ovc b</tt>
 
  <tt>dslices template.em y -ov mask.em -ovas mask -ovc b</tt>
  
[[File:overlayed_mask_dslices.png|thumb|center|300px| The blue square is the control for the handdrawn shape]]
+
{{t|ov}} or {{t|overlay}} is the overlaying volume (in this case the just created file {{t|mask.em}}), {{t|ovas}} or {{t|overlay_as}} indicates that the overlaying volume is to be understood as a solid mask (i.e., we are interested in showing the bright pixels in the mask as a solid color). You can choose color and transparency with {{t|ovc}}/{{t|overlay_color}} and {{t| alpha}}.
 +
 
 +
[[File:overlayed_mask_dslices.png|thumb|center|300px| Mask overlay with {{t|dslices}}]]

Revision as of 10:58, 19 May 2016

Dynamo uses several types of masks in different pipelines.

Masks are used in Dynamo for several purposes: indicating the active part of the template for alignment, restricting the area of the aligned particles that will count for classification, avoiding FSC artifacts, placing aligned averages back in a tomogram....

In some tasks, the masks are expected to be simple geometrical shapes. In other occasions, it might be necessary to have a finer control on the process of constructing a mask. Dynamo includes several tools:

Geometrical Shapes

Use dmask to open a GUI with several geometrical options: spheres, ellipsoids, tubes, cylinders. dmask can be used from the command line.

There are other commands for specific geometries: dsphere, dshell, dcylinder....

Freehand draw

You can edit a template and draw on its 2D slices handdraw lines each enclosing an area of interest. There a different ways to convert such an area into a 3d volume

Revolution solids

Here, you would enclose an area on a 2d slice that includes the Z axis (i.e., a section from an X-view or a Z-view), and then let Dynamo rotate the area around the central Z axis to create a revolution solid.

This can be done with dynamo_mapview. Open your template, go to an X view, select one slice and press on [shift+S]. A second window will pop up, zooming into the selected slice. When you finish, the message area will tell you the name of the file containing the the created revolution solid.

The blue square is the control for the handdrawn shape. Solid red are levels interpolated between the user-drawn light levels

Slide by slide

You can edit a volume as a montage of orthoslices, and handdraw on each of them, or onto a selection of them an let Dynamo interpolate on the other sections:

dpkvol.montage('template.em');

Then choose the Mask tab to created a control for free handdraw of shapes on each slice. Secondary click on a drawn level will offer a menu of options, like interpolating between user-marked levels, or converting the current work into a cube.

The blue square is the control for the handdrawn shape. Solid red are levels interpolated between the user-drawn light levels

By thresholding and smoothing

A mask can be defined to XXXXX


Combination of masks

It is easy to create combinations of masks using logical operators: or just "adds" masks.

Alternatively, you can use the compact syntax in dynamo_mask_combine on a cell array of masks defined independently. The flag delete can be used to define parts of the final mask that need to be set to zero (black).


Depicting mask overlays

When you design a mask, it is frequently useful to check how it relates to a given template. This can be done with the command dslices, using the flags overlay, overlay_as

For instance, if you have a template template.em and want to see how a sphere of radius=16 would act on it, you can type:

dwrite(dynamo_sphere(16,64),'mask.em');
dslices template.em y -ov mask.em -ovas mask -ovc b

ov or overlay is the overlaying volume (in this case the just created file mask.em), ovas or overlay_as indicates that the overlaying volume is to be understood as a solid mask (i.e., we are interested in showing the bright pixels in the mask as a solid color). You can choose color and transparency with ovc/overlay_color and alpha.

Mask overlay with dslices