go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkScaledSingleValuedCostFunction.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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 itkScaledSingleValuedCostFunction_h
20#define itkScaledSingleValuedCostFunction_h
21
22#include "itkSingleValuedCostFunction.h"
23#include "itkIntTypes.h" //temp, needed for IdentifierType
24
25namespace itk
26{
39class ScaledSingleValuedCostFunction : public SingleValuedCostFunction
40{
41public:
43
46 using Superclass = SingleValuedCostFunction;
47 using Pointer = SmartPointer<Self>;
48 using ConstPointer = SmartPointer<const Self>;
49
51 itkNewMacro(Self);
52
54 itkTypeMacro(ScaledSingleValuedCostFunction, SingleValuedCostFunction);
55
57 using Superclass::MeasureType;
58 using Superclass::DerivativeType;
59 using Superclass::ParametersType;
60 // temporary, untill it is fixed in the ITK4
61 // typedef IdentifierType NumberOfParametersType; // temp, copied from itk::TransformBase
62 using NumberOfParametersType = unsigned int; // temp, copied from itk::CostFunction
63 using SingleValuedCostFunctionPointer = Superclass::Pointer;
64
65 using ScalesType = Array<double>;
66
70 MeasureType
71 GetValue(const ParametersType & parameters) const override;
72
77 void
78 GetDerivative(const ParametersType & parameters, DerivativeType & derivative) const override;
79
81 void
82 GetValueAndDerivative(const ParametersType & parameters,
83 MeasureType & value,
84 DerivativeType & derivative) const override;
85
88 GetNumberOfParameters() const override;
89
91 itkSetObjectMacro(UnscaledCostFunction, Superclass);
94
97 virtual void
98 SetScales(const ScalesType & scales);
99
101 itkGetConstReferenceMacro(Scales, ScalesType);
102
106 virtual void
107 SetSquaredScales(const ScalesType & squaredScales);
108
111 itkGetConstReferenceMacro(SquaredScales, ScalesType);
112
114 itkSetMacro(UseScales, bool);
115
117 itkGetConstMacro(UseScales, bool);
118
120 itkBooleanMacro(NegateCostFunction);
121
123 itkSetMacro(NegateCostFunction, bool);
125 itkGetConstMacro(NegateCostFunction, bool);
126
128 virtual void
129 ConvertScaledToUnscaledParameters(ParametersType & parameters) const;
130
132 virtual void
133 ConvertUnscaledToScaledParameters(ParametersType & parameters) const;
134
135protected:
140
142 void
143 PrintSelf(std::ostream & os, Indent indent) const override;
144
145private:
150 bool m_UseScales{ false };
151 bool m_NegateCostFunction{ false };
152};
153
154} // end namespace itk
155
156#endif // #ifndef itkScaledSingleValuedCostFunction_h
A cost function that applies a scaling to another cost function.
virtual void SetScales(const ScalesType &scales)
itkGetModifiableObjectMacro(UnscaledCostFunction, Superclass)
virtual void ConvertUnscaledToScaledParameters(ParametersType &parameters) const
ITK_DISALLOW_COPY_AND_MOVE(ScaledSingleValuedCostFunction)
virtual void ConvertScaledToUnscaledParameters(ParametersType &parameters) const
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void SetSquaredScales(const ScalesType &squaredScales)
~ScaledSingleValuedCostFunction() override=default
void GetDerivative(const ParametersType &parameters, DerivativeType &derivative) const override
NumberOfParametersType GetNumberOfParameters() const override
MeasureType GetValue(const ParametersType &parameters) const override
void GetValueAndDerivative(const ParametersType &parameters, MeasureType &value, DerivativeType &derivative) const override


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo