[Insight-developers] Image to histogram filter bug

Stephen R. Aylward aylward at unc.edu
Tue May 10 15:33:57 EDT 2005


Hi,

It is a known bug and on my to-do list.  Sorry.   Just bumped it up on 
my to-do list.   It is an easy fix.   We'll also add a flag to let the 
user decide if the bins at the extreme extend to +/- infinity or clip.

Thanks for tacing this for us - we didn't realize it was impacting the 
otsu system.

I will try to get to this tonight/tomorrow.

Thanks,
Stephen

Peter Cech wrote:
> Hi,
> 
> I was investigating why OtsuMultipleThresholdImageFilter
> (OtsuMultipleThresholdImageFilter example, CVS as of April, 29) gives me
> all thresholds zero on some images. As it turned out, it is because the
> histogram was empty (no samples were taken).
> 
> I traced the strangeness down to
> ListSampleToHistogramGenerator::GenerateData, where bounds for histogram
> are computed from image data (look inside if(m_AutoMinMax) block). Here,
> the upper bound is defined as upper+margin (if THistogramMeasurement is
> not an integer) or upper+1 (if THistogramMeasurement is an integer),
> where upper is maximum of image data elements.
> 
> Now imagine having an image with elements of type unsigned char and
> containing value 255. The upper bound will be 255+1 = 0 (as the bounds have
> the same type as image) and we get all the samples rejected as being out
> of bounds.
> 
> Histogram::GetIndex(const MeasurementVectorType & measurement,IndexType
> & index ) rejects all the samples >= upper bound, so the above
> computation is correct except not checking for overflow.
> 
> If somebody has an idea how to fix it, please do.
> 
> Regards,
> 
> Peter Cech
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers

-- 
===========================================================
Dr. Stephen R. Aylward
Associate Professor of Radiology
Adjunct Associate Professor of Computer Science and Surgery
http://caddlab.rad.unc.edu
aylward at unc.edu
(919) 966-9695


More information about the Insight-developers mailing list