Skip to content
Snippets Groups Projects
Commit 9eb6e1f6 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

BUG: #1045: add scalar image support to StreamingStatisticsMapFromLabelImageFilter

parent e5a577fb
No related branches found
No related tags found
No related merge requests found
......@@ -199,6 +199,8 @@ PersistentStreamingStatisticsMapFromLabelImageFilter<TInputVectorImage, TLabelIm
itk::ImageRegionConstIterator<TInputVectorImage> inIt(inputPtr, inputPtr->GetRequestedRegion());
itk::ImageRegionConstIterator<TLabelImage> labelIt(labelInputPtr, labelInputPtr->GetRequestedRegion());
itk::VariableLengthVector<double> zeroValue(inputPtr->GetNumberOfComponentsPerPixel());
zeroValue.Fill(0.0);
typename VectorImageType::PixelType value;
typename LabelImageType::PixelType label;
......@@ -211,7 +213,8 @@ PersistentStreamingStatisticsMapFromLabelImageFilter<TInputVectorImage, TLabelIm
label = labelIt.Get();
if (m_RadiometricValueAccumulator.count(label)<=0) //add new element to the map
{
m_RadiometricValueAccumulator[label] = value;
// use a zero pixel with the right number of components to support scalar images
m_RadiometricValueAccumulator[label] = (zeroValue + value);
m_LabelPopulation[label] = 1;
}
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment