From: Juan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Date: Mon, 4 May 2009 07:35:37 +0000 (+0000)
Subject: *** empty log message ***
X-Git-Tag: EED.02Oct2009~94
X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=3948b92b07a8992a6d04081c9649ba63e3e7d613;p=creaMaracasVisu.git

*** empty log message ***
---

diff --git a/bbtk/src/bbmaracasvisuContourVOI.cxx b/bbtk/src/bbmaracasvisuContourVOI.cxx
index 55d6473..dfdfb8d 100644
--- a/bbtk/src/bbmaracasvisuContourVOI.cxx
+++ b/bbtk/src/bbmaracasvisuContourVOI.cxx
@@ -22,6 +22,14 @@ END_EVENT_TABLE( );
   {
 //		wxPanel	*panel	= this;
 
+		wxFlexGridSizer *sizer=new wxFlexGridSizer(1);		
+		sizer	-> AddGrowableCol(0);
+		this	-> SetSizer(sizer);
+		this	-> SetAutoLayout(true);
+		this->wxvtkbaseview = NULL;
+		mcontourvoiwidget=NULL;
+
+
 		if(wxvtkbaseview!=NULL&&imagedata!=NULL){
 
 			setBaseView(wxvtkbaseview);
@@ -32,28 +40,34 @@ END_EVENT_TABLE( );
 
 				
   }
+   void wxWidgetVOI::initializeVOIWidget(){
+	   wxSizer* sizer = this->GetSizer();
 
-  void wxWidgetVOI::setBaseView(wxVtkBaseView * wxvtkbaseview){
-	  this->wxvtkbaseview = wxvtkbaseview;
-  }
-  void wxWidgetVOI::setImageData(vtkImageData * imagedata){
-	  this->imagedata = imagedata;
-  }
+		
+		if(mcontourvoiwidget!=NULL){
+			sizer->Remove(	mcontourvoiwidget );	
+			mcontourvoiwidget->Destroy();
+		}
 
-  void wxWidgetVOI::initializeVOIWidget(){
 		mcontourvoiwidget = new ContourVOIWidget( this, wxvtkbaseview, imagedata );
 		mcontourvoiwidget->ConfigureVTK();
 
-//		wxwidget = new wxMPRWidget2( panel, marimagedata , 1 );	
-//		wxwidget->ConfigureVTK();
-		wxFlexGridSizer *sizer=new wxFlexGridSizer(1);
+		
 		sizer	-> Add( mcontourvoiwidget,1,wxGROW ); 
-		sizer	-> AddGrowableCol(0);
-		this	-> SetSizer(sizer);
-		this	-> SetAutoLayout(true);
-		this	-> Layout();
+//		wxwidget = new wxMPRWidget2( panel, marimagedata , 1 );	
+//		wxwidget->ConfigureVTK();	
+		
 		this->Refresh();
   }
+
+  void wxWidgetVOI::setBaseView(wxVtkBaseView * wxvtkbaseview){
+	  this->wxvtkbaseview = wxvtkbaseview;
+  }
+  void wxWidgetVOI::setImageData(vtkImageData * imagedata){
+	  this->imagedata = imagedata;
+  }
+
+ 
 //--------------------------------------------------------------------------
   wxWidgetVOI::~wxWidgetVOI()
   {
@@ -150,6 +164,21 @@ void ContourVOI::Process()
 
 		std::cout<<"ContourVOI index "<<Index<<" size "<<Size<<std::endl;
 
+		//JCP
+		if(_extract!=NULL){		
+			_extract->Delete();
+		}
+		_extract = vtkExtractVOI::New();
+		_extract->RemoveAllInputs();
+		_extract->SetInput(img);
+		_extract->SetVOI(voi);	
+		_extract->UpdateWholeExtent();
+		_extract->Update();
+		bbSetOutputVOI(_extract->GetOutput());
+		//JCP
+                
+
+		
 		bbSetOutputIndex( Index );
 		bbSetOutputSize( Size );
 	} 
@@ -174,9 +203,11 @@ void ContourVOI::bbUserConstructor()
 
 	_img = NULL;
 	_base = NULL;
+	_extract =NULL;
 	bbSetInputwxVtkBaseView(NULL);
 	bbSetInputIn(NULL);
 	bbSetOutputWidget(NULL);
+	bbSetOutputVOI(NULL);
 
 	bbSetInputIn(NULL);
 	bbSetInputwxVtkBaseView(NULL);
@@ -188,6 +219,7 @@ void ContourVOI::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
 {
 	_img = NULL;
 	_base = NULL;
+	_extract =NULL;
 
 }
 
diff --git a/bbtk/src/bbmaracasvisuContourVOI.h b/bbtk/src/bbmaracasvisuContourVOI.h
index 7f134ea..edc2ebc 100644
--- a/bbtk/src/bbmaracasvisuContourVOI.h
+++ b/bbtk/src/bbmaracasvisuContourVOI.h
@@ -7,6 +7,7 @@
 
 
 #include <vtkImageData.h>
+#include <vtkExtractVOI.h>
 
 #include "Contour/ContourVOIWidget.h"
 
@@ -43,6 +44,7 @@ namespace bbcreaMaracasVisu
 
 		wxVtkBaseView * wxvtkbaseview;
 		vtkImageData * imagedata;
+		
 
 		
 
@@ -76,6 +78,7 @@ virtual void bbUserDestructor();
     BBTK_DECLARE_INPUT(wxVtkBaseView, wxVtkBaseView*);
 	BBTK_DECLARE_OUTPUT(Index,std::string);
 	BBTK_DECLARE_OUTPUT(Size,std::string);
+	BBTK_DECLARE_OUTPUT(VOI,vtkImageData*);
   BBTK_PROCESS(Process);
   void Process();
   BBTK_CREATE_WIDGET(CreateWidget);
@@ -84,6 +87,7 @@ virtual void bbUserDestructor();
 private:
 	vtkImageData* _img;
 	wxVtkBaseView* _base;
+	vtkExtractVOI*	_extract;
 
 };
 
@@ -97,6 +101,7 @@ BBTK_DESCRIPTION("define VOI widget");
 	BBTK_INPUT(ContourVOI,wxVtkBaseView,"maracas visu wxVtkBaseView",wxVtkBaseView*,"");
 	BBTK_OUTPUT(ContourVOI,Index, "Index"	,	std::string,"");
 	BBTK_OUTPUT(ContourVOI,Size, "Size"	,	std::string,"");
+	BBTK_OUTPUT(ContourVOI,VOI,"Region of interest",vtkImageData*,"");
 BBTK_END_DESCRIBE_BLACK_BOX(ContourVOI);
 }
 // EO namespace bbcreaMaracasVisu
diff --git a/bbtk/src/bbmaracasvisuImageChangeInformation.cxx b/bbtk/src/bbmaracasvisuImageChangeInformation.cxx
index 568d2b1..11b365d 100644
--- a/bbtk/src/bbmaracasvisuImageChangeInformation.cxx
+++ b/bbtk/src/bbmaracasvisuImageChangeInformation.cxx
@@ -11,9 +11,11 @@ void ImageChangeInformation::Process()
 	int ext[6];
 	vtkImageData* img = bbGetInputIn();
 	if(img!=NULL){
-		img->GetExtent( ext );
-		if (mchange!=NULL) { mchange->Delete(); }
+		if(mchange != NULL){
+			mchange->Delete();
+		}
 		mchange = vtkImageChangeInformation::New();
+		img->GetExtent( ext );				
 		mchange->SetInput( img );
 		mchange->SetExtentTranslation( -ext[0], -ext[2], -ext[4] );
 		mchange->Update();    //important
@@ -25,13 +27,13 @@ void ImageChangeInformation::Process()
 }
 void ImageChangeInformation::bbUserConstructor()
 {
-  mchange=NULL;
+  mchange = NULL;
    bbSetOutputOut( NULL);
    bbSetInputIn(NULL);
 }
 void ImageChangeInformation::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
 {
-	mchange=NULL;
+	mchange = NULL;
 }
 void ImageChangeInformation::bbUserDestructor()
 {
diff --git a/bbtk/src/bbmaracasvisuViewerMPR.cxx b/bbtk/src/bbmaracasvisuViewerMPR.cxx
index 8375a6e..4b4e994 100644
--- a/bbtk/src/bbmaracasvisuViewerMPR.cxx
+++ b/bbtk/src/bbmaracasvisuViewerMPR.cxx
@@ -40,10 +40,8 @@ END_EVENT_TABLE( );
 		panel	-> Layout();		
   }
 
-  void wxWidgetMPR::setMarImage(marImageData* marimagedata){
-	  wxwidget->setMarImage(marimagedata, 1);
-
-
+  void wxWidgetMPR::setImageData(vtkImageData* img){
+	  wxwidget->setImageData(img, 1);
   }
   void wxWidgetMPR::ConfigureVTK(){
 		wxwidget->ConfigureVTK();
@@ -124,14 +122,19 @@ void ViewerMPR::Process()
 {
 	if (wxwidget!=NULL){
 		wxBusyCursor wait;	   
-		if(marimagedata==NULL){
-			wxwidget->setMarImage(new marImageData(bbGetInputIn() ));
+		vtkImageData* img = bbGetInputIn();
+		if(img!=NULL && img != _img){
+			_img = img;
+			wxwidget->setImageData(_img);
 			wxwidget->ConfigureVTK();
 			
 //			wxwidget->wxPanel::Refresh();
 			wxwidget->Refresh();
 //			wxwidget->Show();
-		}
+
+		}	
+			
+		
 		bbSetOutputPoint( wxwidget->GetPoint() );
 		bbSetOutputRenderer( wxwidget->GetRenderer() );  
 	} // wxwidget
@@ -147,15 +150,13 @@ void ViewerMPR::CreateWidget(wxWindow* parent)
 }
 
 void ViewerMPR::bbUserConstructor()
-{
-		marimagedata =	NULL;
+{		
+		_img = NULL;
 		wxwidget = NULL;
 		bbSetInputIn(NULL);
 }
 void ViewerMPR::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
-{
-
-	marimagedata =	NULL;
+{	
 		wxwidget = NULL;
 		bbSetInputIn(NULL);
 
diff --git a/bbtk/src/bbmaracasvisuViewerMPR.h b/bbtk/src/bbmaracasvisuViewerMPR.h
index af3673a..855b02a 100644
--- a/bbtk/src/bbmaracasvisuViewerMPR.h
+++ b/bbtk/src/bbmaracasvisuViewerMPR.h
@@ -32,7 +32,7 @@ namespace bbcreaMaracasVisu
 		//refreshView
 		void Refresh();
 
-		void setMarImage(marImageData* marimagedata);
+		void setImageData(vtkImageData* img);
 		void ConfigureVTK();
 		
 	private:
@@ -75,7 +75,7 @@ virtual void bbUserDestructor();
 
 private:
   wxWidgetMPR *wxwidget;
-  marImageData	*marimagedata;
+  vtkImageData	*_img;
 };
 
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(ViewerMPR,bbtk::WxBlackBox);
diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx
index 9076438..ff52573 100644
--- a/bbtk/src/bbmaracasvisuViewerNV.cxx
+++ b/bbtk/src/bbmaracasvisuViewerNV.cxx
@@ -65,8 +65,8 @@ void ViewerNV::Process()
 			mwxwidget->SetType(&type);
 			mwxwidget->UpdateLayout(img);
 		}else if (img != currentimg){		
-			//mwxwidget->SetImage(img);
-			mwxwidget->UpdateLayout(img);
+			mwxwidget->SetImage(img);
+			//mwxwidget->UpdateLayout(img);
 		}
 		currenttype = type;
 		currentimg = img;
@@ -101,6 +101,7 @@ void ViewerNV::Process()
 //-------------------------------------------------------------
 void ViewerNV::CreateWidget(wxWindow* parent)
 {
+
     bbtkDebugMessageInc("Core",9,"ViewerNV::CreateWidget()"<<std::endl);
 	mwxwidget = new bbwxMaracas_N_ViewersWidget( this, parent );	
 	bbtkDebugDecTab("Core",9);
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx
index 4febab2..8466cda 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx
@@ -171,8 +171,10 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
 		GetClientSize(&scrX,&scrY);
 		plotter->SetSize(scrX,scrY);
 		pGraphicalFunction* actual=plotter->getFunction(idTransferenceFunction);
-		actual->setScreens(scrX,scrY);
-		actual->setScales();
+		if(actual!=NULL){
+			actual->setScreens(scrX,scrY);
+			actual->setScales();
+		}
 		
 	}
 	/*
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx
index 4fb1334..7635f60 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx
@@ -1710,6 +1710,9 @@ void pPlotterWindow :: OnGuideLines (wxCommandEvent   &event)
 pGraphicalFunction* pPlotterWindow::getFunction(int index)
 {
 	wxNode* node=functions.Item(index);
+	if(node==NULL){
+		return NULL;
+	}
 	return (pGraphicalFunction*)node->GetData();
 }
 /*
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx
index 9c86ffc..16fb797 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx
@@ -35,7 +35,7 @@ vtkBaseData::~vtkBaseData()
 void vtkBaseData::SetMarImageData(marImageData *marimagedata)
 {
 	_marImageData = marimagedata;
-	Configure();
+	//Configure();
 }
 
 //-------------------------------------------------------------------
@@ -57,7 +57,7 @@ void vtkBaseData::Configure()  // virtual
 
 //-------------------------------------------------------------------
 void vtkBaseData::SetZ(double z){
-	int maxZ;
+	//int maxZ;
 
 //	int dim[3];
 //	_marImageData->GetDimensions(dim);
@@ -66,18 +66,29 @@ void vtkBaseData::SetZ(double z){
 	int ext[6];
 	vtkImageData* img = _marImageData->GetImageData();
 	if(img!=NULL){
-		img->GetWholeExtent(ext);
+		/*img->GetWholeExtent(ext);
 		maxZ=ext[5]-ext[4]+1;
 
 		if (z>=maxZ)
 		{
-			z=maxZ-1;
+			//z=maxZ-1;
 		}
 		if (z<=0)
 		{
 			z=0;
 		}
 
+		_z=z;*/
+		img->GetExtent(ext);
+		if (z > ext[5])
+		{
+			z = ext[5];
+		}
+		if (z < ext[4])
+		{
+			z = ext[4];
+		}
+
 		_z=z;
 	}
 }
@@ -128,7 +139,10 @@ void vtkMPRBaseData::Configure()
 	vtkImageData* img = _marImageData->GetImageData();
 	if(img !=NULL){
 		img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2);
-		_transformOrientation=vtkTransform::New();
+	//std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<<std::endl;
+		if(_transformOrientation==NULL){
+			_transformOrientation=vtkTransform::New();
+		}
 		_transformOrientation->Identity();
 	}
 }
@@ -162,6 +176,7 @@ int vtkMPRBaseData::GetMaxPositionZ( )
 //-------------------------------------------------------------------
 double vtkMPRBaseData::GetX()
 {
+
 	return _x;
 }
 //-------------------------------------------------------------------
@@ -170,12 +185,17 @@ double	vtkMPRBaseData::GetY()
 	return _y;
 }
 //-------------------------------------------------------------------
+/**
+**	Calculates the value of the slider and the layer in the image that is spouse to show
+**/
 void vtkMPRBaseData::SetX(double x)
 {
-	int dim[3];
+	//int dim[3];
+	int ext[6];
+
 	vtkImageData* img = _marImageData->GetImageData();
 	if(img!=NULL){
-		img->GetDimensions(dim);
+		/*img->GetDimensions(dim);
 		if (x<0)
 		{
 			x=0;
@@ -183,17 +203,31 @@ void vtkMPRBaseData::SetX(double x)
 		if (x>=dim[0])
 		{
 			x=dim[0]-1;
-		};
+		}
+		_x=x;*/
+		img->GetExtent(ext);
+		if (x < ext[0])
+		{
+			x=ext[0];
+		}
+		if (x > ext[1])
+		{
+			x=ext[1];
+		}
 		_x=x;
 	}
 }
 //-------------------------------------------------------------------
+/**
+**	Calculates the value of the slider and the layer in the image that is spouse to show
+**/
 void vtkMPRBaseData::SetY(double y)
 {
-	int dim[3];
+	//int dim[3];
+	int ext[6];
 	vtkImageData* img = _marImageData->GetImageData();
 	if(img!=NULL){
-		img->GetDimensions(dim);
+		/*img->GetDimensions(dim);
 		if (y<0)
 		{
 			y=0;
@@ -201,13 +235,23 @@ void vtkMPRBaseData::SetY(double y)
 		if (y>=dim[1])
 		{
 			y=dim[1]-1;
-		};
+		}
+		_y=y;*/
+		img->GetExtent(ext);
+		if (y<ext[2])
+		{
+			y=ext[2];
+		}
+		if (y > ext[3])
+		{
+			y=ext[3];
+		}
 		_y=y;
 	}
 }
 //-------------------------------------------------------------------
 vtkTransform *vtkMPRBaseData::GetTransformOrientation()
-{
+{	
 	return _transformOrientation; 
 }
 //-------------------------------------------------------------------
@@ -238,6 +282,18 @@ vtkMPR3DDataViewer::vtkMPR3DDataViewer()
 	_visiblePosition[1]=false;
 	_visiblePosition[2]=false;
 	_ctfun = NULL;
+	_vtkmprbasedata=NULL;
+
+	_ctfun=NULL;
+	_saggitalColors=NULL;
+	_saggital=NULL;
+	_axialColors=NULL;
+	_axial=NULL;
+	_coronalColors=NULL;
+	_coronal=NULL;
+	_mapOutline=NULL;
+	_outline=NULL;
+	_outlineData=NULL;
 }
 //-------------------------------------------------------------------
 vtkMPR3DDataViewer::~vtkMPR3DDataViewer()
@@ -284,7 +340,7 @@ void vtkMPR3DDataViewer::Refresh()
 	int x = (int)(_vtkmprbasedata->GetX());
 	int y = (int)(_vtkmprbasedata->GetY());
 	int z = (int)(_vtkmprbasedata->GetZ());
-
+	std::cout<<" vtkMPR3DDataViewer::Refresh() x="<<x<<" y= "<<y<<" z= "<<z;
 	SetPositionX( x );
 	SetPositionY( y );
 	SetPositionZ( z );
@@ -362,25 +418,28 @@ void vtkMPR3DDataViewer::Configure()
 	_vtkmprbasedata->GetImageData()->GetScalarRange(range);
 	double max = range[1];
 
-	
+	_ctFunVectorPoint.clear();
 	_ctFunVectorPoint.push_back(max*0/4);
 	_ctFunVectorPoint.push_back(max*1/4);
 	_ctFunVectorPoint.push_back(max*2/4);
 	_ctFunVectorPoint.push_back(max*3/4);
 	_ctFunVectorPoint.push_back(max*4/4);
 
+	_ctFunVectorRed.clear();
 	_ctFunVectorRed.push_back(0.0);
 	_ctFunVectorRed.push_back(1.0);
 	_ctFunVectorRed.push_back(0.0);
 	_ctFunVectorRed.push_back(0.0);
 	_ctFunVectorRed.push_back(0.0);
 
+	_ctFunVectorGreen.clear();
 	_ctFunVectorGreen.push_back(0.0);
 	_ctFunVectorGreen.push_back(0.0);
 	_ctFunVectorGreen.push_back(0.0);
 	_ctFunVectorGreen.push_back(1.0);
 	_ctFunVectorGreen.push_back(0.2);
 
+	_ctFunVectorBlue.clear();
 	_ctFunVectorBlue.push_back(0.0);
 	_ctFunVectorBlue.push_back(0.0);
 	_ctFunVectorBlue.push_back(1.0);
@@ -388,7 +447,10 @@ void vtkMPR3DDataViewer::Configure()
 	_ctFunVectorBlue.push_back(0.0);
 
 
-	_ctfun = vtkColorTransferFunction::New();
+	if(_ctfun==NULL){
+		_ctfun = vtkColorTransferFunction::New();
+	}
+	_ctfun->RemoveAllPoints();
 
 	int i,size=_ctFunVectorPoint.size();
 	for (i=0;i<size;i++)
@@ -412,45 +474,92 @@ void vtkMPR3DDataViewer::Configure()
   // values, which the vtkImageMapToColors produces.) Note also that by
   // specifying the DisplayExtent, the pipeline requests data of this extent
   // and the vtkImageMapToColors only processes a slice of data.
-	_saggitalColors = vtkImageMapToColors::New();
+	
+	if(_saggitalColors==NULL){
+		_saggitalColors = vtkImageMapToColors::New();
+	}
+	_saggitalColors->RemoveAllInputs();
+	
     _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() );
 //    _saggitalColors->SetLookupTable(_bwLut);
+	
     _saggitalColors->SetLookupTable(_ctfun);
-	_saggital = vtkImageActor::New();
-    _saggital->SetInput(_saggitalColors->GetOutput());
+
+	
+
+	if(_saggital==NULL){
+		_saggital = vtkImageActor::New();
+		_saggital->SetInput(_saggitalColors->GetOutput());
+	}	
+	//_saggitalColors->Update();
+    
 
 
   // Create the second (axial) plane of the three planes. We use the
   // same approach as before except that the extent differs.
-	_axialColors = vtkImageMapToColors::New();
+
+	
+	if(_axialColors==NULL){
+		_axialColors = vtkImageMapToColors::New();
+	}
+
+	_axialColors->RemoveAllInputs();
     _axialColors->SetInput( _vtkmprbasedata->GetImageData() );
 //    _axialColors->SetLookupTable(_hueLut);
     _axialColors->SetLookupTable(_ctfun);
-	_axial = vtkImageActor::New();
-    _axial->SetInput(_axialColors->GetOutput());
+
+	if(_axial==NULL){
+		_axial = vtkImageActor::New();
+		_axial->SetInput(_axialColors->GetOutput());
+	}
+	
+	//_axialColors->Update();
+    
 
 	// Create the third (coronal) plane of the three planes. We use 
   // the same approach as before except that the extent differs.
-	_coronalColors = vtkImageMapToColors::New();
+	if(_coronalColors==NULL){
+		_coronalColors = vtkImageMapToColors::New();
+	}
+	_coronalColors->RemoveAllInputs();
     _coronalColors->SetInput( _vtkmprbasedata->GetImageData() );
 //    _coronalColors->SetLookupTable(_satLut);
     _coronalColors->SetLookupTable(_ctfun);
-	_coronal = vtkImageActor::New();
-    _coronal->SetInput(_coronalColors->GetOutput());
+
+	if(_coronal==NULL){
+		_coronal = vtkImageActor::New();
+		_coronal->SetInput(_coronalColors->GetOutput());
+	}
+	
+    
 
   // An outline provides context around the data.
   //
-	_outlineData = vtkOutlineFilter::New();
+	if(_outlineData==NULL){
+		_outlineData = vtkOutlineFilter::New();
+	}
+	_outlineData->RemoveAllInputs();
     _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
-	_mapOutline = vtkPolyDataMapper::New();
-    _mapOutline->SetInput(_outlineData->GetOutput());
-	_outline = vtkActor::New();
-    _outline->SetMapper(_mapOutline);
-    _outline->GetProperty()->SetColor(0,0,0);
+
+	if(_mapOutline==NULL){
+		_mapOutline = vtkPolyDataMapper::New();
+		_mapOutline->SetInput(_outlineData->GetOutput());
+	}
+	_mapOutline->Update();    
+	//_mapOutline->RemoveAllInputs();
+    
+	if(_outline==NULL){
+		_outline = vtkActor::New();
+		_outline->SetMapper(_mapOutline);
+		_outline->GetProperty()->SetColor(0,0,0);
+	}
+	
+    
 
 	int ext[6];
 	_vtkmprbasedata->GetImageData()->GetExtent(ext);
 
+	
 
 
 }
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx
index 806b3d9..37ff5bd 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMPRWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/04/23 10:15:56 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2009/05/04 07:35:42 $
+  Version:   $Revision: 1.11 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -67,6 +67,8 @@
 
 #include "matrix.h"
 #include <string>
+#include <stdio.h>
+
 
 
 #include "pPlotter/HistogramDialog.h"
@@ -447,8 +449,8 @@ void wxSphereView::ResetlstId()
 int wxSphereView::GetIdOfImage(double radio)
 {
 	int id=0;
-	int dim[3];
-	_imageSphere->GetDimensions(dim);
+	int dim[3];	
+	_imageSphere->GetDimensions(dim);	
 	int sizeMaxList = dim[2];
 	// Search in list >> alpha beta radio
 	int i,size=_lstId.size();
@@ -576,8 +578,13 @@ void wxSphereView::FiltreImageB(int id, double radio, bool ok,int deltaTMP)
 	unsigned short *pOrig;
 	int dimRes[3],dimOrig[3];
 	double i,j;
+	int ext[6];
+	_imageSphere->GetExtent(ext);
 	_imageSphere->GetDimensions(dimRes);
-	_imageSphere->SetExtent(0,dimRes[0]-1,0,dimRes[1]-1,0,dimRes[2]-1);
+	//JCP 24 - 04 -09
+	//_imageSphere->SetExtent(0,dimRes[0]-1,0,dimRes[1]-1,0,dimRes[2]-1);
+	_imageSphere->SetExtent(ext);
+	//JCP 24 - 04 -09
 	d2x=dimRes[0]/2;
 	d2y=dimRes[1]/2;
 //	double deltaTMP=_delta;
@@ -2492,9 +2499,14 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV
 	wxPanel *panel	= this;
 	_wxvtkmpr3Dview	= wxvtkmpr3Dview;
 
-	int maxX = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionX();
+	/*int maxX = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionX();
 	int maxY = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionY();
-	int maxZ = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionZ();
+	int maxZ = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionZ();*/
+
+	int maxX = 1;
+	int maxY = 1;
+	int maxZ = 1;
+
 	wxCheckBox		*ckBoxX			= new wxCheckBox(panel,-1,_T("X           "));
 					_positionX		= new wxSlider(panel,-1,maxX/2,0,maxX, wxDefaultPosition, wxSize(150,40), wxSL_HORIZONTAL | wxSL_LABELS);
 	wxCheckBox		*ckBoxY			= new wxCheckBox(panel,-1,_T("Y           "));
@@ -2587,6 +2599,45 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV
 
 	panel->SetEventHandler((wxEvtHandler*)this);
 
+	//this->UpdateControlPanel();
+
+}
+void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel()
+{
+
+	vtkMPRBaseData* basedata = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData();
+	if(basedata != NULL){
+
+		/*int maxX = basedata->GetMaxPositionX();
+		int maxY = basedata->GetMaxPositionY();
+		int maxZ = basedata->GetMaxPositionZ();*/
+		int x0,x1,y0,y1,z0,z1;
+
+		basedata->GetDimensionExtention(&x0,&x1,&y0,&y1,&z0,&z1);
+		/*int maxX = x1-x0;//basedata->GetMaxPositionX();
+		int maxY = y1-y0;//basedata->GetMaxPositionY();
+		int maxZ = z1-z0;//basedata->GetMaxPositionZ();*/
+
+		
+
+		//std::cout<<"wxVtkMPR3DViewCntrlPanel::UpdateControlPanel() maxX="<<maxX<<" maxY="<<maxY<<" maxZ="<<maxZ<<std::endl;
+		/*_positionX->SetRange(0,maxX);
+		_positionY->SetRange(0,maxY);
+		_positionZ->SetRange(0,maxZ);*/
+		_positionX->SetRange(x0,x1);
+		_positionY->SetRange(y0,y1);
+		_positionZ->SetRange(z0,z1);
+
+		_positionX->SetValue((x0+x1)/2);
+		_positionY->SetValue((y0+y1)/2);
+		_positionZ->SetValue((z0+z1)/2);
+
+		_positionX->Update();
+		_positionY->Update();
+		_positionZ->Update();
+		this->Update();
+	}
+	
 }
 //-------------------------------------------------------------------
 wxVtkMPR3DViewCntrlPanel::~wxVtkMPR3DViewCntrlPanel()
@@ -2745,7 +2796,12 @@ void wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX(wxCommandEvent& event)
 	_wxvtkmpr3Dview->Refresh();
 
 	wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
- 	_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+
+	try{
+ 		_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+	}catch(char* e){
+		std::cout<<e<<std::endl;
+	}
 
 }
 //-------------------------------------------------------------------
@@ -3513,87 +3569,67 @@ wxVtkMPR3DView::wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview )
 {
 	_wxvtk3Dbaseview			=	wxvtk3Dbaseview;
 	_vtkmpr3Ddataviewer			=	NULL;
-	_wxvtkmpr3DviewCntrlPanel	=	NULL;
-}
-
-//-------------------------------------------------------------------
-wxVtkMPR3DView::~wxVtkMPR3DView()
-{
-}
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::Refresh()   // virtual
-{
-	_vtkmpr3Ddataviewer	->	Refresh();
-	if (_wxvtkmpr3DviewCntrlPanel!=NULL)
-	{
-		_wxvtkmpr3DviewCntrlPanel->Refresh();
+	_wxvtkmpr3DviewCntrlPanel	=	NULL;	
+	_myCallback=NULL;
+	_pointWidget=NULL;
+	_planeWidget=NULL;
+	_vtkplane=NULL;
+	_probe=NULL;
+	_contourMapper=NULL;
+}
+void wxVtkMPR3DView::RemoveActor(vtkActor* actor){	
+
+	_wxvtk3Dbaseview->GetRenderer()->RemoveActor(actor);	
+
+
+}
+void wxVtkMPR3DView::ResetCamera(int* ext, double* origin,double* spc){
+	if(ext == NULL){
+
+		_wxvtk3Dbaseview->GetRenderer()->ResetCamera ();	
+		_wxvtk3Dbaseview->GetCamera()->Dolly(1.5);	
+	}else{
+		/*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0));		
+		double y = (spc[1])*(origin[1]+(double)ext[3]);
+		double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/
+		/*double x0=(spc[0])*((double)ext[0]+origin[0]);
+		double x1=(spc[0])*((double)ext[1]+origin[0]);
+		double y0=(spc[1])*((double)ext[2]+origin[1]);
+		double y1=(spc[1])*((double)ext[3]+origin[1]);
+		double z0=(spc[2])*((double)ext[4]+origin[2]);
+		double z1=(spc[2])*((double)ext[5]+origin[2]);*/
+		double x0=(spc[0])*((double)ext[0]);
+		double x1=(spc[0])*((double)ext[1]);
+		double y0=(spc[1])*((double)ext[2]);
+		double y1=(spc[1])*((double)ext[3]);
+		double z0=(spc[2])*((double)ext[4]);
+		double z1=(spc[2])*((double)ext[5]);
+		
+		_wxvtk3Dbaseview->GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1);
+		//_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z);
+		_wxvtk3Dbaseview->GetCamera()->Dolly(1.5);	
 	}
-
 }
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::RefreshView()   // virtual
-{
-	double spc[3];
-	this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetSpacing(spc);
-
-	//double nx=1,ny=0,nz=0; // JPRx
-	Refresh();
-	double x=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetX();
-	double y=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetY();
-	double z=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetZ();
-
-	x=x*spc[0];
-	y=y*spc[1];
-	z=z*spc[2];
-
-	_pointWidget->SetPosition( x,y,z ); 
-
-
-	double in[3]; 
-	double normal[3];
-	vtkTransform *transform = GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetTransformOrientation();
-	in[0]=1;		in[1]=0;			in[2]=0;
-	transform->TransformPoint(in,normal);
-	_planeWidget->SetNormal( normal[0],normal[1],normal[2] );
+void wxVtkMPR3DView::Configure(){
 
 
-	_planeWidget->SetCenter( x,y,z );
-	_planeWidget->UpdatePlacement();
-	_planeWidget->GetPolyData(_vtkplane);
-}
-//-------------------------------------------------------------------
-wxPanel* wxVtkMPR3DView::CreateControlPanel(wxWindow *parent)
-{
-	_wxvtkmpr3DviewCntrlPanel = new wxVtkMPR3DViewCntrlPanel(parent,this);
-	return _wxvtkmpr3DviewCntrlPanel;
-}
-//-------------------------------------------------------------------
-vtkMPR3DDataViewer* wxVtkMPR3DView::GetVtkMPR3DDataViewer()
-{
-	return _vtkmpr3Ddataviewer; 
-}
-//-------------------------------------------------------------------
-wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview()
-{
-	return _wxvtk3Dbaseview;
-}
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::Configure(){
 	_wxvtk3Dbaseview->Configure();
+	_wxvtkmpr3DviewCntrlPanel->UpdateControlPanel();
+	_wxvtk3Dbaseview->GetRenderer()->Clear();		
 	
 	// Actors are added to the renderer. 
-	_wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetOutlineActor() );			
+	vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor();
+	_wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor );			
 //	_wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(0)  );	// _saggital
 //	_wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(1)  );	// _axial
 //	_wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(2)  );	// _coronal
 
 
 	// An initial camera view is created.  The Dolly() method moves 
-	// the camera towards the FocalPoint, thereby enlarging the image.
+	// the camera towards the FocalPoint, thereby enlarging the image.	
 	_wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera());
-	_wxvtk3Dbaseview->GetRenderer()->ResetCamera ();
-	_wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
+	this->ResetCamera();
+	
 
 	// Set a background color for the renderer and set the size of the
 	// render window (expressed in pixels).
@@ -3610,9 +3646,16 @@ void wxVtkMPR3DView::Configure(){
 
 
 	// vtkPointWidget
+	if(_myCallback!=NULL){
+		_myCallback->Delete();
+
+	}
 	_myCallback = vtkmyPWCallback_3DPointWidget::New();
 	_myCallback->SetWxVtkMPR3DView(this);
  
+	if(_pointWidget!=NULL){
+		_pointWidget->Delete();
+	}
 	_pointWidget = vtkPointWidget::New();
 	_myCallback->SetVtkPointWidget(_pointWidget);
 	_pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); 
@@ -3631,6 +3674,9 @@ void wxVtkMPR3DView::Configure(){
 
 
 // PlaneWidget
+	if(_planeWidget!=NULL){
+		_planeWidget->Delete();
+	}
 	_planeWidget = vtkPlaneWidget::New();
 	_myCallback->SetVtkPlaneWidget(_planeWidget);
 	_planeWidget->SetInput( GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData() );
@@ -3644,30 +3690,112 @@ void wxVtkMPR3DView::Configure(){
 	int pz=(dim[2]/2);
 	int dd=20;
 	_planeWidget->PlaceWidget( px-dd , px+dd , py-dd , py+dd , pz-dd , pz+dd );
-	_vtkplane = vtkPolyData::New();
+
+
+	if(_vtkplane==NULL){
+		_vtkplane = vtkPolyData::New();
+		
+		_probe = vtkProbeFilter::New();
+		_probe->SetInput(_vtkplane);
+
+		_contourMapper = vtkPolyDataMapper::New();
+		
+		_contourMapper->SetInput( _probe->GetPolyDataOutput() );
+
+		_contourPlaneActor = vtkActor::New();
+		_contourPlaneActor->SetMapper(_contourMapper);
+
+		_contourPlaneActor->VisibilityOff();
+
+		_planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
+		_planeWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
+
+		_planeWidget->Off();
+		_wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor );	
+
+	}else{
+		
+	}
 	_planeWidget->GetPolyData(_vtkplane);
 
-	vtkProbeFilter *probe = vtkProbeFilter::New();
-	probe->SetInput(_vtkplane);
-	vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
-	probe->SetSource( imageData );
+	
+	vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();	
+	_probe->SetSource( imageData );
 
-	vtkPolyDataMapper *contourMapper = vtkPolyDataMapper::New();
+	
+	_contourMapper->SetScalarRange( imageData->GetScalarRange() );
+    
+	
 
-	contourMapper->SetInput( probe->GetPolyDataOutput() );
+			
+}
+//-------------------------------------------------------------------
+wxVtkMPR3DView::~wxVtkMPR3DView()
+{
+}
 
-    contourMapper->SetScalarRange( imageData->GetScalarRange() );
-	_contourPlaneActor = vtkActor::New();
-	_contourPlaneActor->SetMapper(contourMapper);
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::Refresh()   // virtual
+{
+	_vtkmpr3Ddataviewer	->	Refresh();
+	if (_wxvtkmpr3DviewCntrlPanel!=NULL)
+	{
+		_wxvtkmpr3DviewCntrlPanel->Refresh();
+	}
 
-	_contourPlaneActor->VisibilityOff();
+}
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::RefreshView()   // virtual
+{
+	double spc[3];
+	this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetSpacing(spc);
 
-	_planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
-	_planeWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
+	//double nx=1,ny=0,nz=0; // JPRx
+	Refresh();
+	double x=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetX();
+	double y=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetY();
+	double z=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetZ();
 
-	_planeWidget->Off();
-	_wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor );			
+	x=x*spc[0];
+	y=y*spc[1];
+	z=z*spc[2];
+
+	_pointWidget->SetPosition( x,y,z ); 
+
+
+	double in[3]; 
+	double normal[3];
+	vtkTransform *transform = GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetTransformOrientation();
+	in[0]=1;		in[1]=0;			in[2]=0;
+	transform->TransformPoint(in,normal);
+	_planeWidget->SetNormal( normal[0],normal[1],normal[2] );
+
+
+	_planeWidget->SetCenter( x,y,z );
+	_planeWidget->UpdatePlacement();
+	_planeWidget->GetPolyData(_vtkplane);
+}
+//-------------------------------------------------------------------
+wxPanel* wxVtkMPR3DView::CreateControlPanel(wxWindow *parent)
+{
+	_wxvtkmpr3DviewCntrlPanel = new wxVtkMPR3DViewCntrlPanel(parent,this);
+	return _wxvtkmpr3DviewCntrlPanel;
 }
+//-------------------------------------------------------------------
+vtkMPR3DDataViewer* wxVtkMPR3DView::GetVtkMPR3DDataViewer()
+{
+	return _vtkmpr3Ddataviewer; 
+}
+//-------------------------------------------------------------------
+wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() throw (char*)
+{
+	if(_wxvtk3Dbaseview==NULL){
+		throw "wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL";
+	}
+	return _wxvtk3Dbaseview;
+}
+//-------------------------------------------------------------------
+
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
 	if (visible!=_vtkmpr3Ddataviewer->GetVisiblePosition(idPosition)){
@@ -4017,8 +4145,11 @@ void wxVtkClipping3DView::VisibleVolumeActor( bool visVolume){
 	}
 }
 //-------------------------------------------------------------------
-wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()
+wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*)
 {
+	if(_wxvtk3Dbaseview==NULL){
+		throw "wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL";
+	}
 	return _wxvtk3Dbaseview;
 }
 //-------------------------------------------------------------------
@@ -4317,6 +4448,8 @@ wxPanelCuttingImageData::wxPanelCuttingImageData (wxWindow *parent)
 {
 	_imageData=NULL;
 	_histogrammeVector=NULL;
+	_wxvtk3Dbaseview=NULL;
+	_wxvtkbaseView=NULL;
 	CreateInterface();
 	CreateModel();
 	Create3DViewObjects();
@@ -4326,24 +4459,31 @@ wxPanelCuttingImageData::wxPanelCuttingImageData (wxWindow *parent)
 wxPanelCuttingImageData::~wxPanelCuttingImageData()
 {
 
-	delete _modelCube;
-	delete _modelSphere;
-	delete _modelCylinder;
 
-	_vtkcube		-> Delete();
-	_vtksphere		-> Delete();
-	_vtkcylinder	-> Delete();
-	_cubeMapper		-> Delete();
-	_sphereMapper	-> Delete();
-	_cylinderMapper	-> Delete();
-	_cubeActor		-> Delete();
-	_sphereActor	-> Delete();
-	_cylinderActor	-> Delete();
-//	_xyplot->RemoveAllInputs();
-	_xyplot			-> Delete();
-	_histogrammeVector->Delete();
+	delete _modelCube;	
+	delete _modelSphere;	
+	delete _modelCylinder;	
+	_vtkcube		-> Delete();	
+	_vtksphere		-> Delete();	
+	_vtkcylinder	-> Delete();	
+	_cubeMapper		-> Delete();	
+	_sphereMapper	-> Delete();	
+	_cylinderMapper	-> Delete();	
+	_cubeActor		-> Delete();	
+	_sphereActor	-> Delete();	
+	_cylinderActor	-> Delete();	
+//	_xyplot->RemoveAllInputs();	
+	_xyplot			-> Delete();	
+	_histogrammeVector->Delete();	
+	_renplotter->Delete();
+	
+	if(_wxvtkbaseView!=NULL){
+		delete _wxvtkbaseView;
+	}
+	//delete _vtkclipping3Ddataviewer;
+	
 
-	delete _wxvtkbaseView;
+	//fclose(file);
 
 }
 
@@ -4486,10 +4626,10 @@ wxWindow *wxPanelCuttingImageData::CreatePlotHistogrammeInterface()
 	_wxvtkbaseView = new wxVtkBaseView(this);
 	_wxvtkbaseView->Configure();
 
-	vtkRenderer *ren = vtkRenderer::New();
+	_renplotter = vtkRenderer::New();
 	vtkRenderWindow *renWin = _wxvtkbaseView->GetRenWin();
-	renWin->AddRenderer( ren );
-	ren->AddActor2D( _xyplot );
+	renWin->AddRenderer( _renplotter );
+	_renplotter->AddActor2D( _xyplot );
 
 	return _wxvtkbaseView->GetWxVTKRenderWindowInteractor();
 }
@@ -4539,7 +4679,7 @@ void wxPanelCuttingImageData::CreateInterface()
 	_infoPixHi	= new wxStaticText(this,-1,_T("############"));
 
 
-	wxWindow *panelPlotHistogramme = CreatePlotHistogrammeInterface();
+	
 
 	_typeFig->Append(_T("Cylindre"));
 	_typeFig->Append(_T("Cube"));
@@ -4631,6 +4771,9 @@ void wxPanelCuttingImageData::CreateInterface()
 //    wxBoxSizer *sizerHor = new wxBoxSizer(wxHORIZONTAL);
     wxBoxSizer *sizerHor = new wxBoxSizer(wxVERTICAL);
 	sizerHor -> Add( topsizer				, 1 , wxALL | wxEXPAND  ,0);
+
+
+	wxWindow *panelPlotHistogramme = CreatePlotHistogrammeInterface();
 	sizerHor -> Add( panelPlotHistogramme	, 1 , wxGROW  ,0);
 
 
@@ -5440,11 +5583,12 @@ wxMPRWidget::wxMPRWidget( wxWindow* parent,
 
 
 	
-	_framePanelCutting				= NULL;
+	_framePanelCutting				= NULL;	
 	_panelCutting					= NULL;
 
 
 	wxBoxSizer			*sizer		= new wxBoxSizer(wxVERTICAL  );
+	_marImageData=NULL;
 
 	if(marimageData!=NULL){
 		_marImageData					= marimageData;
@@ -5478,20 +5622,33 @@ wxMPRWidget::wxMPRWidget( wxWindow* parent,
 	_refreshBPage=0;
 
 }
-void wxMPRWidget::setMarImage(marImageData *marimageData, double voxelsize){
-	_marImageData					= marimageData;
+void wxMPRWidget::setImageData(vtkImageData * img, double voxelsize){
+
+	if(_marImageData!=NULL){
+		_marImageData->removeImageData(0);
+		_marImageData->AddImageData(img);		
+	}else{
+		_marImageData = new marImageData(img);
+	}
+	
 	_voxelSize						= voxelsize;
-	_vtkmprbasedata					= new vtkMPRBaseData(); 
-	_vtkmprbasedata->SetMarImageData(_marImageData);	
 
-	wxSplitterWindow	*pnlSplitter		= new wxSplitterWindow( this , -1);
-	pnlSplitter	-> SetMinimumPaneSize( 2 );
+	if(_vtkmprbasedata==NULL){
+		_vtkmprbasedata					= new vtkMPRBaseData(); 
+		_vtkmprbasedata->SetMarImageData(_marImageData);	
 
-	wxPanel				*MPRPanel	= CreateMPRPanel(pnlSplitter,_vtkmprbasedata);
-	wxPanel				*controlPanel	= CreateControlPanel(pnlSplitter);	
-	pnlSplitter	-> SplitVertically( MPRPanel, controlPanel, 550 );
+		wxSplitterWindow	*pnlSplitter		= new wxSplitterWindow( this , -1);
+		pnlSplitter	-> SetMinimumPaneSize( 2 );
 
-	this->GetSizer()		-> Add( pnlSplitter ,1,wxGROW  ,0);
+		wxPanel				*MPRPanel	= CreateMPRPanel(pnlSplitter,_vtkmprbasedata);
+		wxPanel				*controlPanel	= CreateControlPanel(pnlSplitter);	
+		pnlSplitter	-> SplitVertically( MPRPanel, controlPanel, 550 );
+
+		this->GetSizer()		-> Add( pnlSplitter ,1,wxGROW  ,0);
+	}	
+	
+
+	
 }
 //----------------------------------------------------------------------------
 
@@ -5880,11 +6037,16 @@ wxPanel* wxMPRWidget::CreateMPRPanel4View(wxWindow *parent, vtkMPRBaseData *vtkm
 //----------------------------------------------------------------------------
 void wxMPRWidget::OnCutImagaData(wxCommandEvent &event) 
 {
-	if (_btnCutImageData->GetValue()==true){
+	if (_btnCutImageData->GetValue()==true){		
+       
 		_framePanelCutting = new wxFrame(this,-1,_T("Cutting Module"),wxDefaultPosition,wxDefaultSize,wxCAPTION|wxSTAY_ON_TOP| wxRESIZE_BORDER );
+		
 		_framePanelCutting->SetSize(550,400);
-		_panelCutting	= new wxPanelCuttingImageData(_framePanelCutting);
-		_panelCutting->SetWxVtk3DBaseView( _wxvtk3Dbaseview_Clipping3D_BB  );
+
+		_panelCutting	= new wxPanelCuttingImageData(_framePanelCutting);		
+		if(_wxvtk3Dbaseview_Clipping3D_BB!=NULL){
+			_panelCutting->SetWxVtk3DBaseView( _wxvtk3Dbaseview_Clipping3D_BB  );
+		}
 		_panelCutting->SetVtkMPRBaseData( GetVtkMPRBaseData() );
 		_panelCutting->SetVtkClipping3DDataViewer( this->_wxvtkclipping3Dview_BB->GetVtkClipping3DDataViewer() );
 		_panelCutting->Configure( );
@@ -5898,12 +6060,14 @@ void wxMPRWidget::OnCutImagaData(wxCommandEvent &event)
 //		_framePanelCutting->FitInside();
 */
 		_framePanelCutting->Show();
+
+		
 	} else {
 		if (_framePanelCutting!=NULL){
-			_panelCutting->RemoveActors();
-			_framePanelCutting->Close();
-			_framePanelCutting	= NULL;
-			_panelCutting		= NULL;
+			_panelCutting->RemoveActors();			
+			_framePanelCutting->Destroy();
+			_framePanelCutting=NULL;
+			_panelCutting=NULL;
 		}
 	}
 }
@@ -5914,9 +6078,14 @@ void wxMPRWidget::ConfigureVTK(){
 
 	if (_vtkmprbasedata!=NULL)
 	{
+		_vtkmprbasedata->Configure();
 		x=_vtkmprbasedata			->	GetMaxPositionX()/2;
 		y=_vtkmprbasedata			->	GetMaxPositionY()/2;
-		z=_vtkmprbasedata			->	GetMaxPositionZ()/2;
+		z=_vtkmprbasedata			->	GetMaxPositionZ()/2;	
+		_vtkmprbasedata->SetX( x );
+		_vtkmprbasedata->SetY( y );
+		_vtkmprbasedata->SetZ( z );
+	
 	}
 
 	if(_vtkmpr2Dview[0]!=NULL) {_vtkmpr2Dview[0]				->	Configure();}
@@ -5929,12 +6098,7 @@ void wxMPRWidget::ConfigureVTK(){
 	if (_vtkmpr2Dview_B[2]!=NULL) { _vtkmpr2Dview_B[2]				->	Configure(); }
 
 
-	if (_vtkmprbasedata!=NULL)
-	{
-		_vtkmprbasedata->SetX( x );
-		_vtkmprbasedata->SetY( y );
-		_vtkmprbasedata->SetZ( z );
-	}
+	
 
 	if (_vtkplane2Dview!=NULL){_vtkplane2Dview				->	Configure();}
 	if (_widgetMesure!=NULL){_widgetMesure					->	ConfigureA(_vtkplane2Dview);}
@@ -6108,7 +6272,7 @@ void wxMPRWidget::RefreshView(bool firsttime){
 
 }
 //----------------------------------------------------------------------------
-vtkMPRBaseData  *wxMPRWidget::GetVtkMPRBaseData(){
+vtkMPRBaseData  *wxMPRWidget::GetVtkMPRBaseData(){	
 	return _vtkmprbasedata;
 }
 //----------------------------------------------------------------------------
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.h
index c98583a..f682765 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.h
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMPRWidget.h,v $
   Language:  C++
-  Date:      $Date: 2009/03/24 10:49:21 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2009/05/04 07:35:42 $
+  Version:   $Revision: 1.8 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -421,6 +421,7 @@ public:
 	void		OnVisiblePlane(wxCommandEvent& event);
 	void		OnEditColorTable(wxCommandEvent& event);
 	virtual void Refresh();
+	void		UpdateControlPanel();
 
 private:
 	wxVtkMPR3DView	*_wxvtkmpr3Dview;
@@ -530,7 +531,7 @@ class creaMaracasVisu_EXPORT wxVtkMPR3DView
 {
 public:
 	wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview );
-	virtual ~wxVtkMPR3DView();
+	virtual ~wxVtkMPR3DView();	
 	void				VisibleImageActor(int idPosition, bool visible);
 	void				VisiblePointWidget( bool visible );
 	void				VisiblePlaneWidget( bool visible );
@@ -543,7 +544,7 @@ public:
 	void				SetVtkMPR3DDataViewer( vtkMPR3DDataViewer *vtkmpr3Ddataviewer );
 	wxPanel*			CreateControlPanel(wxWindow *parent);
 
-	vtkMPR3DDataViewer* GetVtkMPR3DDataViewer();
+	vtkMPR3DDataViewer* GetVtkMPR3DDataViewer()throw (char*);
 	wxVtk3DBaseView*	GetWxvtk3Dbaseview();
 
 	void				InitOrientationPointWidget(); 
@@ -552,6 +553,8 @@ public:
 	void				TestLoic1();
 	void				TestLoic2();
 
+	void RemoveActor(vtkActor* actor);
+	void ResetCamera(int *ext=NULL, double* origin=NULL,double* spc=NULL);
 
 private:
 	wxVtk3DBaseView					*_wxvtk3Dbaseview;
@@ -566,6 +569,10 @@ private:
 	// Point Widget (3D)
 	vtkPointWidget					*_pointWidget;
 	vtkmyPWCallback_3DPointWidget	*_myCallback;
+	vtkProbeFilter *_probe;
+	vtkPolyDataMapper *_contourMapper;
+
+	
 
 protected:
 };
@@ -594,7 +601,7 @@ public:
 	void						SetVisibleBoxVolume(bool visible);
 	void						SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation );
 
-	wxVtk3DBaseView*			GetWxvtk3Dbaseview();
+	wxVtk3DBaseView*			GetWxvtk3Dbaseview()throw(char*);
 
 private:
 	wxVtk3DBaseView					*_wxvtk3Dbaseview;
@@ -815,6 +822,7 @@ private:
 	vtkImageData					*_histogrammeVector;
 	vtkXYPlotActor					*_xyplot;
 	wxVtkBaseView					*_wxvtkbaseView;
+	vtkRenderer						*_renplotter;
 
 	void	CreateModel();
 	void	CreateInterface();
@@ -965,7 +973,7 @@ public:
 	//returns the 2d view of the specific direction (0|1|2)
 	wxVtkMPR2DView *GetWxvtkMPR2Dview(int direction);
 
-	void setMarImage(marImageData *marimageData, double voxelsize);
+	void setImageData(vtkImageData * img, double voxelsize);
 
 private:
 	double					_voxelSize;
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx
index 2317a81..4610a7b 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracasIRMView.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/04/15 12:35:01 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2009/05/04 07:35:42 $
+  Version:   $Revision: 1.6 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -87,7 +87,7 @@ void wxMaracasIRMView::changeOpacity(int _propid, int value){
 	irmmanager->changeOpacity(_propid,value);
 }
 
-void wxMaracasIRMView::changeIsoValue(int propid, int value){	
+void wxMaracasIRMView::changeIsoValue(int propid, double value){	
 	irmmanager->changeIsoValue(propid, value);
 }
 
@@ -194,7 +194,16 @@ void wxMaracasIRMView::addIRMViewPanel(wxMaracasIRMViewPanel* irmview, std::stri
 	wxAuiPaneInfo paneinfo;	
 	wxauimanager->AddPane(irmview, paneinfo.DefaultPane().Centre().DestroyOnClose().Caption(s));
 	wxauimanager->Update();
+	
+	
+}
 
+void wxMaracasIRMView::deleteActor(int propid){
+	try{
+		irmmanager->deleteActor(propid);
+	}catch(char* e){
+		
+	}
 }
 
 /**
@@ -206,43 +215,47 @@ wxMaracasIRMViewProp3D::wxMaracasIRMViewProp3D(wxWindow* parent,int propid)
 	createControls();	
 }
 
-wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D(){
-	//this->Show(false);
-	delete _colorchoose;
-	wxMaracasIRMView::getInstance()->addRemoveActor(_propid, false);
+wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D(){	
+	//wxMaracasIRMView::getInstance()->addRemoveActor(_propid, false);
+	wxMaracasIRMView::getInstance()->deleteActor(_propid);
 }
 
 void wxMaracasIRMViewProp3D::createControls(){
 
+	wxFlexGridSizer* sizerirmprop = new wxFlexGridSizer(1,1,1);
+	
 	wxString choices[2];
 	choices[0] = wxString(_T("On"));
 	choices[1] = wxString(_T("Off"));
 	checkbox = new  wxCheckBox(this,-1,wxString(_T("Show Actor")));
-	this->addControl(checkbox);
-
 	Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onCheckBoxChange);	
 	checkbox->SetValue(true);	
+
+	sizerirmprop->Add(checkbox,wxFIXED_MINSIZE);
+
+	//this->addControl(checkbox);	
 	
-	//std::string iconfile = wxMaracasIRMView::getInstance()->getPath();
-	//iconfile+= "/Data/Icons/Color.png";
-	//wxBitmap* bitmap = new wxBitmap(wxString(iconfile.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);	
 	wxBitmap bitmap(Color_xpm);
 	_colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));	
-	Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onColorChange);		
-
-	wxBoxSizer* sizercolor = new wxBoxSizer(wxVERTICAL);
-	sizercolor->Add(checkbox,wxFIXED_MINSIZE);
-	sizercolor->Add(_colorchoose,wxFIXED_MINSIZE);
-	this->addControl(sizercolor);
+	Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onColorChange);			
+	sizerirmprop->Add(_colorchoose,wxFIXED_MINSIZE);	
 
+	//sizercolor->Add(checkbox,wxFIXED_MINSIZE);
+	//sizercolor->Add(_colorchoose,wxFIXED_MINSIZE);
+	//this->addControl(sizercolor);
+	
 	
 	wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity")));		
 	opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS);	
 	Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onOpacityRelease);	
-	wxBoxSizer* sizeropacity = new wxBoxSizer(wxVERTICAL);	
+	wxFlexGridSizer* sizeropacity = new wxFlexGridSizer(1,1,1);	
 	sizeropacity->Add(label,wxFIXED_MINSIZE);
 	sizeropacity->Add(opacity,wxFIXED_MINSIZE);
-	this->addControl(sizeropacity);
+
+	sizerirmprop->Add(sizeropacity,wxFIXED_MINSIZE);
+
+	//this->addControl(sizeropacity);
+	this->addControl(sizerirmprop);
 	
 }
 void wxMaracasIRMViewProp3D::onCheckBoxChange(wxCommandEvent& event){	
@@ -254,9 +267,9 @@ void wxMaracasIRMViewProp3D::onColorChange(wxCommandEvent& event){
 		wxColour colour = colourdiag->GetColourData().GetColour();
 		_colorchoose->SetBackgroundColour(colour);
 
-		float r = colour.Red()/255;
-		float g = colour.Green()/255;
-		float b = colour.Blue()/255;
+		double r = (double)(colour.Red())/255.0;
+		double g = (double)(colour.Green())/255.0;
+		double b = (double)(colour.Blue())/255.0;
 		
 		wxMaracasIRMView::getInstance()->changeColor(this->getPropId(),r,g,b);
 	}
@@ -286,8 +299,8 @@ wxMaracasIRMViewProp3DMHD::~wxMaracasIRMViewProp3DMHD(){
 	//wxMaracasIRMView::getInstance()->addRemoveActor(_propid, false);
 }
 void wxMaracasIRMViewProp3DMHD::createControls(int maxisovalue){
-
-	wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
+	
+	wxFlexGridSizer* sizer = new wxFlexGridSizer(1,1,1);
 
 	wxStaticText* label = new wxStaticText(this, -1, wxString(_T("IsoValue")));
 	sizer->Add(label, wxGROW);
@@ -302,7 +315,7 @@ void wxMaracasIRMViewProp3DMHD::createControls(int maxisovalue){
 
 void wxMaracasIRMViewProp3DMHD::onIsoValueRelease(wxScrollEvent& event ){
 
-	wxMaracasIRMView::getInstance()->changeIsoValue(this->getPropId(), isovalue->GetValue());
+	wxMaracasIRMView::getInstance()->changeIsoValue(this->getPropId(), isovalue->GetValue()/1.0);
 	
 }
 /**
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.h
index 141c09c..441f78c 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.h
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracasIRMView.h,v $
   Language:  C++
-  Date:      $Date: 2009/04/09 13:58:38 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/05/04 07:35:42 $
+  Version:   $Revision: 1.3 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -133,7 +133,7 @@ public:
 
 	void changeOpacity(int propid, int value);
 
-	void changeIsoValue(int propid, int value);
+	void changeIsoValue(int propid, double value);
 
     void addRemoveActor(int propid, bool addremove);
 
@@ -153,6 +153,7 @@ public:
 
 	std::string getPath();
 
+	void deleteActor(int propid);
 private:
 	static wxMaracasIRMView* instance;
 
@@ -163,6 +164,7 @@ private:
 	void createFileChooser();
 
 	std::string _path;
+
 };
 
 
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx
index 1b3ec36..c655d51 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracasIRMViewManager.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/04/14 12:47:30 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2009/05/04 07:35:42 $
+  Version:   $Revision: 1.4 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -49,7 +49,7 @@ int wxMaracasIRMViewManager::addProp3D(vtkProp3D* prop3D, std::string dataname)
 	}
 	return -1;
 }
-int wxMaracasIRMViewManager::addPropMHD(vtkImageData* imagedata, std::string dataname){
+int wxMaracasIRMViewManager::addPropMHD(vtkImageData* imagedata, std::string dataname) throw(char*){
 
 	checkInvariant();
 	if(imagedata != NULL){
@@ -98,14 +98,14 @@ void wxMaracasIRMViewManager::changeOpacity(int propid, int value)  throw(char*)
 /**
 **	changes the isovalue in a prop3D
 **/
-void wxMaracasIRMViewManager::changeIsoValue(int propid, int value )throw(char*){
+void wxMaracasIRMViewManager::changeIsoValue(int propid, double value )throw(char*){
 	checkInvariant();	
 
 	wxMaracasIRMViewManagerData* data = this->getViewData(propid);		
 
-	_renderer->RemoveViewProp(data->getProp3D());
+	//_renderer->RemoveActor(data->getProp3D());
 	data->changeIsoValue(value);
-	_renderer->AddViewProp(data->getProp3D());
+	//_renderer->AddActor(data->getProp3D());
 
 	_renderer->Render();
 }
@@ -169,6 +169,37 @@ void wxMaracasIRMViewManager::changeColor(int propid, double red, double green,
 	checkInvariant();	
 	this->getViewData(propid)->changeColor(red, green, blue);
 
+	_renderer->Render();
+}
+
+void wxMaracasIRMViewManager::deleteActor(int propid) throw (char *){
+	checkInvariant();	
+
+	this->addRemoveActor(propid, false);
+
+	int i,n;
+	bool exit = false;
+	for(i = 0; i < prop3Dvect.size()&&!exit;i++){
+		if(prop3Dvect[i]->getId() == propid){			
+			n=i;
+			exit = true;
+		}
+	}
+	if(exit){
+		wxMaracasIRMViewManagerData* data = prop3Dvect[n];			
+		int j;
+		for(j = i; j < prop3Dvect.size()-1;j++){
+			prop3Dvect[j] = prop3Dvect[j+1];
+		}		
+		delete data;
+		prop3Dvect.pop_back();
+	}else{
+		throw "id not found in the data";
+	}
+
+	
+	
+    
 }
 
 /********************************************************************************************
@@ -177,9 +208,13 @@ void wxMaracasIRMViewManager::changeColor(int propid, double red, double green,
 
 wxMaracasIRMViewManagerData::wxMaracasIRMViewManagerData(vtkProp3D* prop3Dvect, std::string dataname){
 
-	_prop3D = prop3Dvect;
+	_prop3D = prop3Dvect;	
 	_dataname = dataname;
 	_maxgreylevel=-1;
+
+	_cubesFilter=NULL;
+	_cleanFilter=NULL;	
+	_dataMapper=NULL;
 }
 wxMaracasIRMViewManagerData::wxMaracasIRMViewManagerData(vtkImageData* imagedata, std::string dataname){
 
@@ -189,52 +224,51 @@ wxMaracasIRMViewManagerData::wxMaracasIRMViewManagerData(vtkImageData* imagedata
 	_maxgreylevel = getMaxLevel(imagedata);
 	_prop3D=NULL;			
 
-	this->changeIsoValue(this->_maxgreylevel);
-}
-/**
-**	changes the isovalue in a prop3D
-**/
-void wxMaracasIRMViewManagerData::changeIsoValue(int value){	
-	
-
-	if(_prop3D!=NULL){
-		_prop3D->Delete();
-		_polydata->Delete();
-		_dataMapper->Delete();
-	}
-
-	vtkMarchingCubes *cubesFilter = vtkMarchingCubes::New();
-    cubesFilter->SetInput(this->_imagedata);
-    cubesFilter->SetValue(0,value);
-	cubesFilter->ComputeGradientsOn ();
-    cubesFilter->ComputeScalarsOn ();
-	cubesFilter->SetNumberOfContours( 1 );
+	_cubesFilter = vtkMarchingCubes::New();
+	_cleanFilter = vtkCleanPolyData::New();		
+	_dataMapper = vtkPolyDataMapper::New();
+	vtkActor* dataActor = vtkActor::New();
 	
-	// Unir puntos duplicados y remover primitivas degeneradas
-	vtkCleanPolyData *cleanFilter = vtkCleanPolyData::New();
-    cleanFilter->SetInput ( cubesFilter->GetOutput() );
-	cleanFilter->Update();
-
-	_polydata = vtkPolyData::New();
-	_polydata->DeepCopy(cleanFilter->GetOutput());
+	_cubesFilter->SetInput(this->_imagedata);
+	_cubesFilter->ComputeGradientsOn ();
+	_cubesFilter->ComputeScalarsOn ();
+	_cubesFilter->SetNumberOfContours( 1 );
+	_cleanFilter->SetInput ( _cubesFilter->GetOutput() );
+	_dataMapper->SetInput(_cleanFilter->GetOutput());
+	_dataMapper->ScalarVisibilityOff();
+	_dataMapper->ImmediateModeRenderingOn();
+	dataActor->SetMapper(_dataMapper);	
 
-	cubesFilter->Delete();
-	cleanFilter->Delete();
+	this->_prop3D = dataActor;
 
+	this->changeIsoValue(this->_maxgreylevel);	
 
-	_dataMapper = vtkPolyDataMapper::New();
-	_dataMapper->SetInput(_polydata);
 
-	vtkActor* dataActor = vtkActor::New();
-	dataActor->SetMapper(_dataMapper);	
-	_prop3D = dataActor;	
+}
+/**
+**	changes the isovalue in a prop3D
+**/
+void wxMaracasIRMViewManagerData::changeIsoValue(double value){	
+		
+   
+    _cubesFilter->SetValue(0,value);		
+	_cubesFilter->Update();    
+	_cleanFilter->Update();
+	_dataMapper->Update();	
+	
 	
 	
 }
 int wxMaracasIRMViewManagerData::getMaxGreyLevel(){
 	return _maxgreylevel;
 }
-wxMaracasIRMViewManagerData::~wxMaracasIRMViewManagerData(){
+wxMaracasIRMViewManagerData::~wxMaracasIRMViewManagerData(){	
+	if(_cubesFilter!=NULL){
+		_cubesFilter->Delete();
+		_cleanFilter->Delete();
+		_dataMapper->Delete();
+	}
+	_prop3D->Delete();	
 }
 /**
 **	Adds a prop3D to the world of the application
@@ -275,10 +309,18 @@ void wxMaracasIRMViewManagerData::setProp3D(vtkProp3D* prop3D){
 **	Changes the opacity in a prop3D
 **/
 void wxMaracasIRMViewManagerData::changeOpacity(int value){
-	vtkActor* actor = (vtkActor*)_prop3D;
+	std::cout<<"chage op"<<value<<std::endl;
+	vtkActor* actor = (vtkActor*)this->_prop3D;	
 	actor->GetProperty()->SetOpacity((double)value/100.0);
-}
 
+	
+
+}
+void wxMaracasIRMViewManagerData::changeColor(double red, double green, double blue){
+	std::cout<<"chage col"<<red<<green<<blue<<std::endl;
+    vtkActor* actor = (vtkActor*)this->_prop3D;	
+	actor->GetProperty()->SetColor(red,green,blue);	
+}
 /**
 **	Check if the variables are setted correctly
 **/
@@ -289,7 +331,7 @@ void wxMaracasIRMViewManagerData::checkInvariant(){
 **	get the prop3D 
 **/
 vtkProp3D* wxMaracasIRMViewManagerData::getProp3D(){
-	return _prop3D;
+	return this->_prop3D;
 }
 /**
 **	return the id from the daat
@@ -317,7 +359,4 @@ void wxMaracasIRMViewManagerData::setDataname(std::string dataname){
 	_dataname = dataname;
 }
 
-void wxMaracasIRMViewManagerData::changeColor(double red, double green, double blue){
-    vtkActor* actor = (vtkActor*)_prop3D;	
-	actor->GetProperty()->SetColor(red,green,blue);
-}
+
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h
index b3be47c..bd3e892 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracasIRMViewManager.h,v $
   Language:  C++
-  Date:      $Date: 2009/04/14 12:47:30 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2009/05/04 07:35:42 $
+  Version:   $Revision: 1.4 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -61,7 +61,7 @@ public:
 	/**
 	**	changes the isovalue in a prop3D
 	**/
-	void changeIsoValue(int value);	
+	void changeIsoValue(double value);	
 	/**
 	**	Check if the variables are setted correctly
 	**/
@@ -100,7 +100,7 @@ public:
 	/**
 	**	Changes the color of the actor
 	**/
-	void changeColor(double red, double green, double blue);
+	void changeColor(double red, double green, double blue);	
 	
 private:	
 	vtkProp3D* _prop3D;
@@ -110,10 +110,12 @@ private:
 	int _maxgreylevel;
 
 	/**
-	**
+	** to the image render
 	**/
+	vtkMarchingCubes* _cubesFilter;
+	vtkCleanPolyData* _cleanFilter;	
 	vtkPolyDataMapper* _dataMapper;
-	vtkPolyData* _polydata;
+	
 	/**
 	** Get's the max grey level of the image
 	**/
@@ -140,7 +142,7 @@ public:
 	/**
 	**	Adds a prop3D to the manager and returns the identifier
 	**/
-	int addPropMHD(vtkImageData* imagedata, std::string dataname);
+	int addPropMHD(vtkImageData* imagedata, std::string dataname) throw(char*);
 	/**
 	**	Changes the opacity in a prop3D
 	**/
@@ -149,7 +151,7 @@ public:
 	/**
 	**	changes the isovalue in a prop3D
 	**/
-	void changeIsoValue(int propid, int value)throw(char*);
+	void changeIsoValue(int propid, double value)throw(char*);
 
 	/**
 	**	loads a prop3D from a nSTL file
@@ -185,6 +187,8 @@ public:
 	**	Changes the color of the actor
 	**/
 	void changeColor(int propid, double red, double green, double blue) throw(char*);
+
+	void deleteActor(int propid)throw (char *);
 	
 private:	
 	std::vector<wxMaracasIRMViewManagerData*> prop3Dvect;
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
index ff51f73..44edc24 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/04/23 16:03:30 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2009/05/04 07:35:42 $
+  Version:   $Revision: 1.8 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -49,7 +49,8 @@
 		wxwindow2	= NULL;
 		wxwindow3	= NULL;
 		wxwindow4	= NULL;
-		currentwxwindow = NULL;
+
+		_currentwxw = NULL;
 
 		wxSizer *sizer	= new wxBoxSizer(wxVERTICAL);
 		this->SetSizer(sizer);
@@ -151,11 +152,11 @@
  void wxMaracas_N_ViewersWidget::UpdateLayout(vtkImageData* imagedata){
 
 		wxWindow				*wxwindow	= NULL;
-		wxSizer *sizer	= this->GetSizer();
-	
-		if(currentwxwindow!=NULL){
-			currentwxwindow->Show(false);
-			delete currentwxwindow;
+		wxSizer *sizer	= this->GetSizer();	
+		
+		if(_currentwxw != NULL){
+			_currentwxw->Show(false);
+			delete _currentwxw;
 			//sizer->Remove(currentwxwindow);			
 			//delete currentwxwindow;
 		}
@@ -164,6 +165,7 @@
 		if (nTypeView->size()==1)
 		{
 			wxwindow1 = new wxMaracas_ViewerWidget(this, imagedata, (*nTypeView)[0]);
+
 			wxwindow1->ConfigureVTK();
 			wxwindow = wxwindow1;
 		}else	if (nTypeView->size()==2)	{
@@ -210,8 +212,8 @@
 		//panel->SetDimension()
 		sizer->Add( wxwindow , 1, wxEXPAND);
 		sizer->Layout();
-		currentwxwindow = wxwindow;		
-		currentwxwindow->Show(true);
+		_currentwxw = wxwindow;		
+		_currentwxw->Show(true);
 		
 		this->Layout();
 		this->Refresh();
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h
index b7cf72b..89311f8 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_N_ViewersWidget.h,v $
   Language:  C++
-  Date:      $Date: 2009/03/24 10:49:21 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2009/05/04 07:35:42 $
+  Version:   $Revision: 1.4 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -89,7 +89,7 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel
 	wxMaracas_ViewerWidget	*wxwindow3;
 	wxMaracas_ViewerWidget	*wxwindow4;
 
-	wxWindow *currentwxwindow;
+	wxWindow *_currentwxw;
 
 
 	std::vector<int> *nTypeView;
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
index 67f26f9..5d3233f 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_ViewerWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/04/24 15:26:02 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2009/05/04 07:35:42 $
+  Version:   $Revision: 1.10 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -38,7 +38,7 @@
 
 		mType = type;
 
-   	marImageData	*marimagedata	= new marImageData( imagedata );			
+   		marImageData	*marimagedata	= new marImageData( imagedata );			
 		mvtkmprbasedata					= new vtkMPRBaseData(); 
 		mvtkmprbasedata->SetMarImageData(marimagedata);
 
@@ -51,7 +51,8 @@
 		mwxsphereview				= NULL;
 		mwxvtkclipping3Dview		= NULL;
 		mwxvtk3Dbaseview_Clipping3D	= NULL;
-		mwxvtkmpr3Dview				= NULL; 
+		mwxvtkmpr3Dview				= NULL;
+		vtkmpr3Ddataviewer			= NULL;
 
 
 		if (type==-1)
@@ -144,10 +145,11 @@
 			mwxvtk3Dbaseview_Clipping3D				= new wxVtk3DBaseView( panelClipping3D );
 
 			mwxvtkmpr3Dview							= new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D );
-			vtkMPR3DDataViewer *vtkmpr3Ddataviewer	= new vtkMPR3DDataViewer(); 
-			vtkmpr3Ddataviewer->SetVtkMPRBaseData(mvtkmprbasedata);
-			vtkmpr3Ddataviewer->Configure();
-			mwxvtkmpr3Dview->SetVtkMPR3DDataViewer(vtkmpr3Ddataviewer);
+
+
+			vtkmpr3Ddataviewer	= new vtkMPR3DDataViewer(); 	
+
+			
 
 			wxWindow	*window3D					= mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor();
 
@@ -164,6 +166,13 @@
 			panelClipping3D	-> SetMinimumPaneSize( 5 );
 			panelClipping3D	-> SplitHorizontally( panelControl , window3D , 10  );
 			wxwindow=panelClipping3D;
+
+
+			vtkmpr3Ddataviewer->SetVtkMPRBaseData(mvtkmprbasedata);			
+			//vtkmpr3Ddataviewer->Configure();
+
+			mwxvtkmpr3Dview->SetVtkMPR3DDataViewer(vtkmpr3Ddataviewer);
+			
 		}
 
 
@@ -204,6 +213,44 @@
 	void wxMaracas_ViewerWidget::ConfigureVTK()
 	{
   		int x=0,y=0,z=0;
+		int ext[6];
+		ext[0]=0;
+		ext[1]=0;
+		ext[2]=0;
+		ext[3]=0;
+		ext[4]=0;
+		ext[5]=0;
+		double org[3],spc[3];
+		org[0]=0;
+		org[1]=0;
+		org[2]=0;
+		spc[0]=0;
+		spc[1]=0;
+		spc[2]=0;
+		
+
+
+		if (mvtkmprbasedata!=NULL)
+		{
+			mvtkmprbasedata->Configure();
+			/*x = mvtkmprbasedata	->	GetMaxPositionX()/2;
+			y = mvtkmprbasedata	->	GetMaxPositionY()/2;
+			z = mvtkmprbasedata	->	GetMaxPositionZ()/2;		*/	
+
+			mvtkmprbasedata->GetImageData()->GetExtent(ext);
+			mvtkmprbasedata->GetImageData()->GetOrigin(org);
+			mvtkmprbasedata->GetImageData()->GetSpacing(spc);
+
+			x = (ext[0]+ext[1])/2;
+			y = (ext[2]+ext[3])/2;
+			z = (ext[4]+ext[5])/2;
+
+			mvtkmprbasedata->SetX( x );
+			mvtkmprbasedata->SetY( y );
+			mvtkmprbasedata->SetZ( z );
+
+		}
+		
 
 		if ( mvtk2Dbaseview				!=NULL ) { mvtk2Dbaseview				->	Configure();				}
 		if ( mvtkmpr2Dview_X			!=NULL ) { mvtkmpr2Dview_X				->	Configure();				}
@@ -217,19 +264,32 @@
 		if ( mwxsphereview				!=NULL ) { mwxsphereview				->	Configure();				}
 
 		if (mwxvtk3Dbaseview_Clipping3D	!=NULL)	{ mwxvtk3Dbaseview_Clipping3D	->	Configure();				}
-		if (mwxvtkmpr3Dview				!=NULL)	{ mwxvtkmpr3Dview				->	Configure();				}
+		
+		if (vtkmpr3Ddataviewer			!=NULL) { 			
+			vtkmpr3Ddataviewer->Configure();
+			
+		}
+		if (mwxvtkmpr3Dview				!=NULL)	{ 
+			
+			mwxvtkmpr3Dview				->	Configure();
+			mwxvtkmpr3Dview				->ResetCamera(ext,org,spc);
+			
+			
+		}
+
 		if (mwxvtkclipping3Dview		!=NULL)	{ mwxvtkclipping3Dview			->	Configure();				}
+		
 
-		if (mvtkmprbasedata!=NULL)
-		{
-			x = mvtkmprbasedata	->	GetMaxPositionX()/2;
-			y = mvtkmprbasedata	->	GetMaxPositionY()/2;
-			z = mvtkmprbasedata	->	GetMaxPositionZ()/2;
-			mvtkmprbasedata->SetX( x );
-			mvtkmprbasedata->SetY( y );
-			mvtkmprbasedata->SetZ( z );
-		}
+		
+
+		
+		//if(vtkmpr3Ddataviewer!=NULL){vtkmpr3Ddataviewer->Configure();}
 //		RefreshView();
+
+		//if (mwxvtkmpr3Dview				!=NULL)	{
+		//	mwxvtkmpr3Dview->ResetCamera();
+		//}
+
 	}
 
 	//-------------------------------------------------------------------------
@@ -261,13 +321,27 @@
 	wxVtkBaseView *wxMaracas_ViewerWidget::GetwxVtkBaseView()
 	{
 		wxVtkBaseView *wxvtkbaseview=NULL;
-		if (mvtk2Dbaseview!=NULL)				{ wxvtkbaseview = mvtk2Dbaseview;			}
-		if (mvtkmpr2Dview_X!=NULL)				{ wxvtkbaseview = mvtkmpr2Dview_X;			}
-		if (mvtkmpr2Dview_Y!=NULL)				{ wxvtkbaseview = mvtkmpr2Dview_Y;			}
-		if (mvtkmpr2Dview_Z!=NULL)				{ wxvtkbaseview = mvtkmpr2Dview_Z;			}
-		if (mvtkplane2Dview!=NULL)				{ wxvtkbaseview = mvtkplane2Dview;			}
-		if (mwxsphereview!=NULL)				{ wxvtkbaseview = mwxsphereview;			}
-		if (mwxvtk3Dbaseview_Clipping3D!=NULL)	{ wxvtkbaseview = mwxvtk3Dbaseview_Clipping3D;}
+		if (mvtk2Dbaseview!=NULL)				{ 
+			wxvtkbaseview = mvtk2Dbaseview;			
+		}
+		if (mvtkmpr2Dview_X!=NULL){ 
+			wxvtkbaseview = mvtkmpr2Dview_X;
+		}
+		if (mvtkmpr2Dview_Y!=NULL){ 
+			wxvtkbaseview = mvtkmpr2Dview_Y;
+		}
+		if (mvtkmpr2Dview_Z!=NULL){ 
+			wxvtkbaseview = mvtkmpr2Dview_Z;		
+		}
+		if (mvtkplane2Dview!=NULL){
+			wxvtkbaseview = mvtkplane2Dview;		
+		}
+		if (mwxsphereview!=NULL){ 
+			wxvtkbaseview = mwxsphereview;
+		}
+		if (mwxvtk3Dbaseview_Clipping3D!=NULL)	{ 
+			wxvtkbaseview = mwxvtk3Dbaseview_Clipping3D;
+		}
 		return wxvtkbaseview   ;
 	}
 
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h
index 1d584ad..e221d82 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_ViewerWidget.h,v $
   Language:  C++
-  Date:      $Date: 2009/04/24 12:25:31 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2009/05/04 07:35:43 $
+  Version:   $Revision: 1.4 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -93,6 +93,10 @@
 		wxVtk3DBaseView					*mwxvtk3Dbaseview_Clipping3D;
 		wxVtkMPR3DView					*mwxvtkmpr3Dview;
 
+
+		vtkMPR3DDataViewer				*vtkmpr3Ddataviewer;
+
+
   };
 
 #endif // __WX__MARACAS__VIEWERWIDGET__H__
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.cxx
index edfe3f3..d856855 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.cxx
@@ -108,9 +108,7 @@ wxSTLWidget_03::wxSTLWidget_03(wxWindow *parent)//, marInterface* mar)
 	_2_isoActorMC6		= NULL;
 	_2_isoMC6		= NULL;
 
-	//DHC STL SURFACES
-	stlInterna 		= NULL;
-	stlExterna 		= NULL;
+	
 
 	_loadSTLMapper		= NULL;
 	_loadActorSTL		= NULL;
@@ -122,6 +120,15 @@ wxSTLWidget_03::wxSTLWidget_03(wxWindow *parent)//, marInterface* mar)
     joinMapper			= NULL; 
 	joinActor		= NULL;
 
+	//DHC STL SURFACES
+	stlExterna = NULL;
+	stlInterna = NULL;
+	dsm1=NULL;
+	actorInternal = NULL;
+	dsm2 = NULL;
+	actorExternal=NULL;
+	_thresh=NULL;
+
 
 }
 //-------------------------------------------------------------------
@@ -153,11 +160,11 @@ wxPanel* wxSTLWidget_03::CreateViewPanel(wxWindow *parent)
 
 void wxSTLWidget_03::setImage(vtkImageData* img){
 
-	marImageData* marimagedata = new marImageData(img);
-
-	_wxMaracasMPR->setMarImage(marimagedata, 1);
+	_wxMaracasMPR->setImageData(img, 1);
 	_wxMaracasMPR->ConfigureVTK();
-	this->ConfigureProcessing(marimagedata,0,0,0);
+
+
+	this->ConfigureProcessing(img,0,0,0);
 	this->ConfigureSTL();
 
 	_wxMaracasMPR->Refresh();
@@ -417,14 +424,11 @@ void wxSTLWidget_03::Refresh()
 //------------------------------------------------------------------------
 
 
-void wxSTLWidget_03::ConfigureProcessing(marImageData *marimagedata, int x, int y, int z)
+void wxSTLWidget_03::ConfigureProcessing(vtkImageData *img, int x, int y, int z)
 {
     wxBusyCursor wait;
 
-	_imagedata=marimagedata->GetImageData(); // image t=0
-	_imagedata->UpdateInformation();
-	_imagedata->SetUpdateExtent(_imagedata->GetWholeExtent());
-	_imagedata->Update();
+	_imagedata=img;
 
 
 	double puntoactualprov[3];
@@ -470,63 +474,71 @@ void wxSTLWidget_03::ConfigureProcessing(marImageData *marimagedata, int x, int
 
 //	_zslice->SetRange(extprin[4], extprin[5]);
 //	_zslice->SetValue(extprin[5]/2);
-    	
-	_thresh = vtkImageThreshold::New();
-	_thresh->SetInput(_imagedata);
-	//_thresh->ReleaseDataFlagOff();
-	_thresh->SetInValue(255);
-	_thresh->SetOutputScalarTypeToUnsignedShort();
-	_thresh->SetOutValue(0);
-	//_thresh->ThresholdBetween(_sl_minSize->GetValue(), _range[1]);
-	//SIL//
-	_thresh->ThresholdBetween(sl_barrange_segmentation->GetStart(), sl_barrange_segmentation->GetEnd()); 
-
-	vtkImageCast *cast = vtkImageCast::New();
-	cast->SetInput(_thresh->GetOutput());
-	cast->SetOutputScalarTypeToUnsignedChar();
-	cast->Update();
-
-  
-	_connect = vtkImageSeedConnectivity::New();
-	_connect->SetInput(cast->GetOutput());
-	_connect->SetInputConnectValue(255);
-	_connect->SetOutputConnectedValue(255);
-	_connect->SetOutputUnconnectedValue(0);
-	_connect->AddSeed((int)(puntoactualprov[0]), (int)(puntoactualprov[1]), (int)(puntoactualprov[2]));
-//	_connect->Update();
-
-	cast3 = vtkImageCast::New();
-	cast3->SetInput(_connect->GetOutput());
-	cast3->SetOutputScalarTypeToUnsignedShort();
-	cast3->Update();
-//SIL//
+    
+	if(_thresh==NULL){
+		_thresh = vtkImageThreshold::New();
+		//_thresh->ReleaseDataFlagOff();
+		_thresh->SetInValue(255);
+		_thresh->SetOutputScalarTypeToUnsignedShort();
+		_thresh->SetOutValue(0);
+		//_thresh->ThresholdBetween(_sl_minSize->GetValue(), _range[1]);
+		//SIL//
+		_cast = vtkImageCast::New();
+		_cast->SetInput(_thresh->GetOutput());
+		_cast->SetOutputScalarTypeToUnsignedChar();
+
+		_connect = vtkImageSeedConnectivity::New();
+		_connect->SetInput(_cast->GetOutput());
+		_connect->SetInputConnectValue(255);
+		_connect->SetOutputConnectedValue(255);
+		_connect->SetOutputUnconnectedValue(0);
+
+		cast3 = vtkImageCast::New();
+		cast3->SetInput(_connect->GetOutput());
+		cast3->SetOutputScalarTypeToUnsignedShort();
+
+		_thresh2 = vtkImageThreshold::New();
+		//_thresh2->ReleaseDataFlagOff();
+		_thresh2->SetInValue(255);
+		_thresh2->SetOutputScalarTypeToUnsignedShort();
+		_thresh2->SetOutValue(0);
+		//SIL//_thresh2->ThresholdBetween(_sl_minSize->GetValue(), _sl_maxSize->GetValue());
+
+		cast2 = vtkImageCast::New();
+		cast2->SetInput(_thresh2->GetOutput());
+		cast2->SetOutputScalarTypeToUnsignedChar();
+		_connect2 = vtkImageSeedConnectivity::New();
+		_connect2->SetInput(cast2->GetOutput());
+		_connect2->SetInputConnectValue(255);
+		_connect2->SetOutputConnectedValue(255);
+		_connect2->SetOutputUnconnectedValue(0);
+
+		cast4 = vtkImageCast::New();
+		cast4->SetInput(_connect2->GetOutput());
+		cast4->SetOutputScalarTypeToUnsignedShort();
+	}
+	_thresh->RemoveAllInputs();
+	_thresh->SetInput(_imagedata);	
+	_thresh->ThresholdBetween(sl_barrange_segmentation->GetStart(), sl_barrange_segmentation->GetEnd()); 	
+	_thresh->Update();
 	
-	_thresh2 = vtkImageThreshold::New();
-	_thresh2->SetInput(_imagedata);
-	//_thresh2->ReleaseDataFlagOff();
-	_thresh2->SetInValue(255);
-	_thresh2->SetOutputScalarTypeToUnsignedShort();
-	_thresh2->SetOutValue(0);
-	//SIL//_thresh2->ThresholdBetween(_sl_minSize->GetValue(), _sl_maxSize->GetValue());
-	_thresh2->ThresholdBetween(sl_barrange_segmentation->GetStart(), sl_barrange_segmentation->GetEnd());
+	_cast->Update();  
 	
-	cast2 = vtkImageCast::New();
-	cast2->SetInput(_thresh2->GetOutput());
-	cast2->SetOutputScalarTypeToUnsignedChar();
-	cast2->Update();
 
-	_connect2 = vtkImageSeedConnectivity::New();
-	_connect2->SetInput(cast2->GetOutput());
-	_connect2->SetInputConnectValue(255);
-	_connect2->SetOutputConnectedValue(255);
-	_connect2->SetOutputUnconnectedValue(0);
+	_connect->RemoveAllSeeds();
+	_connect->AddSeed((int)(puntoactualprov[0]), (int)(puntoactualprov[1]), (int)(puntoactualprov[2]));
+	//_connect->Update();	
+	//cast3->Update();
+//SIL//	
+	_thresh2->RemoveAllInputs();
+	_thresh2->SetInput(_imagedata);	
+	_thresh2->ThresholdBetween(sl_barrange_segmentation->GetStart(), sl_barrange_segmentation->GetEnd());
+	_thresh2->Update();
+	cast2->Update();
+	_connect2->RemoveAllSeeds();
 	_connect2->AddSeed( (int)(puntoactualprov[0]), (int)(puntoactualprov[1]), (int)(puntoactualprov[2]));
-	_connect2->Update();
-
-	cast4 = vtkImageCast::New();
-	cast4->SetInput(_connect2->GetOutput());
-	cast4->SetOutputScalarTypeToUnsignedShort();
-	cast4->Update();
+	//_connect2->Update();	
+	//cast4->Update();
 }
 
 //------------------------------------------------------------------------
@@ -550,30 +562,36 @@ void wxSTLWidget_03::ConfigureVTK()
 void wxSTLWidget_03::ResetTree2_JF()
 {
 	// Remove 
-	vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
 
-    if (_2_isoActorMC6){
-		ren->RemoveActor(_2_isoActorMC6);
-	}
-    if (_2_stripfinal){
-		ren->RemoveActor(_2_stripfinal);
-	}
+	try{
 
-	// Delete 
-//	if (_2_prgov		) {	_2_prgov		-> Delete(); }
-	if (_2_mapfinal		) {	_2_mapfinal		-> Delete(); }
-	if (_2_stripfinal	) {	_2_stripfinal	-> Delete(); }
-	if (_2_isoMapperMC6	) {	_2_isoMapperMC6	-> Delete(); }
-	if (_2_isoActorMC6	) {	_2_isoActorMC6	-> Delete(); }
-	if (_2_isoMC6		) {	_2_isoMC6		-> Delete(); }
+		vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
 
-	// Init
-//	_2_prgov		= NULL;
-	_2_mapfinal		= NULL;
-	_2_stripfinal	= NULL;
-	_2_isoMapperMC6	= NULL;
-	_2_isoActorMC6	= NULL;
-	_2_isoMC6		= NULL;
+		if (_2_isoActorMC6){
+			ren->RemoveActor(_2_isoActorMC6);
+		}
+		if (_2_stripfinal){
+			ren->RemoveActor(_2_stripfinal);
+		}
+
+		// Delete 
+	//	if (_2_prgov		) {	_2_prgov		-> Delete(); }
+		if (_2_mapfinal		) {	_2_mapfinal		-> Delete(); }
+		if (_2_stripfinal	) {	_2_stripfinal	-> Delete(); }
+		if (_2_isoMapperMC6	) {	_2_isoMapperMC6	-> Delete(); }
+		if (_2_isoActorMC6	) {	_2_isoActorMC6	-> Delete(); }
+		if (_2_isoMC6		) {	_2_isoMC6		-> Delete(); }
+
+		// Init
+	//	_2_prgov		= NULL;
+		_2_mapfinal		= NULL;
+		_2_stripfinal	= NULL;
+		_2_isoMapperMC6	= NULL;
+		_2_isoActorMC6	= NULL;
+		_2_isoMC6		= NULL;
+	}catch(char* e){
+		std::cout<<e<<std::endl;
+	}
 }
 
 
@@ -813,19 +831,23 @@ void wxSTLWidget_03::OnOpacitySTLFile(wxScrollEvent& event)
 void wxSTLWidget_03::Reset_vtk_STLFile()
 {
 	// Remove
-	vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
-    if (_loadActorSTL){
-		ren->RemoveActor(_loadActorSTL);
+	try{
+		vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
+		if (_loadActorSTL){
+			ren->RemoveActor(_loadActorSTL);
+		}
+
+		// Delete 
+		if (_loadSTLMapper		) {	_loadSTLMapper		-> Delete(); }
+		if (_loadActorSTL		) {	_loadActorSTL		-> Delete(); }
+
+		// Init
+		_loadSTLMapper		= NULL;
+		_loadActorSTL		= NULL;
+	}catch(char * e){
+		std::cout<<e<<std::endl;
 	}
 
-	// Delete 
-	if (_loadSTLMapper		) {	_loadSTLMapper		-> Delete(); }
-	if (_loadActorSTL		) {	_loadActorSTL		-> Delete(); }
-
-	// Init
-	_loadSTLMapper		= NULL;
-	_loadActorSTL		= NULL;
-
 }
 //------------------------------------------------------------------------
 void wxSTLWidget_03::OnBtnSTLFileErase(wxCommandEvent& event)
@@ -874,31 +896,37 @@ void wxSTLWidget_03::OnBtnSTLFileLoad(wxCommandEvent& event)
 
 void wxSTLWidget_03::ConfigureSTL()
 {
-	stlExterna = vtkPolyData::New();
-	stlInterna = vtkPolyData::New();
 
-	dsm1 = vtkPolyDataMapper ::New();
-    dsm1->SetInput (stlInterna); 
-    dsm1->ScalarVisibilityOff();
+	if(stlExterna == NULL){
+		stlExterna = vtkPolyData::New();
+		stlInterna = vtkPolyData::New();
 
-    actorInternal = vtkActor::New();
-    actorInternal->SetMapper (dsm1);
-    actorInternal->GetProperty()->SetColor (0,1,0);
+		dsm1 = vtkPolyDataMapper ::New();
+		dsm1->SetInput (stlInterna); 
+		dsm1->ScalarVisibilityOff();
 
-    dsm2 = vtkPolyDataMapper ::New();
-    dsm2->SetInput (stlExterna);
-    dsm2->ScalarVisibilityOff();
+		actorInternal = vtkActor::New();
+		actorInternal->SetMapper (dsm1);
+		actorInternal->GetProperty()->SetColor (0,1,0);
 
-    actorExternal= vtkActor::New();
-    actorExternal->SetMapper (dsm2);
-    actorExternal->GetProperty()->SetRepresentationToWireframe();
+		dsm2 = vtkPolyDataMapper ::New();
+		dsm2->SetInput (stlExterna);
+		dsm2->ScalarVisibilityOff();
 
-//    vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer();
-	vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
-    ren->AddActor(actorInternal);
-    ren->AddActor(actorExternal);
+		actorExternal= vtkActor::New();
+		actorExternal->SetMapper (dsm2);
+		actorExternal->GetProperty()->SetRepresentationToWireframe();
 
-	stlExtractor = new vtkSTLExtractor();  
+	//    vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer();
+		vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
+		ren->AddActor(actorInternal);
+		ren->AddActor(actorExternal);
+
+		stlExtractor = new vtkSTLExtractor();  
+
+	}
+
+	
 }
 
 void wxSTLWidget_03::generateSTLSurfaces()
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.h
index 916ca39..e1eabbf 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.h
@@ -98,6 +98,7 @@ private:
 	vtkImageCast				*cast4; // binary segmentation result
 	vtkImageThreshold			*_thresh;
 	vtkImageThreshold			*_thresh2;
+	vtkImageCast * _cast;
 	vtkImageSeedConnectivity	*_connect;
 	vtkImageSeedConnectivity	*_connect2;
 
@@ -152,7 +153,7 @@ private:
 	//---------------------
 	// Processing
 	//---------------------
-	void ConfigureProcessing(marImageData *marimagedata, int x, int y, int z);
+	void ConfigureProcessing(vtkImageData *img, int x, int y, int z);
 
 
 	//---------------------
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx
index b2340f6..8881c82 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx
@@ -3,8 +3,8 @@
   Program:   Visualization Toolkit
   Module:    $RCSfile: wxVTKRenderWindowInteractor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/10/31 16:32:44 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/05/04 07:35:43 $
+  Version:   $Revision: 1.2 $
 
   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
   All rights reserved.
@@ -677,7 +677,7 @@ void wxVTKRenderWindowInteractor::OnMouseWheel(wxMouseEvent& event)
 }
 
 //---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::Render()
+void wxVTKRenderWindowInteractor::Render() throw (char*)
 {
   RenderAllowed = 1;
   if (!RenderWhenDisabled)
@@ -697,7 +697,11 @@ void wxVTKRenderWindowInteractor::Render()
     {
     if(Handle && (Handle == GetHandleHack()) )
       {
-      RenderWindow->Render();
+		  if(RenderWindow!=NULL){
+			RenderWindow->Render();
+		  }else{
+			  throw "wxVTKRenderWindowInteractor::Render(){RenderWindow not set}";
+		  }
       }
 #if VTK_MAJOR_VERSION == 5 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 2)
     else if(GetHandleHack())
@@ -705,10 +709,12 @@ void wxVTKRenderWindowInteractor::Render()
       //this means the user has reparented us; let's adapt to the
       //new situation by doing the WindowRemap dance
       //store the new situation
-      Handle = GetHandleHack();
-      RenderWindow->SetNextWindowId(reinterpret_cast<void *>(Handle));
-      RenderWindow->WindowRemap();
-      RenderWindow->Render();
+		  if(RenderWindow!=NULL){
+			Handle = GetHandleHack();
+			RenderWindow->SetNextWindowId(reinterpret_cast<void *>(Handle));
+			RenderWindow->WindowRemap();
+			RenderWindow->Render();
+		  }
       }
 #endif
     }
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h
index 098884c..1482efa 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h
@@ -3,8 +3,8 @@
   Program:   Visualization Toolkit
   Module:    $RCSfile: wxVTKRenderWindowInteractor.h,v $
   Language:  C++
-  Date:      $Date: 2008/10/31 16:32:44 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/05/04 07:35:43 $
+  Version:   $Revision: 1.2 $
 
   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
   All rights reserved.
@@ -140,7 +140,7 @@ class /*VTK_RENDERING_EXPORT*/ wxVTKRenderWindowInteractor : public wxWindow, vi
     void OnSize(wxSizeEvent &event);
     void OnMouseWheel(wxMouseEvent& event);
 
-    void Render();
+    void Render()throw (char*);
     void SetRenderWhenDisabled(int newValue);
 
     // Description:
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx
index 7d7e7dc..163aa5f 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx
@@ -190,11 +190,15 @@ wxVtkBaseView::wxVtkBaseView(wxWindow *parent)
 //-------------------------------------------------------------------
 wxVtkBaseView::~wxVtkBaseView()
 {
- //	_iren -> Delete();
+	_iren -> Delete();
 }
 //-------------------------------------------------------------------
-wxVTKRenderWindowInteractor* wxVtkBaseView::GetWxVTKRenderWindowInteractor()
+wxVTKRenderWindowInteractor* wxVtkBaseView::GetWxVTKRenderWindowInteractor() throw (char*)
 {
+
+	if(_iren==NULL){
+		throw "wxVtkBaseView::GetWxVTKRenderWindowInteractor() _iren wxVTKRenderWindowInteractorPlus =NULL";
+	}
    return _iren;
 }
 //-------------------------------------------------------------------
@@ -1799,7 +1803,7 @@ void wxVtk3DBaseView::Configure()
 	if (_configure==false)
 	{
 		_configure=true;
-		wxVtkBaseView::Configure();
+		//wxVtkBaseView::Configure();
 		_aRenderer	= vtkRenderer::New();
 		_renWin		= vtkRenderWindow::New();
 		_renWin->AddRenderer(_aRenderer);
@@ -1833,6 +1837,7 @@ void wxVtk3DBaseView::Configure()
 		// (ResetCamera() method) this vector is used to position the camera
 		// to look at the data in this direction.
 		_aCamera = vtkCamera::New();
+
 //EED 17Avril2009	
 /*
 		_aCamera->SetViewUp (0, 0, -1);
@@ -1843,6 +1848,7 @@ void wxVtk3DBaseView::Configure()
 		
 		_aCamera->SetFocalPoint (0, 0, 0);
 		_aCamera->ComputeViewPlaneNormal();
+
 	}
 }
 //-------------------------------------------------------------------
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h
index 19f0210..2a6f3de 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h
@@ -99,7 +99,7 @@ public:
 	wxVtkBaseView( );
 	wxVtkBaseView( wxWindow *parent );
 	virtual ~wxVtkBaseView();
-	wxVTKRenderWindowInteractor		*GetWxVTKRenderWindowInteractor();
+	wxVTKRenderWindowInteractor		*GetWxVTKRenderWindowInteractor() throw (char*);
 	virtual void					Configure();
 	virtual void					Refresh();
 	virtual void					RefreshView();
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.cxx
index 2fd86e8..b7766c9 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.cxx
+++ b/lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.cxx
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracasMPR.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/03/24 10:49:18 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/05/04 07:35:45 $
+  Version:   $Revision: 1.3 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -52,8 +52,14 @@ vtkPlane2DView *wxMaracasMPR::GetVtkPlane2DView()
 	return _MPR->GetVtkPlane2DView();
 }
 //----------------------------------------------------------------------------
-wxVtkMPR3DView  *wxMaracasMPR::GetWxvtkmpr3Dview_BB()
+wxVtkMPR3DView  *wxMaracasMPR::GetWxvtkmpr3Dview_BB() throw(char*)
 { 
+	if(_MPR == NULL){ 
+        throw "wxVtkMPR3DView  *wxMaracasMPR::GetWxvtkmpr3Dview_BB() _MPR =NULL";
+	}
+	if(_MPR->GetWxvtkmpr3Dview_BB() ==NULL){
+		throw "wxVtkMPR3DView  *wxMaracasMPR::GetWxvtkmpr3Dview_BB() _MPR->GetWxvtkmpr3Dview_BB()=NULL";
+	}
 	return _MPR->GetWxvtkmpr3Dview_BB();
 }
 
@@ -63,8 +69,8 @@ void wxMaracasMPR::RefreshView()
 	_MPR->RefreshView();
 }
 
-void wxMaracasMPR::setMarImage(marImageData *marimageData, double voxelsize){
-	_MPR->setMarImage(marimageData, voxelsize);
+void wxMaracasMPR::setImageData(vtkImageData *img, double voxelsize){
+	_MPR->setImageData(img, voxelsize);
 
 }
 
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.h b/lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.h
index 717047d..e3bb62a 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.h
+++ b/lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.h
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracasMPR.h,v $
   Language:  C++
-  Date:      $Date: 2009/03/24 10:49:18 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2009/05/04 07:35:45 $
+  Version:   $Revision: 1.5 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -35,10 +35,10 @@ public:
 	void ConfigureVTK();
 	vtkMPRBaseData	*GetVtkMPRBaseData();
 	vtkPlane2DView	*GetVtkPlane2DView();
-	wxVtkMPR3DView  *GetWxvtkmpr3Dview_BB();
+	wxVtkMPR3DView  *GetWxvtkmpr3Dview_BB()throw(char*);
 	void			RefreshView();
 
-	void setMarImage(marImageData *marimageData, double voxelsize);
+	void setImageData(vtkImageData *img, double voxelsize);
 
 private:
 	 wxMPRWidget* _MPR;
diff --git a/lib/maracasVisuLib/src/kernel/marImageData.cpp b/lib/maracasVisuLib/src/kernel/marImageData.cpp
index ea1927a..c717cb9 100644
--- a/lib/maracasVisuLib/src/kernel/marImageData.cpp
+++ b/lib/maracasVisuLib/src/kernel/marImageData.cpp
@@ -26,7 +26,7 @@ marImageData::~marImageData()
 	int i,size=_imagedataLST.size();
 	for (i=0;i<size;i++)
 	{
-		_imagedataLST[i]->Delete();
+		//_imagedataLST[i]->Delete();
 	}
 	_imagedataLST.clear();
 }