25
25
namespace itk
26
26
{
27
27
/* ** \class LBFGS2Optimizerv4Enums
28
- * \brief Scoped Enum classes for LBFGS2Optimizerv4 class
28
+ * \brief Scoped Enum classes for LBFGS2Optimizerv4Template class
29
29
* \ingroup ITKOptimizersv4
30
30
*/
31
31
class LBFGS2Optimizerv4Enums
@@ -82,7 +82,7 @@ extern ITKOptimizersv4_EXPORT std::ostream &
82
82
operator <<(std::ostream & out, LBFGS2Optimizerv4Enums::LineSearchMethod value);
83
83
84
84
/* *
85
- *\class LBFGS2Optimizerv4
85
+ *\class LBFGS2Optimizerv4Template
86
86
* \brief Wrap of the libLBFGS[1] algorithm for use in ITKv4 registration framework.
87
87
* LibLBFGS is a translation of LBFGS code by Nocedal [2] and adds the orthantwise
88
88
* limited-memmory Quais-Newton method [3] for optimization with L1-norm on the
@@ -153,11 +153,13 @@ extern ITKOptimizersv4_EXPORT std::ostream &
153
153
*
154
154
* \ingroup ITKOptimizersv4
155
155
*/
156
- class ITKOptimizersv4_EXPORT LBFGS2Optimizerv4 : public GradientDescentOptimizerv4Template<double >
156
+ template <typename TInternalComputationValueType>
157
+ class ITK_TEMPLATE_EXPORT LBFGS2Optimizerv4Template
158
+ : public GradientDescentOptimizerv4Template<TInternalComputationValueType>
157
159
{
158
160
159
161
public:
160
- ITK_DISALLOW_COPY_AND_MOVE (LBFGS2Optimizerv4 );
162
+ ITK_DISALLOW_COPY_AND_MOVE (LBFGS2Optimizerv4Template );
161
163
162
164
using LineSearchMethodEnum = LBFGS2Optimizerv4Enums::LineSearchMethod;
163
165
#if !defined(ITK_LEGACY_REMOVE)
@@ -181,14 +183,14 @@ class ITKOptimizersv4_EXPORT LBFGS2Optimizerv4 : public GradientDescentOptimizer
181
183
using PrecisionType = double ;
182
184
183
185
/* * Standard "Self" type alias. */
184
- using Self = LBFGS2Optimizerv4 ;
185
- using Superclass = GradientDescentOptimizerv4Template<double >;
186
+ using Self = LBFGS2Optimizerv4Template ;
187
+ using Superclass = GradientDescentOptimizerv4Template<TInternalComputationValueType >;
186
188
using Pointer = SmartPointer<Self>;
187
189
using ConstPointer = SmartPointer<const Self>;
188
190
189
- using MetricType = Superclass::MetricType;
190
- using ParametersType = Superclass::ParametersType;
191
- using ScalesType = Superclass::ScalesType;
191
+ using MetricType = typename Superclass::MetricType;
192
+ using ParametersType = typename Superclass::ParametersType;
193
+ using ScalesType = typename Superclass::ScalesType;
192
194
193
195
/* * Stop condition return string type */
194
196
using typename Superclass::StopConditionReturnStringType;
@@ -197,7 +199,7 @@ class ITKOptimizersv4_EXPORT LBFGS2Optimizerv4 : public GradientDescentOptimizer
197
199
itkNewMacro (Self);
198
200
199
201
/* * Run-time type information (and related methods). */
200
- itkTypeMacro (LBFGS2Optimizerv4 , GradientDescentOptimizerv4Template);
202
+ itkTypeMacro (LBFGS2Optimizerv4Template , GradientDescentOptimizerv4Template);
201
203
202
204
/* * Start optimization with an initial value. */
203
205
void
@@ -457,8 +459,8 @@ class ITKOptimizersv4_EXPORT LBFGS2Optimizerv4 : public GradientDescentOptimizer
457
459
itkBooleanMacro (EstimateScalesAtEachIteration);
458
460
459
461
protected:
460
- LBFGS2Optimizerv4 ();
461
- ~LBFGS2Optimizerv4 () override ;
462
+ LBFGS2Optimizerv4Template ();
463
+ ~LBFGS2Optimizerv4Template () override ;
462
464
void
463
465
PrintSelf (std::ostream & os, Indent indent) const override ;
464
466
@@ -534,8 +536,18 @@ class ITKOptimizersv4_EXPORT LBFGS2Optimizerv4 : public GradientDescentOptimizer
534
536
void
535
537
AdvanceOneStep () override
536
538
{
537
- itkWarningMacro (" LBFGS2Optimizerv4 does not implemenetd single step advance" );
539
+ itkWarningMacro (" LBFGS2Optimizerv4Template does not implemenetd single step advance" );
538
540
};
539
541
};
542
+
543
+
544
+ /* * This helps to meet backward compatibility */
545
+ using LBFGS2Optimizerv4 = LBFGS2Optimizerv4Template<double >;
546
+
540
547
} // end namespace itk
548
+
549
+ #ifndef ITK_MANUAL_INSTANTIATION
550
+ # include " itkLBFGS2Optimizerv4.hxx"
551
+ #endif
552
+
541
553
#endif
0 commit comments