Documentation/4.3/Modules/Resampling

From Slicer Wiki
Jump to: navigation, search
Home < Documentation < 4.3 < Modules < Resampling


For the latest Slicer documentation, visit the read-the-docs.


This page discusses Resampling of image and model data. See here for an overview of registration methods.

Transforms and how they are displayed in 3DSlicer

Slicer displays images in physical space, using information on Image Spacing (voxel size), image origin, coordinate system and the direction of the coordinate axes. This information is usually contained in the image header. Some of it can be seen in the Volumes module under Volume Information. If the same image appears differently in different software, the reason is most likely different use/interpretation of this header information.

A transform describes a relocation from one physical orientation into another physical orientation. All registration routines produce such a transform, but it may be optional to the user to just keep the reoriented image and not the transform. Note that if you keep the transform, you can access it via the Data module, you can save it to a text (ITK) file and apply it to other images. There are several modules available just for the task applying such transforms to an image, a process usually referred to as resampling. There is one important distinction between linear (rigid to affine) and nonlinear (BSpline) transforms: Linear transforms can be visualized directly and immediately by placing images inside the transform in the Data module hierarchy. Some registration modules (e.g. BRAINSfit) do this automatically.

Slicer Registration Modules offer 2 types of output: an output transform and/or an output volume:

Method Output 1 Output 2
Rigid to Affine Registration Output Transform Output Volume
B-Spline Registration or combined Affine+B-Spline Registration Output Transform Output Volume

So the effect of a linear transform is therefore visible right away. Nonlinear (BSpline) transforms are not visualized on the fly and must be resampled to see. Hence if you calculate a BSpline transform inside BRAINSfit and then place a volume inside this transform, you will not see an effect, because the Viewer can apply only linear transforms directly. So to see a nonrigid transform you must resample the image. We therefore recommend to always select an output volume when running a nonrigid registration. To apply a transform and resample an image see the resampling via a spatial transformsection below.


What we mean by Resampling

Resampling builds a new dataset (image, surface, fiducials etc.) from an existing one, but with a different orientation, resolution, field of view or aspect ratio. For example the last step in registering two images consists of two main steps: finding the transform and resampling according to this transform. So the last step in registration will be to resample the moving data according to a spatial transform function, and thereby generate a new and aligned image. Or changing the voxel size to something larger or smaller involves resampling. See Wikipedia for a more detailed definition.

Interpolation is the process of estimating the value of the data based on surrounding values. This is necessary because spatial realignment is unlikely to be in exact multiples of voxel sizes. Please pay attention to selecting the proper interpolation method for your data-type. For more detail on interpolation we recommend this Wikipedia article.


Resampling in Place: Change Resolution or Field of View

  • The Crop Volume module ("Modules:All Modules" menu) lets you clip away the image data outside an interactively defined 3D box. Such cropping is very useful to focus automated processing (e.g. registration, segmentation) onto a region of interest or reduce memory usage and speed up performance. The cropping includes a resampling that allows to change the resolution (spacing) of the result image at the same time.
  • The Resample Scalar Volume module ("Modules:All Modules" menu) changes resolution (spacing) of an image, allowing several interpolation options for different data types. This is the method of choice if you wish to increase or decrease the number of voxels per mm or make the voxel size isotropic. You need to specify the desired voxel size in mm. If you do not know the current voxel size of your image, go to the Volume Information tab in the Volumes module.
  • The Cast Scalar Volume module ("Modules:All Modules" menu) lets you change the underlying datatype of your image, e.g. change from floating point to an integer or vice versa. This will not perform an interpolation, since the number of image voxels stays the same, but may be necessary to prepare the image for some modules or to reduce the image (file) size. For example an image stored as float will need twice as much disk space than one stored as short and four times as much as a char.
  • The Model To Label Map module ("Modules:Surface Models" menu) will do the inverse of the Model Maker and generate a binary 3D labelmap image with non-zero values at the location of the surface. This will let you bring the information from surface models back into an implicit image format. You set the resampling options, i.e. the resolution of the result via a reference image. Note that it will not fill a closed model, but produce points at the surface only.
  • The Orient Scalar Images module ("Modules:Converters" menu) will sample the image data along a specified orientation scheme, such as axial/sagittal/coronal planes or RAS or LPI etc. Note that the slices are not interpolated, they are just reordered and/or permuted. The resulting volume will cover the original volume. Because the display is in physical space, you will not see an effect of this resampling in the viewer.
  • The Volumes module ("Modules:Volumes" menu) lets you adjust the physical voxel size of an image (Info Tab), but will not generate a new volume. The changes will take effect immediately and you should see adjustments in your slice views. To obtain a new resampled volume, use the Resample Scalar Volume module described above.
  • The Resample Image (BRAINS) module ("Modules:Registration" menu) lets you resample your image to a new resolution (specified implicitly via a reference image), with choice of interpolation method and output datatype. To resample in place leave the Warp by Transform menu on None.


Resampling via a spatial transform

  • The Resample Image (BRAINS) module ("Modules:Registration" menu) supports applying linear transforms and deformation fields to an image, with choice of interpolation method and output datatype.
  • The Harden Transforms function (context menu via the right mouse button) in the Data module can also be used to resample an image or fiducial set through a linear transform.
  • The AC-PC Transform module ("Modules:Registration:Specialized" menu) lets you realign your brain image along the anterior-posterior commissure and interhemispheral midline. You (manually) select fiducials to define these points. An output transform is generated that you can then apply to the image using the resampling tools described here.
  • The main registration modules all contain a resampling option, i.e. they offer to produce a direct result volume, which includes a resampling step. In most cases the interpolation is linear. If you wish for more control over how the resampling is performed (e.g. select a different interpolator or output size or voxel size), select the registration module's option to generate an output/saved transform and then use one of the dedicated resampling modules described here to generate the new volume. The exception are modules which do not (yet) offer a transform output (e.g. Fast Nonrigid BSpline); for those you must use the module-specific resampling options to generate a result image.
  • The Expert Automated Registration module ("Modules:All Modules" menu) offers pure resampling from a given transform: select None for initialization and None for registration, specify the transform to apply under Load Transform and set the interpolation type under Advanced Registration Parameters.


Resampling Vector- and Tensor-Data

  • The Resample ResampleScalar/Vector/DWI Volume module ("Modules:All Modules" menu) is the method of choice to realign scalar, vector or diffusion weighted data along a given transform. It supports both linear and nonlinear transforms as well as deformation fields. Note that tensor data, such as DTI has a separate volume (below).
  • The Resample DTI Volume module ("Modules:All Modules" menu) is designed specifically for reorienting diffusion tensor MRI data. Note the difference to DWI above. Use this for DTI but not for DWI. It supports both linear and nonlinear transforms as well as deformation fields. Note that simply sending each component of a DTI tensor through the transform separately would yield an incorrect result. This module will transform the vector/tensor data correctly.