]> Creatis software - creaMaracasVisu.git/commitdiff
ibad origin position for widget in cut module
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Mon, 7 Feb 2011 10:30:05 +0000 (10:30 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Mon, 7 Feb 2011 10:30:05 +0000 (10:30 +0000)
lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx

index 7b23c7ff52f15b0e800543e918067a198e104174..546e416cd15547c95f1a67fd552615074fba483b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelData.cxx,v $
   Language:  C++
-  Date:      $Date: 2011/02/07 09:16:29 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2011/02/07 10:30:05 $
+  Version:   $Revision: 1.9 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -15,7 +15,7 @@
 
 =========================================================================*/
 #include "CutModelData.h"
-
+#include "vtkRenderWindow.h"
 /**
 **     Start of the manager class
 **/
@@ -35,6 +35,7 @@ void CutModelData::initializeData(int id, vtkRenderWindowInteractor* interactor,
        createActor();
        createShapes();
        ChangeShape(0);
+        interactor->GetRenderWindow ()->Render();
        checkInvariant();
 }
 
@@ -91,9 +92,9 @@ void CutModelData::setTransform(vtkImageData* img)throw( CutModelException){
        matrix->SetElement(1,1,(ext[3]-ext[2])/4*spc[1]);       
        matrix->SetElement(2,2,(ext[5]-ext[4])/4*spc[2]);
 
-       double orgx = (ori[0] + (ext[1]-ext[0])/2)*spc[0];
-       double orgy = (ori[1] + (ext[3]-ext[2])/2)*spc[1];
-       double orgz = (ori[2] + (ext[5]-ext[4])/2)*spc[2];
+        double orgx = (ext[1]+ext[0])/2.*spc[0];
+        double orgy = (ext[3]+ext[2])/2.*spc[1];
+        double orgz = (ext[5]+ext[4])/2.*spc[2];
 
        matrix->SetElement(0,3,orgx);
        matrix->SetElement(1,3,orgy);
@@ -225,11 +226,11 @@ void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyi
        
        copyimage->GetExtent(ext);        
        
-       for (xx=ext[0];xx<ext[1]; xx++)
+        for (xx=ext[0];xx<=ext[1]; xx++)
        {
-               for (yy=ext[2];yy<ext[3]; yy++)
+                for (yy=ext[2];yy<=ext[3]; yy++)
                {
-                       for (zz=ext[4];zz<ext[5];zz++)
+                        for (zz=ext[4];zz<=ext[5];zz++)
                        {
                                inside=actualCuttingModel->IfPointInside(xx,yy,zz);
                                if (  ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) )
@@ -272,11 +273,11 @@ void CutModelData::ExecuteUnCut(bool isinside, vtkImageData* image, vtkImageData
 
        copyimage->GetExtent(ext);        
 
-       for (xx=ext[0];xx<ext[1]; xx++)
+        for (xx=ext[0];xx<=ext[1]; xx++)
        {
-               for (yy=ext[2];yy<ext[3]; yy++)
+                for (yy=ext[2];yy<=ext[3]; yy++)
                {
-                       for (zz=ext[4];zz<ext[5];zz++)
+                        for (zz=ext[4];zz<=ext[5];zz++)
                        {
                                inside=actualCuttingModel->IfPointInside(xx,yy,zz);
                                if (  ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) )