Xmipp

xmipp_transform_mask (v3.0)

Usage

Create or Apply a mask. Count pixels/voxels within a mask

You do not need to give the dimensions of the mask but you simply provide an example of image/volume you are going to apply the mask to, then the dimensions are taken from this file and the mask is created. In the creation of the mask, a file with the mask is written to disk but it is not applied to the input file.

You can generate blank images/volumes with the size of the sample one if you do not supply any mask type.You may also apply masks without having to generate the corresponding files (but you also can save them)

This utility also allows you to count the number of pixels/voxels in an image/volume which are inside a given mask and whose value is below|above or both some threshold.

Parameters

-i, --input <input_file>
Input file: metadata, stack, volume or image.
--mode <mode=overwrite>
Metadata writing mode.
where <mode> can be:
  • overwrite Replace the content of the file with the Metadata
  • append Write the Metadata as a new block, removing the old one
--label <image_label=image>
Label to be used to read/write images.
-o, --output <output_file=>
Output file: metadata, stack, volume or image.
--oroot <root=>
Rootname of output individual images. Output image format can be set adding extension after rootname as ":ext".
--mask <mask_type=circular>


where <mask_type> can be:
    • circular <R> circle/sphere mask if R>0 => outside R if R<0 => inside R
    • DWT_circular <R> <smin> <smax> circle/sphere mask smin and smax define the scales to be kept
    • rectangular <Xrect> <Yrect> <Zrect=-1> 2D or 3D rectangle if X,Y,Z > 0 => outside rectangle if X,Y,Z < 0 => inside rectangle
    • crown <R1> <R2> 2D or 3D crown if R1,R2 > 0 => outside crown if R1,R2 < 0 => inside crown
    • cylinder <R> <H> 2D circle or 3D cylinder if R,H > 0 => outside cylinder if R,H < 0 => inside cylinder
    • cone <theta> 3D cone (parallel to Z) if theta > 0 => outside cone if theta < 0 => inside cone
    • wedge <th0> <thF> 3D missing-wedge mask for data collected between tilting angles th0 and thF (around the Y-axis)
    • binary_file <binary_file> Read from file
    • gaussian <sigma> 2D or 3D gaussian if sigma > 0 => outside gaussian if sigma < 0 => inside gaussian
    • raised_cosine <R1> <R2> 2D or 3D raised_cosine if R1,R2 > 0 => outside sphere if R1,R2 < 0 => inside sphere
    • raised_crown <R1> <R2> <pixwidth> 2D or 3D raised_crown if R1,R2 > 0 => outside sphere if R1,R2 < 0 => inside sphere
    • blob_circular <R1> <blob_radius> 2D or 3D blob circular if blob_radius > 0 => outside sphere if blob_radius < 0 => inside sphere
    • blob_crown <R1> <R2> <blob_radius> 2D or 3D blob_crown if blob_radius > 0 => outside sphere if blob_radius < 0 => inside sphere
    • blackman 2D or 3D Blackman mask always inside blackman
    • sinc <w> 2D or 3D sincs if w > 0 => outside sinc if w < 0 => inside sinc
-m <blob_order=2>
Order of blob
-a <blob_alpha=10.4>
Alpha of blob
--center <x0=0> <y0=0> <z0=0>
mask center
--create_mask <output_mask_file>
Don't apply and save mask
--count_above <th>
Voxels within mask >= th
--count_below <th>
Voxels within mask <= th
--substitute <val=0>
Value outside the mask: userProvidedValue|min|max|avg

Examples and notes

Sample at circular mask inside radius 72:
xmipp_transform_mask  -i reference.vol -o output_volume.vol --mask circular -72
As above but save mask:
xmipp_transform_mask  -i reference.vol --create_mask  output_mask.vol --mask circular -25
Mask and overwrite a selection file:
xmipp_transform_mask  -i t7_10.sel --mask circular -72
Mask using rectangular mask:
xmipp_transform_mask -i singleImage.spi -o salida20.spi --mask rectangular -10 -10

Creating a mask

Most of the masks are valid in 2D and 3D. If a mask is nonsense in some space (2D or 3D) then no mask is generated, for instance, an image with all 1's would be generated if a mask is nonsense in 2D

  Inner Outer
Circular circular_inner.gif circular_outer.gif
Rectangular rectangular_inner.gif rectangular_outer.gif
Crown crown_inner.gif crown_outer.gif
Gaussian gaussian_inner.gif gaussian_outer.gif
Raised Cosine raised_cosine_inner.gif raised_cosine_outer.gif
Raised Crown raised_crown_inner.jpg raised_crown_outer.jpg

Circular (2D) and Spherical (3D) masks

  • --mask circular [R] A binary mask (0 or 1) is generated
    If R>0 then the exterior of the circle/sphere is 1 and the interior is 0 circular_outer.gif
    If R<0 then the interior of the circle/sphere is 1 and the exterior is 0 circular_inner.gif

Rectangular (2D) and Box (3D) masks

  • --mask rectangular [Xrect] [Yrect] [Zrect] A binary mask (0 or 1) is generated. If Zrect is not given you cannot apply this mask to volumes
    If X,Y,Z>0 then the exterior of the rectangle/box is 1 and the interior is 0 rectangular_outer.gif
    If X,Y,Z<0 then the interior of the rectangle/box is 1 and the exterior is 0 rectangular_inner.gif

Circular (2D) and Spherical (3D) crowns

  • --mask crown [R1] [R2] A binary mask (0 or 1) is generated
    If R1,R2>0 then the exterior of the circular/spherical crown is 1 and the interior is 0 crown_outer.gif
    If R1,R2<0 then the interior of the circular/spherical crown is 1 and the exterior is 0 crown_inner.gif

3D cylinders

  • --mask cylinder [R] [H] A binary mask (0 or 1) is generated
    If R,H>0 then the exterior of the cylinder is 1 and the interior is 0  
    If R,H<0 then the interior of the cylinder is 1 and the exterior is 0  

3D cones

  • --mask cone [theta] A binary cone-shaped mask (0 or 1) is generated. The cone has an aperture angle of theta degrees and is parallel to the Z-axis
    If theta>0 then the exterior of the cone is 0 and the inside is 1  
    If theta<0 then the interior of the cone is 0 and the exterior is 1  

3D wedges

  • --mask wedge [theta0] [thetaF] A binary mask is created corresponding to a missing wedge in Fourier-Space, for data that is collected between tilting angles theta0=[-90,0] and thetaF=[0,90]. The Y-axis is supposed to be the tilting axis.

2D and 3D Gaussians

  • --mask gaussian [sigma] A continuous mask [0,1] is generated
    If sigma>0 then the exterior of the gaussian is 1 and the interior is 0 gaussian_outer.gif
    If sigma<0 then the interior of the gaussian is 1 and the exterior is 0 gaussian_inner.gif

2D and 3D raised cosines

  • --mask raised_cosine [R1] [R2] A continuous mask [0,1] is generated. For R1<R<R2 the mask performs a smooth adaptation from 0 to 1
    If R1,R2>0 then the exterior of the circle/sphere crown is 1 and the interior is 0 raised_cosine_outer.gif
    If R1,R2<0 then the interior of the circle/sphere crown is 1 and the exterior is 0 raised_cosine_inner.gif

2D and 3D raised crowns

  • --mask raised_crown [R1] [R2] [pix_width] A continuous mask [0,1] is generated. For R1-pix_width<R<R1+pix_width the mask performs a smooth adaptation from 0 to 1, in R1+pix_width<R<R2-pix_width is constant and R2-pix_width<R<R2+pix_width it is also smooth
    If R1,R2>0 then the exterior of the circle/sphere crown is 1 and the interior is 0 raised_crown_outer.jpg
    If R1,R2<0 then the interior of the circle/sphere crown is 1 and the exterior is 0 raised_crown_inner.jpg

Masks from files

  • --mask [file] A binary file is read from the selected file. It can be a 2D or a 3D binary mask

User's comments

%COMMENT{type="tableappend"}%