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> >
108 itkStaticConstMacro( ImageDimension,
unsigned int, TFixedImage::ImageDimension );
128 typedef typename OutputTransformType::ScalarType
RealType;
196 this->SetFixedImage( 0, image );
200 return this->GetFixedImage( 0 );
202 virtual void SetFixedImage(
SizeValueType,
const FixedImageType * );
203 virtual const FixedImageType * GetFixedImage(
SizeValueType )
const;
209 this->SetMovingImage( 0, image );
213 return this->GetMovingImage( 0 );
215 virtual void SetMovingImage(
SizeValueType,
const MovingImageType * );
216 virtual const MovingImageType * GetMovingImage(
SizeValueType )
const;
222 this->SetFixedPointSet( 0, pointSet );
226 return this->GetFixedPointSet( 0 );
228 virtual void SetFixedPointSet(
SizeValueType,
const PointSetType * );
229 virtual const PointSetType * GetFixedPointSet(
SizeValueType )
const;
235 this->SetMovingPointSet( 0, pointSet );
239 return this->GetMovingPointSet( 0 );
241 virtual void SetMovingPointSet(
SizeValueType,
const PointSetType * );
242 virtual const PointSetType * GetMovingPointSet(
SizeValueType )
const;
246 itkSetObjectMacro(
Optimizer, OptimizerType );
247 itkGetModifiableObjectMacro(
Optimizer, OptimizerType );
258 void SetOptimizerWeights( OptimizerWeightsType & );
259 itkGetConstMacro( OptimizerWeights, OptimizerWeightsType );
263 itkSetObjectMacro( Metric, MetricType );
264 itkGetModifiableObjectMacro( Metric, MetricType );
268 itkSetMacro( MetricSamplingStrategy, MetricSamplingStrategyType );
269 itkGetConstMacro( MetricSamplingStrategy, MetricSamplingStrategyType );
283 void MetricSamplingReinitializeSeed();
284 void MetricSamplingReinitializeSeed(
int seed);
288 void SetMetricSamplingPercentage(
const RealType );
291 virtual void SetMetricSamplingPercentagePerLevel(
const MetricSamplingPercentageArrayType &samplingPercentages );
292 itkGetConstMacro( MetricSamplingPercentagePerLevel, MetricSamplingPercentageArrayType );
296 itkSetGetDecoratedObjectInputMacro( FixedInitialTransform, InitialTransformType );
299 itkSetGetDecoratedObjectInputMacro( MovingInitialTransform, InitialTransformType );
316 itkSetGetDecoratedObjectInputMacro(InitialTransform, InitialTransformType);
319 void SetTransformParametersAdaptorsPerLevel( TransformParametersAdaptorsContainerType & );
320 const TransformParametersAdaptorsContainerType & GetTransformParametersAdaptorsPerLevel()
const;
343 for(
unsigned int level = 0; level < factors.
Size(); ++level )
346 shrinkFactors.
Fill( factors[level] );
347 this->SetShrinkFactorsPerDimension( level, shrinkFactors );
357 if( level >= this->m_ShrinkFactorsPerLevel.size() )
359 itkExceptionMacro(
"Requesting level greater than the number of levels." );
361 return this->m_ShrinkFactorsPerLevel[level];
370 if( level >= this->m_ShrinkFactorsPerLevel.size() )
372 this->m_ShrinkFactorsPerLevel.resize( level + 1 );
374 this->m_ShrinkFactorsPerLevel[level] = factors;
384 itkSetMacro( SmoothingSigmasPerLevel, SmoothingSigmasArrayType );
385 itkGetConstMacro( SmoothingSigmasPerLevel, SmoothingSigmasArrayType );
392 itkSetMacro( SmoothingSigmasAreSpecifiedInPhysicalUnits,
bool );
393 itkGetConstMacro( SmoothingSigmasAreSpecifiedInPhysicalUnits,
bool );
394 itkBooleanMacro( SmoothingSigmasAreSpecifiedInPhysicalUnits );
399 using Superclass::MakeOutput;
410 virtual OutputTransformType * GetModifiableTransform();
411 virtual const OutputTransformType * GetTransform()
const;
417 itkGetConstReferenceMacro( CurrentIteration,
SizeValueType );
420 itkGetConstReferenceMacro( CurrentMetricValue, RealType );
423 itkGetConstReferenceMacro( CurrentConvergenceValue, RealType );
426 itkGetConstReferenceMacro( IsConverged,
bool );
431 itkSetMacro( InPlace,
bool );
432 itkGetConstMacro( InPlace,
bool );
433 itkBooleanMacro( InPlace );
441 itkBooleanMacro( InitializeCenterOfLinearOutputTransform );
442 itkSetMacro( InitializeCenterOfLinearOutputTransform,
bool );
443 itkGetConstMacro( InitializeCenterOfLinearOutputTransform,
bool );
458 void InitializeCenterOfLinearOutputTransform();
460 #ifdef ITKV3_COMPATIBILITY
476 void StartRegistration(
void) { this->Update(); }
480 ImageRegistrationMethodv4();
481 virtual ~ImageRegistrationMethodv4() ITK_OVERRIDE;
482 virtual
void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
485 virtual
void GenerateData() ITK_OVERRIDE;
487 virtual
void AllocateOutputs();
490 virtual
void InitializeRegistrationAtEachLevel( const
SizeValueType );
493 virtual VirtualImageBaseConstPointer GetCurrentLevelVirtualDomainImage();
496 virtual
void SetMetricSamplePoints();
498 SizeValueType m_CurrentLevel;
499 SizeValueType m_NumberOfLevels;
500 SizeValueType m_CurrentIteration;
512 SizeValueType m_NumberOfFixedObjects;
513 SizeValueType m_NumberOfMovingObjects;
517 bool m_OptimizerWeightsAreIdentity;
522 SizeValueType m_NumberOfMetrics;
523 int m_FirstImageMetricIndex;
526 bool m_SmoothingSigmasAreSpecifiedInPhysicalUnits;
528 bool m_ReseedIterator;
530 int m_CurrentRandomSeed;
547 bool m_InitializeCenterOfLinearOutputTransform;
550 template<typename TTransform>
553 ptr = TTransform::New();
564 #ifndef ITK_MANUAL_INSTANTIATION
565 #include "itkImageRegistrationMethodv4.hxx"
Array< SizeValueType > ShrinkFactorsArrayType
FixedImageMaskType::ConstPointer FixedImageMaskConstPointer
Transform< RealType, ImageDimension, ImageDimension > InitialTransformType
ImageMetricType::FixedSampledPointSetType MetricSamplePointSetType
Light weight base class for most itk classes.
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
virtual void SetMovingImage(const MovingImageType *image)
virtual void SetMovingPointSet(const PointSetType *pointSet)
DerivativeType::ValueType DerivativeValueType
This class takes one ore more ObjectToObject metrics and assigns weights to their derivatives to comp...
TMovingImage MovingImageType
virtual const PointSetType * GetFixedPointSet() const
ShrinkFilterType::ShrinkFactorsType ShrinkFactorsPerDimensionContainerType
TVirtualImage VirtualImageType
Computes similarity between two point sets.
FixedImageType::Pointer FixedImagePointer
Array< RealType > SmoothingSigmasArrayType
Array< RealType > MetricSamplingPercentageArrayType
MovingImageType::Pointer MovingImagePointer
TransformParametersAdaptorType::Pointer TransformParametersAdaptorPointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
MovingImageMaskType::ConstPointer MovingImageMaskConstPointer
DecoratedInitialTransformType::Pointer DecoratedInitialTransformPointer
CompositeTransformType::Pointer CompositeTransformPointer
ImageMetricType::FixedImageMaskType FixedImageMaskType
ObjectType * GetPointer() const
Vector< RealType, ImageDimension > VectorType
Base class for all object-to-object similarlity metrics added in ITKv4.
unsigned long SizeValueType
SmartPointer< Self > Pointer
void Fill(const ValueType &)
void SetShrinkFactorsPerLevel(ShrinkFactorsArrayType factors)
std::vector< MovingImageMaskConstPointer > MovingImageMasksContainerType
ImageToImageMetricv4< FixedImageType, MovingImageType, VirtualImageType, RealType > ImageMetricType
virtual void SetFixedPointSet(const PointSetType *pointSet)
ShrinkFactorsPerDimensionContainerType GetShrinkFactorsPerDimension(const unsigned int level) const
A templated class holding a n-Dimensional vector.
std::vector< FixedImageMaskConstPointer > FixedImageMasksContainerType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
ImageRegistrationMethodv4 Self
TOutputTransform OutputTransformType
virtual const FixedImageType * GetFixedImage() const
std::vector< TransformParametersAdaptorPointer > TransformParametersAdaptorsContainerType
MetricSamplingStrategyType
ImageMetricType::MovingImageMaskType MovingImageMaskType
Decorates any subclass of itkObject with a DataObject API.
static void MakeOutputTransform(SmartPointer< InitialTransformType > &ptr)
Implementation of the composite pattern.
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
InitialTransformType::Pointer InitialTransformPointer
Generic representation for an optimization method.
OptimizerType::ScalesType OptimizerWeightsType
DecoratedOutputTransformType::Pointer DecoratedOutputTransformPointer
ObjectToObjectOptimizerBaseTemplate< RealType > OptimizerType
OutputTransformType::DerivativeType DerivativeType
MetricType::Pointer MetricPointer
virtual void SetFixedImage(const FixedImageType *image)
void SetShrinkFactorsPerDimension(unsigned int level, ShrinkFactorsPerDimensionContainerType factors)
PointSetType::ConstPointer PointSetConstPointer
TransformParametersAdaptorBase< InitialTransformType > TransformParametersAdaptorType
std::vector< MovingImagePointer > MovingImagesContainerType
ObjectToObjectMetricBaseTemplate< RealType > MetricType
Base class for templated image classes.
DataObjectDecorator< InitialTransformType > DecoratedInitialTransformType
virtual const DecoratedOutputTransformType * GetTransformOutput() const
DataObjectDecorator< OutputTransformType > DecoratedOutputTransformType
ShrinkImageFilter< FixedImageType, VirtualImageType > ShrinkFilterType
Reduce the size of an image by an integer factor in each dimension.
SmartPointer< const Self > ConstPointer
SizeValueType Size(void) const
virtual const PointSetType * GetMovingPointSet() const
std::vector< FixedImagePointer > FixedImagesContainerType
VirtualImageBaseType::ConstPointer VirtualImageBaseConstPointer
OptimizerType::Pointer OptimizerPointer
Interface method for the current registration framework.
PointSetToPointSetMetricv4< PointSetType, PointSetType, RealType > PointSetMetricType
Abstract base for object-to-object optimizers.
CompositeTransform< RealType, ImageDimension > CompositeTransformType
OutputTransformType::ScalarType RealType
std::vector< PointSetConstPointer > PointSetsContainerType
OutputTransformType::Pointer OutputTransformPointer
ObjectToObjectMultiMetricv4< ImageDimension, ImageDimension, VirtualImageType, RealType > MultiMetricType
ImageBase< ImageDimension > VirtualImageBaseType
virtual const MovingImageType * GetMovingImage() const
VirtualImageType::Pointer VirtualImagePointer
TFixedImage FixedImageType