SimpleITK  
sitkDemonsRegistrationFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18 #ifndef sitkDemonsRegistrationFilter_h
19 #define sitkDemonsRegistrationFilter_h
20 
21 /*
22  * WARNING: DO NOT EDIT THIS FILE!
23  * THIS FILE IS AUTOMATICALLY GENERATED BY THE SIMPLEITK BUILD PROCESS.
24  * Please look at sitkImageFilterTemplate.h.in to make changes.
25  */
26 
27 #include <memory>
28 
29 #include "sitkBasicFilters.h"
30 #include "sitkImageFilter.h"
31 
32 namespace itk::simple {
33 
59  public:
61 
63  virtual ~DemonsRegistrationFilter();
64 
68 
71 \
72 
76  SITK_RETURN_SELF_TYPE_HEADER SetStandardDeviations ( std::vector<double> StandardDeviations ) { this->m_StandardDeviations = std::move(StandardDeviations); return *this; }
77 
79  SITK_RETURN_SELF_TYPE_HEADER SetStandardDeviations( double value ) { this->m_StandardDeviations = std::vector<double>(3, value); return *this; }
80 
84  std::vector<double> GetStandardDeviations() const { return this->m_StandardDeviations; }\
85 
88  SITK_RETURN_SELF_TYPE_HEADER SetNumberOfIterations ( uint32_t NumberOfIterations ) { this->m_NumberOfIterations = NumberOfIterations; return *this; }
89 
92  uint32_t GetNumberOfIterations() const { return this->m_NumberOfIterations; }\
93 
96  SITK_RETURN_SELF_TYPE_HEADER SetMaximumRMSError ( double MaximumRMSError ) { this->m_MaximumRMSError = MaximumRMSError; return *this; }
97 
100  double GetMaximumRMSError() const { return this->m_MaximumRMSError; }\
101 
105  SITK_RETURN_SELF_TYPE_HEADER SetUseMovingImageGradient ( bool UseMovingImageGradient ) { this->m_UseMovingImageGradient = UseMovingImageGradient; return *this; }
106 
108  SITK_RETURN_SELF_TYPE_HEADER UseMovingImageGradientOn() { return this->SetUseMovingImageGradient(true); }
109  SITK_RETURN_SELF_TYPE_HEADER UseMovingImageGradientOff() { return this->SetUseMovingImageGradient(false); }
110 
114  bool GetUseMovingImageGradient() const { return this->m_UseMovingImageGradient; }\
115 
119  SITK_RETURN_SELF_TYPE_HEADER SetSmoothDisplacementField ( bool SmoothDisplacementField ) { this->m_SmoothDisplacementField = SmoothDisplacementField; return *this; }
120 
122  SITK_RETURN_SELF_TYPE_HEADER SmoothDisplacementFieldOn() { return this->SetSmoothDisplacementField(true); }
123  SITK_RETURN_SELF_TYPE_HEADER SmoothDisplacementFieldOff() { return this->SetSmoothDisplacementField(false); }
124 
128  bool GetSmoothDisplacementField() const { return this->m_SmoothDisplacementField; }\
129 
133  SITK_RETURN_SELF_TYPE_HEADER SetSmoothUpdateField ( bool SmoothUpdateField ) { this->m_SmoothUpdateField = SmoothUpdateField; return *this; }
134 
136  SITK_RETURN_SELF_TYPE_HEADER SmoothUpdateFieldOn() { return this->SetSmoothUpdateField(true); }
137  SITK_RETURN_SELF_TYPE_HEADER SmoothUpdateFieldOff() { return this->SetSmoothUpdateField(false); }
138 
142  bool GetSmoothUpdateField() const { return this->m_SmoothUpdateField; }\
143 
147  SITK_RETURN_SELF_TYPE_HEADER SetUpdateFieldStandardDeviations ( std::vector<double> UpdateFieldStandardDeviations ) { this->m_UpdateFieldStandardDeviations = std::move(UpdateFieldStandardDeviations); return *this; }
148 
150  SITK_RETURN_SELF_TYPE_HEADER SetUpdateFieldStandardDeviations( double value ) { this->m_UpdateFieldStandardDeviations = std::vector<double>(3, value); return *this; }
151 
155  std::vector<double> GetUpdateFieldStandardDeviations() const { return this->m_UpdateFieldStandardDeviations; }\
156 
160  SITK_RETURN_SELF_TYPE_HEADER SetMaximumKernelWidth ( unsigned int MaximumKernelWidth ) { this->m_MaximumKernelWidth = MaximumKernelWidth; return *this; }
161 
165  unsigned int GetMaximumKernelWidth() const { return this->m_MaximumKernelWidth; }\
166 
170  SITK_RETURN_SELF_TYPE_HEADER SetMaximumError ( double MaximumError ) { this->m_MaximumError = MaximumError; return *this; }
171 
175  double GetMaximumError() const { return this->m_MaximumError; }\
176 
180  SITK_RETURN_SELF_TYPE_HEADER SetIntensityDifferenceThreshold ( double IntensityDifferenceThreshold ) { this->m_IntensityDifferenceThreshold = IntensityDifferenceThreshold; return *this; }
181 
184  double GetIntensityDifferenceThreshold() const { return this->m_IntensityDifferenceThreshold; }\
185 
188  SITK_RETURN_SELF_TYPE_HEADER SetUseImageSpacing ( bool UseImageSpacing ) { this->m_UseImageSpacing = UseImageSpacing; return *this; }
189 
191  SITK_RETURN_SELF_TYPE_HEADER UseImageSpacingOn() { return this->SetUseImageSpacing(true); }
192  SITK_RETURN_SELF_TYPE_HEADER UseImageSpacingOff() { return this->SetUseImageSpacing(false); }
193 
196  bool GetUseImageSpacing() const { return this->m_UseImageSpacing; }
204  uint32_t GetElapsedIterations() const { return this->m_pfGetElapsedIterations(); };
205 
212  double GetRMSChange() const { return this->m_RMSChange; };
213 
221  double GetMetric() const { return this->m_pfGetMetric(); };
222 
230  void StopRegistration() { return this->m_pfGetStopRegistration(); };
231 
232 
234  std::string GetName() const { return std::string ("DemonsRegistrationFilter"); }
235 
237  std::string ToString() const;
238 
239 
242  Image Execute ( const Image & fixedImage, const Image & movingImage, const Image & initialDisplacementField );
243  Image Execute ( const Image & fixedImage, const Image & movingImage );
244 
245  private:
246 
249  using MemberFunctionType = Image (Self::*)( const Image * fixedImage, const Image * movingImage, const Image * initialDisplacementField );
250  template <class TImageType> Image ExecuteInternal ( const Image * fixedImage, const Image * movingImage, const Image * initialDisplacementField );
251 
252 
254 
255  std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
256 
257 
258  std::vector<double> m_StandardDeviations{std::vector<double>(3, 1.0)};
259 
260  /* Number of iterations to run */
261  uint32_t m_NumberOfIterations{10u};
262 
263  /* Value of RMS change below which the filter should stop. This is a convergence criterion. */
264  double m_MaximumRMSError{0.02};
265 
266  bool m_UseMovingImageGradient{false};
267 
268  bool m_SmoothDisplacementField{true};
269 
270  bool m_SmoothUpdateField{false};
271 
272  std::vector<double> m_UpdateFieldStandardDeviations{std::vector<double>(3, 1.0)};
273 
274  unsigned int m_MaximumKernelWidth{30u};
275 
276  double m_MaximumError{0.1};
277 
278  double m_IntensityDifferenceThreshold{0.001};
279 
280  bool m_UseImageSpacing{true};
281 
282 
283  std::function<uint32_t()> m_pfGetElapsedIterations;
284 
285  double m_RMSChange{0.0};
286 
287  std::function<double()> m_pfGetMetric;
288 
289  std::function<void()> m_pfGetStopRegistration;
290 
291  // Holder of process object for active measurements
292  itk::ProcessObject *m_Filter{nullptr};
293 
294  };
295 
296 
297 }
298 #endif
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:76
sitkBasicFilters.h
itk::simple::DemonsRegistrationFilter::MemberFunctionType
Image(Self::*)(const Image *fixedImage, const Image *movingImage, const Image *initialDisplacementField) MemberFunctionType
Definition: sitkDemonsRegistrationFilter.h:249
itk::simple::DemonsRegistrationFilter::UseMovingImageGradientOff
Self & UseMovingImageGradientOff()
Definition: sitkDemonsRegistrationFilter.h:109
itk::simple::DemonsRegistrationFilter::GetNumberOfIterations
uint32_t GetNumberOfIterations() const
Definition: sitkDemonsRegistrationFilter.h:92
itk::simple::DemonsRegistrationFilter::UseMovingImageGradientOn
Self & UseMovingImageGradientOn()
Definition: sitkDemonsRegistrationFilter.h:108
itk::simple::DemonsRegistrationFilter::UseImageSpacingOff
Self & UseImageSpacingOff()
Definition: sitkDemonsRegistrationFilter.h:192
itk::simple::detail::MemberFunctionAddressor
Definition: sitkDetail.h:28
itk::simple::DemonsRegistrationFilter::SetUseImageSpacing
Self & SetUseImageSpacing(bool UseImageSpacing)
Definition: sitkDemonsRegistrationFilter.h:188
itk::simple::DemonsRegistrationFilter::GetMaximumRMSError
double GetMaximumRMSError() const
Definition: sitkDemonsRegistrationFilter.h:100
itk::simple::DemonsRegistrationFilter::GetSmoothUpdateField
bool GetSmoothUpdateField() const
Definition: sitkDemonsRegistrationFilter.h:142
itk::simple::DemonsRegistrationFilter::UseImageSpacingOn
Self & UseImageSpacingOn()
Definition: sitkDemonsRegistrationFilter.h:191
itk::simple::DemonsRegistrationFilter::SetMaximumKernelWidth
Self & SetMaximumKernelWidth(unsigned int MaximumKernelWidth)
Definition: sitkDemonsRegistrationFilter.h:160
itk::simple::DemonsRegistrationFilter::m_pfGetStopRegistration
std::function< void()> m_pfGetStopRegistration
Definition: sitkDemonsRegistrationFilter.h:289
itk::simple::BasicPixelIDTypeList
typelist2::typelist< BasicPixelID< int8_t >, BasicPixelID< uint8_t >, BasicPixelID< int16_t >, BasicPixelID< uint16_t >, BasicPixelID< int32_t >, BasicPixelID< uint32_t >, BasicPixelID< float >, BasicPixelID< double > > BasicPixelIDTypeList
Definition: sitkPixelIDTypeLists.h:51
itk::simple::DemonsRegistrationFilter::SetSmoothUpdateField
Self & SetSmoothUpdateField(bool SmoothUpdateField)
Definition: sitkDemonsRegistrationFilter.h:133
itk::simple::DemonsRegistrationFilter::StopRegistration
void StopRegistration()
Definition: sitkDemonsRegistrationFilter.h:230
itk::simple::DemonsRegistrationFilter::SetNumberOfIterations
Self & SetNumberOfIterations(uint32_t NumberOfIterations)
Definition: sitkDemonsRegistrationFilter.h:88
sitkImageFilter.h
itk::simple::DemonsRegistrationFilter::GetSmoothDisplacementField
bool GetSmoothDisplacementField() const
Definition: sitkDemonsRegistrationFilter.h:128
itk::simple::DemonsRegistrationFilter::GetMaximumKernelWidth
unsigned int GetMaximumKernelWidth() const
Definition: sitkDemonsRegistrationFilter.h:165
itk::simple::DemonsRegistrationFilter::SetSmoothDisplacementField
Self & SetSmoothDisplacementField(bool SmoothDisplacementField)
Definition: sitkDemonsRegistrationFilter.h:119
itk::simple::DemonsRegistrationFilter::SmoothDisplacementFieldOn
Self & SmoothDisplacementFieldOn()
Definition: sitkDemonsRegistrationFilter.h:122
itk::simple::DemonsRegistrationFilter::SetIntensityDifferenceThreshold
Self & SetIntensityDifferenceThreshold(double IntensityDifferenceThreshold)
Definition: sitkDemonsRegistrationFilter.h:180
itk::simple::DemonsRegistrationFilter::PixelIDTypeList
BasicPixelIDTypeList PixelIDTypeList
Definition: sitkDemonsRegistrationFilter.h:70
itk::simple::DemonsRegistrationFilter::SetUpdateFieldStandardDeviations
Self & SetUpdateFieldStandardDeviations(std::vector< double > UpdateFieldStandardDeviations)
Definition: sitkDemonsRegistrationFilter.h:147
itk::simple::DemonsRegistrationFilter::GetUpdateFieldStandardDeviations
std::vector< double > GetUpdateFieldStandardDeviations() const
Definition: sitkDemonsRegistrationFilter.h:155
itk::simple::DemonsRegistrationFilter::SetStandardDeviations
Self & SetStandardDeviations(double value)
Definition: sitkDemonsRegistrationFilter.h:79
itk::simple::DemonsRegistrationFilter
Deformably register two images using the demons algorithm.
Definition: sitkDemonsRegistrationFilter.h:58
itk::simple::DemonsRegistrationFilter::GetElapsedIterations
uint32_t GetElapsedIterations() const
Number of iterations run.
Definition: sitkDemonsRegistrationFilter.h:204
itk::simple::DemonsRegistrationFilter::m_pfGetElapsedIterations
std::function< uint32_t()> m_pfGetElapsedIterations
Definition: sitkDemonsRegistrationFilter.h:283
SITKBasicFilters_EXPORT
#define SITKBasicFilters_EXPORT
Definition: sitkBasicFilters.h:52
itk::simple::DemonsRegistrationFilter::GetStandardDeviations
std::vector< double > GetStandardDeviations() const
Definition: sitkDemonsRegistrationFilter.h:84
itk::simple::DemonsRegistrationFilter::SetUpdateFieldStandardDeviations
Self & SetUpdateFieldStandardDeviations(double value)
Definition: sitkDemonsRegistrationFilter.h:150
itk::simple::DemonsRegistrationFilter::SmoothUpdateFieldOn
Self & SmoothUpdateFieldOn()
Definition: sitkDemonsRegistrationFilter.h:136
itk::simple::DemonsRegistrationFilter::GetIntensityDifferenceThreshold
double GetIntensityDifferenceThreshold() const
Definition: sitkDemonsRegistrationFilter.h:184
itk::simple::DemonsRegistrationFilter::m_pfGetMetric
std::function< double()> m_pfGetMetric
Definition: sitkDemonsRegistrationFilter.h:287
itk::simple::DemonsRegistrationFilter::m_MemberFactory
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Definition: sitkDemonsRegistrationFilter.h:255
itk::simple::DemonsRegistrationFilter::GetMetric
double GetMetric() const
Definition: sitkDemonsRegistrationFilter.h:221
itk::simple::DemonsRegistrationFilter::SmoothUpdateFieldOff
Self & SmoothUpdateFieldOff()
Definition: sitkDemonsRegistrationFilter.h:137
itk::simple::DemonsRegistrationFilter::SetMaximumRMSError
Self & SetMaximumRMSError(double MaximumRMSError)
Definition: sitkDemonsRegistrationFilter.h:96
itk::ProcessObject
itk::simple::ImageFilter
The base interface for SimpleITK filters that take one input image.
Definition: sitkImageFilter.h:34
itk::simple::DemonsRegistrationFilter::SetMaximumError
Self & SetMaximumError(double MaximumError)
Definition: sitkDemonsRegistrationFilter.h:170
itk::simple::DemonsRegistrationFilter::SetStandardDeviations
Self & SetStandardDeviations(std::vector< double > StandardDeviations)
Definition: sitkDemonsRegistrationFilter.h:76
itk::simple
Definition: sitkAdditionalProcedures.h:28
itk::simple::DemonsRegistrationFilter::GetName
std::string GetName() const
Definition: sitkDemonsRegistrationFilter.h:234
itk::simple::DemonsRegistrationFilter::SetUseMovingImageGradient
Self & SetUseMovingImageGradient(bool UseMovingImageGradient)
Definition: sitkDemonsRegistrationFilter.h:105
itk::simple::DemonsRegistrationFilter::GetUseImageSpacing
bool GetUseImageSpacing() const
Definition: sitkDemonsRegistrationFilter.h:196
itk::simple::DemonsRegistrationFilter::SmoothDisplacementFieldOff
Self & SmoothDisplacementFieldOff()
Definition: sitkDemonsRegistrationFilter.h:123
itk::simple::DemonsRegistrationFilter::GetUseMovingImageGradient
bool GetUseMovingImageGradient() const
Definition: sitkDemonsRegistrationFilter.h:114
itk::simple::DemonsRegistrationFilter::GetRMSChange
double GetRMSChange() const
The Root Mean Square of the levelset upon termination.
Definition: sitkDemonsRegistrationFilter.h:212
itk::simple::DemonsRegistrationFilter::GetMaximumError
double GetMaximumError() const
Definition: sitkDemonsRegistrationFilter.h:175