[Insight-users] ItkHistogram errors and proposing changes to BinMin/Max

Martin Styner martin_styner@ieee.org
Mon, 09 Sep 2002 10:31:40 +0200


Hi

I found a (minor) error in itkHistogram.txx (mispelling of a member at 
line 341), here is the diff of that specific location:
341c341
<     m_TempMeasurmentVector[i] = this->GetBinMin(i, index[i]) ;
---
 >     m_TempMeasurementVector[i] = this->GetBinMin(i, index[i]) ;


Also, I think that the Min and Max values for the Bin's should not be of 
type float, but of the same types as the histogram values 
(Statistics::Histogram<..>::MeasurementType). On one hand, this would 
eliminate all the conversion froma and to the float type, also it  would 
make more sense from a design-viewpoint. This would create following 
changes to itkHistogram.txx and itkHistogram.h (again as diffs):

Index: Code/Numerics/Statistics/itkHistogram.h
diff -r1.20 itkHistogram.h
176c176
<                  const float min)
---
 >                  const MeasurementType min)
181c181
<                  unsigned long nbin, float max)
---
 >                  unsigned long nbin, const MeasurementType max)
212c212
<                                                   &measurement) const ;
---
 >                                                   &measurement)  ;
216c216
<                                                   &measurement) const;
---
 >                                                   &measurement) ;
219c219
<   MeasurementVectorType& GetHistogramMinFromIndex(const IndexType 
&index) const ;
---
 >   MeasurementVectorType& GetHistogramMinFromIndex(const IndexType 
&index) ;
222c222
<   MeasurementVectorType& GetHistogramMaxFromIndex(const IndexType 
&index) const ;
---
 >   MeasurementVectorType& GetHistogramMaxFromIndex(const IndexType 
&index) ;
387c387
<   std::vector< std::vector<float> > m_Min ;
---
 >   std::vector< std::vector<MeasurementType> > m_Min ;
390c390
<   std::vector< std::vector<float> > m_Max ;
---
 >   std::vector< std::vector<MeasurementType> > m_Max ;

Index: Code/Numerics/Statistics/itkHistogram.txx
diff -r1.14 itkHistogram.txx
308c308
< ::GetHistogramMinFromValue(const MeasurementVectorType &measurement) const
---
 > ::GetHistogramMinFromValue(const MeasurementVectorType &measurement)
322c322
< ::GetHistogramMaxFromValue(const MeasurementVectorType &measurement) const
---
 > ::GetHistogramMaxFromValue(const MeasurementVectorType &measurement)
337c337
< ::GetHistogramMinFromIndex(const IndexType &index) const
---
 > ::GetHistogramMinFromIndex(const IndexType &index)
341c341
<     m_TempMeasurmentVector[i] = this->GetBinMin(i, index[i]) ;
---
 >     m_TempMeasurementVector[i] = this->GetBinMin(i, index[i]) ;
343c343
<   return m_TempMeasurmentVector ;
---
 >   return m_TempMeasurementVector ;
351c351
< ::GetHistogramMaxFromIndex(const IndexType &index) const
---
 > ::GetHistogramMaxFromIndex(const IndexType &index)

What do others think of the proposed changes
best wishes
Martin

-- 
Martin Styner, PhD. Ing. ETH
Group Head Medical Image Analysis for Orthopedics
M.E. Mueller Institute for Biomechanics
Center for Computed Assisted Surgery
University of Bern
Murtenstrasse 35
P.O.Box 30
CH - 3010 Bern
Switzerland
Tel office: ++41-31-632-8784 , FAX: ++41-31-632-4951
email: Martin.Styner@memot.unibe.ch, martin_styner@ieee.org
WWW: http://cranium.unibe.ch/~mstyner