changeset 172:316324f42848 wasm

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 06 Mar 2018 16:53:48 +0100
parents 01e32beee56c
children 6b0411ac843a
files Framework/Toolbox/GeometryToolbox.h Framework/Volumes/VolumeReslicer.cpp
diffstat 2 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Toolbox/GeometryToolbox.h	Tue Mar 06 15:43:57 2018 +0100
+++ b/Framework/Toolbox/GeometryToolbox.h	Tue Mar 06 16:53:48 2018 +0100
@@ -148,10 +148,9 @@
 {
   assert(x >= 0 && y >= 0);
 
-  // Compute the fractional part of (x,y) (this is the "floor()"
-  // operation on positive integers)
-  float xx = x - static_cast<float>(static_cast<int>(x));
-  float yy = y - static_cast<float>(static_cast<int>(y));
+  // Compute the fractional part of (x,y)
+  float xx = x - std::floor(x);
+  float yy = y - std::floor(y);
 
   return ComputeBilinearInterpolationInternal(xx, yy, f00, f01, f10, f11);
 }
@@ -171,9 +170,9 @@
 {
   assert(x >= 0 && y >= 0 && z >= 0);
 
-  float xx = x - static_cast<float>(static_cast<int>(x));
-  float yy = y - static_cast<float>(static_cast<int>(y));
-  float zz = z - static_cast<float>(static_cast<int>(z));
+  float xx = x - std::floor(x);
+  float yy = y - std::floor(y);
+  float zz = z - std::floor(z);
 
   // "In practice, a trilinear interpolation is identical to two
   // bilinear interpolation combined with a linear interpolation"
--- a/Framework/Volumes/VolumeReslicer.cpp	Tue Mar 06 15:43:57 2018 +0100
+++ b/Framework/Volumes/VolumeReslicer.cpp	Tue Mar 06 16:53:48 2018 +0100
@@ -1129,8 +1129,8 @@
 
     // Secondly, the extent together with the voxel size gives the
     // size of the output image
-    unsigned int width = boost::math::round(extent_.GetWidth() / voxelSize);
-    unsigned int height = boost::math::round(extent_.GetHeight() / voxelSize);
+    unsigned int width = boost::math::iround(extent_.GetWidth() / voxelSize);
+    unsigned int height = boost::math::iround(extent_.GetHeight() / voxelSize);
 
     slice_.reset(new Orthanc::Image(outputFormat_, width, height, false));