mincresample - resamples a minc file along new spatial dimensions
[<options>] <infile> <outfile>
will resample a minc file along new spatial dimensions with new
voxel positions. Each volume in the input file (given by the spatial
dimensions xspace, yspace and zspace) is resampled according to the
command-line options. Non-spatial dimensions are preserved in their
original order, but spatial dimensions can be re-ordered to give
transverse, sagittal or coronal images. The new voxel values are
calculated using tri-linear, tri-cubic or nearest-neighbour
World coordinates refer to millimetric coordinates relative to some physical
origin (either the scanner or some anatomical structure). Voxel coordinates
are simply the indices into the image volume of a given voxel.
In order to specify appropriate resampling options, it is necessary
to understand how MINC coordinate conversions work.
Each dimension of a MINC image volume is specified by name - the
spatial dimensions are xspace, yspace and zspace. The convention is
that positive xspace coordinates run from the patient's left side to
right side, positive yspace coordinates run from patient posterior to
anterior and positive zspace coordinates run from inferior to
superior. For each of these spatial dimensions, the world coordinate
conversion is specified by a pair of attributes: step and start. The
xspace world coordinate, for example is calculated using x = v*step +
start, where x is the x world coordinate and v is the voxel count
(starting at zero). Thus the magnitude of the step attribute
specifies the distance between voxels and the sign of the step
attribute specifies the orientation of the axis.
There is a further twist: MINC files are allowed to have
non-orthogonal axes with the dimensions not perfectly aligned with the
named axis. There can be a direction_cosine attribute that gives the
true orientation of the axis. For example, normally the xspace
dimension should line up with the world x axis, ie. direction cosine =
(1,0,0); however, it is possible to have a direction cosine of (0.9,
These attributes (step, start and direction_cosines) provide a
conversion from voxel coordinates to world coordinates. Combined with
a number of elements or samples along an axis, they provide a complete
description of where the output sampling should be. However, when we
are resampling data, we are frequently interested in a change of world
coordinates: from an MRI scanner's coordinate system to a PET
scanner's coordinate system, for example, or from a volume in its
acquisition space to coordinates in a standardized space. This change
of world coordinates can be specified through the use of a
transformation (.xfm) file. Thus, in general, the resampling involves
three transformations: from the input file's voxel coordinates to its
world coordinates (specified by the input file), from the input world
coordinates to the output world coordinates (specified by the
transformation file), and from the output file's world coordinates to
its voxel coordinates (specified by command-line options).
In general, direction cosines are rarely used - axis re-orientation is
specified by a change of world coordinates (the transformation file).
As well, resampling positions (output world to voxel conversion) are
often specified relative to a model file (ie. resample this file so
that it looks like that file). Although there are many options for a
complete specification of the transformation, one does not usually
need to specify more than a few of them.
Note that options can be specified in abbreviated form (as long as
they are unique) and can be given anywhere on the command line.
Create MINC 2.0 format output files.
Overwrite an existing file.
Don't overwrite an existing file (default).
Print out progress information for each slice computed (default).
Do not print out progress information.
Options that give the output sampling (all of the following except
-transformation) are parsed in the order that they appear on the
command line. Thus a command with -like file.mnc -znelements 34
-zstep 2 will give a sampling like that in file in file.mnc but with
34 samples at 2 mm along the zspace axis. The default sampling is
taken from the input file, transformed according to any transformation.
Specify a file giving the world coordinate transformation (default is
the identity transformation).
Invert the transformation before using it.
Do no invert the transformation (default).
Transform the input sampling (using the transform specified by
-transformation) along with the data and use this as the default
Use the input sampling as the default sampling, as is, without
transformation, even though the data is being transformed (old
Specify a model file that gives the output world to voxel
transformation and number of elements (ie. transform this file so that it
looks like that one).
Set the sampling to standard values (start = 0, step = 1, direction
cosines point along appropriate axes).
Set the name of the output space (usually native____ or talairach_).
Set the name of the output space to talairach_.
Set the units of the output space.
-originox oy oz
Specify the coordinate of the first voxel. This is not the same as the
start value if the direction cosines are non-standard. As well, the
start is not just a perpendicular projection of the origin onto the
axis, it is a parallel projection (as in a multi-dimensional
parallelogram projection). The conversion is handled properly by this
-nelementsnx ny nz
Number of elements along each of the world dimensions.
Number of elements along the xspace dimension.
Number of elements along the yspace dimension.
Number of elements along the zspace dimension.
-stepxstep ystep zstep
Step between voxels along each of the world dimensions.
Step between voxels along the xspace dimension.
Step between voxels along the yspace dimension.
Step between voxels along the zspace dimension.
-startxstart ystart zstart
Position of centre of first voxel along each of the world dimensions.
Position of centre of first voxel along the xspace dimension.
Position of centre of first voxel along the yspace dimension.
Position of centre of first voxel along the zspace dimension.
-dircosx1 x2 x3 y1 y2 y3 z1 z2 z3
Direction cosines for each of the world axes.
-xdircosx1 x2 x3
Direction cosines for the xspace dimension.
-ydircosy1 y2 y3
Direction cosines for the yspace dimension.
-zdircosz1 z2 z3
Direction cosines for the zspace dimension.
The default is to preserve the original dimension order.
Write out transverse slices.
Write out sagittal slices.
Write out coronal slices.
Output data type and range
The default for type, sign and valid range is to use those of the input
file. If type is specified, then both sign and valid range are set to
the default for that type. If sign is specified, then valid range is
set to the default for the type and sign.
Store output voxels in 8-bit integer format.
Store output voxels in 16-bit integer format.
Store output voxels in 32-bit integer format.
Superseded by -int.
Store output voxels in 32-bit floating point format.
Store output voxels in 64-bit floating point format.
Write out values as signed integers (default for short and long). Ignored for
floating point types.
Write out values as unsigned integers (default for byte). Ignored for
floating point types.
specifies the valid range of output voxel values. Default is the full range
for the type and sign. This option is ignored for floating point
Preserve the real minimum and maximum from the input volume, so that
values are scaled in the same way on output. This is particularly
useful for resampling label volumes where interpolating intensity
values does not make sense.
Recompute the real minimum and maximum for each output slice. This is
Handling of undefined (invalid) voxel values
Output voxels that fall outside of the input volume have undefined
values. When the -fill option is used, these voxels are given a value
that is outside of the valid range (less than the valid minimum, if
the type, sign and valid range permit) so that they can be detected
by other software. The values of these voxels are not included in the
image-max and image-min variables.
Use a real/physical value (not voxel value) of zero for points
outside of the input volume. These points are included in the
calculation of the image-max and image-min variables.
This is the default.
Specifies a real/physical value (not voxel value) for points outside
of the input volume. The points are not included in the calculation
of the image-max and image-min variables.
Do a tri-linear interpolation between voxels. The edges of the volume
are at the centre of the first and last voxels of a dimension. This
is the default.
Do a tri-cubic interpolation between voxels. The edges of the volume
are at the centre of the first and last voxels of a dimension.
Do nearest neighbour interpolation between voxels (ie. find the voxel
closest to the point and use its value). The edges of the volume
are at the edge of the first and last voxels of a dimension (centre
+/- half voxel separation).
Do renormalized windowed-sinc interpolation between voxels, as described
by Thacker et al. JMRI 10:582-588 (1999).
Specifies the half-width of the sinc interpolation kernel, in the range
from 1 to 10. The full sinc kernel width is n * 2 + 1, and therefore
varies from 3 to 21. The default value is 5 giving a full-width of 11.
Use a Hanning window with the sinc interpolant. This is the default.
Use a Hamming window with the sinc interpolant.
Print summary of command-line options and exit.
Print the program's version number and exit.
Resample an individual's brain in a standardized space on a
standard sampling grid: