# What's the difference between vtkImageHistogramStatistics and vtkImageAccumulate?

**URL:** https://discourse.vtk.org/t/whats-the-difference-between-vtkimagehistogramstatistics-and-vtkimageaccumulate/15200
**Category:** Support
**Created:** [January 23, 2025, 12:39am UTC](https://discourse.vtk.org/t/whats-the-difference-between-vtkimagehistogramstatistics-and-vtkimageaccumulate/15200 "2025-01-23T00:39:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![SeanHan](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@SeanHan](https://discourse.vtk.org/u/SeanHan)
#### Post date: [January 23, 2025, 12:39am UTC](https://discourse.vtk.org/t/whats-the-difference-between-vtkimagehistogramstatistics-and-vtkimageaccumulate/15200/1 "2025-01-23T00:39:09Z")

</div>

VTkImageHistoramStatistics and VTkImageAccumulate can both collect image information. What is the difference？

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [January 23, 2025, 2:56am UTC](https://discourse.vtk.org/t/whats-the-difference-between-vtkimagehistogramstatistics-and-vtkimageaccumulate/15200/2 "2025-01-23T02:56:47Z")

</div>

For multi-component (e.g. RGB images), ImageAccumulate produces a multi-dimensional histogram, while HistogramStatistics requires you to choose a component, and then produces a 1D histogram for the chosen component.

Both filters have a SetStencilData() method that allows you to specify a region of interest over which to compute the histogram and the statistics.

HistogramStatistics is a multithreaded filter, ImageAccumulate is not.

Finally, the way they compute the mean and standard deviation is different. ImageAccumulate computes the sum and sum^2 of the pixel values as it iterates over the pixels. HistogramStatistics generates the histogram first, and then computes the sums from the histogram. The histogram method is more robust, particularly for very large images.

---

<div class="post-metadata">

### Author: ![SeanHan](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@SeanHan](https://discourse.vtk.org/u/SeanHan)
#### Post date: [January 23, 2025, 3:01am UTC](https://discourse.vtk.org/t/whats-the-difference-between-vtkimagehistogramstatistics-and-vtkimageaccumulate/15200/3 "2025-01-23T03:01:55Z")

</div>

I understand now, thank you very much!
