ITK  5.4.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  * https://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 
110  itkOverrideGetNameOfClassMacro(ObjectToObjectMultiMetricv4);
111 
113  itkNewMacro(Self);
114 
116  using typename Superclass::MeasureType;
117  using typename Superclass::DerivativeType;
118  using typename Superclass::DerivativeValueType;
119  using typename Superclass::ParametersType;
120  using typename Superclass::ParametersValueType;
121  using typename Superclass::NumberOfParametersType;
122  using typename Superclass::CoordinateRepresentationType;
123  using typename Superclass::MovingTransformType;
124  using typename Superclass::FixedTransformType;
125 
130  using MetricQueueType = std::deque<MetricBasePointer>;
131 
132  using ObjectType = typename Superclass::ObjectType;
133 
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 typename Superclass::MetricCategoryType;
215 
217  MetricCategoryType
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:
230  MetricQueueType m_MetricQueue{};
231  WeightsArrayType m_MetricWeights{};
232  mutable MetricValueArrayType m_MetricValueArray{};
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
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::ObjectToObjectMultiMetricv4::SetMovingObject
void SetMovingObject(const ObjectType *) override
Definition: itkObjectToObjectMultiMetricv4.h:165
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::ObjectToObjectMultiMetricv4
This class takes one ore more ObjectToObject metrics and assigns weights to their derivatives to comp...
Definition: itkObjectToObjectMultiMetricv4.h:96
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
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:55
itk::ObjectToObjectMultiMetricv4::MetricQueueType
std::deque< MetricBasePointer > MetricQueueType
Definition: itkObjectToObjectMultiMetricv4.h:130
itkArray.h
itk::Array< TInternalComputationValueType >::ValueType
TInternalComputationValueType ValueType
Definition: itkArray.h:52
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:61
itk::ObjectToObjectMetric
Computes similarity between regions of two objects.
Definition: itkObjectToObjectMetric.h:92
Superclass
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
Definition: itkAddImageFilter.h:90
itk::ObjectToObjectMultiMetricv4::GetMetricCategory
MetricCategoryType GetMetricCategory() const override
Definition: itkObjectToObjectMultiMetricv4.h:218
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83