[Insight-developers] New Histogram metric & Histogram GetIndex

Luis Ibanez luis . ibanez at kitware . com
Mon, 29 Dec 2003 19:09:35 -0500


A problem in the use of the GetIndex() method
of the itk::Histogram has been exposed by the
new HistogramImageToImage metric.

The GetIndex() method finds the index of the
histogram bin correspondin the a measurement.

The problem with the method is that if the measurement
happens to have components that are outside the
range defined for the histogram, it will simply
return without having filled all the other components
of the index. Further, there is no indication that the
returned index is invalid.

A Bug # 473 was created regarding this issue.
http://www . itk . org/Bug/bug . php?op=show&bugid=473&pos=9

Options seem to be:

A) throw an exception when the measurement is
    out of the range

B) change the signature of the method to be
    something like


    bool GetIndex( measurement, IndexType & index );

   or

    const IndexType & GetIndex( measuremetn, bool );


   where the returned bool can be used to signal if
   the computation of the index was succesful or not.


Option (A) has been implemented now,... but the similarity
of this case with the situation of interpolators may lead
us to choose for (B).  Image interpolators face a similar
dilema when they are asked to generate a pixel value for
an index that is outside the extent of the image.


Maybe we could talk about this issue in the next Tcon.


    Luis