Page MenuHomePhabricator

Histogram barchart is erroneous and inconsistent if turning on ignore_zero_valued_voxels
Closed, ResolvedPublic

Event Timeline

Load an image and open the statistics view. Have a look at the histogram bar chart's axis (i.e. pixel intensity and frequency). Now turn on "ignore zero voxels". You can see that the intensity values and the frequency changed significantly.
If you copy each histogram to the clipboard and take a look at the values e.g. in excel there a different values too.

Most likely this problem is just due to a different bin size. Anyway it must be investigated and either the error be fixed or an equal bin size set.

Regarding this context it would be nice to have a feedback about the current bin size.

When statistics are calculated for a simple image the number of bins is set to 768 in mitkImageStatisticsCalculator in the method InternalCalculateStatisticsUnmasked.
If the checkbox "ignore zero-valued voxels" is selected the method InternalCalculateStatisticsMasked is called, where the number of bins is set to 384, which is the reason for the change in the histogram.
To have an equal histogram, the bin size has to be the same. It should be discussed how to solve this problem.

Using ignore zero-valued voxels should not change the histogram, but it is useful to change the number of bins by laying a mask over the image.

Changed Target Milestone to upcoming release

New remote branch pushed: bug-13582-HistogramBarchartErroneousByIgnoreZeroValuedVoxels

[8490b0]: Merge branch 'bug-13582-HistogramBarchartErroneousByIgnoreZeroValuedVo

Merged commits:

2012-11-28 16:25:45 Moritz Petry [95c140]
Checks now if there is a mask in use, or if method is only called by the use of
"Ignore zero-valued voxels".