18 #ifndef itkImageToImageMetric_h
19 #define itkImageToImageMetric_h
53 template <
typename TFixedImage,
typename TMovingImage>
83 static constexpr
unsigned int MovingImageDimension = TMovingImage::ImageDimension;
84 static constexpr
unsigned int FixedImageDimension = TFixedImage::ImageDimension;
130 using typename Superclass::MeasureType;
133 using typename Superclass::DerivativeType;
136 using typename Superclass::ParametersType;
164 return this->GetNumberOfPixelsCounted();
167 itkGetConstReferenceMacro(NumberOfPixelsCounted,
SizeValueType);
171 SetFixedImageRegion(
const FixedImageRegionType reg);
174 itkGetConstReferenceMacro(FixedImageRegion, FixedImageRegionType);
177 itkSetObjectMacro(MovingImageMask, MovingImageMaskType);
178 itkSetConstObjectMacro(MovingImageMask, MovingImageMaskType);
179 itkGetConstObjectMacro(MovingImageMask, MovingImageMaskType);
183 itkSetObjectMacro(FixedImageMask, FixedImageMaskType);
184 itkSetConstObjectMacro(FixedImageMask, FixedImageMaskType);
185 itkGetConstObjectMacro(FixedImageMask, FixedImageMaskType);
191 SetFixedImageIndexes(
const FixedImageIndexContainer & indexes);
194 SetUseFixedImageIndexes(
bool useIndexes);
196 itkGetConstReferenceMacro(UseFixedImageIndexes,
bool);
201 itkGetConstReferenceMacro(NumberOfWorkUnits,
ThreadIdType);
205 itkSetMacro(ComputeGradient,
bool);
206 itkGetConstReferenceMacro(ComputeGradient,
bool);
207 itkBooleanMacro(ComputeGradient);
215 itkGetModifiableObjectMacro(GradientImage, GradientImageType);
219 SetTransformParameters(
const ParametersType & parameters)
const;
225 return m_Transform->GetNumberOfParameters();
235 MultiThreadingInitialize();
241 itkGetConstReferenceMacro(NumberOfFixedImageSamples,
SizeValueType);
249 this->SetNumberOfFixedImageSamples(num);
255 return this->GetNumberOfFixedImageSamples();
261 SetFixedImageSamplesIntensityThreshold(
const FixedImagePixelType & thresh);
263 itkGetConstReferenceMacro(FixedImageSamplesIntensityThreshold, FixedImagePixelType);
266 SetUseFixedImageSamplesIntensityThreshold(
bool useThresh);
268 itkGetConstReferenceMacro(UseFixedImageSamplesIntensityThreshold,
bool);
274 SetUseAllPixels(
bool useAllPixels);
279 this->SetUseAllPixels(
true);
285 this->SetUseAllPixels(
false);
288 itkGetConstReferenceMacro(UseAllPixels,
bool);
295 SetUseSequentialSampling(
bool useSequential);
297 itkGetConstReferenceMacro(UseSequentialSampling,
bool);
311 ReinitializeSeed(
int seed);
330 itkSetMacro(UseCachingOfBSplineWeights,
bool);
331 itkGetConstReferenceMacro(UseCachingOfBSplineWeights,
bool);
332 itkBooleanMacro(UseCachingOfBSplineWeights);
341 return m_ThreaderTransform.get();
350 PrintSelf(std::ostream & os,
Indent indent)
const override;
375 bool m_UseFixedImageIndexes{
false };
378 bool m_UseFixedImageSamplesIntensityThreshold{
false };
418 bool m_ComputeGradient{
true };
426 bool m_UseAllPixels{
false };
427 bool m_UseSequentialSampling{
false };
429 bool m_ReseedIterator{
false };
440 bool m_TransformIsBSpline{
false };
446 static constexpr
unsigned int DeformationSplineOrder = 3;
484 bool m_UseCachingOfBSplineWeights{
true };
492 PreComputeTransformValues();
497 TransformPoint(
unsigned int sampleNumber,
500 double & movingImageValue,
504 TransformPointWithDerivatives(
unsigned int sampleNumber,
507 double & movingImageValue,
512 bool m_InterpolatorIsBSpline{
false };
542 : m_ConstMetricPointer{ i2i_metricPointer }
547 return m_ConstMetricPointer;
566 : m_WorkUnitInfo(static_cast<const typename
MultiThreaderType::WorkUnitInfo *>(workunitInfoAsVoid))
571 return m_WorkUnitInfo->WorkUnitID;
576 return (static_cast<ConstantPointerWrapper *>(m_WorkUnitInfo->UserData))->GetConstMetricPointer();
587 bool m_WithinThreadPreProcess{
false };
588 bool m_WithinThreadPostProcess{
false };
591 GetValueMultiThreadedInitiate()
const;
594 GetValueMultiThreadedPostProcessInitiate()
const;
597 GetValueMultiThreaded(
void * workunitInfoAsVoid);
600 GetValueMultiThreadedPostProcess(
void * workunitInfoAsVoid);
612 double itkNotUsed(movingImageValue))
const
621 GetValueAndDerivativeMultiThreadedInitiate()
const;
624 GetValueAndDerivativeMultiThreadedPostProcessInitiate()
const;
627 GetValueAndDerivativeMultiThreaded(
void * workunitInfoAsVoid);
630 GetValueAndDerivativeMultiThreadedPostProcess(
void * workunitInfoAsVoid);
633 GetValueAndDerivativeThread(
ThreadIdType threadId)
const;
642 double itkNotUsed(movingImageValue),
655 SynchronizeTransforms()
const;
662 #ifndef ITK_MANUAL_INSTANTIATION
663 # include "itkImageToImageMetric.hxx"