ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkObjectToObjectMetricBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkObjectToObjectMetricBase_h
19 #define itkObjectToObjectMetricBase_h
20 
21 #include "itkTransformBase.h"
23 
24 
25 namespace itk
26 {
49 template<typename TInternalComputationValueType=double>
50 class ITK_TEMPLATE_EXPORT ObjectToObjectMetricBaseTemplate:
51  public SingleValuedCostFunctionv4Template<TInternalComputationValueType>
52 {
53 public:
59 
62 
64  typedef TInternalComputationValueType CoordinateRepresentationType;
65 
67  typedef typename Superclass::MeasureType MeasureType;
68 
70  typedef typename Superclass::DerivativeType DerivativeType;
71  typedef typename DerivativeType::ValueType DerivativeValueType;
72 
74  typedef typename Superclass::ParametersType ParametersType;
75  typedef TInternalComputationValueType ParametersValueType;
76 
78  typedef Object ObjectType;
80 
82  itkSetConstObjectMacro( FixedObject, ObjectType );
83  itkGetConstObjectMacro( FixedObject, ObjectType );
85 
87  itkSetConstObjectMacro( MovingObject, ObjectType );
88  itkGetConstObjectMacro( MovingObject, ObjectType );
90 
94  typedef enum { GRADIENT_SOURCE_FIXED=0,
96  GRADIENT_SOURCE_BOTH } GradientSourceType;
97 
104  itkSetMacro( GradientSource, GradientSourceType );
105 
110  itkGetConstMacro( GradientSource, GradientSourceType );
111 
114  bool GetGradientSourceIncludesFixed() const;
115 
118  bool GetGradientSourceIncludesMoving() const;
119 
124  virtual void Initialize(void) = 0;
125 
128  typedef unsigned int NumberOfParametersType;
129 
133  virtual MeasureType GetValue() const ITK_OVERRIDE = 0;
134 
138  virtual void GetDerivative( DerivativeType & ) const = 0;
139 
142  virtual void GetValueAndDerivative( MeasureType & value, DerivativeType & derivative ) const ITK_OVERRIDE = 0;
143 
147  virtual NumberOfParametersType GetNumberOfParameters() const ITK_OVERRIDE = 0;
148  virtual NumberOfParametersType GetNumberOfLocalParameters() const = 0;
150 
152  virtual void SetParameters( ParametersType & params ) = 0;
153 
155  virtual const ParametersType & GetParameters() const = 0;
156 
159  virtual bool HasLocalSupport() const = 0;
160 
167  virtual void UpdateTransformParameters( const DerivativeType & derivative,
168  ParametersValueType factor = NumericTraits<ParametersValueType>::OneValue()) = 0;
169 
175  MeasureType GetCurrentValue() const;
176 
177  typedef enum {
178  UNKNOWN_METRIC = 0,
179  OBJECT_METRIC = 1,
180  IMAGE_METRIC = 2,
181  POINT_SET_METRIC = 3,
182  MULTI_METRIC = 4
183  } MetricCategoryType;
184 
187  {
188  return UNKNOWN_METRIC;
189  }
190 
191 protected:
193  virtual ~ObjectToObjectMetricBaseTemplate() ITK_OVERRIDE;
194 
195  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
196 
198  ObjectConstPointer m_FixedObject;
199  ObjectConstPointer m_MovingObject;
200 
201  GradientSourceType m_GradientSource;
202 
204  mutable MeasureType m_Value;
205 
206 private:
207  ITK_DISALLOW_COPY_AND_ASSIGN(ObjectToObjectMetricBaseTemplate);
208 };
209 
211 typedef ObjectToObjectMetricBaseTemplate<double> ObjectToObjectMetricBase;
212 
213 } // end namespace itk
214 
215 #ifndef ITK_MANUAL_INSTANTIATION
216 #include "itkObjectToObjectMetricBase.hxx"
217 #endif
218 
219 #endif
SingleValuedCostFunctionv4Template< TInternalComputationValueType > Superclass
TInternalComputationValueType ParametersValueType
Base class for all object-to-object similarlity metrics added in ITKv4.
TInternalComputationValueType CoordinateRepresentationType
virtual MetricCategoryType GetMetricCategory() const
Class to hold and manage different parameter types used during optimization.
This class is a base for a CostFunction that returns a single value.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Define additional traits for native types such as int or float.
Base class for most ITK classes.
Definition: itkObject.h:59