18 #ifndef itkImageToImageMetricv4_h
19 #define itkImageToImageMetricv4_h
168 template<
typename TFixedImage,
typename TMovingImage,
typename TVirtualImage = TFixedImage,
169 typename TInternalComputationValueType = double,
170 typename TMetricTraits = DefaultImageToImageMetricTraitsv4< TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType >
173 :
public ObjectToObjectMetric<TFixedImage::ImageDimension, TMovingImage::ImageDimension, TVirtualImage, TInternalComputationValueType>
261 static constexpr
DimensionType FixedImageDimension = Superclass::FixedDimension;
262 static constexpr
DimensionType MovingImageDimension = Superclass::MovingDimension;
263 static constexpr
DimensionType VirtualImageDimension = Superclass::VirtualDimension;
361 if( image !=
nullptr )
363 this->SetFixedImage( image );
367 itkExceptionMacro(
"Incorrect object type. Should be an image." )
376 if( image !=
nullptr )
378 this->SetMovingImage( image );
382 itkExceptionMacro(
"Incorrect object type. Should be an image." )
388 itkSetConstObjectMacro(FixedImage, FixedImageType);
389 itkGetConstObjectMacro(FixedImage, FixedImageType);
392 itkSetConstObjectMacro(MovingImage, MovingImageType);
393 itkGetConstObjectMacro(MovingImage, MovingImageType);
397 itkSetObjectMacro(FixedInterpolator, FixedInterpolatorType);
400 itkGetModifiableObjectMacro(FixedInterpolator, FixedInterpolatorType);
403 itkSetObjectMacro(MovingInterpolator, MovingInterpolatorType);
406 itkGetModifiableObjectMacro(MovingInterpolator, MovingInterpolatorType);
409 itkSetObjectMacro(MovingImageMask, MovingImageMaskType);
410 itkSetConstObjectMacro(MovingImageMask, MovingImageMaskType);
411 itkGetConstObjectMacro(MovingImageMask, MovingImageMaskType);
415 itkSetObjectMacro(FixedImageMask, FixedImageMaskType);
416 itkSetConstObjectMacro(FixedImageMask, FixedImageMaskType);
417 itkGetConstObjectMacro(FixedImageMask, FixedImageMaskType);
423 itkSetObjectMacro(FixedSampledPointSet, FixedSampledPointSetType);
424 itkSetConstObjectMacro(FixedSampledPointSet, FixedSampledPointSetType);
425 itkGetConstObjectMacro(FixedSampledPointSet, FixedSampledPointSetType);
429 itkSetObjectMacro(VirtualSampledPointSet, VirtualPointSetType);
430 itkGetConstObjectMacro(VirtualSampledPointSet, VirtualPointSetType);
434 itkSetMacro(UseSampledPointSet,
bool);
435 itkGetConstReferenceMacro(UseSampledPointSet,
bool);
436 itkBooleanMacro(UseSampledPointSet);
441 itkSetMacro(UseVirtualSampledPointSet,
bool);
442 itkGetConstReferenceMacro(UseVirtualSampledPointSet,
bool);
443 itkBooleanMacro(UseVirtualSampledPointSet);
446 #if !defined(ITK_LEGACY_REMOVE)
449 itkLegacyMacro(
virtual void SetUseFixedSampledPointSet(
bool v) ) { this->SetUseSampledPointSet(v);}
450 itkLegacyMacro(
virtual bool GetUseFixedSampledPointSet()
const ) {
return this->GetUseSampledPointSet();}
451 itkLegacyMacro(
virtual void UseFixedSampledPointSetOn() ) {
return this->UseSampledPointSetOn();}
452 itkLegacyMacro(
virtual void UseFixedSampledPointSetOff() ) {
return this->UseSampledPointSetOff();}
458 itkSetObjectMacro( FixedImageGradientFilter, FixedImageGradientFilterType );
459 itkGetModifiableObjectMacro(FixedImageGradientFilter, FixedImageGradientFilterType );
460 itkSetObjectMacro( MovingImageGradientFilter, MovingImageGradientFilterType );
461 itkGetModifiableObjectMacro(MovingImageGradientFilter, MovingImageGradientFilterType );
465 itkSetObjectMacro( FixedImageGradientCalculator, FixedImageGradientCalculatorType);
466 itkGetModifiableObjectMacro(FixedImageGradientCalculator, FixedImageGradientCalculatorType);
467 itkSetObjectMacro( MovingImageGradientCalculator, MovingImageGradientCalculatorType);
468 itkGetModifiableObjectMacro(MovingImageGradientCalculator, MovingImageGradientCalculatorType);
473 itkSetMacro(UseFixedImageGradientFilter,
bool);
474 itkGetConstReferenceMacro(UseFixedImageGradientFilter,
bool);
475 itkBooleanMacro(UseFixedImageGradientFilter);
479 itkSetMacro(UseMovingImageGradientFilter,
bool);
480 itkGetConstReferenceMacro(UseMovingImageGradientFilter,
bool);
481 itkBooleanMacro(UseMovingImageGradientFilter);
492 virtual void SetMaximumNumberOfWorkUnits(
const ThreadIdType workUnits );
493 virtual ThreadIdType GetMaximumNumberOfWorkUnits()
const;
496 #if !defined ( ITK_LEGACY_REMOVE )
502 itkLegacyMacro(
virtual ThreadIdType GetNumberOfThreadsUsed()
const )
504 return this->GetNumberOfWorkUnitsUsed();
513 itkLegacyMacro(
virtual void SetMaximumNumberOfThreads(
const ThreadIdType count ) )
515 this->SetMaximumNumberOfWorkUnits(count);
517 itkLegacyMacro(
virtual ThreadIdType GetMaximumNumberOfThreads()
const )
519 return this->GetMaximumNumberOfWorkUnits();
521 #endif // !ITK_LEGACY_REMOVE
535 itkGetModifiableObjectMacro(FixedImageGradientImage, FixedImageGradientImageType);
538 itkGetModifiableObjectMacro(MovingImageGradientImage, MovingImageGradientImageType);
543 return this->m_NumberOfValidPoints;
565 itkSetMacro(UseFloatingPointCorrection,
bool);
566 itkGetConstReferenceMacro(UseFloatingPointCorrection,
bool);
567 itkBooleanMacro(UseFloatingPointCorrection);
574 itkSetMacro( FloatingPointCorrectionResolution, DerivativeValueType );
575 itkGetConstMacro( FloatingPointCorrectionResolution, DerivativeValueType );
586 void Initialize()
override;
588 MeasureType GetValue()
const override;
590 void GetDerivative( DerivativeType & )
const override;
597 void GetValueAndDerivative( MeasureType & value, DerivativeType & derivative )
const override;
602 itkGetConstReferenceMacro(NumberOfSkippedFixedSampledPoints,
SizeValueType);
614 return Superclass::IMAGE_METRIC;
642 virtual void InitializeForIteration()
const;
651 bool TransformAndEvaluateFixedPoint(
657 bool TransformAndEvaluateMovingPoint(
671 virtual void ComputeFixedImageGradientFilterImage();
676 virtual void ComputeMovingImageGradientFilterImage()
const;
684 virtual void GetValueAndDerivativeExecute()
const;
688 virtual void InitializeDefaultFixedImageGradientFilter();
689 virtual void InitializeDefaultMovingImageGradientFilter();
693 itkGetConstMacro( ComputeDerivative,
bool );
715 typename DefaultFixedImageGradientFilter::Pointer
717 typename DefaultMovingImageGradientFilter::Pointer
722 typename DefaultFixedImageGradientCalculator::Pointer
724 typename DefaultMovingImageGradientCalculator::Pointer
761 void PrintSelf(std::ostream& os,
Indent indent)
const override;
765 void MapFixedSampledPointSetToVirtual();
769 typename FixedTransformType::OutputPointType &mappedFixedPoint)
const
771 mappedFixedPoint = this->m_FixedTransform->TransformPoint(virtualPoint);
774 template <
typename TVirtualPo
int>
776 typename FixedTransformType::OutputPointType &mappedFixedPoint)
const
778 typename FixedTransformType::OutputPointType localVirtualPoint;
781 localVirtualPoint.CastFrom(virtualPoint);
783 mappedFixedPoint = this->m_FixedTransform->TransformPoint( localVirtualPoint );
786 template <
typename TFixedImagePo
int>
788 TFixedImagePoint &mappedFixedPoint)
const
790 typename FixedTransformType::OutputPointType localMappedFixedPoint;
791 localMappedFixedPoint.CastFrom(mappedFixedPoint);
792 localMappedFixedPoint = this->m_FixedTransform->TransformPoint( virtualPoint );
793 mappedFixedPoint.CastFrom(localMappedFixedPoint);
796 template <
typename TVirtualPo
int,
typename TFixedImagePo
int>
798 TFixedImagePoint &mappedFixedPoint)
const
800 typename FixedTransformType::OutputPointType localVirtualPoint;
801 typename FixedTransformType::OutputPointType localMappedFixedPoint;
803 localVirtualPoint.CastFrom(virtualPoint);
804 localMappedFixedPoint.CastFrom(mappedFixedPoint);
806 localMappedFixedPoint = this->m_FixedTransform->TransformPoint( localVirtualPoint );
807 mappedFixedPoint.CastFrom(localMappedFixedPoint);
829 #ifdef ITK_USE_CONCEPT_CHECKING
834 #endif // ITK_USE_CONCEPT_CHECKING
840 #ifndef ITK_MANUAL_INSTANTIATION
841 #include "itkImageToImageMetricv4.hxx"
FixedImageMaskConstPointer m_FixedImageMask
typename MetricTraits::MovingRealType MovingRealType
void LocalTransformPoint(const typename FixedTransformType::OutputPointType &virtualPoint, typename FixedTransformType::OutputPointType &mappedFixedPoint) const
void LocalTransformPoint(const TVirtualPoint &virtualPoint, typename FixedTransformType::OutputPointType &mappedFixedPoint) const
typename MetricTraits::FixedImageGradientCalculatorType FixedImageGradientCalculatorType
typename MovingImageType::RegionType MovingImageRegionType
ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Self >::Pointer m_SparseGetValueAndDerivativeThreader
Light weight base class for most itk classes.
typename Superclass::VirtualPointSetPointer VirtualPointSetPointer
typename Superclass::FixedTransformType FixedTransformType
typename MovingImageType::IndexType MovingImageIndexType
typename MetricTraits::DefaultMovingImageGradientCalculator DefaultMovingImageGradientCalculator
typename MetricTraits::FixedRealType FixedRealType
typename Superclass::MovingTransformType MovingTransformType
Define numeric traits for std::vector.
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
unsigned long SizeValueType
TInternalComputationValueType ParametersValueType
DefaultFixedImageGradientCalculator::Pointer m_DefaultFixedImageGradientCalculator
typename Superclass::VirtualPixelType VirtualPixelType
typename FixedImageType::IndexType FixedImageIndexType
typename MetricTraits::DefaultMovingImageGradientFilter DefaultMovingImageGradientFilter
typename MovingImageType::ConstPointer MovingImageConstPointer
typename MovingImageGradientImageType::Pointer MovingImageGradientImagePointer
DefaultMovingImageGradientFilter::Pointer m_DefaultMovingImageGradientFilter
typename MovingImageType::Pointer MovingImagePointer
typename FixedImageMaskType::ConstPointer FixedImageMaskConstPointer
Class for partitioning of an ImageRegion.
bool m_UseFloatingPointCorrection
SizeValueType GetNumberOfValidPoints() const override
FixedImageGradientCalculatorPointer m_FixedImageGradientCalculator
typename MetricTraits::FixedImageGradientType FixedImageGradientType
typename MetricTraits::MovingImageGradientType MovingImageGradientType
SizeValueType m_NumberOfSkippedFixedSampledPoints
typename FixedImageType::PointType FixedImagePointType
typename MetricTraits::FixedImageGradientImageType FixedImageGradientImageType
typename Superclass::VirtualImageType VirtualImageType
void LocalTransformPoint(const TVirtualPoint &virtualPoint, TFixedImagePoint &mappedFixedPoint) const
DefaultFixedImageGradientFilter::Pointer m_DefaultFixedImageGradientFilter
bool m_HaveMadeGetValueWarning
MovingImageGradientFilterPointer m_MovingImageGradientFilter
typename DerivativeType::ValueType DerivativeValueType
Computes similarity between regions of two objects.
ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< VirtualImageDimension >, Self >::Pointer m_DenseGetValueAndDerivativeThreader
typename MetricTraits::MovingImageGradientImageType MovingImageGradientImageType
typename MetricTraits::MovingImageGradientFilterType MovingImageGradientFilterType
typename Superclass::MovingTransformPointer MovingTransformPointer
typename MovingImageGradientFilterType::Pointer MovingImageGradientFilterPointer
void LocalTransformPoint(const typename FixedTransformType::OutputPointType &virtualPoint, TFixedImagePoint &mappedFixedPoint) const
typename MovingImageType::PixelType MovingImagePixelType
typename FixedImageMaskType::Pointer FixedImageMaskPointer
typename MetricTraits::DefaultFixedImageGradientFilter DefaultFixedImageGradientFilter
typename Superclass::DerivativeType DerivativeType
typename MovingImageMaskType::ConstPointer MovingImageMaskConstPointer
DerivativeType * m_DerivativeResult
typename Superclass::FixedInputPointType FixedInputPointType
bool m_UseVirtualSampledPointSet
typename MetricTraits::VirtualImageGradientType VirtualImageGradientType
typename MovingInterpolatorType::Pointer MovingInterpolatorPointer
typename Superclass::MeasureType MeasureType
typename PixelTraits< MovingImagePixelType >::ValueType MovingImagePixelValueType
typename TPixelType::ValueType ValueType
typename FixedSampledPointSetType::Pointer FixedSampledPointSetPointer
FixedImagePixelType FixedPixelType
typename Superclass::DimensionType ImageDimensionType
MetricTraits m_MetricTraits
TInternalComputationValueType CoordinateRepresentationType
typename Superclass::VirtualSizeType VirtualRadiusType
bool m_UseFixedImageGradientFilter
typename Superclass::VirtualSpacingType VirtualSpacingType
typename MetricTraits::MovingGradientPixelType MovingGradientPixelType
typename Superclass::VirtualImagePointer VirtualImagePointer
typename FixedImageGradientFilterType::Pointer FixedImageGradientFilterPointer
FixedImageGradientImagePointer m_FixedImageGradientImage
typename MetricTraits::DefaultFixedImageGradientCalculator DefaultFixedImageGradientCalculator
FixedInterpolatorPointer m_FixedInterpolator
VirtualPointSetPointer m_VirtualSampledPointSet
MovingImageGradientImagePointer m_MovingImageGradientImage
ImageBaseType::IndexType IndexType
typename Superclass::MovingTransformParametersType MovingTransformParametersType
typename Superclass::VirtualPointType VirtualPointType
typename MovingImageType::PointType MovingImagePointType
typename FixedInterpolatorType::Pointer FixedInterpolatorPointer
Implementation of the composite pattern.
MovingImageGradientInterpolatorType::Pointer m_MovingImageGradientInterpolator
typename Superclass::VirtualPointSetType VirtualPointSetType
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
FixedSampledPointSetConstPointer m_FixedSampledPointSet
MovingImageMaskConstPointer m_MovingImageMask
typename FixedSampledPointSetType::ConstPointer FixedSampledPointSetConstPointer
MovingInterpolatorPointer m_MovingInterpolator
typename Superclass::VirtualSizeType VirtualSizeType
Partitions an indexed container.
typename Superclass::MovingOutputPointType MovingOutputPointType
unsigned int NumberOfParametersType
FixedImageConstPointer m_FixedImage
Linearly interpolate an image at specified positions.
unsigned int ThreadIdType
typename Superclass::VirtualIndexType VirtualIndexType
typename Superclass::VirtualDirectionType VirtualDirectionType
MovingImagePixelType MovingPixelType
typename FixedImageType::Pointer FixedImagePointer
Base class for all image interpolaters.
bool m_UseMovingImageGradientFilter
typename NumericTraits< MovingRealType >::ScalarRealType MovingScalarRealType
typename FixedImageGradientImageType::Pointer FixedImageGradientImagePointer
typename Superclass::MovingInputPointType MovingInputPointType
void SetFixedObject(const ObjectType *object) override
typename MovingImageGradientCalculatorType::Pointer MovingImageGradientCalculatorPointer
typename Superclass::VirtualPointType VirtualOriginType
bool m_UseSampledPointSet
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
bool SupportsArbitraryVirtualDomainSamples() const override
virtual void FinalizeThread(const ThreadIdType)
DerivativeValueType m_FloatingPointCorrectionResolution
void SetMovingObject(const ObjectType *object) override
typename MovingImageMaskType::Pointer MovingImageMaskPointer
Control indentation during Print() invocation.
typename FixedImageGradientCalculatorType::Pointer FixedImageGradientCalculatorPointer
ImageBaseType::PointType PointType
MovingImageConstPointer m_MovingImage
typename Superclass::VirtualRegionType VirtualRegionType
typename FixedImageType::PixelType FixedImagePixelType
typename PixelTraits< FixedImagePixelType >::ValueType FixedImagePixelValueType
typename MetricTraits::MovingImageGradientCalculatorType MovingImageGradientCalculatorType
FixedImageGradientInterpolatorType::Pointer m_FixedImageGradientInterpolator
TInternalComputationValueType InternalComputationValueType
TMetricTraits MetricTraits
typename Superclass::DimensionType DimensionType
Base class for most ITK classes.
ImageBaseType::RegionType RegionType
typename Superclass::FixedTransformPointer FixedTransformPointer
#define itkConceptMacro(name, concept)
typename MetricTraits::FixedImageGradientFilterType FixedImageGradientFilterType
TMovingImage MovingImageType
typename FixedImageType::ConstPointer FixedImageConstPointer
typename MetricTraits::FixedGradientPixelType FixedGradientPixelType
typename Superclass::JacobianType JacobianType
A templated class holding a n-Dimensional covariant vector.
typename Superclass::FixedTransformJacobianType FixedTransformJacobianType
typename Superclass::FixedOutputPointType FixedOutputPointType
typename Superclass::MovingTransformJacobianType MovingTransformJacobianType
MetricCategoryType GetMetricCategory() const override
typename NumericTraits< FixedRealType >::ScalarRealType FixedScalarRealType
MovingImageGradientCalculatorPointer m_MovingImageGradientCalculator
DefaultMovingImageGradientCalculator::Pointer m_DefaultMovingImageGradientCalculator
TFixedImage FixedImageType
FixedImageGradientFilterPointer m_FixedImageGradientFilter
typename Superclass::FixedTransformParametersType FixedTransformParametersType