diff Framework/Toolbox/Slice.cpp @ 120:063f7f3d9f14 wasm

fix 3d locations of the doses
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Oct 2017 15:51:34 +0200
parents ba83e38cf3ff
children e66b2c757790
line wrap: on
line diff
--- a/Framework/Toolbox/Slice.cpp	Mon Oct 02 22:01:41 2017 +0200
+++ b/Framework/Toolbox/Slice.cpp	Wed Oct 04 15:51:34 2017 +0200
@@ -69,7 +69,7 @@
     std::vector<std::string> offsets;
     Orthanc::Toolbox::TokenizeString(offsets, offsetTag, '\\');
 
-    if (frameCount_ == 0 ||
+    if (frameCount_ <= 1 ||
         offsets.size() != frameCount_ ||
         frame >= frameCount_)
     {
@@ -77,9 +77,10 @@
       return false;
     }
 
-    double offset0, z;
+    double offset0, offset1, z;
 
     if (!ParseDouble(offset0, offsets[0]) ||
+        !ParseDouble(offset1, offsets[1]) ||
         !ParseDouble(z, offsets[frame]))
     {
       LOG(ERROR) << "Invalid syntax";
@@ -93,8 +94,18 @@
     }
 
     geometry_ = CoordinateSystem3D(geometry_.GetOrigin() + z * geometry_.GetNormal(),
+                                   //+ 650 * geometry_.GetAxisX(),
                                    geometry_.GetAxisX(),
                                    geometry_.GetAxisY());
+
+    thickness_ = offset1 - offset0;
+    if (thickness_ < 0)
+    {
+      thickness_ = -thickness_;
+    }
+
+    printf("%d: %f %f %f\n", frame_, geometry_.GetOrigin()[0], geometry_.GetOrigin()[1], geometry_.GetOrigin()[2]);
+    //printf("%f %f %f\n", pixelSpacingX_, pixelSpacingY_, thickness_);
     
     return true;
   }