From 5559c46e158e78849d438b18b1781732b1958036 Mon Sep 17 00:00:00 2001 From: Julien Malik <julien.malik@c-s.fr> Date: Sun, 11 Mar 2012 16:39:16 +0100 Subject: [PATCH] COMP: fix ambiguous call to vcl_floor on windows --- Code/BasicFilters/otbMeanShiftImageFilter2.h | 2 +- .../BasicFilters/otbMeanShiftImageFilter2.txx | 35 +++++++++---------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Code/BasicFilters/otbMeanShiftImageFilter2.h b/Code/BasicFilters/otbMeanShiftImageFilter2.h index 095f6c4474..fb06eef495 100644 --- a/Code/BasicFilters/otbMeanShiftImageFilter2.h +++ b/Code/BasicFilters/otbMeanShiftImageFilter2.h @@ -86,7 +86,7 @@ public: typedef typename InputImageType::PixelType InputPixelType; typedef typename InputImageType::IndexType InputIndexType; typedef typename InputImageType::SizeType InputSizeType; - typedef typename InputImageType::IndexType IndexType; + typedef typename InputImageType::IndexValueType InputIndexValueType; typedef typename InputImageType::PointType PointType; typedef typename InputImageType::RegionType RegionType; typedef typename InputImageType::SizeType SizeType; diff --git a/Code/BasicFilters/otbMeanShiftImageFilter2.txx b/Code/BasicFilters/otbMeanShiftImageFilter2.txx index 206c802e53..722e9c42b4 100644 --- a/Code/BasicFilters/otbMeanShiftImageFilter2.txx +++ b/Code/BasicFilters/otbMeanShiftImageFilter2.txx @@ -513,26 +513,23 @@ void MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel InputSizeType inputSize = requestedRegion.GetSize(); InputIndexType inputIndex = requestedRegion.GetIndex(); - unsigned int width = inputSize[0]; - unsigned int height = inputSize[1]; - // define region itk::ImageRegion<2> imageRegion; - IndexType index; - index[0] = vcl_floor(latticePosition[0] + 0.5); - index[1] = vcl_floor(latticePosition[1] + 0.5); - - int xMin = index[0] - vcl_floor(kernelSize[0] / 2); - int xMax = xMin + kernelSize[0]; - int yMin = index[1] - vcl_floor(kernelSize[1] / 2); - int yMax = yMin + kernelSize[1]; - - IndexType minIndex; - minIndex[0] = vcl_max(xMin,static_cast<int>(inputIndex[0])); // add image index - minIndex[1] = vcl_max(yMin,static_cast<int>(inputIndex[1])); // add image index - IndexType maxIndex; - maxIndex[0] = vcl_min(xMax, static_cast<int> (width-1+inputIndex[0])); //add image index - maxIndex[1] = vcl_min(yMax, static_cast<int> (height-1+inputIndex[1])); //add image index + InputIndexType index; + index[0] = static_cast<InputIndexValueType>(vcl_floor(latticePosition[0] + 0.5)); + index[1] = static_cast<InputIndexValueType>(vcl_floor(latticePosition[1] + 0.5)); + + InputIndexValueType xMin = index[0] - static_cast<InputIndexValueType>(vcl_floor(kernelSize[0] / 2)); + InputIndexValueType xMax = xMin + kernelSize[0]; + InputIndexValueType yMin = index[1] - static_cast<InputIndexValueType>(vcl_floor(kernelSize[1] / 2)); + InputIndexValueType yMax = yMin + kernelSize[1]; + + InputIndexType minIndex; + minIndex[0] = vcl_max(xMin,inputIndex[0]); // add image index + minIndex[1] = vcl_max(yMin,inputIndex[1]); // add image index + InputIndexType maxIndex; + maxIndex[0] = vcl_min(xMax, static_cast<InputIndexValueType>(inputSize[0]-1+inputIndex[0])); //add image index + maxIndex[1] = vcl_min(yMax, static_cast<InputIndexValueType>(inputSize[1]-1+inputIndex[1])); //add image index imageRegion.SetIndex(index); SizeType size; @@ -542,7 +539,7 @@ void MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel OutputPixelType *it = *neighborhood; PointType pixelPos; - IndexType pixelIndex; + InputIndexType pixelIndex; InputPixelType inputPixel; inputPixel.SetSize(numberOfComponents); -- GitLab