From 34808baba98d0c1535deb7f5edf3e9ecbb5c8679 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Thu, 8 Aug 2024 10:11:21 -0400 Subject: [PATCH] COMP: ITKThresholdMaximumConnectedComponentsImageFilter Fix value changed warning Signed-off-by: Michael Jackson --- ...dMaximumConnectedComponentsImageFilter.cpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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;