18 #ifndef itkImageToImageMetric_h
19 #define itkImageToImageMetric_h
51 template <
typename TFixedImage,
typename TMovingImage>
81 static constexpr
unsigned int MovingImageDimension = TMovingImage::ImageDimension;
82 static constexpr
unsigned int FixedImageDimension = TFixedImage::ImageDimension;
162 return this->GetNumberOfPixelsCounted();
165 itkGetConstReferenceMacro(NumberOfPixelsCounted,
SizeValueType);
169 SetFixedImageRegion(
const FixedImageRegionType reg);
172 itkGetConstReferenceMacro(FixedImageRegion, FixedImageRegionType);
175 itkSetObjectMacro(MovingImageMask, MovingImageMaskType);
176 itkSetConstObjectMacro(MovingImageMask, MovingImageMaskType);
177 itkGetConstObjectMacro(MovingImageMask, MovingImageMaskType);
181 itkSetObjectMacro(FixedImageMask, FixedImageMaskType);
182 itkSetConstObjectMacro(FixedImageMask, FixedImageMaskType);
183 itkGetConstObjectMacro(FixedImageMask, FixedImageMaskType);
189 SetFixedImageIndexes(
const FixedImageIndexContainer & indexes);
192 SetUseFixedImageIndexes(
bool useIndexes);
194 itkGetConstReferenceMacro(UseFixedImageIndexes,
bool);
199 itkGetConstReferenceMacro(NumberOfWorkUnits,
ThreadIdType);
203 itkSetMacro(ComputeGradient,
bool);
204 itkGetConstReferenceMacro(ComputeGradient,
bool);
205 itkBooleanMacro(ComputeGradient);
213 itkGetModifiableObjectMacro(GradientImage, GradientImageType);
217 SetTransformParameters(
const ParametersType & parameters)
const;
223 return m_Transform->GetNumberOfParameters();
233 MultiThreadingInitialize();
239 itkGetConstReferenceMacro(NumberOfFixedImageSamples,
SizeValueType);
247 this->SetNumberOfFixedImageSamples(num);
253 return this->GetNumberOfFixedImageSamples();
259 SetFixedImageSamplesIntensityThreshold(
const FixedImagePixelType & thresh);
261 itkGetConstReferenceMacro(FixedImageSamplesIntensityThreshold, FixedImagePixelType);
264 SetUseFixedImageSamplesIntensityThreshold(
bool useThresh);
266 itkGetConstReferenceMacro(UseFixedImageSamplesIntensityThreshold,
bool);
272 SetUseAllPixels(
bool useAllPixels);
277 this->SetUseAllPixels(
true);
283 this->SetUseAllPixels(
false);
286 itkGetConstReferenceMacro(UseAllPixels,
bool);
293 SetUseSequentialSampling(
bool useSequential);
295 itkGetConstReferenceMacro(UseSequentialSampling,
bool);
309 ReinitializeSeed(
int seed);
328 itkSetMacro(UseCachingOfBSplineWeights,
bool);
329 itkGetConstReferenceMacro(UseCachingOfBSplineWeights,
bool);
330 itkBooleanMacro(UseCachingOfBSplineWeights);
339 return m_ThreaderTransform;
348 PrintSelf(std::ostream & os,
Indent indent)
const override;
373 bool m_UseFixedImageIndexes{
false };
376 bool m_UseFixedImageSamplesIntensityThreshold{
false };
416 bool m_ComputeGradient{
true };
424 bool m_UseAllPixels{
false };
425 bool m_UseSequentialSampling{
false };
427 bool m_ReseedIterator{
false };
438 bool m_TransformIsBSpline{
false };
444 static constexpr
unsigned int DeformationSplineOrder = 3;
482 bool m_UseCachingOfBSplineWeights{
true };
490 PreComputeTransformValues();
495 TransformPoint(
unsigned int sampleNumber,
498 double & movingImageValue,
502 TransformPointWithDerivatives(
unsigned int sampleNumber,
505 double & movingImageValue,
510 bool m_InterpolatorIsBSpline{
false };
540 : m_ConstMetricPointer{ i2i_metricPointer }
545 return m_ConstMetricPointer;
564 : m_WorkUnitInfo(static_cast<const typename
MultiThreaderType::WorkUnitInfo *>(workunitInfoAsVoid))
569 return m_WorkUnitInfo->WorkUnitID;
574 return (static_cast<ConstantPointerWrapper *>(m_WorkUnitInfo->UserData))->GetConstMetricPointer();
584 mutable unsigned int * m_ThreaderNumberOfMovingImageSamples{
nullptr };
585 bool m_WithinThreadPreProcess{
false };
586 bool m_WithinThreadPostProcess{
false };
589 GetValueMultiThreadedInitiate()
const;
592 GetValueMultiThreadedPostProcessInitiate()
const;
595 GetValueMultiThreaded(
void * workunitInfoAsVoid);
598 GetValueMultiThreadedPostProcess(
void * workunitInfoAsVoid);
610 double itkNotUsed(movingImageValue))
const
619 GetValueAndDerivativeMultiThreadedInitiate()
const;
622 GetValueAndDerivativeMultiThreadedPostProcessInitiate()
const;
625 GetValueAndDerivativeMultiThreaded(
void * workunitInfoAsVoid);
628 GetValueAndDerivativeMultiThreadedPostProcess(
void * workunitInfoAsVoid);
631 GetValueAndDerivativeThread(
ThreadIdType threadId)
const;
640 double itkNotUsed(movingImageValue),
653 SynchronizeTransforms()
const;
660 #ifndef ITK_MANUAL_INSTANTIATION
661 # include "itkImageToImageMetric.hxx"