[vtkusers] Merging/combining vtkImageHistogramStatistics from multiple images

Elvis Stansvik elvis.stansvik at orexplore.com
Thu Oct 20 03:31:38 EDT 2016

In our app, multiple volumes are stacked on top of each other in a
low-resolution view. The user can select an area along the Z axis
which overlaps several volumes. The program will then extract the
selected sections and show higher-resolution versions of them in
another view.

I now need to calculate a histogram for what the user is seeing in
this high-res view. I started out using vtkImageHistogramStatistics,
since it seemed convenient that it also gave me some stats which I

The problem now is that vtkImageHistogramStatistics takes a single
image as input, while what I need is to calculate a combined histogram
for a set of images.

I know I can just sum the histogram arrays (available as a
vtkTypeIdArray through vtkImageHistogramStatistics::GetHistogram), but
I thought I should ask first: Is there some built-in way of "merging"
several vtkImageHistogramStatistics? Or some other better approach
which I haven't thought of?

One idea would be to first append the images with a vtkImageAppend,
and calculate the histogram on the resulting single image. But the
problem is that in my case, my images don't always have the same
extent (in any of the dimensions).

Thanks in advance,

More information about the vtkusers mailing list