From 757ded0c3399d82bc807b23838da03b495c6904f Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 26 Jan 2025 16:08:24 -0600 Subject: [PATCH] COMP: Type matching for complex pixel data types Modules/Filtering/ImageCompose/include/itkComposeImageFilter.hxx:135:19: error: non-constant-expression cannot be narrowed from type 'PixelType' (aka 'unsigned char') to 'float' in initializer list [-Wc++11-narrowing] 135 | oit.Set({ inputItContainer[0].Get(), inputItContainer[1].Get() }); | ^~~~~~~~~~~~~~~~~~~~~~~~~ Identified when building SphinxExamples remote module. --- .../Filtering/ImageCompose/include/itkComposeImageFilter.hxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/Filtering/ImageCompose/include/itkComposeImageFilter.hxx b/Modules/Filtering/ImageCompose/include/itkComposeImageFilter.hxx index 60a520f1786..9f5313db7b1 100644 --- a/Modules/Filtering/ImageCompose/include/itkComposeImageFilter.hxx +++ b/Modules/Filtering/ImageCompose/include/itkComposeImageFilter.hxx @@ -132,7 +132,10 @@ ComposeImageFilter::DynamicThreadedGenerateData(const if constexpr (std::is_same::ValueType>>::value) { - oit.Set({ inputItContainer[0].Get(), inputItContainer[1].Get() }); + using ValueType = typename NumericTraits::ValueType; + const OutputPixelType current_pixel = OutputPixelType{ static_cast(inputItContainer[0].Get()), + static_cast(inputItContainer[1].Get()) }; + oit.Set(current_pixel); ++(inputItContainer[0]); ++(inputItContainer[1]); }