Skip to content

Commit a7546b6

Browse files
jhlegarretadzenanz
authored andcommitted
ENH: Clamp STAPLEImageFilter maximum iterations
Clamp `STAPLEImageFilter` maximum iterations to avoid setting a 0 value, and thus giving rise dynamic memory defects when querying about non-existing vector indices for the sensitivity and specifity. Related to commit 5b5d85e.
1 parent 7539b50 commit a7546b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/Filtering/ImageCompare/include/itkSTAPLEImageFilter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class ITK_TEMPLATE_EXPORT STAPLEImageFilter : public ImageToImageFilter<TInputIm
204204
/** Set/Get the maximum number of iterations after which the STAPLE algorithm
205205
* will be considered to have converged. In general this SHOULD NOT be set and
206206
* the algorithm should be allowed to converge on its own. */
207-
itkSetMacro(MaximumIterations, unsigned int);
207+
itkSetClampMacro(MaximumIterations, unsigned int, 1, NumericTraits<unsigned int>::max());
208208
itkGetConstMacro(MaximumIterations, unsigned int);
209209

210210
/** Scales the estimated prior probability that a pixel will be inside the

0 commit comments

Comments
 (0)