18 #ifndef itkImageRegistrationMethodv4_h
19 #define itkImageRegistrationMethodv4_h
89 template<
typename TFixedImage,
90 typename TMovingImage,
91 typename TOutputTransform = Transform<double, TFixedImage::ImageDimension, TFixedImage::ImageDimension>,
92 typename TVirtualImage = TFixedImage,
93 typename TPointSet = PointSet<unsigned int, TFixedImage::ImageDimension> >
110 static constexpr
unsigned int ImageDimension = TFixedImage::ImageDimension;
132 using RealType =
typename OutputTransformType::ScalarType;
200 this->SetFixedImage( 0, image );
204 return this->GetFixedImage( 0 );
206 virtual void SetFixedImage(
SizeValueType,
const FixedImageType * );
207 virtual const FixedImageType * GetFixedImage(
SizeValueType )
const;
213 this->SetMovingImage( 0, image );
217 return this->GetMovingImage( 0 );
219 virtual void SetMovingImage(
SizeValueType,
const MovingImageType * );
220 virtual const MovingImageType * GetMovingImage(
SizeValueType )
const;
226 this->SetFixedPointSet( 0, pointSet );
230 return this->GetFixedPointSet( 0 );
232 virtual void SetFixedPointSet(
SizeValueType,
const PointSetType * );
233 virtual const PointSetType * GetFixedPointSet(
SizeValueType )
const;
239 this->SetMovingPointSet( 0, pointSet );
243 return this->GetMovingPointSet( 0 );
245 virtual void SetMovingPointSet(
SizeValueType,
const PointSetType * );
246 virtual const PointSetType * GetMovingPointSet(
SizeValueType )
const;
250 itkSetObjectMacro(
Optimizer, OptimizerType );
251 itkGetModifiableObjectMacro(
Optimizer, OptimizerType );
262 void SetOptimizerWeights( OptimizerWeightsType & );
263 itkGetConstMacro( OptimizerWeights, OptimizerWeightsType );
267 itkSetObjectMacro( Metric, MetricType );
268 itkGetModifiableObjectMacro( Metric, MetricType );
272 itkSetMacro( MetricSamplingStrategy, MetricSamplingStrategyType );
273 itkGetConstMacro( MetricSamplingStrategy, MetricSamplingStrategyType );
287 void MetricSamplingReinitializeSeed();
288 void MetricSamplingReinitializeSeed(
int seed);
292 void SetMetricSamplingPercentage(
const RealType );
295 virtual void SetMetricSamplingPercentagePerLevel(
const MetricSamplingPercentageArrayType &samplingPercentages );
296 itkGetConstMacro( MetricSamplingPercentagePerLevel, MetricSamplingPercentageArrayType );
300 itkSetGetDecoratedObjectInputMacro( FixedInitialTransform, InitialTransformType );
303 itkSetGetDecoratedObjectInputMacro( MovingInitialTransform, InitialTransformType );
320 itkSetGetDecoratedObjectInputMacro(InitialTransform, InitialTransformType);
323 void SetTransformParametersAdaptorsPerLevel( TransformParametersAdaptorsContainerType & );
324 const TransformParametersAdaptorsContainerType & GetTransformParametersAdaptorsPerLevel()
const;
347 for(
unsigned int level = 0; level < factors.
Size(); ++level )
350 shrinkFactors.Fill( factors[level] );
351 this->SetShrinkFactorsPerDimension( level, shrinkFactors );
361 if( level >= this->m_ShrinkFactorsPerLevel.size() )
363 itkExceptionMacro(
"Requesting level greater than the number of levels." );
365 return this->m_ShrinkFactorsPerLevel[level];
374 if( level >= this->m_ShrinkFactorsPerLevel.size() )
376 this->m_ShrinkFactorsPerLevel.resize( level + 1 );
378 this->m_ShrinkFactorsPerLevel[level] = factors;
388 itkSetMacro( SmoothingSigmasPerLevel, SmoothingSigmasArrayType );
389 itkGetConstMacro( SmoothingSigmasPerLevel, SmoothingSigmasArrayType );
396 itkSetMacro( SmoothingSigmasAreSpecifiedInPhysicalUnits,
bool );
397 itkGetConstMacro( SmoothingSigmasAreSpecifiedInPhysicalUnits,
bool );
398 itkBooleanMacro( SmoothingSigmasAreSpecifiedInPhysicalUnits );
403 using Superclass::MakeOutput;
414 virtual OutputTransformType * GetModifiableTransform();
415 virtual const OutputTransformType * GetTransform()
const;
421 itkGetConstReferenceMacro( CurrentIteration,
SizeValueType );
424 itkGetConstReferenceMacro( CurrentMetricValue, RealType );
427 itkGetConstReferenceMacro( CurrentConvergenceValue, RealType );
430 itkGetConstReferenceMacro( IsConverged,
bool );
435 itkSetMacro( InPlace,
bool );
436 itkGetConstMacro( InPlace,
bool );
437 itkBooleanMacro( InPlace );
445 itkBooleanMacro( InitializeCenterOfLinearOutputTransform );
446 itkSetMacro( InitializeCenterOfLinearOutputTransform,
bool );
447 itkGetConstMacro( InitializeCenterOfLinearOutputTransform,
bool );
462 void InitializeCenterOfLinearOutputTransform();
467 void PrintSelf( std::ostream & os,
Indent indent )
const override;
470 void GenerateData()
override;
472 virtual void AllocateOutputs();
475 virtual void InitializeRegistrationAtEachLevel(
const SizeValueType );
478 virtual VirtualImageBaseConstPointer GetCurrentLevelVirtualDomainImage();
481 virtual void SetMetricSamplePoints();
533 template<
typename TTransform>
536 ptr = TTransform::New();
547 #ifndef ITK_MANUAL_INSTANTIATION
548 #include "itkImageRegistrationMethodv4.hxx"
SizeValueType m_NumberOfLevels
typename MovingImageType::ConstPointer MovingImageConstPointer
SizeValueType m_CurrentIteration
TMovingImage MovingImageType
Light weight base class for most itk classes.
virtual DecoratedOutputTransformType * GetTransformOutput()
std::vector< FixedImageMaskConstPointer > FixedImageMasksContainerType
typename VirtualImageType::Pointer VirtualImagePointer
virtual void SetMovingImage(const MovingImageType *image)
typename DecoratedInitialTransformType::Pointer DecoratedInitialTransformPointer
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
virtual void SetMovingPointSet(const PointSetType *pointSet)
VirtualImagePointer m_VirtualDomainImage
typename CompositeTransformType::Pointer CompositeTransformPointer
typename OutputTransformType::DerivativeType DerivativeType
RealType m_CurrentConvergenceValue
MovingImageMasksContainerType m_MovingImageMasks
unsigned long SizeValueType
This class takes one ore more ObjectToObject metrics and assigns weights to their derivatives to comp...
virtual const PointSetType * GetFixedPointSet() const
bool m_InitializeCenterOfLinearOutputTransform
ObjectType * GetPointer() const noexcept
OutputTransformPointer m_OutputTransform
Computes similarity between two point sets.
typename PointSetType::ConstPointer PointSetConstPointer
std::vector< MovingImageConstPointer > MovingImagesContainerType
bool m_SmoothingSigmasAreSpecifiedInPhysicalUnits
TVirtualImage VirtualImageType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
RealType m_CurrentMetricValue
std::vector< TransformParametersAdaptorPointer > TransformParametersAdaptorsContainerType
typename TransformParametersAdaptorType::Pointer TransformParametersAdaptorPointer
typename ImageMetricType::FixedImageMaskType FixedImageMaskType
SizeValueType m_NumberOfMovingObjects
typename FixedImageType::ConstPointer FixedImageConstPointer
typename VirtualImageBaseType::ConstPointer VirtualImageBaseConstPointer
Base class for all object-to-object similarlity metrics added in ITKv4.
std::vector< ShrinkFactorsPerDimensionContainerType > m_ShrinkFactorsPerLevel
class ITK_FORWARD_EXPORT ProcessObject
void SetShrinkFactorsPerLevel(ShrinkFactorsArrayType factors)
OptimizerPointer m_Optimizer
typename MovingImageType::Pointer MovingImagePointer
typename InitialTransformType::Pointer InitialTransformPointer
MetricSamplingPercentageArrayType m_MetricSamplingPercentagePerLevel
virtual void SetFixedPointSet(const PointSetType *pointSet)
OptimizerWeightsType m_OptimizerWeights
MovingImagesContainerType m_MovingSmoothImages
std::vector< MovingImageMaskConstPointer > MovingImageMasksContainerType
std::vector< PointSetConstPointer > PointSetsContainerType
PointSetsContainerType m_MovingPointSets
static void MakeOutputTransform(SmartPointer< TTransform > &ptr)
ShrinkFactorsPerDimensionContainerType GetShrinkFactorsPerDimension(const unsigned int level) const
bool m_OptimizerWeightsAreIdentity
A templated class holding a n-Dimensional vector.
virtual const FixedImageType * GetFixedImage() const
typename OptimizerType::ScalesType OptimizerWeightsType
SizeValueType Size() const
MetricSamplingStrategyType
Decorates any subclass of itkObject with a DataObject API.
static void MakeOutputTransform(SmartPointer< InitialTransformType > &ptr)
Implementation of the composite pattern.
typename DerivativeType::ValueType DerivativeValueType
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
typename ShrinkFilterType::ShrinkFactorsType ShrinkFactorsPerDimensionContainerType
Generic representation for an optimization method.
typename DecoratedOutputTransformType::Pointer DecoratedOutputTransformPointer
PointSetsContainerType m_FixedPointSets
std::vector< FixedImageConstPointer > FixedImagesContainerType
TransformParametersAdaptorsContainerType m_TransformParametersAdaptorsPerLevel
CompositeTransformPointer m_CompositeTransform
TOutputTransform OutputTransformType
virtual void SetFixedImage(const FixedImageType *image)
void SetShrinkFactorsPerDimension(unsigned int level, ShrinkFactorsPerDimensionContainerType factors)
SizeValueType m_NumberOfMetrics
typename FixedImageType::Pointer FixedImagePointer
MetricSamplingStrategyType m_MetricSamplingStrategy
typename MovingImageMaskType::ConstPointer MovingImageMaskConstPointer
Base class for templated image classes.
typename ImageMetricType::MovingImageMaskType MovingImageMaskType
SizeValueType m_NumberOfFixedObjects
virtual const DecoratedOutputTransformType * GetTransformOutput() const
int m_FirstImageMetricIndex
Control indentation during Print() invocation.
Reduce the size of an image by an integer factor in each dimension.
typename OutputTransformType::ScalarType RealType
SmoothingSigmasArrayType m_SmoothingSigmasPerLevel
typename ImageMetricType::FixedSampledPointSetType MetricSamplePointSetType
virtual const PointSetType * GetMovingPointSet() const
FixedImageMasksContainerType m_FixedImageMasks
SizeValueType m_CurrentLevel
Interface method for the current registration framework.
TFixedImage FixedImageType
Abstract base for object-to-object optimizers.
FixedImagesContainerType m_FixedSmoothImages
typename MetricType::Pointer MetricPointer
virtual const MovingImageType * GetMovingImage() const
typename OptimizerType::Pointer OptimizerPointer
typename OutputTransformType::Pointer OutputTransformPointer
typename FixedImageMaskType::ConstPointer FixedImageMaskConstPointer