diff --git a/src/Plugins/ITKImageProcessing/src/ITKImageProcessing/Filters/ITKThresholdMaximumConnectedComponentsImageFilter.cpp b/src/Plugins/ITKImageProcessing/src/ITKImageProcessing/Filters/ITKThresholdMaximumConnectedComponentsImageFilter.cpp index d636bc389b..15c1691298 100644 --- a/src/Plugins/ITKImageProcessing/src/ITKImageProcessing/Filters/ITKThresholdMaximumConnectedComponentsImageFilter.cpp +++ b/src/Plugins/ITKImageProcessing/src/ITKImageProcessing/Filters/ITKThresholdMaximumConnectedComponentsImageFilter.cpp @@ -21,7 +21,7 @@ using FilterOutputType = uint8; struct ITKThresholdMaximumConnectedComponentsImageFilterFunctor { uint32 minimumObjectSizeInPixels = 0u; - float64 upperBoundary = 65536.0; + float64 upperBoundary = 65536.0f; uint8 insideValue = 1u; uint8 outsideValue = 0u; @@ -31,7 +31,23 @@ struct ITKThresholdMaximumConnectedComponentsImageFilterFunctor using FilterType = itk::ThresholdMaximumConnectedComponentsImageFilter; auto filter = FilterType::New(); filter->SetMinimumObjectSizeInPixels(minimumObjectSizeInPixels); - filter->SetUpperBoundary(static_cast(std::min(upperBoundary, itk::NumericTraits::max()))); + + if constexpr(std::is_same_v) + { + auto upBound = std::min(upperBoundary, itk::NumericTraits::max()); + filter->SetUpperBoundary(upBound); + } + else if constexpr(std::is_same_v) + { + auto upBound = std::min(upperBoundary, itk::NumericTraits::max()); + filter->SetUpperBoundary(upBound); + } + else + { + auto upBound = static_cast(std::min(upperBoundary, itk::NumericTraits::max())); + filter->SetUpperBoundary(upBound); + } + filter->SetInsideValue(insideValue); filter->SetOutsideValue(outsideValue); return filter;