[Insight-developers] Histogram::GetIndex() boundary conditions
Stephen R. Aylward
aylward at unc.edu
Tue Apr 26 15:45:38 EDT 2005
I agree. Often histograms have open tails...perhaps that should be the
default. Regardless, having the low values index the upper bin and
having inconsistent behavior seems like a mistake.
Stephen
Miller, James V (Research) wrote:
> I was recently looking through the code for itk::Histogram and noticed blocks of code like
>
> if (tempMeasurement < m_Min[dim][begin])
> {
> // one of measurement is below the minimum
> m_TempIndex[dim] = (long) m_Size[dim] ;
> itkWarningMacro(<<"One of the measurement components is below the minimum");
> }
>
> and
>
> if (tempMeasurement < m_Min[dim][begin])
> {
> // one of measurement is below the minimum
> index[dim] = (long) m_Size[dim] ;
> return false;
> }
>
> and similar code for when the index exceeds the maximum bounds.
>
> The first block of code was from GetIndex(const MeasurementVectorType& measurement) and the second was from GetIndex(const MeasurementVectorType & measurement, IndexType & index).
>
> In the former case, a component of the index is set and the procedure continues along it way. In the second case, a component is set and the routine returns.
>
> Should the latter return before it has the opportunity to set the rest of the components of the index?
>
> Is the index component value correct for these cases? In both exceeding the minimum and maximum bounds, the index component is set to m_Size[dim]. I am assuming this indicates a bin that is outside the histogram. I would have guessed that specifying a measurement that was below the first bin would put that measurement in the first bin and that specifying a measurement that is above the last bin would put that measurement in the last bin.
>
> Jim
>
>
>
>
> Jim Miller
> _____________________________________
> Visualization & Computer Vision
> GE Research
> Bldg. KW, Room C218B
> 1 Research Circle, Schenectady NY 12309-1027
>
> millerjv at reserch.ge.com <mailto:millerjv at reserch.ge.com>
> (518) 387-4005, Dial Comm: 8*833-4005
> Cell: (518) 505-7065, Fax: (518) 387-6981
>
>
> _______________________________________________
> 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