SimpleITK
|
Deformably register two images using a symmetric forces demons algorithm. More...
#include <sitkFastSymmetricForcesDemonsRegistrationFilter.h>
Deformably register two images using a symmetric forces demons algorithm.
This class was contributed by Tom Vercauteren, INRIA & Mauna Kea Technologies based on a variation of the DemonsRegistrationFilter .
FastSymmetricForcesDemonsRegistrationFilter implements the demons deformable algorithm that register two images by computing the deformation field which will map a moving image onto a fixed image.
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 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 DemonsRegistrationFunction .
This implementation was taken from the Insight Journal paper: https://doi.org/10.54294/ux2obj
Definition at line 66 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Public Types | |
using | PixelIDTypeList = BasicPixelIDTypeList |
using | Self = FastSymmetricForcesDemonsRegistrationFilter |
enum | UseGradientTypeType { Symmetric , Fixed , WarpedMoving , MappedMoving } |
![]() | |
using | Self = ImageFilter |
![]() | |
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) |
FastSymmetricForcesDemonsRegistrationFilter () | |
uint32_t | GetElapsedIterations () const |
Number of iterations run. | |
double | GetIntensityDifferenceThreshold () const |
double | GetMaximumError () const |
unsigned int | GetMaximumKernelWidth () const |
double | GetMaximumRMSError () const |
double | GetMaximumUpdateStepLength () const |
double | GetMetric () const |
std::string | GetName () const |
uint32_t | GetNumberOfIterations () const |
double | GetRMSChange () const |
bool | GetSmoothDisplacementField () const |
bool | GetSmoothUpdateField () const |
std::vector< double > | GetStandardDeviations () const |
std::vector< double > | GetUpdateFieldStandardDeviations () const |
UseGradientTypeType | GetUseGradientType () const |
bool | GetUseImageSpacing () const |
Self & | SetIntensityDifferenceThreshold (double IntensityDifferenceThreshold) |
Self & | SetMaximumError (double MaximumError) |
Self & | SetMaximumKernelWidth (unsigned int MaximumKernelWidth) |
Self & | SetMaximumRMSError (double MaximumRMSError) |
Self & | SetMaximumUpdateStepLength (double MaximumUpdateStepLength) |
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 & | SetUseGradientType (UseGradientTypeType UseGradientType) |
Self & | SetUseImageSpacing (bool UseImageSpacing) |
Self & | SmoothDisplacementFieldOff () |
Self & | SmoothDisplacementFieldOn () |
Self & | SmoothUpdateFieldOff () |
Self & | SmoothUpdateFieldOn () |
void | StopRegistration () |
std::string | ToString () const |
Self & | UseImageSpacingOff () |
Self & | UseImageSpacingOn () |
virtual | ~FastSymmetricForcesDemonsRegistrationFilter () |
![]() | |
ImageFilter () | |
virtual | ~ImageFilter ()=0 |
![]() | |
virtual void | Abort () |
virtual int | AddCommand (itk::simple::EventEnum event, const std::function< void()> &func) |
Directly add a callback to observe an event. | |
virtual int | AddCommand (itk::simple::EventEnum event, itk::simple::Command &cmd) |
Add a Command Object to observer the event. | |
virtual float | GetProgress () const |
An Active Measurement of the progress of execution. | |
virtual bool | HasCommand (itk::simple::EventEnum event) const |
Query of this object has any registered commands for event. | |
ProcessObject () | |
virtual void | RemoveAllCommands () |
Remove all registered commands. | |
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 | |
itk::ProcessObject * | m_Filter {nullptr} |
double | m_IntensityDifferenceThreshold {0.001} |
double | m_MaximumError {0.1} |
unsigned int | m_MaximumKernelWidth {30u} |
double | m_MaximumRMSError {0.02} |
double | m_MaximumUpdateStepLength {0.5} |
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > | m_MemberFactory |
uint32_t | m_NumberOfIterations {10u} |
std::function< uint32_t()> | m_pfGetElapsedIterations |
std::function< double()> | m_pfGetMetric |
std::function< void()> | m_pfGetStopRegistration |
double | m_RMSChange {0.0} |
bool | m_SmoothDisplacementField {true} |
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)} |
UseGradientTypeType | m_UseGradientType {itk::simple::FastSymmetricForcesDemonsRegistrationFilter::Symmetric} |
bool | m_UseImageSpacing {true} |
Friends | |
struct | detail::MemberFunctionAddressor< MemberFunctionType > |
Additional Inherited Members | |
![]() | |
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. | |
static void | SetGlobalDefaultCoordinateTolerance (double) |
Access the global tolerance to determine congruent spaces. | |
static double | GetGlobalDefaultDirectionTolerance () |
Access the global tolerance to determine congruent spaces. | |
static void | SetGlobalDefaultDirectionTolerance (double) |
Access the global tolerance to determine congruent spaces. | |
static bool | SetGlobalDefaultThreader (const std::string &threader) |
Set/Get the default threader used for process objects. | |
static std::string | GetGlobalDefaultThreader () |
Set/Get the default threader used for process objects. | |
static void | SetGlobalDefaultNumberOfThreads (unsigned int n) |
static unsigned int | GetGlobalDefaultNumberOfThreads () |
Set/Get the default threader used for process objects. | |
![]() | |
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) |
![]() | |
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) |
![]() | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
![]() | |
template<class TImageType> | |
static void | FixNonZeroIndex (TImageType *img) |
![]() | |
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 262 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
using itk::simple::FastSymmetricForcesDemonsRegistrationFilter::PixelIDTypeList = BasicPixelIDTypeList |
Define the pixels types supported by this filter
Definition at line 78 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
using itk::simple::FastSymmetricForcesDemonsRegistrationFilter::Self = FastSymmetricForcesDemonsRegistrationFilter |
Definition at line 68 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Enumerator | |
---|---|
Symmetric | |
Fixed | |
WarpedMoving | |
MappedMoving |
Definition at line 110 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
|
virtual |
Destructor
itk::simple::FastSymmetricForcesDemonsRegistrationFilter::FastSymmetricForcesDemonsRegistrationFilter | ( | ) |
Default Constructor that takes no arguments and initializes default parameters
Image itk::simple::FastSymmetricForcesDemonsRegistrationFilter::Execute | ( | const Image & | fixedImage, |
const Image & | movingImage ) |
Image itk::simple::FastSymmetricForcesDemonsRegistrationFilter::Execute | ( | const Image & | fixedImage, |
const Image & | movingImage, | ||
const Image & | initialDisplacementField ) |
Execute the filter on the input image
|
private |
Referenced by detail::MemberFunctionAddressor< MemberFunctionType >.
|
inline |
Number of iterations run.
This is an active measurement. It may be accessed while the filter is being executing in command call-backs and can be accessed after execution.
Definition at line 217 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_pfGetElapsedIterations.
|
inline |
Definition at line 197 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_IntensityDifferenceThreshold.
|
inline |
Set/Get the desired maximum error of the Guassian kernel approximate.
Definition at line 188 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_MaximumError.
|
inline |
Set/Get the desired limits of the Gaussian kernel width.
Definition at line 178 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_MaximumKernelWidth.
|
inline |
Definition at line 108 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_MaximumRMSError.
|
inline |
Definition at line 127 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_MaximumUpdateStepLength.
|
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 value is calculated for the current iteration
This is an active measurement. It may be accessed while the filter is being executing in command call-backs and can be accessed after execution.
Definition at line 234 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_pfGetMetric.
|
inlinevirtual |
Name of this class
Implements itk::simple::ProcessObject.
Definition at line 247 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
|
inline |
Definition at line 100 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_NumberOfIterations.
|
inline |
Set/Get the root mean squared change of the previous iteration. May not be used by all solvers.
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 225 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_RMSChange.
|
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 141 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_SmoothDisplacementField.
|
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 155 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_SmoothUpdateField.
|
inline |
Set/Get the Gaussian smoothing standard deviations for the displacement field. The values are set with respect to pixel coordinates.
Definition at line 92 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_StandardDeviations.
|
inline |
Set the Gaussian smoothing standard deviations for the update field. The values are set with respect to pixel coordinates.
Definition at line 168 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_UpdateFieldStandardDeviations.
|
inline |
Definition at line 118 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_UseGradientType.
|
inline |
Definition at line 209 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_UseImageSpacing.
|
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 193 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_IntensityDifferenceThreshold.
|
inline |
Set/Get the desired maximum error of the Guassian kernel approximate.
Definition at line 183 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_MaximumError.
|
inline |
Set/Get the desired limits of the Gaussian kernel width.
Definition at line 173 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_MaximumKernelWidth.
|
inline |
Definition at line 104 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_MaximumRMSError.
|
inline |
Set/Get the maximum update step length.
Definition at line 123 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_MaximumUpdateStepLength.
|
inline |
Definition at line 96 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_NumberOfIterations.
|
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 132 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_SmoothDisplacementField.
Referenced by SmoothDisplacementFieldOff(), and SmoothDisplacementFieldOn().
|
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 146 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_SmoothUpdateField.
Referenced by SmoothUpdateFieldOff(), and SmoothUpdateFieldOn().
|
inline |
Set the values of the StandardDeviations vector all to value
Definition at line 87 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_StandardDeviations.
|
inline |
Set/Get the Gaussian smoothing standard deviations for the displacement field. The values are set with respect to pixel coordinates.
Definition at line 84 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_StandardDeviations.
|
inline |
Set the values of the UpdateFieldStandardDeviations vector all to value
Definition at line 163 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_UpdateFieldStandardDeviations.
|
inline |
Set the Gaussian smoothing standard deviations for the update field. The values are set with respect to pixel coordinates.
Definition at line 160 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_UpdateFieldStandardDeviations.
|
inline |
Definition at line 114 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_UseGradientType.
|
inline |
Definition at line 201 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_UseImageSpacing.
Referenced by UseImageSpacingOff(), and UseImageSpacingOn().
|
inline |
Definition at line 136 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References SetSmoothDisplacementField().
|
inline |
Set the value of SmoothDisplacementField to true or false respectfully.
Definition at line 135 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References SetSmoothDisplacementField().
|
inline |
Definition at line 150 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References SetSmoothUpdateField().
|
inline |
Set the value of SmoothUpdateField to true or false respectfully.
Definition at line 149 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References SetSmoothUpdateField().
|
inline |
This is an active measurement. It may be accessed while the filter is being executing in command call-backs and can be accessed after execution.
Definition at line 243 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References m_pfGetStopRegistration.
|
virtual |
Print ourselves out
Reimplemented from itk::simple::ProcessObject.
|
inline |
Definition at line 205 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References SetUseImageSpacing().
|
inline |
Set the value of UseImageSpacing to true or false respectfully.
Definition at line 204 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References SetUseImageSpacing().
|
friend |
Definition at line 263 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
References ExecuteInternal().
|
private |
Definition at line 307 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
|
private |
Definition at line 293 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetIntensityDifferenceThreshold(), and SetIntensityDifferenceThreshold().
|
private |
Definition at line 291 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetMaximumError(), and SetMaximumError().
|
private |
Definition at line 289 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetMaximumKernelWidth(), and SetMaximumKernelWidth().
|
private |
Definition at line 277 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetMaximumRMSError(), and SetMaximumRMSError().
|
private |
Definition at line 281 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetMaximumUpdateStepLength(), and SetMaximumUpdateStepLength().
|
private |
Definition at line 268 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
|
private |
Definition at line 274 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetNumberOfIterations(), and SetNumberOfIterations().
|
private |
Definition at line 298 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetElapsedIterations().
|
private |
Definition at line 302 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetMetric().
|
private |
Definition at line 304 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by StopRegistration().
|
private |
Definition at line 300 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetRMSChange().
|
private |
Definition at line 283 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetSmoothDisplacementField(), and SetSmoothDisplacementField().
|
private |
Definition at line 285 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetSmoothUpdateField(), and SetSmoothUpdateField().
|
private |
Definition at line 271 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetStandardDeviations(), SetStandardDeviations(), and SetStandardDeviations().
|
private |
Definition at line 287 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetUpdateFieldStandardDeviations(), SetUpdateFieldStandardDeviations(), and SetUpdateFieldStandardDeviations().
|
private |
Definition at line 279 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetUseGradientType(), and SetUseGradientType().
|
private |
Definition at line 295 of file sitkFastSymmetricForcesDemonsRegistrationFilter.h.
Referenced by GetUseImageSpacing(), and SetUseImageSpacing().