Difference between revisions of "Modules:BRAINSFit"
Hjmjohnson (talk | contribs) |
|||
Line 92: | Line 92: | ||
{| | {| | ||
| | | | ||
− | * <span style="color:blue">'''''Input Parameters''''' </span> | + | * <span style="color:blue">'''''Input Parameters''''' </span> |
** <span style="color:green">'''Fixed Image Volume'''</span> [<span style="color:orange">--fixedVolume</span>] : The fixed image for registration by mutual information optimization. | ** <span style="color:green">'''Fixed Image Volume'''</span> [<span style="color:orange">--fixedVolume</span>] : The fixed image for registration by mutual information optimization. | ||
** <span style="color:green">'''Moving Image Volume'''</span> [<span style="color:orange">--movingVolume</span>] : The moving image for registration by mutual information optimization. | ** <span style="color:green">'''Moving Image Volume'''</span> [<span style="color:orange">--movingVolume</span>] : The moving image for registration by mutual information optimization. | ||
− | * <span style="color:blue">'''''Registration phases to use''''' </span> | + | * <span style="color:blue">'''''Registration phases to use''''' </span> |
** <span style="color:green">'''Initialize with previously generated transform'''</span> [<span style="color:orange">--initialTransform</span>] : Filename of transform used to initialize the registration. This CAN NOT be used with either CenterOfHeadLAlign, MomentsAlign, GeometryAlign, or initialTransform file. | ** <span style="color:green">'''Initialize with previously generated transform'''</span> [<span style="color:orange">--initialTransform</span>] : Filename of transform used to initialize the registration. This CAN NOT be used with either CenterOfHeadLAlign, MomentsAlign, GeometryAlign, or initialTransform file. | ||
** <span style="color:green">'''Initialize with MomentsAlign registration phase'''</span> [<span style="color:orange">--useMomentsAlign</span>] : MomentsAlign assumes that the center of mass of the images represent similar structures. Perform a MomentsAlign registration as part of the sequential registration steps. This option MUST come first, and CAN NOT be used with either CenterOfHeadLAlign, GeometryAlign, or initialTransform file. This family of options superceeds the use of transformType if any of them are set. ''Default value: false'' | ** <span style="color:green">'''Initialize with MomentsAlign registration phase'''</span> [<span style="color:orange">--useMomentsAlign</span>] : MomentsAlign assumes that the center of mass of the images represent similar structures. Perform a MomentsAlign registration as part of the sequential registration steps. This option MUST come first, and CAN NOT be used with either CenterOfHeadLAlign, GeometryAlign, or initialTransform file. This family of options superceeds the use of transformType if any of them are set. ''Default value: false'' | ||
Line 109: | Line 109: | ||
− | * <span style="color:blue">'''''Output Settings (At least one output must be specified.)''''' </span> | + | * <span style="color:blue">'''''Output Settings (At least one output must be specified.)''''' </span> |
** <span style="color:green">'''Slicer BSpline Transform'''</span> [<span style="color:orange">--bsplineTransform</span>] : (optional) Filename to which save the estimated transform. NOTE: You must set at least one output object (either a deformed image or a transform. NOTE: USE THIS ONLY IF THE FINAL TRANSFORM IS BSpline | ** <span style="color:green">'''Slicer BSpline Transform'''</span> [<span style="color:orange">--bsplineTransform</span>] : (optional) Filename to which save the estimated transform. NOTE: You must set at least one output object (either a deformed image or a transform. NOTE: USE THIS ONLY IF THE FINAL TRANSFORM IS BSpline | ||
** <span style="color:green">'''Slicer Linear Transform'''</span> [<span style="color:orange">--linearTransform</span>] : (optional) Filename to which save the estimated transform. NOTE: You must set at least one output object (either a deformed image or a transform. NOTE: USE THIS ONLY IF THE FINAL TRANSFORM IS ---NOT--- BSpline | ** <span style="color:green">'''Slicer Linear Transform'''</span> [<span style="color:orange">--linearTransform</span>] : (optional) Filename to which save the estimated transform. NOTE: You must set at least one output object (either a deformed image or a transform. NOTE: USE THIS ONLY IF THE FINAL TRANSFORM IS ---NOT--- BSpline | ||
Line 117: | Line 117: | ||
− | * <span style="color:blue">'''''Registration Parameters''''' </span> | + | * <span style="color:blue">'''''Registration Parameters''''' </span> |
− | ** <span style="color:green">'''Transform Type'''</span> [<span style="color:orange">--transformType</span>] : Specifies a list of registration types to be used. The valid types are, Rigid, ScaleVersor3D, ScaleSkewVersor3D, Affine, and BSpline. Specifiying more than one in a comma separated list will initialize the next stage with the previous results | + | ** <span style="color:green">'''Transform Type'''</span> [<span style="color:orange">--transformType</span>] : Specifies a list of registration types to be used. The valid types are, Rigid, ScaleVersor3D, ScaleSkewVersor3D, Affine, and BSpline. Specifiying more than one in a comma separated list will initialize the next stage with the previous results. |
** <span style="color:green">'''Number Of Iterations'''</span> [<span style="color:orange">--numberOfIterations</span>] : The maximum number of iterations to try before failing to converge. Use an explicit limit like 500 or 1000 to manage risk of divergence ''Default value: 1500'' | ** <span style="color:green">'''Number Of Iterations'''</span> [<span style="color:orange">--numberOfIterations</span>] : The maximum number of iterations to try before failing to converge. Use an explicit limit like 500 or 1000 to manage risk of divergence ''Default value: 1500'' | ||
** <span style="color:green">'''Number Of Samples'''</span> [<span style="color:orange">--numberOfSamples</span>] : The number of voxels sampled for mutual information computation. Increase this for a slower, more careful fit. You can also limit the sampling focus with ROI masks and ROIAUTO mask generation. ''Default value: 100000'' | ** <span style="color:green">'''Number Of Samples'''</span> [<span style="color:orange">--numberOfSamples</span>] : The number of voxels sampled for mutual information computation. Increase this for a slower, more careful fit. You can also limit the sampling focus with ROI masks and ROIAUTO mask generation. ''Default value: 100000'' | ||
Line 129: | Line 129: | ||
− | * <span style="color:blue">'''''Advanced Output Settings''''' </span> | + | * <span style="color:blue">'''''Advanced Output Settings''''' </span> |
** <span style="color:green">'''Stripped Output Transform'''</span> [<span style="color:orange">--strippedOutputTransform</span>] : File name for the rigid component of the estimated affine transform. Can be used to rigidly register the moving image to the fixed image. NOTE: This value is overwritten if either bsplineTransform or linearTransform is set. | ** <span style="color:green">'''Stripped Output Transform'''</span> [<span style="color:orange">--strippedOutputTransform</span>] : File name for the rigid component of the estimated affine transform. Can be used to rigidly register the moving image to the fixed image. NOTE: This value is overwritten if either bsplineTransform or linearTransform is set. | ||
** <span style="color:green">'''Background Fill Value'''</span> [<span style="color:orange">--backgroundFillValue</span>] : Background fill value for output image. ''Default value: 0.0'' | ** <span style="color:green">'''Background Fill Value'''</span> [<span style="color:orange">--backgroundFillValue</span>] : Background fill value for output image. ''Default value: 0.0'' | ||
Line 137: | Line 137: | ||
− | * <span style="color:blue">'''''Control of Mask Processing''''' </span> | + | * <span style="color:blue">'''''Control of Mask Processing''''' </span> |
** <span style="color:green">'''Mask Processing Mode'''</span> [<span style="color:orange">--maskProcessingMode</span>] : What mode to use for using the masks. If ROIAUTO is choosen, then the mask is implicitly defined using a otsu forground and hole filling algorithm. The Region Of Interest mode (choose ROI) uses the masks to define what parts of the image should be used for computing the transform. ''Default value: NOMASK'' | ** <span style="color:green">'''Mask Processing Mode'''</span> [<span style="color:orange">--maskProcessingMode</span>] : What mode to use for using the masks. If ROIAUTO is choosen, then the mask is implicitly defined using a otsu forground and hole filling algorithm. The Region Of Interest mode (choose ROI) uses the masks to define what parts of the image should be used for computing the transform. ''Default value: NOMASK'' | ||
** <span style="color:green">'''Output Fixed Mask (ROIAUTO only)'''</span> [<span style="color:orange">--outputFixedVolumeROI</span>] : The ROI automatically found in fixed image. | ** <span style="color:green">'''Output Fixed Mask (ROIAUTO only)'''</span> [<span style="color:orange">--outputFixedVolumeROI</span>] : The ROI automatically found in fixed image. | ||
Line 145: | Line 145: | ||
− | * <span style="color:blue">'''''Special Input Image Parameters''''' </span> | + | * <span style="color:blue">'''''Special Input Image Parameters''''' </span> |
** <span style="color:green">'''Fixed Image Time Index'''</span> [<span style="color:orange">--fixedVolumeTimeIndex</span>] : The index in the time series for the 3D fixed image to fit, if 4-dimensional. ''Default value: 0'' | ** <span style="color:green">'''Fixed Image Time Index'''</span> [<span style="color:orange">--fixedVolumeTimeIndex</span>] : The index in the time series for the 3D fixed image to fit, if 4-dimensional. ''Default value: 0'' | ||
** <span style="color:green">'''Moving Image Time Index'''</span> [<span style="color:orange">--movingVolumeTimeIndex</span>] : The index in the time series for the 3D moving image to fit, if 4-dimensional. ''Default value: 0'' | ** <span style="color:green">'''Moving Image Time Index'''</span> [<span style="color:orange">--movingVolumeTimeIndex</span>] : The index in the time series for the 3D moving image to fit, if 4-dimensional. ''Default value: 0'' | ||
Line 154: | Line 154: | ||
− | * <span style="color:blue">'''''Registration Debugging Parameters''''' </span> | + | * <span style="color:blue">'''''Registration Debugging Parameters''''' </span> |
** <span style="color:green">'''Caching BSpline Weights Mode'''</span> [<span style="color:orange">--useCachingOfBSplineWeightsMode</span>] : This is a 5x speed advantage at the expense of requiring much more memory. Only relevant when transformType is BSpline. ''Default value: ON'' | ** <span style="color:green">'''Caching BSpline Weights Mode'''</span> [<span style="color:orange">--useCachingOfBSplineWeightsMode</span>] : This is a 5x speed advantage at the expense of requiring much more memory. Only relevant when transformType is BSpline. ''Default value: ON'' | ||
** <span style="color:green">'''Explicit PDF Derivatives Mode'''</span> [<span style="color:orange">--useExplicitPDFDerivativesMode</span>] : Using mode AUTO means OFF for BSplineDeformableTransforms and ON for the linear transforms. The ON alternative uses more memory to sometimes do a better job. ''Default value: AUTO'' | ** <span style="color:green">'''Explicit PDF Derivatives Mode'''</span> [<span style="color:orange">--useExplicitPDFDerivativesMode</span>] : Using mode AUTO means OFF for BSplineDeformableTransforms and ON for the linear transforms. The ON alternative uses more memory to sometimes do a better job. ''Default value: AUTO'' | ||
Line 166: | Line 166: | ||
− | * <span style="color:blue">'''''Risky Expert-only Parameters''''' </span> | + | * <span style="color:blue">'''''Risky Expert-only Parameters''''' </span> |
** <span style="color:green">'''Selective Permission for Transform Parameters to Vary'''</span> [<span style="color:orange">--permitParameterVariation</span>] : A bit vector to permit linear transform parameters to vary under optimization. The vector order corresponds with transform parameters, and beyond the end ones fill in as a default. For instance, you can choose to rotate only in x (pitch) with 1,0,0; this is mostly for expert use in turning on and off individual degrees of freedom in rotation, translation or scaling without multiplying the number of transform representations; this trick is probably meaningless when tried with the general affine transform. | ** <span style="color:green">'''Selective Permission for Transform Parameters to Vary'''</span> [<span style="color:orange">--permitParameterVariation</span>] : A bit vector to permit linear transform parameters to vary under optimization. The vector order corresponds with transform parameters, and beyond the end ones fill in as a default. For instance, you can choose to rotate only in x (pitch) with 1,0,0; this is mostly for expert use in turning on and off individual degrees of freedom in rotation, translation or scaling without multiplying the number of transform representations; this trick is probably meaningless when tried with the general affine transform. | ||
+ | |||
||[[Image:BRAINSFitUI_part1.png|thumb|280px|User Interface]] [[Image:BRAINSFitUI_part2.png|thumb|280px|User Interface]] | ||[[Image:BRAINSFitUI_part1.png|thumb|280px|User Interface]] [[Image:BRAINSFitUI_part2.png|thumb|280px|User Interface]] |
Revision as of 01:23, 9 June 2010
Home < Modules:BRAINSFitReturn to Slicer 3.6 Documentation
Module Name
BRAINSFit
General Information
Module Type & Category
Type: CLI
Category: Registration
Authors, Collaborators & Contact
Author: Hans J. Johnson, hans-johnson -at- uiowa.edu, http://wwww.psychiatry.uiowa.edu
Contributors: Hans Johnson(1,3,4); Kent Williams(1); Gregory Harris(1), Vincent Magnotta(1,2,3); Andriy Fedorov(5), fedorov -at- bwh.harvard.edu (Slicer integration); (1=University of Iowa Department of Psychiatry, 2=University of Iowa Department of Radiology, 3=University of Iowa Department of Biomedical Engineering, 4=University of Iowa Department of Electrical and Computer Engineering, 5=Surgical Planning Lab, Harvard)
Module Description
Program title | BRAINSFit |
Program version | 3.0.0 |
Program documentation-url | http://wiki.slicer.org/slicerWiki/index.php/Modules:BRAINSFit |
Insight/Examples/Registration/ImageRegistration8.cxx This program is the most functional example of multi-modal 3D rigid image registration provided with ITK. ImageRegistration8 is in the Examples directory, and also sec. 8.5.3 in the ITK manual. We have modified and extended this example in several ways:
- defined a new ITK Transform class, based on itkScaleSkewVersor3DTransform which has 3 dimensions of scale but no skew aspect.
- implemented a set of functions to convert between Versor Transforms and the general itk::AffineTransform and deferred converting from specific to more general representations to preserve transform information specificity as long as possible. Our Rigid transform is the narrowest, a Versor rotation plus separate translation.
- Added a template class itkMultiModal3DMutualRegistrationHelper which is templated over the type of ITK transform generated, and the optimizer used.
- Added image masks as an optional input to the Registration algorithm, limiting the volume considered during registration to voxels within the brain.
- Added image mask generation as an optional input to the Registration algorithm when meaningful masks such as for whole brain are not available, allowing the fit to at least be focused on whole head tissue.
- Added the ability to use one transform result, such as the Rigid transform, to initialize a more adaptive transform
- Defined the command line parameters using tools from the Slicer [ 3] program, in order to conform to the Slicer3 Execution model.
Added the ability to write output images in any ITK-supported scalar image format.
- Extensive testing as part of the BRAINS2 application suite, determined reasonable defaults for registration algorithm parameters. http://testing.psychiatry.uiowa.edu/CDash/
Usage
The BRAINSFit distribution contains a directory named TestData, which contains two example images. The first, test.nii.gz is a NIfTI format image volume, which is used the input for the CTest-managed regression test program. The program makexfrmedImage.cxx, included in the BRAINSFit distribution was used to generate test2.nii.gz, by scaling, rotating and translating test.nii.gz. You can see representative Sagittal slices of test.nii.gz (in this case, the fixed image, test2.nii.gz (the moving image), and the two images ’checkerboarded’ together to the right. To register test2.nii.gz to test.nii.gz, you can use the following command:
BRAINSFit --fixedVolume test.nii.gz \ --movingVolume test2.nii.gz \ --outputVolume registered.nii.gz \ --transformType Affine
A representative slice of the registered results image registered.nii.gz is to the right. You can see from the Checkerboard of the Fixed and Registered images that the fit is quite good with Affine transform-based registration. The blurring of the registered images is a consequence of the initial scaling used in generating the moving image from the fixed image, compounded by the interpolation necessitated by the transform operation.
You can see the differences in results if you re-run BRAINSFit using Rigid, ScaleVersor3D, or ScaleSkewVersor3D as the ----transformType parameter. In this case, the authors judged Affine the best method for registering these particular two images; in the BRAINS2 automated processing pipeline, Rigid usually works well for registering research scans.
Quick Tour of Features and Use
This section was partially generated with a python script to convert Slicer Execution Model xml files into MediaWiki compatible documentation
|
Development
Notes from the Developer(s)
This is a thin wrapper program around the BRAINSFitHelper class in BRAINSCommonLib. The BRAINSFitHelper class is intended to allow all the functionality of BRAINSFit to be easily incorporated into another program by including a single header file, linking against the BRAINSCommonLib library, and adding code similar to the following to your application:
typedef itk::BRAINSFitHelper HelperType; HelperType::Pointer myHelper=HelperType::New(); myHelper->SetTransformType(localTransformType); myHelper->SetFixedVolume(extractFixedVolume); myHelper->SetMovingVolume(extractMovingVolume); myHelper->StartRegistration(); currentGenericTransform=myHelper->GetCurrentGenericTransform(); MovingVolumeType::ConstPointer preprocessedMovingVolume = myHelper->GetPreprocessedMovingVolume(); /* Optional member functions that can also be set */ myHelper->SetHistogramMatch(histogramMatch); myHelper->SetNumberOfMatchPoints(numberOfMatchPoints); myHelper->SetFixedBinaryVolume(fixedMask); myHelper->SetMovingBinaryVolume(movingMask); myHelper->SetPermitParameterVariation(permitParameterVariation); myHelper->SetNumberOfSamples(numberOfSamples); myHelper->SetNumberOfHistogramBins(numberOfHistogramBins); myHelper->SetNumberOfIterations(numberOfIterations); myHelper->SetMaximumStepLength(maximumStepSize); myHelper->SetMinimumStepLength(minimumStepSize); myHelper->SetRelaxationFactor(relaxationFactor); myHelper->SetTranslationScale(translationScale); myHelper->SetReproportionScale(reproportionScale); myHelper->SetSkewScale(skewScale); myHelper->SetUseExplicitPDFDerivativesMode(useExplicitPDFDerivativesMode); myHelper->SetUseCachingOfBSplineWeightsMode(useCachingOfBSplineWeightsMode); myHelper->SetBackgroundFillValue(backgroundFillValue); myHelper->SetInitializeTransformMode(localInitializeTransformMode); myHelper->SetMaskInferiorCutOffFromCenter(maskInferiorCutOffFromCenter); myHelper->SetCurrentGenericTransform(currentGenericTransform); myHelper->SetSplineGridSize(splineGridSize); myHelper->SetCostFunctionConvergenceFactor(costFunctionConvergenceFactor); myHelper->SetProjectedGradientTolerance(projectedGradientTolerance); myHelper->SetMaxBSplineDisplacement(maxBSplineDisplacement); myHelper->SetDisplayDeformedImage(UseDebugImageViewer); myHelper->SetPromptUserAfterDisplay(PromptAfterImageSend); myHelper->SetDebugLevel(debugLevel); if(debugLevel > 7 ) { myHelper->PrintCommandLine(true,"BF"); }
Dependencies
BRAINSFit depends on Slicer3 (for the SlicerExecutionModel support) and ITK. BRAINSFit depends on the BRAINSCommonLib library
Tests
Nightly testing of the development head can be found at: http://testing.psychiatry.uiowa.edu/CDash
Known bugs
Links to known bugs and feature requests are listed at:
Usability issues
Follow this link to the Slicer3 bug tracker. Please select the usability issue category when browsing or contributing.
Source code & documentation
Links to the module's source code:
Source code:
More Information
Acknowledgment
This research was supported by funding from grants NS050568 and NS40068 from the National Institute of Neurological Disorders and Stroke and grants MH31593, MH40856, from the National Institute of Mental Health.
References
Publications related to this module go here. Links to pdfs would be useful.