]> Creatis software - clitk.git/blobdiff - itk/itkBSplineInterpolateImageFunctionWithLUT.txx
Remove vcl_math calls
[clitk.git] / itk / itkBSplineInterpolateImageFunctionWithLUT.txx
index c776afae94d3f338ef752443c0c06bf575250fd5..58a173a10cea02189c190a61ec9458b226e9d44c 100644 (file)
@@ -1,23 +1,24 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
 #ifndef _ITKINTERPOLATEIMAGEFUNCTIONWITHLUT_TXX
 #define _ITKINTERPOLATEIMAGEFUNCTIONWITHLUT_TXX
+#include <itkMath.h>
 
-/* =========================================================================
-                                                                                
-@file   itkBSplineInterpolateImageFunctionWithLUT.txx
-@author David Sarrut <david.sarrut@creatis.insa-lyon.fr>
-
-Copyright (c) 
-* CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). 
-All rights reserved. See Doc/License.txt or
-http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
-* Léon Bérard cancer center, 28 rue Laënnec, 69373 Lyon cedex 08, France
-* http://www.creatis.insa-lyon.fr/rio
-                                                                                
-This software is distributed WITHOUT ANY WARRANTY; without even the
-implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.  See the above copyright notices for more information.
-                                                                             
-========================================================================= */
 namespace itk
 {
   //====================================================================
@@ -186,11 +187,11 @@ namespace itk
     for(int l=0; l<TImageType::ImageDimension; l++) 
       {
        // Compute t1 = distance to floor 
-       TCoefficientType t1 = x[l]- vcl_floor(x[l]);
+       TCoefficientType t1 = x[l]- std::floor(x[l]);
     
        // Compute index in precomputed weights table
        TCoefficientType t2 = mSamplingFactors[l]*t1;
-       index[l] = (IndexValueType)lrint(t2);
+       index[l] = (IndexValueType)Math::Round<TCoefficientType>(t2);
 
        // For even order : test if too close to 0.5 (but lower). In this
        // case : take the next coefficient
@@ -236,13 +237,13 @@ namespace itk
     long indx;
     for (unsigned int l=0; l<d; l++)  {
       if (mSplineOrders[l] & 1) {  // Use this index calculation for odd splineOrder (like cubic)
-       indx = (long)vcl_floor(x[l]) - mSplineOrders[l] / 2 ; //this->m_SplineOrder / 2;
+       indx = (long)std::floor(x[l]) - mSplineOrders[l] / 2 ; //this->m_SplineOrder / 2;
        evaluateIndex[l] = indx;
       }
       else { // Use this index calculation for even splineOrder
-       if (mSplineOrders[l] == 0) evaluateIndex[l] = (long)rint(x[l]);
+       if (mSplineOrders[l] == 0) evaluateIndex[l] = Math::Round<typename ContinuousIndexType::ValueType>(x[l]);
        else {
-         indx = (long)vcl_floor((x[l]+ 0.5)) - mSplineOrders[l] / 2; //this->m_SplineOrder / 2;
+         indx = (long)std::floor((x[l]+ 0.5)) - mSplineOrders[l] / 2; //this->m_SplineOrder / 2;
          evaluateIndex[l] = indx;
        }
       }