File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,10 @@ class ITK_EXPORT SingleImageCostFunction :
110
110
itkSetConstObjectMacro ( Image, ImageType );
111
111
itkGetConstObjectMacro ( Image, ImageType );
112
112
113
+ /* * Get/set the DerivativeThreshold. */
114
+ itkSetMacro ( DerivativeThreshold, DerivativeType::ValueType );
115
+ itkGetConstReferenceMacro ( DerivativeThreshold, DerivativeType::ValueType );
116
+
113
117
/* * Initialize the cost function */
114
118
virtual void Initialize (void ) throw ( ExceptionObject );
115
119
@@ -150,6 +154,7 @@ class ITK_EXPORT SingleImageCostFunction :
150
154
/* * Used to define the value outside the image buffer. Important when
151
155
* path points are on the edge of an image */
152
156
ImagePixelType m_OutsideValue;
157
+ typename DerivativeType::ValueType m_DerivativeThreshold;
153
158
154
159
};
155
160
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ SingleImageCostFunction<TImage>
33
33
m_Image = nullptr ; // Provided by user
34
34
m_Interpolator = nullptr ; // Configured in Initialize()
35
35
m_GradientImageFunction = nullptr ; // Configured in Initialize()
36
+ m_DerivativeThreshold = 15.0 ; // as in original implementation
36
37
}
37
38
38
39
@@ -137,7 +138,6 @@ SingleImageCostFunction<TImage>
137
138
}
138
139
139
140
// Convert the image function output to the cost function derivative
140
- constexpr typename DerivativeType::ValueType DerivativeThreshold = 15.0 ;
141
141
for (unsigned int i=0 ; i<ImageDimension; i++)
142
142
{
143
143
derivative[i] = static_cast <typename DerivativeType::ValueType>( output[i] );
@@ -146,7 +146,7 @@ SingleImageCostFunction<TImage>
146
146
// (indicated by very large values) which may skew the gradient.
147
147
// To avoid this skewing effect, we reset gradient values larger
148
148
// than a given threshold.
149
- if ( itk::Math::abs (derivative[i]) > DerivativeThreshold )
149
+ if ( itk::Math::abs (derivative[i]) > m_DerivativeThreshold )
150
150
{
151
151
derivative[i] = 0.0 ;
152
152
}
You can’t perform that action at this time.
0 commit comments