Difference between revisions of "Documentation/4.1/Modules/Resampling"

From Slicer Wiki
Jump to: navigation, search
(Created page with '=Transforms and how they are displayed in 3DSlicer= Slicer displays images in physical space, using information on ''Image Spacing'' (voxel size), ''image origin'', ''coordinate …')
 
Line 1: Line 1:
 
=Transforms and how they are displayed in 3DSlicer=
 
=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 [[Documentation/4.1/Volumes|''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. <br>
 
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 [[Documentation/4.1/Volumes|''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. <br>
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 [[Documentation/4.1/Data|''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 [[Documentation/4.1/Data|''Data module'']] hierarchy. Some registration modules (e.g. BRAINSfit) do this automatically. 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.  
+
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 [[Documentation/4.1/Data|''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 [[Documentation/4.1/Data|''Data module'']] hierarchy. Some registration modules (e.g. BRAINSfit) do this automatically. 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 [[Documentation/4.1/Modules/Resampling#R|Applying a transform section below]].
 +
 
 
= What we mean by ''Resampling'' =
 
= 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.  
 
'''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.  

Revision as of 16:39, 20 April 2012

Home < Documentation < 4.1 < Modules < Resampling

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. 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 Applying a transform section 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 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 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 Info tab in the Volumes module.
  • The Resample Scalar Volume Batch Make module is the batch version of the above Resample Scalar Volume module. Use this if you have many image files that need to have their resolution changed/adjusted. The new resampled images will be written back out to a specified directory.
  • The Cast Image module 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 Diffusion Tensor Estimation module will produce a new tensor image from raw diffusion (DWI) MRI. The new volume will be in the same orientation and resolution as the input DWI. There are three estimation methods available: least squares, weigthed least squares and non-linear estimation.
  • The Model Into Label Volume module 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 Images module 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 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 BRAINSresample module lets you resample your image to a new resolution (specified implicitly via a reference image), with choice of interpolation method and output datatype.


Resampling via a spatial transform

  • The Resample Scalar/Vector/DWI Volume Module sends both scalar and vector images through a transform. Several interpolation options.
  • 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 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 ( Affine Registration, Expert Automated Registration, Deformable B-Spline Registration, Multires Affine Registration, Surface Registration, Fiducial Alignment etc. 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 BRAINSresample module supports applying linear transforms and deformation fields to an image, with choice of interpolation method and output datatype.
  • The Expert Automated Registration module 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 ResampleScalarVectorDWIVolume Module 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 is designed specifically for reorienting diffusion tensor MRI data. 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.

Resampling Surface- and Model-Data

  • The Model Transform Module reorients your surface model based on a transform. It creates a new model which is a transformed version of the input polygonal model
  • The Modules:Model Into Label Volume module will resample a model back into a labelmap (outline, non-filled).
  • The PolyData To Labelmap module will resample a model back into a labelmap while filling the interior.