ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkObjectToObjectOptimizerBase.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#ifndef itkObjectToObjectOptimizerBase_h
19#define itkObjectToObjectOptimizerBase_h
20
21#include "ITKOptimizersv4Export.h"
22
26#include "itkIntTypes.h"
27
28namespace itk
29{
53// Define how to print enumeration
56extern ITKOptimizersv4_EXPORT std::ostream &
57 operator<<(std::ostream & out,
59
112template <typename TInternalComputationValueType = double>
113class ITK_TEMPLATE_EXPORT ObjectToObjectOptimizerBaseTemplate : public Object
114{
115public:
116 ITK_DISALLOW_COPY_AND_MOVE(ObjectToObjectOptimizerBaseTemplate);
117
123
125 itkOverrideGetNameOfClassMacro(ObjectToObjectOptimizerBaseTemplate);
126
130
133
137
140
143
146
148 using StopConditionReturnStringType = std::string;
149
151 using StopConditionDescriptionType = std::ostringstream;
152
155 itkSetObjectMacro(Metric, MetricType);
156 itkGetModifiableObjectMacro(Metric, MetricType);
158
162 itkGetConstReferenceMacro(CurrentMetricValue, MeasureType);
163
169 virtual const MeasureType &
170 GetValue() const;
171
173 // itkSetMacro( Scales, ScalesType );
174 virtual void
175 SetScales(const ScalesType & scales)
176 {
177 this->m_Scales = scales;
178 }
179
181 itkGetConstReferenceMacro(Scales, ScalesType);
182
184 itkGetConstReferenceMacro(ScalesAreIdentity, bool);
185
187 itkSetMacro(Weights, ScalesType);
188
191 itkGetConstReferenceMacro(Weights, ScalesType);
192
194 itkGetConstReferenceMacro(WeightsAreIdentity, bool);
195
198 bool
200
210 itkSetObjectMacro(ScalesEstimator, ScalesEstimatorType);
211
218 itkSetMacro(DoEstimateScales, bool);
219 itkGetConstReferenceMacro(DoEstimateScales, bool);
220 itkBooleanMacro(DoEstimateScales);
222
226 virtual void
228
229#if !defined(ITK_LEGACY_REMOVE)
234 itkLegacyMacro(virtual void SetNumberOfThreads(ThreadIdType number))
235 {
236 return this->SetNumberOfWorkUnits(number);
237 }
238 itkLegacyMacro(virtual const ThreadIdType & GetNumberOfThreads() const)
239 {
240 return this->m_NumberOfWorkUnits;
241 }
243#endif // !ITK_LEGACY_REMOVE
244
246 itkGetConstReferenceMacro(NumberOfWorkUnits, ThreadIdType);
247
249 itkGetConstMacro(CurrentIteration, SizeValueType);
250
252 itkSetMacro(NumberOfIterations, SizeValueType);
253
255 itkGetConstMacro(NumberOfIterations, SizeValueType);
256
260 virtual const ParametersType &
262
270 virtual void
271 StartOptimization(bool doOnlyInitialization = false);
272
276
280 virtual bool
282 {
283 return true;
284 }
285
286protected:
289
291
296
299
303
309
312
315
318
323
324 void
325 PrintSelf(std::ostream & os, Indent indent) const override;
326};
327
330
331} // end namespace itk
332
333#endif
334
336#ifndef ITK_TEMPLATE_EXPLICIT_ObjectToObjectOptimizerBaseTemplate
337// Explicit instantiation is required to ensure correct dynamic_cast
338// behavior across shared libraries.
339//
340// IMPORTANT: Since within the same compilation unit,
341// ITK_TEMPLATE_EXPLICIT_<classname> defined and undefined states
342// need to be considered. This code *MUST* be *OUTSIDE* the header
343// guards.
344//
345#if defined(ITKOptimizersv4_EXPORTS)
346// We are building this library
347# define ITKOptimizersv4_EXPORT_EXPLICIT ITK_FORWARD_EXPORT
348#else
349// We are using this library
350# define ITKOptimizersv4_EXPORT_EXPLICIT ITKOptimizersv4_EXPORT
351#endif
352namespace itk
353{
354
355ITK_GCC_PRAGMA_DIAG_PUSH()
356ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
357
358#if defined(_MSC_VER)
359# pragma warning(disable : 4661) // no suitable definition provided for explicit template instantiation request
360#endif
363
364ITK_GCC_PRAGMA_DIAG_POP()
365
366} // end namespace itk
367#undef ITKOptimizersv4_EXPORT_EXPLICIT
368#endif
Control indentation during Print() invocation.
Definition itkIndent.h:50
Base class for all object-to-object similarity metrics added in ITKv4.
This class contains all the enum classes used by ObjectToObjectOptimizerBaseTemplate class.
Abstract base for object-to-object optimizers.
virtual void StartOptimization(bool doOnlyInitialization=false)
OptimizerParameterScalesEstimatorTemplate< TInternalComputationValueType > ScalesEstimatorType
void PrintSelf(std::ostream &os, Indent indent) const override
virtual StopConditionReturnStringType GetStopConditionDescription() const =0
virtual const ParametersType & GetCurrentPosition() const
virtual void SetScales(const ScalesType &scales)
virtual const MeasureType & GetValue() const
virtual void SetNumberOfWorkUnits(ThreadIdType number)
ObjectToObjectMetricBaseTemplate< TInternalComputationValueType > MetricType
OptimizerParameterScalesEstimatorTemplate is the base class offering a empty method of estimating the...
Class to hold and manage different parameter types used during optimization.
Implements transparent reference counting.
#define ITKOptimizersv4_EXPORT_EXPLICIT
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
ObjectToObjectOptimizerBaseTemplateEnums::StopConditionObjectToObjectOptimizer StopConditionObjectToObjectOptimizerEnum
unsigned long SizeValueType
Definition itkIntTypes.h:86
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
template class ITKOptimizersv4_EXPORT_EXPLICIT ObjectToObjectOptimizerBaseTemplate< double >
template class ITKOptimizersv4_EXPORT_EXPLICIT ObjectToObjectOptimizerBaseTemplate< float >
ObjectToObjectOptimizerBaseTemplate< double > ObjectToObjectOptimizerBase