Commit bb925623 authored by Otmane Lahlou's avatar Otmane Lahlou

ENH: replace the use of itk::NumericTraits<>::Clamp() function

parent 9317c9af
......@@ -84,13 +84,21 @@ HistogramModel
// Due to float/double conversion, it can happen
// that the minimum or maximum value go slightly outside the histogram
// Clamping the value solves the issue and avoid RangeError
measurement[0] =
itk::NumericTraits<MeasurementType>::Clamp(
measurement[0],
histogram->GetBinMin(0, 0),
histogram->GetBinMax(0, histogram->GetSize(0) - 1)
);
// measurement[0] =
// itk::NumericTraits<MeasurementType>::Clamp(
// measurement[0],
// histogram->GetBinMin(0, 0),
// histogram->GetBinMax(0, histogram->GetSize(0) - 1)
// );
//
// itk::NumericsTraits<>::Clamp(...) was removed when .
// TODO : when otb::Clamp will be developped, use this function
measurement[0] =
measurement[0]<histogram->GetBinMin(0, 0)?
histogram->GetBinMin(0, 0):(measurement[0]>histogram->GetBinMax(0, histogram->GetSize(0) - 1)?
histogram->GetBinMax(0, histogram->GetSize(0) - 1):measurement[0]);
// Get the index of measurement in 1D-histogram.
Histogram::IndexType index;
if( !histogram->GetIndex( measurement, index ) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment