18 #ifndef itkImageToImageMetricv4_h
19 #define itkImageToImageMetricv4_h
167 template<
typename TFixedImage,
typename TMovingImage,
typename TVirtualImage = TFixedImage,
168 typename TInternalComputationValueType = double,
169 typename TMetricTraits = DefaultImageToImageMetricTraitsv4< TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType >
172 :
public ObjectToObjectMetric<TFixedImage::ImageDimension, TMovingImage::ImageDimension, TVirtualImage, TInternalComputationValueType>
259 itkStaticConstMacro(FixedImageDimension,
DimensionType, Superclass::FixedDimension);
260 itkStaticConstMacro(MovingImageDimension,
DimensionType, Superclass::MovingDimension);
261 itkStaticConstMacro(VirtualImageDimension,
DimensionType, Superclass::VirtualDimension);
326 typedef typename FixedImageGradientFilterType::Pointer
328 typedef typename MovingImageGradientFilterType::Pointer
338 typedef typename MetricTraits::FixedImageGradientCalculatorType
340 typedef typename MetricTraits::MovingImageGradientCalculatorType
343 typedef typename FixedImageGradientCalculatorType::Pointer
345 typedef typename MovingImageGradientCalculatorType::Pointer
367 if( image != ITK_NULLPTR )
369 this->SetFixedImage( image );
373 itkExceptionMacro(
"Incorrect object type. Should be an image." )
382 if( image != ITK_NULLPTR )
384 this->SetMovingImage( image );
388 itkExceptionMacro(
"Incorrect object type. Should be an image." )
394 itkSetConstObjectMacro(FixedImage, FixedImageType);
395 itkGetConstObjectMacro(FixedImage, FixedImageType);
398 itkSetConstObjectMacro(MovingImage, MovingImageType);
399 itkGetConstObjectMacro(MovingImage, MovingImageType);
403 itkSetObjectMacro(FixedInterpolator, FixedInterpolatorType);
406 itkGetModifiableObjectMacro(FixedInterpolator, FixedInterpolatorType);
409 itkSetObjectMacro(MovingInterpolator, MovingInterpolatorType);
412 itkGetModifiableObjectMacro(MovingInterpolator, MovingInterpolatorType);
415 itkSetObjectMacro(MovingImageMask, MovingImageMaskType);
416 itkSetConstObjectMacro(MovingImageMask, MovingImageMaskType);
417 itkGetConstObjectMacro(MovingImageMask, MovingImageMaskType);
421 itkSetObjectMacro(FixedImageMask, FixedImageMaskType);
422 itkSetConstObjectMacro(FixedImageMask, FixedImageMaskType);
423 itkGetConstObjectMacro(FixedImageMask, FixedImageMaskType);
429 itkSetObjectMacro(FixedSampledPointSet, FixedSampledPointSetType);
430 itkSetConstObjectMacro(FixedSampledPointSet, FixedSampledPointSetType);
431 itkGetConstObjectMacro(FixedSampledPointSet, FixedSampledPointSetType);
435 itkSetMacro(UseFixedSampledPointSet,
bool);
436 itkGetConstReferenceMacro(UseFixedSampledPointSet,
bool);
437 itkBooleanMacro(UseFixedSampledPointSet);
441 itkGetModifiableObjectMacro(VirtualSampledPointSet, VirtualPointSetType);
444 itkSetObjectMacro( FixedImageGradientFilter, FixedImageGradientFilterType );
445 itkGetModifiableObjectMacro(FixedImageGradientFilter, FixedImageGradientFilterType );
446 itkSetObjectMacro( MovingImageGradientFilter, MovingImageGradientFilterType );
447 itkGetModifiableObjectMacro(MovingImageGradientFilter, MovingImageGradientFilterType );
451 itkSetObjectMacro( FixedImageGradientCalculator, FixedImageGradientCalculatorType);
452 itkGetModifiableObjectMacro(FixedImageGradientCalculator, FixedImageGradientCalculatorType);
453 itkSetObjectMacro( MovingImageGradientCalculator, MovingImageGradientCalculatorType);
454 itkGetModifiableObjectMacro(MovingImageGradientCalculator, MovingImageGradientCalculatorType);
459 itkSetMacro(UseFixedImageGradientFilter,
bool);
460 itkGetConstReferenceMacro(UseFixedImageGradientFilter,
bool);
461 itkBooleanMacro(UseFixedImageGradientFilter);
465 itkSetMacro(UseMovingImageGradientFilter,
bool);
466 itkGetConstReferenceMacro(UseMovingImageGradientFilter,
bool);
467 itkBooleanMacro(UseMovingImageGradientFilter);
478 virtual void SetMaximumNumberOfThreads(
const ThreadIdType threads );
492 itkGetModifiableObjectMacro(FixedImageGradientImage, FixedImageGradientImageType);
495 itkGetModifiableObjectMacro(MovingImageGradientImage, MovingImageGradientImageType);
500 return this->m_NumberOfValidPoints;
522 itkSetMacro(UseFloatingPointCorrection,
bool);
523 itkGetConstReferenceMacro(UseFloatingPointCorrection,
bool);
524 itkBooleanMacro(UseFloatingPointCorrection);
531 itkSetMacro( FloatingPointCorrectionResolution, DerivativeValueType );
532 itkGetConstMacro( FloatingPointCorrectionResolution, DerivativeValueType );
543 virtual void Initialize(
void) ITK_OVERRIDE;
545 virtual MeasureType GetValue() const ITK_OVERRIDE;
547 virtual
void GetDerivative( DerivativeType & ) const ITK_OVERRIDE;
554 virtual
void GetValueAndDerivative( MeasureType & value, DerivativeType & derivative ) const ITK_OVERRIDE;
559 itkGetConstReferenceMacro(NumberOfSkippedFixedSampledPoints,
SizeValueType);
561 virtual
bool SupportsArbitraryVirtualDomainSamples(
void ) const ITK_OVERRIDE
571 return Superclass::IMAGE_METRIC;
577 CoordinateRepresentationType >
601 virtual void InitializeForIteration()
const;
610 bool TransformAndEvaluateFixedPoint(
616 bool TransformAndEvaluateMovingPoint(
630 virtual void ComputeFixedImageGradientFilterImage();
635 virtual void ComputeMovingImageGradientFilterImage()
const;
643 virtual void GetValueAndDerivativeExecute()
const;
647 virtual void InitializeDefaultFixedImageGradientFilter();
648 virtual void InitializeDefaultMovingImageGradientFilter();
652 itkGetConstMacro( ComputeDerivative,
bool );
674 typename DefaultFixedImageGradientFilter::Pointer
676 typename DefaultMovingImageGradientFilter::Pointer
681 typename DefaultFixedImageGradientCalculator::Pointer
683 typename DefaultMovingImageGradientCalculator::Pointer
716 void PrintSelf(std::ostream& os,
Indent indent) const ITK_OVERRIDE;
720 void MapFixedSampledPointSetToVirtual();
726 mappedFixedPoint = this->m_FixedTransform->TransformPoint(virtualPoint);
729 template <
typename TVirtualPo
int>
731 typename FixedTransformType::OutputPointType &mappedFixedPoint)
const
733 typename FixedTransformType::OutputPointType localVirtualPoint;
736 localVirtualPoint.CastFrom(virtualPoint);
738 mappedFixedPoint = this->m_FixedTransform->TransformPoint( localVirtualPoint );
741 template <
typename TFixedImagePo
int>
743 TFixedImagePoint &mappedFixedPoint)
const
745 typename FixedTransformType::OutputPointType localMappedFixedPoint;
746 localMappedFixedPoint.CastFrom(mappedFixedPoint);
747 localMappedFixedPoint = this->m_FixedTransform->TransformPoint( virtualPoint );
748 mappedFixedPoint.CastFrom(localMappedFixedPoint);
751 template <
typename TVirtualPo
int,
typename TFixedImagePo
int>
753 TFixedImagePoint &mappedFixedPoint)
const
755 typename FixedTransformType::OutputPointType localVirtualPoint;
756 typename FixedTransformType::OutputPointType localMappedFixedPoint;
758 localVirtualPoint.CastFrom(virtualPoint);
759 localMappedFixedPoint.CastFrom(mappedFixedPoint);
761 localMappedFixedPoint = this->m_FixedTransform->TransformPoint( localVirtualPoint );
762 mappedFixedPoint.CastFrom(localMappedFixedPoint);
786 #ifdef ITK_USE_CONCEPT_CHECKING
791 #endif // ITK_USE_CONCEPT_CHECKING
797 #ifndef ITK_MANUAL_INSTANTIATION
798 #include "itkImageToImageMetricv4.hxx"
FixedImageMaskConstPointer m_FixedImageMask
MovingImagePixelType MovingPixelType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
void LocalTransformPoint(const TVirtualPoint &virtualPoint, typename FixedTransformType::OutputPointType &mappedFixedPoint) const
MetricTraits::DefaultMovingImageGradientCalculator DefaultMovingImageGradientCalculator
Superclass::VirtualSpacingType VirtualSpacingType
Superclass::VirtualRegionType VirtualRegionType
SpatialObject< itkGetStaticConstMacro(MovingImageDimension) > MovingImageMaskType
MetricTraits::MovingRealType MovingRealType
Superclass::VirtualPointSetType VirtualPointSetType
ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Self >::Pointer m_SparseGetValueAndDerivativeThreader
Superclass::DimensionType DimensionType
TInternalComputationValueType ValueType
Light weight base class for most itk classes.
Superclass::MovingTransformJacobianType MovingTransformJacobianType
PointSet< typename FixedImageType::PixelType, itkGetStaticConstMacro(FixedImageDimension)> FixedSampledPointSetType
Superclass::VirtualPointType VirtualOriginType
Superclass::JacobianType JacobianType
Superclass::MeasureType MeasureType
TPixelType::ValueType ValueType
LinearInterpolateImageFunction< FixedImageGradientImageType, CoordinateRepresentationType > FixedImageGradientInterpolatorType
FixedImagePixelType FixedPixelType
bool m_UseFixedSampledPointSet
Superclass::VirtualIndexType VirtualIndexType
Superclass::FixedTransformPointer FixedTransformPointer
MovingImageGradientFilterType::Pointer MovingImageGradientFilterPointer
MetricTraits::MovingGradientPixelType MovingGradientPixelType
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
Superclass::ParametersValueType ParametersValueType
Superclass::FixedTransformType FixedTransformType
DefaultFixedImageGradientCalculator::Pointer m_DefaultFixedImageGradientCalculator
Superclass::MovingTransformType MovingTransformType
Superclass::VirtualPixelType VirtualPixelType
MetricTraits::FixedGradientPixelType FixedGradientPixelType
SmartPointer< const Self > ConstPointer
TMovingImage MovingImageType
MetricTraits::DefaultFixedImageGradientFilter DefaultFixedImageGradientFilter
DefaultMovingImageGradientFilter::Pointer m_DefaultMovingImageGradientFilter
FixedImageMaskType::ConstPointer FixedImageMaskConstPointer
Superclass::VirtualImagePointer VirtualImagePointer
Class for partitioning of an ImageRegion.
virtual void SetFixedObject(const ObjectType *object) override
bool m_UseFloatingPointCorrection
virtual void SetMovingObject(const ObjectType *object) override
FixedImageGradientCalculatorPointer m_FixedImageGradientCalculator
SizeValueType m_NumberOfSkippedFixedSampledPoints
CovariantVector< typename VirtualImageGradientType::ValueType, VirtualImageDimension > VirtualImageComponentGradientType
MovingInterpolatorType::Pointer MovingInterpolatorPointer
void LocalTransformPoint(const TVirtualPoint &virtualPoint, TFixedImagePoint &mappedFixedPoint) const
PixelTraits< FixedImagePixelType >::ValueType FixedImagePixelValueType
Superclass::DimensionType ImageDimensionType
DefaultFixedImageGradientFilter::Pointer m_DefaultFixedImageGradientFilter
bool m_HaveMadeGetValueWarning
MovingImageGradientFilterPointer m_MovingImageGradientFilter
Computes similarity between regions of two objects.
ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< VirtualImageDimension >, Self >::Pointer m_DenseGetValueAndDerivativeThreader
Superclass::NumberOfParametersType NumberOfParametersType
MetricTraits::FixedImageGradientType FixedImageGradientType
MovingImageType::ConstPointer MovingImageConstPointer
Superclass::VirtualDirectionType VirtualDirectionType
MetricTraits::FixedImageGradientFilterType FixedImageGradientFilterType
void LocalTransformPoint(const typename FixedTransformType::OutputPointType &virtualPoint, TFixedImagePoint &mappedFixedPoint) const
Superclass::MovingOutputPointType MovingOutputPointType
unsigned long SizeValueType
DerivativeType::ValueType DerivativeValueType
Superclass::ParametersType ParametersType
LinearInterpolateImageFunction< MovingImageGradientImageType, CoordinateRepresentationType > MovingImageGradientInterpolatorType
TInternalComputationValueType CoordinateRepresentationType
MetricTraits::FixedRealType FixedRealType
Superclass::MovingTransformParametersType MovingTransformParametersType
DerivativeType * m_DerivativeResult
MetricTraits::DefaultMovingImageGradientFilter DefaultMovingImageGradientFilter
FixedImageGradientFilterType::Pointer FixedImageGradientFilterPointer
FixedImageType::PixelType FixedImagePixelType
MetricTraits::FixedImageGradientImageType FixedImageGradientImageType
SpatialObject< itkGetStaticConstMacro(FixedImageDimension) > FixedImageMaskType
FixedImageType::IndexType FixedImageIndexType
CovariantVector< typename MovingImageGradientType::ValueType, MovingImageDimension > MovingImageComponentGradientType
PixelTraits< MovingImagePixelType >::ValueType MovingImagePixelValueType
MetricTraits m_MetricTraits
MovingImageMaskType::ConstPointer MovingImageMaskConstPointer
bool m_UseFixedImageGradientFilter
Superclass::VirtualPointType VirtualPointType
Superclass::MetricCategoryType MetricCategoryType
NumericTraits< MovingRealType >::ScalarRealType MovingScalarRealType
FixedImageGradientImageType::Pointer FixedImageGradientImagePointer
FixedImageGradientImagePointer m_FixedImageGradientImage
Superclass::VirtualPointSetPointer VirtualPointSetPointer
FixedInterpolatorPointer m_FixedInterpolator
FixedImageGradientCalculatorType::Pointer FixedImageGradientCalculatorPointer
VirtualPointSetPointer m_VirtualSampledPointSet
MovingImageGradientImagePointer m_MovingImageGradientImage
ImageBaseType::PointType PointType
FixedImageMaskType::Pointer FixedImageMaskPointer
MovingImageGradientCalculatorType::Pointer MovingImageGradientCalculatorPointer
Superclass::DerivativeType DerivativeType
TInternalComputationValueType InternalComputationValueType
Implementation of the composite pattern.
MetricTraits::MovingImageGradientFilterType MovingImageGradientFilterType
Superclass::FixedTransformJacobianType FixedTransformJacobianType
MovingImageGradientInterpolatorType::Pointer m_MovingImageGradientInterpolator
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
FixedSampledPointSetConstPointer m_FixedSampledPointSet
MovingImageMaskConstPointer m_MovingImageMask
FixedImageType::Pointer FixedImagePointer
virtual MetricCategoryType GetMetricCategory() const override
Superclass::FixedTransformParametersType FixedTransformParametersType
MovingInterpolatorPointer m_MovingInterpolator
ObjectToObjectMetric< TFixedImage::ImageDimension, TMovingImage::ImageDimension, TVirtualImage, TInternalComputationValueType > Superclass
MetricTraits::MovingImageGradientCalculatorType MovingImageGradientCalculatorType
Superclass::MovingTransformPointer MovingTransformPointer
Partitions an indexed container.
NumericTraits< FixedRealType >::ScalarRealType FixedScalarRealType
InterpolateImageFunction< MovingImageType, CoordinateRepresentationType > MovingInterpolatorType
DerivativeType::ValueType DerivativeValueType
FixedImageConstPointer m_FixedImage
Linearly interpolate an image at specified positions.
unsigned int ThreadIdType
MovingImageType::IndexType MovingImageIndexType
MovingImageType::PixelType MovingImagePixelType
Superclass::MovingInputPointType MovingInputPointType
InterpolateImageFunction< FixedImageType, CoordinateRepresentationType > FixedInterpolatorType
Base class for all image interpolaters.
bool m_UseMovingImageGradientFilter
SmartPointer< Self > Pointer
MovingImageType::PointType MovingImagePointType
MetricTraits::VirtualImageGradientType VirtualImageGradientType
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
MovingImageMaskType::Pointer MovingImageMaskPointer
Superclass::FixedOutputPointType FixedOutputPointType
virtual void FinalizeThread(const ThreadIdType)
FixedInterpolatorType::Pointer FixedInterpolatorPointer
DerivativeValueType m_FloatingPointCorrectionResolution
MetricTraits::MovingImageGradientType MovingImageGradientType
FixedSampledPointSetType::Pointer FixedSampledPointSetPointer
Control indentation during Print() invocation.
MovingImageConstPointer m_MovingImage
CovariantVector< typename FixedImageGradientType::ValueType, FixedImageDimension > FixedImageComponentGradientType
FixedImageType::ConstPointer FixedImageConstPointer
MovingImageType::Pointer MovingImagePointer
FixedImageGradientInterpolatorType::Pointer m_FixedImageGradientInterpolator
MovingImageType::RegionType MovingImageRegionType
virtual SizeValueType GetNumberOfValidPoints() const override
ImageToImageMetricv4 Self
FixedImageType::PointType FixedImagePointType
MovingImageGradientImageType::Pointer MovingImageGradientImagePointer
Base class for most ITK classes.
#define itkConceptMacro(name, concept)
TFixedImage FixedImageType
A templated class holding a n-Dimensional covariant vector.
MetricTraits::MovingImageGradientImageType MovingImageGradientImageType
Superclass::VirtualSizeType VirtualRadiusType
MetricTraits::DefaultFixedImageGradientCalculator DefaultFixedImageGradientCalculator
TMetricTraits MetricTraits
Superclass::ObjectType ObjectType
Superclass::VirtualSizeType VirtualSizeType
Superclass::FixedInputPointType FixedInputPointType
MovingImageGradientCalculatorPointer m_MovingImageGradientCalculator
DefaultMovingImageGradientCalculator::Pointer m_DefaultMovingImageGradientCalculator
MetricTraits::FixedImageGradientCalculatorType FixedImageGradientCalculatorType
FixedImageGradientFilterPointer m_FixedImageGradientFilter
Superclass::VirtualImageType VirtualImageType
Superclass::GradientSourceType GradientSourceType
ImageBaseType::IndexType IndexType
FixedSampledPointSetType::ConstPointer FixedSampledPointSetConstPointer