SimpleITK
|
Deformably register two images using level set motion. More...
#include <sitkLevelSetMotionRegistrationFilter.h>
Deformably register two images using level set motion.
LevelSetMotionFilter implements a deformable registration algorithm that aligns a fixed and a moving image under level set motion. The equations of motion are similar to those of the DemonsRegistrationFilter . The main differences are: (1) Gradients of the moving image are calculated on a smoothed image while intensity difference are measured on the original images (2) Magnitude of the motion vector is a function of the differences in intensity between the fixed and moving pixel. An adaptive timestep is calculated based on the maximum motion vector over the entire field to ensure stability. The timestep also implicitly converts the motion vector measured in units of intensity to a vector measured in physical units. Demons, on the other hand, defines its motion vectors as function of both the intensity differences and gradient magnitude at each respective pixel. Consider two separate pixels with the same intensity differences between the corresponding fixed and moving pixel pairs. In demons, the motion vector of the pixel over a low gradient region will be larger than the motion vector of the pixel over a large gradient region. This leads to an unstable vector field. In the levelset approach, the motion vectors will be proportional to the gradients, scaled by the maximum gradient over the entire field. The pixel with at the lower gradient position will more less than the pixel at the higher gradient position. (3) Gradients are calculated using minmod finite difference instead of using central differences.
A deformation field is represented as a image whose pixel type is some vector type with at least N elements, where N is the dimension of the fixed image. The vector type must support element access via operator []. It is assumed that the vector elements behave like floating point scalars.
This class is templated over the fixed image type, moving image type and the deformation field type.
The input fixed and moving images are set via methods SetFixedImage and SetMovingImage respectively. An initial deformation field maybe set via SetInitialDisplacementField or SetInput. If no initial field is set, a zero field is used as the initial condition.
The algorithm has one parameters: the number of iteration to be performed.
The output deformation field can be obtained via methods GetOutput or GetDisplacementField.
This class make use of the finite difference solver hierarchy. Update for each iteration is computed in LevelSetMotionFunction.
Ref: B.C. Vemuri, J. Ye, Y. Chen, C.M. Leonard. "Image registration via level-set motion: applications to atlas-based segmentation". Medical Image Analysis. Vol. 7. pp. 1-20. 2003.
Definition at line 65 of file sitkLevelSetMotionRegistrationFilter.h.
Public Types | |
using | PixelIDTypeList = BasicPixelIDTypeList |
using | Self = LevelSetMotionRegistrationFilter |
Public Types inherited from itk::simple::ImageFilter | |
using | Self = ImageFilter |
Public Types inherited from itk::simple::ProcessObject | |
using | Self = ProcessObject |
Public Member Functions | |
Image | Execute (const Image &fixedImage, const Image &movingImage) |
Image | Execute (const Image &fixedImage, const Image &movingImage, const Image &initialDisplacementField) |
double | GetAlpha () const |
uint32_t | GetElapsedIterations () const |
Number of iterations run. More... | |
double | GetGradientMagnitudeThreshold () const |
double | GetGradientSmoothingStandardDeviations () const |
double | GetIntensityDifferenceThreshold () const |
double | GetMaximumError () const |
unsigned int | GetMaximumKernelWidth () const |
double | GetMaximumRMSError () const |
double | GetMetric () const |
std::string | GetName () const |
uint32_t | GetNumberOfIterations () const |
double | GetRMSChange () const |
The Root Mean Square of the levelset upon termination. More... | |
bool | GetSmoothDisplacementField () const |
bool | GetSmoothUpdateField () const |
std::vector< double > | GetStandardDeviations () const |
std::vector< double > | GetUpdateFieldStandardDeviations () const |
bool | GetUseImageSpacing () const |
LevelSetMotionRegistrationFilter () | |
Self & | SetAlpha (double Alpha) |
Self & | SetGradientMagnitudeThreshold (double GradientMagnitudeThreshold) |
Self & | SetGradientSmoothingStandardDeviations (double GradientSmoothingStandardDeviations) |
Self & | SetIntensityDifferenceThreshold (double IntensityDifferenceThreshold) |
Self & | SetMaximumError (double MaximumError) |
Self & | SetMaximumKernelWidth (unsigned int MaximumKernelWidth) |
Self & | SetMaximumRMSError (double MaximumRMSError) |
Self & | SetNumberOfIterations (uint32_t NumberOfIterations) |
Self & | SetSmoothDisplacementField (bool SmoothDisplacementField) |
Self & | SetSmoothUpdateField (bool SmoothUpdateField) |
Self & | SetStandardDeviations (double value) |
Self & | SetStandardDeviations (std::vector< double > StandardDeviations) |
Self & | SetUpdateFieldStandardDeviations (double value) |
Self & | SetUpdateFieldStandardDeviations (std::vector< double > UpdateFieldStandardDeviations) |
Self & | SetUseImageSpacing (bool UseImageSpacing) |
Self & | SmoothDisplacementFieldOff () |
Self & | SmoothDisplacementFieldOn () |
Self & | SmoothUpdateFieldOff () |
Self & | SmoothUpdateFieldOn () |
std::string | ToString () const |
Self & | UseImageSpacingOff () |
Self & | UseImageSpacingOn () |
virtual | ~LevelSetMotionRegistrationFilter () |
Public Member Functions inherited from itk::simple::ImageFilter | |
ImageFilter () | |
virtual | ~ImageFilter ()=0 |
Public Member Functions inherited from itk::simple::ProcessObject | |
virtual void | Abort () |
virtual int | AddCommand (itk::simple::EventEnum event, const std::function< void()> &func) |
Directly add a callback to observe an event. More... | |
virtual int | AddCommand (itk::simple::EventEnum event, itk::simple::Command &cmd) |
Add a Command Object to observer the event. More... | |
virtual float | GetProgress () const |
An Active Measurement of the progress of execution. More... | |
virtual bool | HasCommand (itk::simple::EventEnum event) const |
Query of this object has any registered commands for event. More... | |
ProcessObject () | |
virtual void | RemoveAllCommands () |
Remove all registered commands. More... | |
virtual | ~ProcessObject () |
virtual void | DebugOn () |
virtual void | DebugOff () |
virtual bool | GetDebug () const |
virtual void | SetDebug (bool debugFlag) |
virtual void | SetNumberOfThreads (unsigned int n) |
virtual unsigned int | GetNumberOfThreads () const |
virtual void | SetNumberOfWorkUnits (unsigned int n) |
virtual unsigned int | GetNumberOfWorkUnits () const |
Private Types | |
using | MemberFunctionType = Image(Self::*)(const Image *fixedImage, const Image *movingImage, const Image *initialDisplacementField) |
Private Member Functions | |
template<class TImageType > | |
Image | ExecuteInternal (const Image *fixedImage, const Image *movingImage, const Image *initialDisplacementField) |
Private Attributes | |
double | m_Alpha {0.1} |
uint32_t | m_ElapsedIterations {0} |
double | m_GradientMagnitudeThreshold {1e-9} |
double | m_GradientSmoothingStandardDeviations {1.0} |
double | m_IntensityDifferenceThreshold {0.001} |
double | m_MaximumError {0.1} |
unsigned int | m_MaximumKernelWidth {30u} |
double | m_MaximumRMSError {0.02} |
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > | m_MemberFactory |
double | m_Metric {0.0} |
uint32_t | m_NumberOfIterations {10u} |
double | m_RMSChange {0.0} |
bool | m_SmoothDisplacementField {false} |
bool | m_SmoothUpdateField {false} |
std::vector< double > | m_StandardDeviations {std::vector<double>(3, 1.0)} |
std::vector< double > | m_UpdateFieldStandardDeviations {std::vector<double>(3, 1.0)} |
bool | m_UseImageSpacing {true} |
Friends | |
struct | detail::MemberFunctionAddressor< MemberFunctionType > |
Additional Inherited Members | |
Static Public Member Functions inherited from itk::simple::ProcessObject | |
static bool | GetGlobalDefaultDebug () |
static void | GlobalDefaultDebugOff () |
static void | GlobalDefaultDebugOn () |
static void | SetGlobalDefaultDebug (bool debugFlag) |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
static void | SetGlobalWarningDisplay (bool flag) |
static bool | GetGlobalWarningDisplay () |
static double | GetGlobalDefaultCoordinateTolerance () |
Access the global tolerance to determine congruent spaces. More... | |
static void | SetGlobalDefaultCoordinateTolerance (double) |
Access the global tolerance to determine congruent spaces. More... | |
static double | GetGlobalDefaultDirectionTolerance () |
Access the global tolerance to determine congruent spaces. More... | |
static void | SetGlobalDefaultDirectionTolerance (double) |
Access the global tolerance to determine congruent spaces. More... | |
static bool | SetGlobalDefaultThreader (const std::string &threader) |
Set/Get the default threader used for process objects. More... | |
static std::string | GetGlobalDefaultThreader () |
Set/Get the default threader used for process objects. More... | |
static void | SetGlobalDefaultNumberOfThreads (unsigned int n) |
static unsigned int | GetGlobalDefaultNumberOfThreads () |
Set/Get the default threader used for process objects. More... | |
Protected Member Functions inherited from itk::simple::ImageFilter | |
void | CheckImageMatchingDimension (const Image &image1, const Image &image2, const std::string &image2Name) |
void | CheckImageMatchingPixelType (const Image &image1, const Image &image2, const std::string &image2Name) |
void | CheckImageMatchingSize (const Image &image1, const Image &image2, const std::string &image2Name) |
Protected Member Functions inherited from itk::simple::ProcessObject | |
virtual unsigned long | AddITKObserver (const itk::EventObject &, itk::Command *) |
virtual itk::ProcessObject * | GetActiveProcess () |
virtual void | OnActiveProcessDelete () |
virtual void | onCommandDelete (const itk::simple::Command *cmd) noexcept |
virtual void | PreUpdate (itk::ProcessObject *p) |
virtual void | RemoveITKObserver (EventCommand &e) |
Protected Member Functions inherited from itk::simple::NonCopyable | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
Static Protected Member Functions inherited from itk::simple::ImageFilter | |
template<class TImageType > | |
static void | FixNonZeroIndex (TImageType *img) |
Static Protected Member Functions inherited from itk::simple::ProcessObject | |
template<class TImageType > | |
static TImageType::ConstPointer | CastImageToITK (const Image &img) |
template<class TPixelType , unsigned int VImageDimension, unsigned int VLength, template< typename, unsigned int > class TVector> | |
static Image | CastITKToImage (itk::Image< TVector< TPixelType, VLength >, VImageDimension > *img) |
template<unsigned int VImageDimension, unsigned int VLength, template< unsigned int > class TVector> | |
static Image | CastITKToImage (itk::Image< TVector< VLength >, VImageDimension > *img) |
template<class TImageType > | |
static Image | CastITKToImage (TImageType *img) |
static const itk::EventObject & | GetITKEventObject (EventEnum e) |
template<typename T > | |
static std::ostream & | ToStringHelper (std::ostream &os, const T &v) |
static std::ostream & | ToStringHelper (std::ostream &os, const char &v) |
static std::ostream & | ToStringHelper (std::ostream &os, const signed char &v) |
static std::ostream & | ToStringHelper (std::ostream &os, const unsigned char &v) |
|
private |
Setup for member function dispatching
Definition at line 258 of file sitkLevelSetMotionRegistrationFilter.h.
Define the pixels types supported by this filter
Definition at line 77 of file sitkLevelSetMotionRegistrationFilter.h.
Definition at line 67 of file sitkLevelSetMotionRegistrationFilter.h.
|
virtual |
Destructor
itk::simple::LevelSetMotionRegistrationFilter::LevelSetMotionRegistrationFilter | ( | ) |
Default Constructor that takes no arguments and initializes default parameters
Image itk::simple::LevelSetMotionRegistrationFilter::Execute | ( | const Image & | fixedImage, |
const Image & | movingImage | ||
) |
Image itk::simple::LevelSetMotionRegistrationFilter::Execute | ( | const Image & | fixedImage, |
const Image & | movingImage, | ||
const Image & | initialDisplacementField | ||
) |
Execute the filter on the input image
|
private |
|
inline |
Definition at line 186 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Number of iterations run.
This is a measurement. Its value is updated in the Execute methods, so the value will only be valid after an execution.
Definition at line 223 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 204 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 87 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 195 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get the desired maximum error of the Guassian kernel approximate.
Definition at line 177 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get the desired limits of the Gaussian kernel width.
Definition at line 167 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 103 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Get the metric value. The metric value is the mean square difference in intensity between the fixed image and transforming moving image computed over the overlapping region between the two images. This is value is only available for the previous iteration and NOT the current iteration.
This is a measurement. Its value is updated in the Execute methods, so the value will only be valid after an execution.
Definition at line 239 of file sitkLevelSetMotionRegistrationFilter.h.
|
inlinevirtual |
Name of this class
Implements itk::simple::ProcessObject.
Definition at line 243 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 95 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
The Root Mean Square of the levelset upon termination.
This is a measurement. Its value is updated in the Execute methods, so the value will only be valid after an execution.
Definition at line 231 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get whether the displacement field is smoothed (regularized). Smoothing the displacement yields a solution elastic in nature. If SmoothDisplacementField is on, then the displacement field is smoothed with a Gaussian whose standard deviations are specified with SetStandardDeviations()
Definition at line 130 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get whether the update field is smoothed (regularized). Smoothing the update field yields a solution viscous in nature. If SmoothUpdateField is on, then the update field is smoothed with a Gaussian whose standard deviations are specified with SetUpdateFieldStandardDeviations()
Definition at line 157 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get the Gaussian smoothing standard deviations for the displacement field. The values are set with respect to pixel coordinates.
Definition at line 116 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set the Gaussian smoothing standard deviations for the update field. The values are set with respect to pixel coordinates.
Definition at line 143 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 216 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get the parameter alpha. Alpha is added to the calculated gradient magnitude prior to normalizing the gradient to protect against numerical instability as the gradient magnitude approaches zero. This should be set as a small fraction of the intensity dynamic range, for instance 0.04%. Default is the absolute (not percentage) value of 0.1.
Definition at line 182 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get the threshold below which the gradient magnitude is considered the zero vector. Default is 1e-9.
Definition at line 200 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get the standard deviation used for smoothing the moving image prior to calculating gradients. The standard deviation is measured in physical units (for instance mm). Note that this smoothing value is not to be confused with the PDEDeformableRegistrationFilter::SetStandardDeviations() method. The method in PDEDeformableRegistrationFilter is for setting the smoothing parameters for regularizing the deformation field between iterations. Those smoothing parameters are set in pixel units not physical units. Deformation field smoothing is not done by default in LevelSetMotionRegistration. This smoothing parameter is to condition the gradient calculation and parameter is specified in physical units.
Definition at line 83 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get the threshold below which the absolute difference of intensity yields a match. When the intensities match between a moving and fixed image pixel, the update vector (for that iteration) will be the zero vector. Default is 0.001.
Definition at line 191 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get the desired maximum error of the Guassian kernel approximate.
Definition at line 172 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get the desired limits of the Gaussian kernel width.
Definition at line 162 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 99 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 91 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get whether the displacement field is smoothed (regularized). Smoothing the displacement yields a solution elastic in nature. If SmoothDisplacementField is on, then the displacement field is smoothed with a Gaussian whose standard deviations are specified with SetStandardDeviations()
Definition at line 121 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get whether the update field is smoothed (regularized). Smoothing the update field yields a solution viscous in nature. If SmoothUpdateField is on, then the update field is smoothed with a Gaussian whose standard deviations are specified with SetUpdateFieldStandardDeviations()
Definition at line 148 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set the values of the StandardDeviations vector all to value
Definition at line 111 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set/Get the Gaussian smoothing standard deviations for the displacement field. The values are set with respect to pixel coordinates.
Definition at line 108 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set the values of the UpdateFieldStandardDeviations vector all to value
Definition at line 138 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set the Gaussian smoothing standard deviations for the update field. The values are set with respect to pixel coordinates.
Definition at line 135 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 208 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 125 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set the value of SmoothDisplacementField to true or false respectfully.
Definition at line 124 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Definition at line 152 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set the value of SmoothUpdateField to true or false respectfully.
Definition at line 151 of file sitkLevelSetMotionRegistrationFilter.h.
|
virtual |
Print ourselves out
Reimplemented from itk::simple::ProcessObject.
|
inline |
Definition at line 212 of file sitkLevelSetMotionRegistrationFilter.h.
|
inline |
Set the value of UseImageSpacing to true or false respectfully.
Definition at line 211 of file sitkLevelSetMotionRegistrationFilter.h.
|
friend |
Definition at line 262 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 287 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 296 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 291 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 267 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 289 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 285 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 283 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 273 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 264 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 300 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 270 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 298 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 277 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 281 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 275 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 279 of file sitkLevelSetMotionRegistrationFilter.h.
|
private |
Definition at line 293 of file sitkLevelSetMotionRegistrationFilter.h.