18 #ifndef itkImageToImageMetric_h
19 #define itkImageToImageMetric_h
50 template<
typename TFixedImage,
typename TMovingImage >
79 itkStaticConstMacro(MovingImageDimension,
81 TMovingImage::ImageDimension);
82 itkStaticConstMacro(FixedImageDimension,
84 TFixedImage::ImageDimension);
89 itkGetStaticConstMacro(MovingImageDimension),
90 itkGetStaticConstMacro(FixedImageDimension) >
168 return this->GetNumberOfPixelsCounted();
171 itkGetConstReferenceMacro(NumberOfPixelsCounted,
SizeValueType);
174 virtual void SetFixedImageRegion(
const FixedImageRegionType reg);
177 itkGetConstReferenceMacro(FixedImageRegion, FixedImageRegionType);
180 itkSetObjectMacro(MovingImageMask, MovingImageMaskType);
181 itkSetConstObjectMacro(MovingImageMask, MovingImageMaskType);
182 itkGetConstObjectMacro(MovingImageMask, MovingImageMaskType);
186 itkSetObjectMacro(FixedImageMask, FixedImageMaskType);
187 itkSetConstObjectMacro(FixedImageMask, FixedImageMaskType);
188 itkGetConstObjectMacro(FixedImageMask, FixedImageMaskType);
193 void SetFixedImageIndexes(
const FixedImageIndexContainer & indexes);
195 void SetUseFixedImageIndexes(
bool useIndex);
197 itkGetConstReferenceMacro(UseFixedImageIndexes,
bool);
201 itkGetConstReferenceMacro(NumberOfThreads,
ThreadIdType);
205 itkSetMacro(ComputeGradient,
bool);
206 itkGetConstReferenceMacro(ComputeGradient,
bool);
207 itkBooleanMacro(ComputeGradient);
211 virtual void ComputeGradient();
214 itkGetModifiableObjectMacro(GradientImage, GradientImageType);
217 void SetTransformParameters(
const ParametersType & parameters)
const;
222 return m_Transform->GetNumberOfParameters();
227 virtual void Initialize(
void);
230 virtual void MultiThreadingInitialize(
void);
234 virtual void SetNumberOfFixedImageSamples(
SizeValueType numSamples);
235 itkGetConstReferenceMacro(NumberOfFixedImageSamples,
SizeValueType);
242 this->SetNumberOfFixedImageSamples(num);
247 return this->GetNumberOfFixedImageSamples();
252 void SetFixedImageSamplesIntensityThreshold(
const FixedImagePixelType & thresh);
254 itkGetConstReferenceMacro(FixedImageSamplesIntensityThreshold, FixedImagePixelType);
256 void SetUseFixedImageSamplesIntensityThreshold(
bool useThresh);
258 itkGetConstReferenceMacro(UseFixedImageSamplesIntensityThreshold,
bool);
263 void SetUseAllPixels(
bool useAllPixels);
267 this->SetUseAllPixels(
true);
272 this->SetUseAllPixels(
false);
275 itkGetConstReferenceMacro(UseAllPixels,
bool);
281 void SetUseSequentialSampling(
bool sequentialSampling);
283 itkGetConstReferenceMacro(UseSequentialSampling,
bool);
294 void ReinitializeSeed();
295 void ReinitializeSeed(
int seed);
314 itkSetMacro(UseCachingOfBSplineWeights,
bool);
315 itkGetConstReferenceMacro(UseCachingOfBSplineWeights,
bool);
316 itkBooleanMacro(UseCachingOfBSplineWeights);
324 return m_ThreaderTransform;
332 virtual
void PrintSelf(std::ostream & os,
Indent indent) const ITK_OVERRIDE;
426 itkStaticConstMacro(DeformationSplineOrder,
unsigned int, 3);
429 FixedImageType ::ImageDimension,
477 virtual void PreComputeTransformValues();
481 virtual void TransformPoint(
unsigned int sampleNumber,
483 bool & sampleWithinSupportRegion,
484 double & movingImageValue,
487 virtual void TransformPointWithDerivatives(
unsigned int sampleNumber,
489 bool & sampleWithinSupportRegion,
490 double & movingImageValue,
522 void GetValueMultiThreadedPreProcessInitiate()
const;
524 void GetValueMultiThreadedInitiate()
const;
526 void GetValueMultiThreadedPostProcessInitiate()
const;
534 virtual inline void GetValueThread(
ThreadIdType threadId)
const;
538 bool itkNotUsed(withinSampleThread) )
const
544 double itkNotUsed(movingImageValue) )
const
548 bool itkNotUsed(withinSampleThread) )
const
551 void GetValueAndDerivativeMultiThreadedPreProcessInitiate()
const;
553 void GetValueAndDerivativeMultiThreadedInitiate()
const;
555 void GetValueAndDerivativeMultiThreadedPostProcessInitiate()
const;
563 virtual inline void GetValueAndDerivativeThread(
ThreadIdType threadId)
const;
567 bool itkNotUsed(withinSampleThread) )
const
573 double itkNotUsed(movingImageValue),
578 bool itkNotUsed(withinSampleThread) )
const
584 virtual void SynchronizeTransforms()
const;
593 #ifndef ITK_MANUAL_INSTANTIATION
594 #include "itkImageToImageMetric.hxx"
virtual bool GetValueAndDerivativeThreadProcessSample(ThreadIdType, SizeValueType, const MovingImagePointType &, double, const ImageDerivativesType &) const
virtual void GetValueThreadPostProcess(ThreadIdType, bool) const
unsigned int * m_ThreaderNumberOfMovingImageSamples
TransformType::OutputPointType OutputPointType
virtual void GetValueThreadPreProcess(ThreadIdType, bool) const
BSplineTransformIndexArrayType m_BSplineTransformIndices
This class is a base for the CostFunctions returning a single value.
FixedImageMaskType::ConstPointer FixedImageMaskConstPointer
TransformPointer m_Transform
std::vector< FixedImageIndexType > FixedImageIndexContainer
bool m_WithinThreadPostProcess
BSplineTransformType::WeightsType BSplineTransformWeightsType
MovingImageMaskConstPointer m_MovingImageMask
Superclass::ParametersValueType CoordinateRepresentationType
TransformType::InputPointType InputPointType
virtual void GetValueAndDerivativeThreadPreProcess(ThreadIdType, bool) const
void SetNumberOfSpatialSamples(SizeValueType num)
signed long IndexValueType
Array2D< WeightsValueType > BSplineTransformWeightsArrayType
BSplineParametersOffsetType m_BSplineParametersOffset
FixedImageIndexContainer m_FixedImageIndexes
TransformType::Pointer TransformPointer
FixedArray< SizeValueType, FixedImageType::ImageDimension > BSplineParametersOffsetType
CovariantVector< double, itkGetStaticConstMacro(MovingImageDimension) > ImageDerivativesType
TransformPointer * m_ThreaderTransform
SizeValueType GetNumberOfSpatialSamples(void)
bool m_UseFixedImageIndexes
BSplineTransformType::Pointer m_BSplineTransform
BSplineTransformWeightsArrayType m_BSplineTransformWeightsArray
NumericTraits< MovingImagePixelType >::RealType RealType
BSplineTransformIndicesArrayType m_BSplineTransformIndicesArray
std::vector< MovingImagePointType > MovingImagePointArrayType
FixedImageType::IndexType FixedImageIndexType
BSplineTransformWeightsType m_BSplineTransformWeights
FixedImagePointType point
Computes the gradient of an image by convolution with the first derivative of a Gaussian.
Superclass::DerivativeType DerivativeType
MovingImageType::ConstPointer MovingImageConstPointer
Calculate the derivative by central differencing.
MultiThreader MultiThreaderType
SizeValueType m_NumberOfPixelsCounted
TransformType::OutputPointType MovingImagePointType
MultiThreaderParameterType m_ThreaderParameter
unsigned long SizeValueType
#define ITK_THREAD_RETURN_TYPE
MovingImageConstPointer m_MovingImage
const TransformPointer * GetThreaderTransform()
Simulate a standard C array with copy semnatics.
FixedImageSampleContainer m_FixedImageSamples
MovingImagePointArrayType m_BSplinePreTransformPointsArray
ImageToImageMetric * metric
TMovingImage::PixelType MovingImagePixelType
CentralDifferenceImageFunction< MovingImageType, CoordinateRepresentationType > DerivativeFunctionType
TFixedImage FixedImageType
FixedImageIndexType::IndexValueType FixedImageIndexValueType
Array2D class representing a 2D array with size defined at construction time.
SizeValueType m_NumberOfParameters
BooleanArrayType m_WithinBSplineSupportRegionArray
Class to hold and manage different parameter types used during optimization.
SpatialObject< itkGetStaticConstMacro(FixedImageDimension) > FixedImageMaskType
TMovingImage MovingImageType
Superclass::ParametersType ParametersType
BSplineBaseTransform< CoordinateRepresentationType, FixedImageType::ImageDimension, itkGetStaticConstMacro(DeformationSplineOrder) > BSplineTransformType
SmartPointer< const Self > ConstPointer
Implementation of the composite pattern.
FixedImageConstPointer m_FixedImage
InterpolatorPointer m_Interpolator
ThreadIdType m_NumberOfThreads
BSplineTransformIndexArrayType::ValueType IndexValueType
GradientImagePointer m_GradientImage
MovingImageMaskType::ConstPointer MovingImageMaskConstPointer
virtual bool GetValueThreadProcessSample(ThreadIdType, SizeValueType, const MovingImagePointType &, double) const
BSplineTransformWeightsType * m_ThreaderBSplineTransformWeights
unsigned int ThreadIdType
std::vector< FixedImageSamplePoint > FixedImageSampleContainer
SmartPointer< GradientImageType > GradientImagePointer
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType > BSplineInterpolatorType
SingleValuedCostFunction Superclass
Image< GradientPixelType, itkGetStaticConstMacro(MovingImageDimension) > GradientImageType
SizeValueType GetNumberOfMovingImageSamples(void)
Base class for all image interpolaters.
SpatialObject< itkGetStaticConstMacro(MovingImageDimension) > MovingImageMaskType
BSplineInterpolatorType::Pointer m_BSplineInterpolator
bool m_UseSequentialSampling
InterpolatorType::Pointer InterpolatorPointer
TransformType::JacobianType TransformJacobianType
FixedImageMaskConstPointer m_FixedImageMask
DerivativeFunctionType::Pointer m_DerivativeCalculator
FixedImageMaskType::Pointer FixedImageMaskPointer
virtual unsigned int GetNumberOfParameters(void) const override
FixedImageRegionType m_FixedImageRegion
MovingImageMaskType::Pointer MovingImageMaskPointer
void UseAllPixelsOff(void)
bool m_UseCachingOfBSplineWeights
FixedImagePixelType m_FixedImageSamplesIntensityThreshold
bool m_UseFixedImageSamplesIntensityThreshold
BSplineTransformWeightsType::ValueType WeightsValueType
InterpolateImageFunction< MovingImageType, CoordinateRepresentationType > InterpolatorType
bool m_TransformIsBSpline
Control indentation during Print() invocation.
FixedImageType::ConstPointer FixedImageConstPointer
TFixedImage::PixelType FixedImagePixelType
TransformType::InputPointType FixedImagePointType
virtual void GetValueAndDerivativeThreadPostProcess(ThreadIdType, bool) const
Evaluates the B-Spline interpolation of an image. Spline order may be from 0 to 5.
BSplineTransformIndexArrayType * m_ThreaderBSplineTransformIndices
Array2D< IndexValueType > BSplineTransformIndicesArrayType
Superclass::MeasureType MeasureType
CovariantVector< RealType, itkGetStaticConstMacro(MovingImageDimension) > GradientPixelType
Transform< CoordinateRepresentationType, itkGetStaticConstMacro(MovingImageDimension), itkGetStaticConstMacro(FixedImageDimension) > TransformType
SizeValueType m_NumBSplineWeights
Computes similarity between regions of two images.
MovingImageType::IndexType MovingImageIndexType
bool m_WithinThreadPreProcess
A templated class holding a geometric point in n-Dimensional space.
bool m_InterpolatorIsBSpline
A templated class holding a n-Dimensional covariant vector.
TransformType::ParametersType TransformParametersType
GradientRecursiveGaussianImageFilter< MovingImageType, GradientImageType > GradientImageFilterType
Templated n-dimensional image class.
SmartPointer< Self > Pointer
MultiThreaderType::Pointer m_Threader
FixedImageType::RegionType FixedImageRegionType
std::vector< bool > BooleanArrayType
ImageBaseType::IndexType IndexType
BSplineTransformType::ParameterIndexArrayType BSplineTransformIndexArrayType
GradientImageFilterType::Pointer GradientImageFilterPointer
SizeValueType m_NumberOfFixedImageSamples
void UseAllPixelsOn(void)