MantisBT - ITK
View Issue Details
0011481ITKITKpublic2010-11-18 23:032010-11-19 09:30
David Doria 
Gabe Hart 
normalminorsometimes
assignedopen 
LinuxFedora13
ITK-4-A3 
 
backlog
0011481: itkImageToHistogramFilter Strange Behavior when image has zero variance in at least one component
If at least one component of an image has zero variance, iterating over the histogram displays strange behavior.

How should this case be handled? Throw an error/warning that the bounds do not make sense to compute? Choose arbitrary bin end points (0 - 1, etc)?
I have attached Test.cxx which demonstrates the problem. The CreateImage function creates a mostly black image with one red and one green pixel. There is code to create a blue pixel, but it is commented. If this blue pixel is added, then no components have zero variance and everything works as expected. Without this blue pixel, calling:

<< histogram->GetIndex(histogramIterator.GetMeasurementVector()) << " "
<< histogram->GetIndex(histogramIterator.GetInstanceIdentifier()) << " "

produces the wrong values for the index. However, calling

<< histogram->GetIndex(histogramIterator.GetInstanceIdentifier()) << " "
<< histogram->GetIndex(histogramIterator.GetMeasurementVector()) << " "

produces the correct values (note that these are the same calls, just in the opposite order).

By "wrong values", I mean the index is actually out of bounds. Here I have created a 2x2x2 histogram, and sometimes the a component of the index is 2, which is invalid. Also, the iterator doesn't seem to traverse the histogram in the correct order. This is probably due to the fact that the position is being computed using invalid bounds (in the zero variance case only).
No tags attached.
cxx Test.cxx (3,677) 2010-11-18 23:03
https://public.kitware.com/Bug/file/3513/Test.cxx
Issue History
2010-11-18 23:03David DoriaNew Issue
2010-11-18 23:03David DoriaStatusnew => assigned
2010-11-18 23:03David DoriaAssigned To => Luis Ibanez
2010-11-18 23:03David DoriaFile Added: Test.cxx
2010-11-19 09:30Gabe HartAssigned ToLuis Ibanez => Gabe Hart

There are no notes attached to this issue.