Pre-Processing Native MINC Files
To re-order the internal dimensions of the MINC volume for optimized performance:
mincreshape -clobber +direction -dimorder zspace,yspace,xspace -dimsize xspace=−1 -dimsize yspace=−1 -dimsize zspace=−1 input.mnc output.mnc
To ensure that the voxel spacing is regular:
minc_modify_header -sinsert xspace:spacing=‘regular__’ input.mnc
minc_modify_header -sinsert yspace:spacing=‘regular__’ input.mnc
minc_modify_header -sinsert zspace:spacing=‘regular__’ input.mnc
To center a volume in the field of view, first obtain the extents of the bounding box, then change the start coordinates to place the origin at the center of the volume.
mincinfo input.mnc
file: input.mnc image: unsigned short 0 to 4095 image dimensions: xspace zspace yspace dimension name length step start -------------- ------ —— ----- xspace 160 1 −75.746 zspace 256 −1 123.252 yspace 224 −1 128.631
The corner of the volume with the origin at its center is:
xstart = -0.5 * xlength * xstep = -0.5 * 160 * 1 = -80.0 zstart = -0.5 * zlength * zstep = -0.5 * 256 * (-1) = 128.0 ystart = -0.5 * ylength * ystep = -0.5 * 224 * (-1) = 112.0
To set the origin:
minc_modify_header -dinsert xspace:start=-80.0 -dinsert zspace:start=128.0 -dinsert yspace:start=112.0 input.mnc
Here is a sample Perl script for converting: center_mnc_origin
Note that it is not necessary to reset the origin if the initial origin is close to the center of the field of view. This change is only necessary when the origin is far from the center, for example when the origin is set to the lower left corner of the field of view (often the case after a NIfTI to MINC conversion).