From: Juan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Date: Mon, 7 Feb 2011 10:30:05 +0000 (+0000)
Subject: ibad origin position for widget in cut module
X-Git-Tag: Creatools2-0-3.creaMaracasVisu1-0-3.17Feb2011~1
X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=44f56c175ed253a0c2600ec683f368627c4da4ee;p=creaMaracasVisu.git

ibad origin position for widget in cut module
---

diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx
index 7b23c7f..546e416 100644
--- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx
+++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx
@@ -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)) )