NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkImageToImageMetricWithConstraint.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkImageToImageMetricWithConstraint_h
16 #define itkImageToImageMetricWithConstraint_h
17 
18 #include <itkImageToImageMetric.h>
19 #include <itkConstraint.h>
21 
22 namespace itk
23 {
48 template < typename TFixedImage, typename TMovingImage >
50  public ImageToImageMetric< TFixedImage, TMovingImage>
51 {
52 public:
53 
56  typedef ImageToImageMetric<TFixedImage, TMovingImage > Superclass;
57  typedef SmartPointer<Self> Pointer;
58  typedef SmartPointer<const Self> ConstPointer;
59 
63 
67 
69  typedef typename Superclass::MeasureType MeasureType;
70  typedef typename Superclass::DerivativeType DerivativeType;
71  typedef typename Superclass::ParametersType TransformParametersType;
72 
74  itkTypeMacro(ImageToImageMetricWithConstraint, ImageToImageMetric);
75 
77  itkSetObjectMacro(DerivativeBridge, MetricDerivativeBridgeType);
78  itkGetObjectMacro(DerivativeBridge, MetricDerivativeBridgeType);
79 
81  itkSetObjectMacro( Constraint, ConstraintType );
82  itkGetObjectMacro( Constraint, ConstraintType );
83 
85  itkSetMacro( WeightingFactor, double );
86  itkGetMacro( WeightingFactor, double );
87 
89  itkSetMacro( UseConstraintGradient, bool );
90  itkGetConstMacro( UseConstraintGradient, bool );
91 
93  itkSetMacro( PrintOutMetricEvaluation, bool );
94  itkGetMacro( PrintOutMetricEvaluation, bool );
95 
98  virtual MeasureType GetValue( const TransformParametersType & parameters ) const;
99 
104  virtual void GetConstraintDerivative( const TransformParametersType & parameters, DerivativeType & derivative ) const;
105 
116  virtual void GetDerivative( const TransformParametersType & parameters, DerivativeType & derivative ) const;
117 
119  virtual void GetValueAndDerivative( const TransformParametersType & parameters, MeasureType& Value, DerivativeType& derivative ) const;
120 
121 protected:
122 
125  void PrintSelf(std::ostream& os, Indent indent) const;
126 
128  virtual MeasureType GetSimilarity( const TransformParametersType & parameters ) const = 0;
129 
131  virtual void GetCostFunctionDerivative( const TransformParametersType & parameters, DerivativeType & derivative ) const = 0;
132 
137  MetricDerivativePointer m_DerivativeBridge;
138 
143  ConstraintPointer m_Constraint;
144 
150 
153 
156 
157 };
158 
159 } // end namespace itk
160 
161 #ifndef ITK_MANUAL_INSTANTIATION
162 #include "itkImageToImageMetricWithConstraint.txx"
163 #endif
164 
165 #endif
166 
167 
168 
Abstract base class to provide functionality for adding arbitrary constraints, and also arbitrary way...
Definition: itkImageToImageMetricWithConstraint.h:49
SmartPointer< Self > Pointer
Definition: itkMetricDerivativeBridge.h:42
Superclass::DerivativeType DerivativeType
Definition: itkImageToImageMetricWithConstraint.h:70
bool m_UseConstraintGradient
Definition: itkImageToImageMetricWithConstraint.h:152
Definition: niftkITKAffineResampleImage.cxx:74
SmartPointer< Self > Pointer
Definition: itkConstraint.h:49
MetricDerivativeBridge< TFixedImage, TMovingImage > MetricDerivativeBridgeType
Definition: itkImageToImageMetricWithConstraint.h:65
Abstract Base class for constraints, which are objects that return a single double value...
Definition: itkConstraint.h:42
MetricDerivativePointer m_DerivativeBridge
Definition: itkImageToImageMetricWithConstraint.h:137
Definition: itkMetricDerivativeBridge.h:34
ImageToImageMetric< TFixedImage, TMovingImage > Superclass
Definition: itkImageToImageMetricWithConstraint.h:56
double m_WeightingFactor
Definition: itkImageToImageMetricWithConstraint.h:149
ConstraintPointer m_Constraint
Definition: itkImageToImageMetricWithConstraint.h:143
SmartPointer< const Self > ConstPointer
Definition: itkImageToImageMetricWithConstraint.h:58
ImageToImageMetricWithConstraint Self
Definition: itkImageToImageMetricWithConstraint.h:55
SmartPointer< Self > Pointer
Definition: itkImageToImageMetricWithConstraint.h:57
Superclass::ParametersType TransformParametersType
Definition: itkImageToImageMetricWithConstraint.h:71
AbstractBase class, implementing Bridge [2] to provide an interface for anything that calculates deri...
Definition: itkMetricDerivativeBridge.h:24
itk::Constraint ConstraintType
Definition: itkImageToImageMetricWithConstraint.h:61
Superclass::MeasureType MeasureType
Definition: itkImageToImageMetricWithConstraint.h:69
ConstraintType::Pointer ConstraintPointer
Definition: itkImageToImageMetricWithConstraint.h:62
bool m_PrintOutMetricEvaluation
Definition: itkImageToImageMetricWithConstraint.h:155
MetricDerivativeBridgeType::Pointer MetricDerivativePointer
Definition: itkImageToImageMetricWithConstraint.h:66
virtual ~ImageToImageMetricWithConstraint()
Definition: itkImageToImageMetricWithConstraint.h:124