ITK  5.0.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:
54  ITK_DISALLOW_COPY_AND_ASSIGN(ObjectToObjectMetricBaseTemplate);
55 
61 
64 
66  using CoordinateRepresentationType = TInternalComputationValueType;
67 
69  using MeasureType = typename Superclass::MeasureType;
70 
72  using DerivativeType = typename Superclass::DerivativeType;
73  using DerivativeValueType = typename DerivativeType::ValueType;
74 
76  using ParametersType = typename Superclass::ParametersType;
77  using ParametersValueType = TInternalComputationValueType;
78 
80  using ObjectType = Object;
82 
84  itkSetConstObjectMacro( FixedObject, ObjectType );
85  itkGetConstObjectMacro( FixedObject, ObjectType );
87 
89  itkSetConstObjectMacro( MovingObject, ObjectType );
90  itkGetConstObjectMacro( MovingObject, ObjectType );
92 
96  typedef enum { GRADIENT_SOURCE_FIXED=0,
98  GRADIENT_SOURCE_BOTH } GradientSourceType;
99 
106  itkSetMacro( GradientSource, GradientSourceType );
107 
112  itkGetConstMacro( GradientSource, GradientSourceType );
113 
116  bool GetGradientSourceIncludesFixed() const;
117 
120  bool GetGradientSourceIncludesMoving() const;
121 
126  virtual void Initialize() = 0;
127 
130  using NumberOfParametersType = unsigned int;
131 
135  MeasureType GetValue() const override = 0;
136 
140  virtual void GetDerivative( DerivativeType & ) const = 0;
141 
144  void GetValueAndDerivative( MeasureType & value, DerivativeType & derivative ) const override = 0;
145 
149  NumberOfParametersType GetNumberOfParameters() const override = 0;
150  virtual NumberOfParametersType GetNumberOfLocalParameters() const = 0;
152 
154  virtual void SetParameters( ParametersType & params ) = 0;
155 
157  virtual const ParametersType & GetParameters() const = 0;
158 
161  virtual bool HasLocalSupport() const = 0;
162 
169  virtual void UpdateTransformParameters( const DerivativeType & derivative,
171 
177  MeasureType GetCurrentValue() const;
178 
179  typedef enum {
180  UNKNOWN_METRIC = 0,
181  OBJECT_METRIC = 1,
182  IMAGE_METRIC = 2,
183  POINT_SET_METRIC = 3,
184  MULTI_METRIC = 4
185  } MetricCategoryType;
186 
189  {
190  return UNKNOWN_METRIC;
191  }
192 
193 protected:
195  ~ObjectToObjectMetricBaseTemplate() override = default;
196 
197  void PrintSelf(std::ostream & os, Indent indent) const override;
198 
202 
204 
207 };
208 
211 
212 } // end namespace itk
213 
214 #ifndef ITK_MANUAL_INSTANTIATION
215 #include "itkObjectToObjectMetricBase.hxx"
216 #endif
217 
218 #endif
Light weight base class for most itk classes.
Define numeric traits for std::vector.
Base class for all object-to-object similarlity metrics added in ITKv4.
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
Base class for most ITK classes.
Definition: itkObject.h:60