ITK  5.2.0
Insight Toolkit
itkObjectToObjectMultiMetricv4.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 
19 #ifndef itkObjectToObjectMultiMetricv4_h
20 #define itkObjectToObjectMultiMetricv4_h
21 
23 #include "itkArray.h"
24 #include <deque>
25 
26 namespace itk
27 {
92 template <unsigned int TFixedDimension,
93  unsigned int TMovingDimension,
94  typename TVirtualImage = Image<double, TFixedDimension>,
95  class TInternalComputationValueType = double>
96 class ITK_TEMPLATE_EXPORT ObjectToObjectMultiMetricv4
97  : public ObjectToObjectMetric<TFixedDimension, TMovingDimension, TVirtualImage, TInternalComputationValueType>
98 {
99 public:
100  ITK_DISALLOW_COPY_AND_MOVE(ObjectToObjectMultiMetricv4);
101 
104  using Superclass =
108 
111 
113  itkNewMacro(Self);
114 
116  using MeasureType = typename Superclass::MeasureType;
117  using DerivativeType = typename Superclass::DerivativeType;
118  using DerivativeValueType = typename Superclass::DerivativeValueType;
119  using ParametersType = typename Superclass::ParametersType;
120  using ParametersValueType = typename Superclass::ParametersValueType;
121  using NumberOfParametersType = typename Superclass::NumberOfParametersType;
122  using CoordinateRepresentationType = typename Superclass::CoordinateRepresentationType;
123  using MovingTransformType = typename Superclass::MovingTransformType;
124  using FixedTransformType = typename Superclass::FixedTransformType;
125 
130  using MetricQueueType = std::deque<MetricBasePointer>;
131 
132  using ObjectType = typename Superclass::ObjectType;
133 
134  using WeightValueType = typename DerivativeType::ValueType;
137 
138  itkSetMacro(MetricWeights, WeightsArrayType);
139  itkGetMacro(MetricWeights, WeightsArrayType);
140 
142  void
143  AddMetric(MetricType * metric);
144 
146  void
147  ClearMetricQueue();
148 
151  GetNumberOfMetrics() const;
152 
153  void
154  Initialize() override;
155 
157  void
158  SetFixedObject(const ObjectType * itkNotUsed(object)) override
159  {
160  itkExceptionMacro("A single object should not be specified for the multi metric.");
161  }
162 
164  void
165  SetMovingObject(const ObjectType * itkNotUsed(object)) override
166  {
167  itkExceptionMacro("A single object should not be specified for the multi metric.");
168  }
169 
171  void
172  SetMovingTransform(MovingTransformType *) override;
173 
175  void
176  SetFixedTransform(FixedTransformType *) override;
177 
182  MeasureType
183  GetValue() const override;
184 
185  void
186  GetDerivative(DerivativeType &) const override;
187 
194  void
195  GetValueAndDerivative(MeasureType & firstValue, DerivativeType & derivativeResult) const override;
196 
199  MetricValueArrayType
200  GetValueArray() const;
201 
204  MeasureType
205  GetWeightedValue() const;
206 
208  const MetricQueueType &
209  GetMetricQueue() const;
210 
211  bool
212  SupportsArbitraryVirtualDomainSamples() const override;
213 
214  using MetricCategoryType = typename Superclass::MetricCategoryType;
215 
218  GetMetricCategory() const override
219  {
220  return MetricCategoryType::MULTI_METRIC;
221  }
222 
223 protected:
225  ~ObjectToObjectMultiMetricv4() override = default;
226  void
227  PrintSelf(std::ostream & os, Indent indent) const override;
228 
229 private:
233 };
234 
235 } // end namespace itk
236 
237 #ifndef ITK_MANUAL_INSTANTIATION
238 # include "itkObjectToObjectMultiMetricv4.hxx"
239 #endif
240 
241 #endif
itk::ObjectToObjectMultiMetricv4::SetFixedObject
void SetFixedObject(const ObjectType *) override
Definition: itkObjectToObjectMultiMetricv4.h:158
itk::OptimizerParameters< TInternalComputationValueType >
itk::ObjectToObjectMultiMetricv4::SetMovingObject
void SetMovingObject(const ObjectType *) override
Definition: itkObjectToObjectMultiMetricv4.h:165
itk::ObjectToObjectMultiMetricv4
This class takes one ore more ObjectToObject metrics and assigns weights to their derivatives to comp...
Definition: itkObjectToObjectMultiMetricv4.h:96
itk::ObjectToObjectMultiMetricv4::FixedTransformType
typename Superclass::FixedTransformType FixedTransformType
Definition: itkObjectToObjectMultiMetricv4.h:124
itk::ObjectToObjectMultiMetricv4::m_MetricWeights
WeightsArrayType m_MetricWeights
Definition: itkObjectToObjectMultiMetricv4.h:231
itk::ObjectToObjectMetricBaseTemplate::NumberOfParametersType
unsigned int NumberOfParametersType
Definition: itkObjectToObjectMetricBase.h:176
itk::ObjectToObjectMultiMetricv4::MetricCategoryType
typename Superclass::MetricCategoryType MetricCategoryType
Definition: itkObjectToObjectMultiMetricv4.h:214
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ObjectToObjectMultiMetricv4::WeightValueType
typename DerivativeType::ValueType WeightValueType
Definition: itkObjectToObjectMultiMetricv4.h:134
itk::ObjectToObjectMultiMetricv4::MetricBaseConstPointer
typename MetricType::ConstPointer MetricBaseConstPointer
Definition: itkObjectToObjectMultiMetricv4.h:129
itk::ObjectToObjectMetricBaseTemplate::DerivativeValueType
typename DerivativeType::ValueType DerivativeValueType
Definition: itkObjectToObjectMetricBase.h:113
itk::ObjectToObjectMultiMetricv4::m_MetricQueue
MetricQueueType m_MetricQueue
Definition: itkObjectToObjectMultiMetricv4.h:230
itkObjectToObjectMetric.h
itk::ObjectToObjectMultiMetricv4::MetricBasePointer
typename MetricType::Pointer MetricBasePointer
Definition: itkObjectToObjectMultiMetricv4.h:128
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ObjectToObjectMetricBaseTemplate::CoordinateRepresentationType
TInternalComputationValueType CoordinateRepresentationType
Definition: itkObjectToObjectMetricBase.h:106
itk::CostFunctionTemplate::ParametersValueType
TInternalComputationValueType ParametersValueType
Definition: itkCostFunction.h:52
itk::ObjectToObjectMultiMetricv4::MetricQueueType
std::deque< MetricBasePointer > MetricQueueType
Definition: itkObjectToObjectMultiMetricv4.h:130
itkArray.h
itk::ObjectToObjectMetricBaseTemplate::MeasureType
typename Superclass::MeasureType MeasureType
Definition: itkObjectToObjectMetricBase.h:109
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Array< WeightValueType >
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::ObjectToObjectMetric
Computes similarity between regions of two objects.
Definition: itkObjectToObjectMetric.h:92
itk::ObjectToObjectMultiMetricv4::m_MetricValueArray
MetricValueArrayType m_MetricValueArray
Definition: itkObjectToObjectMultiMetricv4.h:232
itk::ObjectToObjectMetricBaseTemplate::DerivativeType
typename Superclass::DerivativeType DerivativeType
Definition: itkObjectToObjectMetricBase.h:112
itk::ObjectToObjectMultiMetricv4::MovingTransformType
typename Superclass::MovingTransformType MovingTransformType
Definition: itkObjectToObjectMultiMetricv4.h:123
itk::ObjectToObjectMultiMetricv4::GetMetricCategory
MetricCategoryType GetMetricCategory() const override
Definition: itkObjectToObjectMultiMetricv4.h:218
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83