Skip to content

Commit

Permalink
COMP: ITKThresholdMaximumConnectedComponentsImageFilter Fix value cha…
Browse files Browse the repository at this point in the history
…nged warning (BlueQuartzSoftware#1043)

* COMP: ITKThresholdMaximumConnectedComponentsImageFilter Fix value changed warning

Signed-off-by: Michael Jackson <[email protected]>

* ITKArrayHelper: Quiet more implicit conversion warnings

Signed-off-by: Michael Jackson <[email protected]>

* Update src/Plugins/ITKImageProcessing/src/ITKImageProcessing/Filters/ITKThresholdMaximumConnectedComponentsImageFilter.cpp

Co-authored-by: Jared Duffey <[email protected]>

* Update src/Plugins/ITKImageProcessing/src/ITKImageProcessing/Filters/ITKThresholdMaximumConnectedComponentsImageFilter.cpp

Co-authored-by: Jared Duffey <[email protected]>

---------

Signed-off-by: Michael Jackson <[email protected]>
Co-authored-by: Jared Duffey <[email protected]>
  • Loading branch information
imikejackson and JDuffeyBQ committed Aug 30, 2024
1 parent e5ffbfa commit 632042f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ Result<> ConvertImageToDataStore(DataStore<NewStoreT>& dataStore, itk::Image<Pix
constexpr auto destMaxV = static_cast<float64>(std::numeric_limits<NewStoreT>::max());
constexpr auto originMaxV = std::numeric_limits<T>::max();
std::transform(rawBufferPtr, rawBufferPtr + pixelContainer->Size(), dataStore.data(), [](auto value) {
float64 ratio = static_cast<float64>(value) / originMaxV;
float64 ratio = static_cast<float64>(value) / static_cast<float64>(originMaxV);
return static_cast<NewStoreT>(ratio * destMaxV);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ struct ITKThresholdMaximumConnectedComponentsImageFilterFunctor
using FilterType = itk::ThresholdMaximumConnectedComponentsImageFilter<InputImageT, OutputImageT>;
auto filter = FilterType::New();
filter->SetMinimumObjectSizeInPixels(minimumObjectSizeInPixels);
filter->SetUpperBoundary(static_cast<typename InputImageT::PixelType>(std::min<double>(upperBoundary, itk::NumericTraits<typename InputImageT::PixelType>::max())));

using PixelType = typename InputImageT::PixelType;
using MinType = std::conditional_t<std::is_same_v<PixelType, int64> || std::is_same_v<PixelType, uint64>, PixelType, float64>;
auto upBound = static_cast<PixelType>(std::min<MinType>(upperBoundary, itk::NumericTraits<PixelType>::max()));
filter->SetUpperBoundary(upBound);

filter->SetInsideValue(insideValue);
filter->SetOutsideValue(outsideValue);
return filter;
Expand Down

0 comments on commit 632042f

Please sign in to comment.