Chimera Commands Index

mask  volume-model  surf-models  options

The mask command extracts a volume data subregion bounded by surfaces (details...). All kinds of surface models can be used, but not surfaces in VRML models. A new data set with values of zero in the masked-out areas will be generated, and can be saved to a file using Volume Viewer or the command volume. See also: vop, sop, shape, segment, Segger, SegFit, Icosahedron Surface, Volume Eraser, Volume Tracer

Volume-model can be the model number (preceded by #) of the input volume data set, or the word ones to indicate a map with all values set to 1. The spacing and border options only apply when the volume data is specified as ones.

Surf-models specifies the bounding surface(s) and can be one or more comma-separated model numbers (preceded by #) or the word sel to indicate the currently selected surfaces or surface pieces.


Option keywords for mask can be truncated to unique strings, and their case does not matter. Synonyms for true: True, 1. Synonyms for false: False, 0. A vertical bar “|” designates mutually exclusive options, and default settings are indicated with bold.
axis  x,y,z
Projection axis vector (default is along the data Y axis: 0,1,0). This is relevant when the surfaces have holes. The region between surface layers is computed along the specified axis (see algorithm). Vector coordinates x,y,z are relative to the untransformed data. The vector can point in any direction (need not be parallel to the X, Y, or Z axis) and need not be of unit length.
fullmap  true | false
Make the masked volume data set have the same dimensions as the original volume data set. The full size of the original volume data set is used even if only a subregion is being displayed. Otherwise, the bounds will be set as small as possible to enclose the surfaces, and the masked volume may be smaller. If the input volume is specified as ones (which has no defined dimensions), the border option applies instead.
pad  distance
Before computing the masked volume, move the surface by the specified distance along the surface normals. The units of length are the same as for the data (generally Å or nm), and positive or negative values can be used. This allows extracting a larger or smaller region than is enclosed by the original surface. Known problem: if the resulting surface intersects itself, the masked volume will not include the intersection. For larger-region extraction, the problem can be avoided by using extend instead.
extend  N
Before computing the masked volume, move the surface outward by N voxels, where N is a positive integer. In other words, include grid points that are within N grid units (along the grid X, Y, and Z axes) of the original surface. Unlike pad, this option correctly handles self-intersections of the expanded surface.
slab  width | d1,d2
Extract a slab of data around a surface layer. Two additional surfaces, displaced as specified from the existing surface and joined at their edges (if any), are computed but not displayed. Data for voxels between the computed surfaces are retained. If a single value (width) is supplied, the two computed surfaces are offset along the normals of the original surface by ±½(width). Alternatively, two values separated by a comma but no spaces can be used to specify the offsets of the two surfaces independently. Positive or negative values can be used, and the units of length are the same as for the data (generally Å or nm). The basic algorithm applies, except that the original surface is replaced by the pair of computed surfaces.
sandwich  true | false
Include only volume voxels lying between two surface layers. Otherwise, the volume projected along the axis beyond a single surface layer will also be included (see algorithm).
fillOverlap true | false
When multiple surface pieces are specified, retain the union of the values from masking to each piece separately. For example, if two surface pieces are concentric spheres, fillOverlap true will return values for all grid points within the larger sphere, whereas fillOverlap false will return values for only those points in the shell between the two surfaces.
invertMask true | false
Include the opposite data, the spatial complement of what would otherwise be included.
spacing  S | Sx,Sy,Sz
Grid spacing for the output map when the input volume is specified as ones (default 1% of the maximum of the X, Y, and Z dimensions of the bounding surfaces); otherwise, the spacing will be the same as for the input map. The spacing is specified in units of length, typically Å. If a single number is supplied, it is used in all three directions; if three numbers are supplied (separated by commas but not spaces), they are used in the X, Y, and Z directions, respectively.
border  B
How far out from the bounding surfaces in all six directions (±X, ±Y, ±Z) to place the edge of the output map when the input volume is specified as ones; otherwise, the bounds will be set as described for the fullmap option. The border distance B is specified in units of length, typically Å (default 0.0).
modelId  N
Open the new volume as model number N (an integer, optionally preceded by #). Submodel specifications #N.N (# required) can also be given. The default is the lowest unused number.

Mask Algorithm

The masked volume is computed by finding where lines parallel to the projection axis intersect the surfaces. For a given line, the volume data between the 1st and 2nd, 3rd and 4th, 5th and 6th, ... points of intersection are included in the masked volume, while those between the 2nd and 3rd, 4th and 5th, ... are excluded (unless multiple surface pieces are used and fillOverlap is set to true). The calculation uses a set of parallel lines that pass through points on a rectangular grid perpendicular to the projection axis. If the projection is along a data axis (data X, Y, or Z), the lines will pass through the grid points of the data; otherwise, lines along the projection axis with spacing equal to the minimum grid plane spacing of the data will be used. For each volume voxel, the intersections of the closest grid line are used to determine inclusion in the masked volume. If there is an odd number of intersections, then points beyond the final one are included in the masked volume unless the sandwich option is used. In the new data set, values outside the masked region are set to zero and those inside are set to the original volume values. The grid points of the calculated volume align exactly with those of the original volume. By default, the bounds are set to minimally enclose the surfaces (but see the fullmap and border options). The full size of the original volume data set is used even if only a subregion is being displayed.