Skip to content

Commit

Permalink
COMP: Type matching for complex pixel data types
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hjmjohnson committed Jan 26, 2025
1 parent acaddf4 commit 757ded0
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ ComposeImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(const
if constexpr (std::is_same<OutputPixelType,
std::complex<typename NumericTraits<OutputPixelType>::ValueType>>::value)
{
oit.Set({ inputItContainer[0].Get(), inputItContainer[1].Get() });
using ValueType = typename NumericTraits<OutputPixelType>::ValueType;
const OutputPixelType current_pixel = OutputPixelType{ static_cast<ValueType>(inputItContainer[0].Get()),
static_cast<ValueType>(inputItContainer[1].Get()) };
oit.Set(current_pixel);
++(inputItContainer[0]);
++(inputItContainer[1]);
}
Expand Down

0 comments on commit 757ded0

Please sign in to comment.