]> Creatis software - creaMaracasVisu.git/commitdiff
*** empty log message ***
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Tue, 24 Mar 2009 10:49:16 +0000 (10:49 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Tue, 24 Mar 2009 10:49:16 +0000 (10:49 +0000)
18 files changed:
lib/maracasVisuLib/CMakeLists.txt
lib/maracasVisuLib/src/interface/wxWindows/CMakeLists.txt
lib/maracasVisuLib/src/interface/wxWindows/widgets/Copie de wxSTLWidget_03.cxx [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/Copie de wxSTLWidget_03.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceWidget.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.h
lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.cxx
lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.h
lib/maracasVisuLib/src/kernel/marImageData.cpp
lib/maracasVisuLib/src/kernel/marKVolume.h

index acd08ba1ec572aa736a333ee587cfeb58e984b1a..d1d8438b540b8d94cb24eb2ff829e2e95d0ecb60 100644 (file)
@@ -7,11 +7,11 @@ SET ( LIBRARY_NAME   creaMaracasVisu  )
 # CREATES A USER OPTION IN CMAKE
 OPTION ( BUILD_${LIBRARY_NAME}  "Build ${LIBRARY_NAME} library ?" ON)
 
-#OPTION ( EXPORTS_MaracasKernel  "Build ${LIBRARY_NAME} library ?" ON)
-#IF (EXPORTS_MaracasKernel)
-#      SET(MaracasKernel_EXPORTS)
-#      ADD_DEFINITIONS (-DMaracasKernel_EXPORTS)
-#ENDIF(EXPORTS_MaracasKernel)
+OPTION ( EXPORTS_MaracasKernel  "Build ${LIBRARY_NAME} library ?" ON)
+IF (EXPORTS_MaracasKernel)
+       SET(MaracasKernel_EXPORTS)
+       ADD_DEFINITIONS (-DMaracasKernel_EXPORTS)
+ENDIF(EXPORTS_MaracasKernel)
 
 #----------------------------------------------------------------------------
 IF ( BUILD_${LIBRARY_NAME} )
@@ -91,6 +91,7 @@ IF ( BUILD_${LIBRARY_NAME} )
     src/interface/wxWindows/widgets/pPlotter/mathplot.h
     src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.h
     src/interface/wxWindows/widgets/pPlotter/Histogram.h
+       src/interface/wxWindows/widgets/wxSTLWidget_03.h
     include/matrix.h
     src/kernel/marImageData.h
     src/kernel/marDicomBase.h
@@ -101,6 +102,7 @@ IF ( BUILD_${LIBRARY_NAME} )
     src/kernel/marParameters.h
     src/kernel/marDynData.h
     src/kernel/creaMaracasVisu_EXPORT.h 
+       src/kernel/vtkSTLExtractor.cpp
   )
   #----------------------------------------------------------------------------
 
@@ -122,6 +124,8 @@ IF ( BUILD_${LIBRARY_NAME} )
     src/interface/wxWindows/Contour/vectorFunctions.cxx
 #    src/interface/wxWindows/wxMaracasImageBrowser02.cxx
 #    src/interface/wxWindows/widgets/wxReadingPriorityPanel.cpp
+       
+       
     src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx
     src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.cxx
     src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.cxx
@@ -159,6 +163,7 @@ IF ( BUILD_${LIBRARY_NAME} )
     src/interface/wxWindows/widgets/pPlotter/mathplot.cxx
     src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.cxx
     src/interface/wxWindows/widgets/pPlotter/Histogram.cxx
+       src/interface/wxWindows/widgets/wxSTLWidget_03.cxx
 ###
        src/kernel/marImageData.cpp
        src/kernel/marDicomBase.cpp
@@ -167,6 +172,7 @@ IF ( BUILD_${LIBRARY_NAME} )
        src/kernel/volume.cxx
        src/kernel/marParameters.cpp
        src/kernel/marDynData.cpp       
+       src/kernel/vtkSTLExtractor.cpp
   )
   #----------------------------------------------------------------------------
 #jhcl-Start===========================================================================
index ea3827fd3906efccb708e28d3f013babf9aa568e..d5056c983db707bdbbb16da3f5a905ab8ebd1eca 100644 (file)
@@ -54,6 +54,8 @@ SET(MARACAS_LIB_SRCS
   wxMaracasHelpDialog.h
   wxMaracasQuantification.cxx
   wxMaracasQuantification.h
+  
+       
   widgets/wxVTKRenderWindowInteractor.cxx
   widgets/wxVTKRenderWindowInteractor.h
   widgets/wxVTKRenderWindowInteractorEditContour.cxx
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/Copie de wxSTLWidget_03.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/Copie de wxSTLWidget_03.cxx
new file mode 100644 (file)
index 0000000..1afdbfb
--- /dev/null
@@ -0,0 +1,1033 @@
+
+#include "vtkObjectFactory.h"
+
+#include "vtkActor.h"
+#include "vtkCylinderSource.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkRenderer.h"
+#include "vtkRenderWindow.h"
+#include "vtkRenderWindowInteractor.h"
+#include "vtkProperty.h"
+#include "vtkCamera.h"
+#include "vtkPoints.h"
+#include "vtkCellArray.h"
+#include "vtkPolyData.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkPolyDataWriter.h"
+#include "vtkPolyDataReader.h"
+#include "vtkImageReader.h"
+#include "vtkImageViewer.h"
+#include "vtkImageViewer2.h"
+#include "vtkImageToStructuredPoints.h"
+#include <vtkImageThreshold.h> 
+#include "vtkImageWriter.h"
+
+
+#include "vtkExtractVOI.h"
+#include "vtkImageClip.h"
+#include "vtkImageResample.h"
+#include "vtkImageThreshold.h"
+#include "vtkImageCast.h"
+#include "vtkImageSeedConnectivity.h"
+#include "vtkImageData.h"
+#include "vtkMarchingCubes.h"
+#include "vtkImageReslice.h"
+#include "vtkTransform.h"
+#include "vtkSphereSource.h"
+#include "vtkDoubleArray.h"
+#include "vtkPointData.h"
+#include "vtkCommand.h"
+#include "vtkCallbackCommand.h"
+#include "vtkImageResample.h"
+#include "vtkMath.h"
+#include "vtkStripper.h"
+#include <vtkSTLReader.h> 
+#include "vtkMetaImageWriter.h"
+
+
+#include "vtkTriangleFilter.h"
+#include "vtkSTLWriter.h"
+#include "vtkPolyDataConnectivityFilter.h"
+#include "vtkClosePolyData.h"
+#include "vtkAppendFilter.h"
+
+#include "wxSTLWidget_03.h"
+
+#include <wx/splitter.h>
+
+#include <wx/filedlg.h>
+
+
+
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+wxSTLWidget_03::wxSTLWidget_03(wxWindow *parent, marInterface* mar)
+: wxPanel( parent, -1) 
+{
+       _wxMaracasMPR           = NULL;
+       _maxSize                = 2000;
+       _minSize                = 300;
+
+       _stlMarchingCubesLevel  = 128;
+       _stlDeltaGaussLevel             = 100;
+
+       _mar=new marInterface();        
+       _mar->_parameters->setRescaleSlope( mar->_parameters->getRescaleSlope() );
+       _mar->_parameters->setRescaleIntercept( mar->_parameters->getRescaleIntercept() );
+       _mar->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
+       _mar->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension) );
+       _mar->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_y_dimension) );
+       _mar->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_z_dimension) );
+       int voi[6];
+       mar->_experiment->getVOI( voi );
+       _mar->_experiment->setVOI( voi );
+       _mar->SetDicom(mar->_dicom);
+       _mar->initExperiment( );
+        
+
+       wxBoxSizer              *sizer          = new wxBoxSizer(wxVERTICAL  );
+       wxSplitterWindow        *pnlSplitter    = new wxSplitterWindow( this , -1);
+       wxPanel                 *viewPanel      = CreateViewPanel(pnlSplitter);
+printf("EED wxSTLWidget_03::wxSTLWidget_03 01\n");
+       wxPanel                 *controlPanel   = CreateControlPanel(pnlSplitter);
+printf("EED wxSTLWidget_03::wxSTLWidget_03 02\n");
+
+       sizer           -> Add( pnlSplitter ,1,wxGROW  ,0);
+       pnlSplitter     -> SetMinimumPaneSize( 150 );
+       pnlSplitter     -> SplitVertically( viewPanel, controlPanel, 600 );
+
+//     pnlSplitter     -> SplitVertically( new wxPanel(pnlSplitter,-1), new wxPanel(pnlSplitter,-1) , 600 );
+//     pnlSplitter     -> SplitVertically( viewPanel, new wxPanel(pnlSplitter,-1) , 600 );
+
+       this            -> SetSizer(sizer);
+
+       // Result 2: Volume + Axis
+//     _2_prgov                = NULL;
+       _2_mapfinal             = NULL;
+       _2_stripfinal           = NULL;
+       _2_isoMapperMC6         = NULL;
+       _2_isoActorMC6          = NULL;
+       _2_isoMC6               = NULL;
+
+       //DHC STL SURFACES
+       stlInterna              = NULL;
+       stlExterna              = NULL;
+
+       _loadSTLMapper          = NULL;
+       _loadActorSTL           = NULL;
+
+       
+       //JOIN REGIONS
+       arteryImageData         = NULL;
+       joinMarchingCubes       = NULL;
+    joinMapper                 = NULL; 
+       joinActor               = NULL;
+printf("EED wxSTLWidget_03::wxSTLWidget_03 03\n");
+
+
+}
+//-------------------------------------------------------------------
+wxSTLWidget_03::~wxSTLWidget_03(){
+       ResetTree2_JF();
+       Reset_vtk_STLFile();
+}
+//-------------------------------------------------------------------
+wxPanel* wxSTLWidget_03::CreateViewPanel(wxWindow *parent)
+{
+       wxPanel *panel          =       new wxPanel(parent,-1);
+    wxBoxSizer *sizer  =       new wxBoxSizer(wxVERTICAL);
+
+
+   // MPR
+       vtkImageData *imagedata;
+       imagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
+       imagedata->Update();    
+printf("EED wxSTLWidget_03::CreateViewPanel  01 \n");
+       _wxMaracasMPR = new wxMaracasMPR( panel, new marImageData(imagedata), _mar->_parameters->getVoxelSize() );
+printf("EED wxSTLWidget_03::CreateViewPanel  02 \n");
+       _wxMaracasMPR->ConfigureVTK();
+printf("EED wxSTLWidget_03::CreateViewPanel  03 \n");
+       
+       sizer->Add(     _wxMaracasMPR , 1, wxEXPAND, 0);
+       panel->SetSizer(sizer);
+       panel->SetAutoLayout(true);
+       panel->SetSize(400,400);
+       panel->Layout();
+printf("EED wxSTLWidget_03::CreateViewPanel  04 \n");
+       return panel;
+}
+//-------------------------------------------------------------------
+wxWindow* wxSTLWidget_03::CreateSelectAPointPanel(wxWindow *parent)
+{
+printf("EED wxSTLWidget_03::CreateSelectAPointPanel  01\n");
+       wxPanel *panel          = new wxPanel(parent,-1);
+
+printf("EED wxSTLWidget_03::CreateSelectAPointPanel  02\n");
+
+    wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
+printf("EED wxSTLWidget_03::CreateSelectAPointPanel  03\n");
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+printf("EED wxSTLWidget_03::CreateSelectAPointPanel  04\n");
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+printf("EED wxSTLWidget_03::CreateSelectAPointPanel  05\n");
+
+       sizer->Add(new wxStaticText(panel,-1,_T(" Select a 3D Point...")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+printf("EED wxSTLWidget_03::CreateSelectAPointPanel  06\n");
+
+       panel->SetSizer(sizer);
+       panel->SetAutoLayout(true);
+       panel->SetSize(400,600);
+       panel->Layout();
+printf("EED wxSTLWidget_03::CreateSelectAPointPanel  07\n");
+
+
+       return panel;
+}
+//-------------------------------------------------------------------
+wxWindow* wxSTLWidget_03::CreateSegmentationPanel(wxWindow *parent)
+{
+       wxPanel *panel          = new wxPanel(parent,-1);
+
+
+       _opacity_Vol            = new wxSlider( panel, -1, 40, 0, 100                            , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS );
+       _opacity_Vol    ->SetSize(250,20);  
+       /*SIL
+       _sl_maxSize                     = new wxSlider( panel, -1, 300 , 0, 2000 , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL  |  wxSL_AUTOTICKS | wxSL_LABELS );
+       _sl_minSize                     = new wxSlider( panel, -1, 200 , 0, 2000 , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL  |  wxSL_AUTOTICKS | wxSL_LABELS );
+       
+       _sl_minSizeSpin = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT  );
+       _sl_minSizeSpin->SetRange(1,8);
+       _sl_minSizeSpin->SetValue(5);
+
+       _sl_maxSizeSpin = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT  );
+       _sl_maxSizeSpin->SetRange(1,8);
+       _sl_maxSizeSpin->SetValue(5);
+
+       */
+
+       _sl_RangeSizeSpin = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT  );
+       _sl_RangeSizeSpin->SetRange(1,8);
+       _sl_RangeSizeSpin->SetValue(5);
+
+
+       //SIL//
+       sl_barrange_segmentation = new mBarRange(panel, 300,70);
+       sl_barrange_segmentation -> setVisibleLabels ( true );
+       sl_barrange_segmentation -> setIfWithActualDrawed( false );
+       sl_barrange_segmentation -> setActiveStateTo ( true );
+       sl_barrange_segmentation -> setRepresentedValues (0,  2000);
+       sl_barrange_segmentation -> setDeviceBlitStart (10,10);
+       sl_barrange_segmentation -> setDeviceEndMargin(10);
+       parent->SetBackgroundColour(wxColour(255,255,255));
+       sl_barrange_segmentation-> setBackgroundColor( wxColour(255,255,255 ));
+
+
+       wxButton *btnExtract                            = new wxButton(panel,-1,_T("Segmentation"));
+       wxButton *btnSaveBinaryFile                     = new wxButton(panel,-1,_T("Save Binary File"));
+
+//SIL//        Connect(_sl_minSizeSpin->GetId()        , wxEVT_COMMAND_SLIDER_UPDATED   , (wxObjectEventFunction) &wxSTLWidget_03::OnMinSpin ); 
+//SIL//        Connect(_sl_maxSizeSpin->GetId()        , wxEVT_COMMAND_SLIDER_UPDATED   , (wxObjectEventFunction) &wxSTLWidget_03::OnMaxSpin ); 
+       Connect(_opacity_Vol->GetId()           , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSTLWidget_03::OnOpacity_Vol                                        ); 
+       Connect(btnExtract->GetId()                     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxSTLWidget_03::OnBtnExtraction                                      ); 
+       Connect(btnSaveBinaryFile->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxSTLWidget_03::OnBtnSaveBinaryFile                          ); 
+
+       //SIL//
+       Connect(_sl_RangeSizeSpin->GetId()      , wxEVT_COMMAND_SLIDER_UPDATED   , (wxObjectEventFunction) &wxSTLWidget_03::OnRangeSpin ); 
+       Connect(sl_barrange_segmentation->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxSTLWidget_03::OnStartChanged_range );
+       Connect(sl_barrange_segmentation->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxSTLWidget_03::OnEndChanged_range );      
+       Connect(sl_barrange_segmentation->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxSTLWidget_03::OnBarMoved_range );
+
+    wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  - - -  Segmentation - - - ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  "))); 
+       
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  "))); 
+
+       /*sizer->Add(new wxStaticText(panel,-1,_T(" Threshold min")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  "))); 
+       sizer->Add(_sl_minSizeSpin, 1, wxALL|wxEXPAND, 0);*/
+       //sizer->Add(_sl_minSize, 1, wxALL|wxEXPAND, 0);
+
+       sizer->Add(new wxStaticText(panel,-1,_T(" Threshold min-max")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  "))); 
+       sizer->Add(_sl_RangeSizeSpin, 1, wxALL|wxEXPAND, 0);
+       sizer->Add(sl_barrange_segmentation,3,wxALL|wxGROW,0 );
+       
+       //SIL//sizer->Add(new wxStaticText(panel,-1,_T(" Threshold max")));
+       //SIL//sizer->Add(new wxStaticText(panel,-1,_T("  "))); 
+       //SIL// sizer->Add(_sl_maxSizeSpin, 1, wxALL|wxEXPAND, 0);
+       //SIL//sizer->Add(_sl_maxSize, 1, wxALL|wxEXPAND, 0);
+       
+       sizer->Add(btnExtract);
+       sizer->Add(new wxStaticText(panel,-1,_T(" ")));
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("Opacity - Result Volume")));
+       sizer->Add(_opacity_Vol);
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(btnSaveBinaryFile);
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       
+       panel->SetSizer(sizer);
+       panel->SetAutoLayout(true);
+       panel->SetSize(400,600);
+       panel->Layout();
+
+       return panel;
+}
+//-------------------------------------------------
+wxWindow* wxSTLWidget_03::CreateSmoothingPanel(wxWindow *parent)
+{
+       wxPanel *panel          = new wxPanel(parent,-1);
+
+       stlSliderDeltaGauss     = new wxSlider( panel, -1, (int)(_stlDeltaGaussLevel) , 0, 300 , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS );
+       stlSliderMarchingCubes= new wxSlider( panel, -1, (int)(_stlMarchingCubesLevel) , 0, 256 , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS );
+       stlSliderOpacityInternal = new wxSlider(panel, -1, 100,0,100, wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS);
+       stlSliderOpacityExternal = new wxSlider(panel, -1, 100,0,100, wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS);
+       wxButton *btnFileSTL = new wxButton(panel,-1,_T("Generate STL files"));
+
+       Connect(btnFileSTL->GetId()                             , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxSTLWidget_03::OnBtnCreateFileSTL                   );
+       Connect(stlSliderDeltaGauss->GetId()    , wxEVT_SCROLL_THUMBRELEASE             , (wxObjectEventFunction) &wxSTLWidget_03::OnChangeSTLGaussLevel                );
+       Connect(stlSliderMarchingCubes->GetId() , wxEVT_SCROLL_THUMBRELEASE             , (wxObjectEventFunction) &wxSTLWidget_03::OnChangeSTLMarchingCubesLevel);
+       Connect(stlSliderOpacityInternal->GetId(), wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSTLWidget_03::OnOpacitySTLInternal                 );
+       Connect(stlSliderOpacityExternal->GetId(), wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSTLWidget_03::OnOpacitySTLExternal                 );
+
+
+    wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+
+       sizer->Add(new wxStaticText(panel,-1,_T("-- Smoothing --")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       
+       sizer->Add(new wxStaticText(panel,-1,_T(" Delta Gauss")));
+       sizer->Add(stlSliderDeltaGauss);
+
+       sizer->Add(new wxStaticText(panel,-1,_T(" Marching Cubes Level")));
+       sizer->Add(stlSliderMarchingCubes);
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+
+       sizer->Add(new wxStaticText(panel, -1,_T(" Opacity STL Internal")));
+       sizer->Add(stlSliderOpacityInternal);
+
+       sizer->Add(new wxStaticText(panel, -1,_T(" Opacity STL External")));
+       sizer->Add(stlSliderOpacityExternal);
+
+       sizer->Add(btnFileSTL);
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+
+
+       panel->SetSizer(sizer);
+       panel->SetAutoLayout(true);
+       panel->SetSize(400,600);
+       panel->Layout();
+       return panel;
+}
+//-------------------------------------------------
+wxWindow* wxSTLWidget_03::CreateReadSTLFilePanel(wxWindow *parent)
+{
+       wxPanel *panel          = new wxPanel(parent,-1);
+
+       wxButton *btnReadSTLFile                        = new wxButton(panel,-1,_T("Read STL File"));
+       wxButton *btnEraseReadSTLFile           = new wxButton(panel,-1,_T("Erase STL File"));
+       _sl_opacity_STL_file                            = new wxSlider( panel, -1, 100 , 0, 100 , wxDefaultPosition, wxSize(200,40), wxSL_HORIZONTAL | wxSL_LABELS );
+
+       Connect(btnReadSTLFile->GetId()                 , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxSTLWidget_03::OnBtnSTLFileLoad                     ); 
+       Connect(btnEraseReadSTLFile->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxSTLWidget_03::OnBtnSTLFileErase                    ); 
+       Connect(_sl_opacity_STL_file->GetId()   , wxEVT_SCROLL_THUMBRELEASE     , (wxObjectEventFunction) &wxSTLWidget_03::OnOpacitySTLFile                             ); 
+
+
+    wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+
+       sizer->Add(new wxStaticText(panel,-1,_T("-- Read STL File --")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+       sizer->Add(new wxStaticText(panel,-1,_T("  ")));
+
+       sizer->Add(btnReadSTLFile );
+       sizer->Add(btnEraseReadSTLFile );
+       sizer->Add(new wxStaticText(panel, -1,_T(" Opacity STL File")));
+       sizer->Add(_sl_opacity_STL_file);
+
+
+       panel->SetSizer(sizer);
+       panel->SetAutoLayout(true);
+       panel->SetSize(400,600);
+       panel->Layout();
+       return panel;
+}
+//-------------------------------------------------------------------
+wxPanel* wxSTLWidget_03::CreateControlPanel(wxWindow *parent)
+{
+printf("EED wxSTLWidget_03::CreateControlPanel 01\n");
+       wxPanel *panel                  = new wxPanel(parent,-1);
+
+       wxNotebook *noteBook    = new wxNotebook(panel, -1);
+printf("EED wxSTLWidget_03::CreateControlPanel 02\n");
+       noteBook->AddPage(CreateSelectAPointPanel(noteBook),_T("0 ->") );
+printf("EED wxSTLWidget_03::CreateControlPanel 03\n");
+       noteBook->AddPage(CreateSegmentationPanel(noteBook),_T("1 ->") );
+printf("EED wxSTLWidget_03::CreateControlPanel 04\n");
+       noteBook->AddPage(CreateSmoothingPanel(noteBook)   ,_T("2 ->") );
+printf("EED wxSTLWidget_03::CreateControlPanel 05\n");
+       noteBook->AddPage(CreateReadSTLFilePanel(noteBook) ,_T("3 "  ) );
+printf("EED wxSTLWidget_03::CreateControlPanel 06\n");
+       noteBook->SetSelection(0);
+       noteBook->SetSize(350,250);
+    wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
+       sizer->Add(noteBook);
+       panel->SetSizer(sizer);
+       panel->SetAutoLayout(true);
+       panel->SetSize(400,600);
+       panel->Layout();
+
+printf("EED wxSTLWidget_03::CreateControlPanel 07\n");
+       return panel;
+}
+//------------------------------------------------------------------------
+void wxSTLWidget_03::Refresh()
+{
+       if (_wxMaracasMPR!=NULL){
+               _wxMaracasMPR->RefreshView();
+       }
+}
+
+//------------------------------------------------------------------------
+
+
+void wxSTLWidget_03::ConfigureProcessing(marImageData *marimagedata, int x, int y, int z)
+{
+    wxBusyCursor wait;
+
+       _imagedata=marimagedata->GetImageData(); // image t=0
+       _imagedata->UpdateInformation();
+       _imagedata->SetUpdateExtent(_imagedata->GetWholeExtent());
+       _imagedata->Update();
+
+
+       double puntoactualprov[3];
+       puntoactualprov[0] = x;
+       puntoactualprov[1] = y;
+       puntoactualprov[2] = z;
+
+       double espprin[3];
+       int extprin[6];                         
+       
+       _imagedata->GetSpacing(espprin);
+       _imagedata->GetExtent(extprin);
+
+
+// MAZV 27 sep 2006
+//     puntoactualprov[0]=puntoactualprov[0]*espprin[0];
+//     puntoactualprov[1]=puntoactualprov[1]*espprin[1];
+//     puntoactualprov[2]=puntoactualprov[2]*espprin[2];
+       
+    _imagedata->GetScalarRange( _range );
+
+       // Update Controls
+       //SIL//
+       /*_sl_minSize->SetRange( (int)(_range[0]), (int)( _range[1]) );
+       _sl_minSize->SetValue( (int)(_range[1]/4) );
+
+       _sl_maxSize->SetRange( (int)(_range[0]) , (int)(_range[1]));
+       _sl_maxSize->SetValue( (int)(_range[1]/2) );*/
+
+       //SIL//
+       minRangeValue = _range[0];
+       maxRangeValue = _range[1];
+
+       sl_barrange_segmentation ->setRepresentedValues(minRangeValue, maxRangeValue);
+       sl_barrange_segmentation ->SetStart((int)(maxRangeValue/4));
+       sl_barrange_segmentation ->SetEnd((int)(maxRangeValue/2));
+       sl_barrange_segmentation -> RefreshForce();     
+       lastResizeRef_Value = ( maxRangeValue - minRangeValue)/2;       
+
+// MAZV 27 sep 2006
+//     _highthreshold->SetRange(_range[0], _range[1]);
+//     _highthreshold->SetValue( _range[1] );
+
+//     _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//
+       
+       _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());
+       
+       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);
+       _connect2->AddSeed( (int)(puntoactualprov[0]), (int)(puntoactualprov[1]), (int)(puntoactualprov[2]));
+       _connect2->Update();
+
+       cast4 = vtkImageCast::New();
+       cast4->SetInput(_connect2->GetOutput());
+       cast4->SetOutputScalarTypeToUnsignedShort();
+       cast4->Update();
+}
+
+//------------------------------------------------------------------------
+
+
+
+void wxSTLWidget_03::ConfigureVTK()
+{
+       wxBusyCursor wait;
+//     vtkImageData    *imagedata              = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
+       marImageData    *marimagedata           = _mar->_experiment->getDynData( )->GetMarImageData();
+       
+       //CONFIGURACION ADICIONAL
+       this->ConfigureSTL();
+       this->ConfigureProcessing(marimagedata,0,0,0);
+       
+}
+
+//------------------------------------------------------------------------
+
+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);
+       }
+
+       // 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;
+}
+
+
+
+
+
+
+//------------------------------------------------------------------------
+void wxSTLWidget_03::ExtractSurface(int x, int y, int z)
+{
+       
+       double opacityvol               = ((double)_opacity_Vol->GetValue())/100;
+//     vtkImageData *imagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
+
+       double  puntoactualprov[3];
+       double  espprin[3];
+       int             extprin[6];                             
+
+
+       puntoactualprov[0]      =       x;
+       puntoactualprov[1]      =       y;
+       puntoactualprov[2]      =       z;
+       
+       _imagedata->UpdateInformation();
+       _imagedata->SetUpdateExtent(_imagedata->GetWholeExtent());
+       _imagedata->Update();
+
+       _imagedata->GetSpacing(espprin);
+       _imagedata->GetExtent(extprin);
+
+
+
+
+       _connect->RemoveAllSeeds ();
+       _connect->AddSeed( (int)(puntoactualprov[0] ), (int)(puntoactualprov[1]) ,(int)( puntoactualprov[2]) );
+       _connect->Update();
+       cast3->Update();
+
+
+
+       _thresh->ThresholdBetween(3000, 3002 );
+       _thresh2->ThresholdBetween(3000, 3001);
+//     _thresh->Update();
+//     _thresh2->Update();
+
+       _thresh->ThresholdBetween(_minSize, _range[1] );
+       _thresh->Update();
+
+       _thresh2->ThresholdBetween(_minSize, _maxSize);
+       _thresh2->Update();
+
+       cast2->Update();
+       _connect2->RemoveAllSeeds ();
+       _connect2->AddSeed( (int)(puntoactualprov[0]) , (int)(puntoactualprov[1]) , (int)(puntoactualprov[2]) );
+       _connect2->Update();
+       cast4->Update();
+
+
+
+
+       // Visualisation - result volume
+   
+    _2_isoMC6 = vtkMarchingCubes::New();
+       _2_isoMC6->SetInput(cast4->GetOutput());
+
+    _2_isoMC6->SetValue(0, 128);
+       _2_isoMC6->Update();
+
+       _2_isoMapperMC6 = vtkPolyDataMapper::New();
+    _2_isoMapperMC6->SetInput(_2_isoMC6->GetOutput());
+    _2_isoMapperMC6->ScalarVisibilityOff();
+    _2_isoMapperMC6->ImmediateModeRenderingOn();
+
+       vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
+
+       if (_2_isoActorMC6!=NULL)
+       {
+               ren->RemoveActor(_2_isoActorMC6);
+       }
+
+
+       _2_isoActorMC6 = vtkActor::New();
+    _2_isoActorMC6->SetMapper(_2_isoMapperMC6);
+    _2_isoActorMC6->GetProperty()->SetColor(1.0, 1.0, 0.5);
+    _2_isoActorMC6->GetProperty()->SetOpacity( opacityvol );
+    
+       // Interface Update
+
+       ren->AddActor(_2_isoActorMC6);
+
+}
+
+//------------------------------------------------------------------------
+void wxSTLWidget_03::OnOpacity_Vol(wxScrollEvent& event)
+{
+       if (_2_isoActorMC6!=NULL){
+               double value = ((double)_opacity_Vol->GetValue())/100;
+               _2_isoActorMC6->GetProperty( )->SetOpacity( value );
+               Refresh();
+       }
+}
+//------------------------------------------------------------------------
+
+void wxSTLWidget_03::OnMinSpin         (       wxScrollEvent &          event           )      
+{
+       /*wxSlider *sl_A=_sl_minSize;
+       wxSlider *sl_B=_sl_minSizeSpin;
+       int value = sl_A->GetValue();
+       int delta=(int)pow( 4 , sl_B->GetValue() );
+       int min=value - delta/2;
+       int max=value + delta/2;
+       if (min<0)
+       {
+               min=0;
+               max=delta;
+       }
+       sl_A->SetRange(min,max);
+
+
+       */
+}
+
+//------------------------------------------------------------------------
+
+void wxSTLWidget_03::OnMaxSpin         (       wxScrollEvent &          event           )      
+{
+       /*wxSlider *sl_A=_sl_maxSize;
+       wxSlider *sl_B=_sl_maxSizeSpin;
+       int value = sl_A->GetValue();
+       int delta = (int)pow( 4 , sl_B->GetValue() );
+       int min=value - delta/2;
+       int max=value + delta/2;
+       if (min<0)
+       {
+               min=0;
+               max=delta;
+       }
+       sl_A->SetRange(min,max);*/      
+}
+
+//------------------------------------------------------------------------
+
+void wxSTLWidget_03::OnRangeSpin       (       wxScrollEvent &          event           )      
+{
+       wxSlider *sl_B=_sl_RangeSizeSpin;
+
+       int value = lastResizeRef_Value;
+       int delta = (int)pow( 4 , sl_B->GetValue() );
+       int startResized = value - delta/2;
+       int endResized = value + delta/2;
+
+       if( startResized < minRangeValue )
+               startResized = minRangeValue;
+
+       if( endResized > maxRangeValue )
+               endResized = maxRangeValue;
+
+       sl_barrange_segmentation->setRepresentedValues(startResized,endResized);
+       sl_barrange_segmentation -> RefreshForce();     
+}
+
+//------------------------------------------------------------------------
+void wxSTLWidget_03:: OnStartChanged_range(wxCommandEvent& event)
+{
+       lastResizeRef_Value = sl_barrange_segmentation->GetStart();
+}
+//------------------------------------------------------------------------
+void wxSTLWidget_03:: OnEndChanged_range(wxCommandEvent& event)
+{
+       lastResizeRef_Value = sl_barrange_segmentation->GetEnd();   
+}
+//------------------------------------------------------------------------
+void wxSTLWidget_03:: OnBarMoved_range(wxCommandEvent& event)
+{
+       lastResizeRef_Value = (sl_barrange_segmentation->GetEnd() - sl_barrange_segmentation->GetStart())/2 ;
+}
+//------------------------------------------------------------------------
+
+void wxSTLWidget_03::OnBtnSaveBinaryFile(wxCommandEvent& event)
+{
+       wxString dirSTL = _mar->_parameters->getStringParam( 
+    marParameters::e_installation_directory ); 
+       dirSTL = ( dirSTL == _T("NO_DIRECTORY") ) ? wxGetHomeDir( ) : dirSTL;
+       wxFileDialog dialog( this, _T("Choose a directory..."), ( !dirSTL.IsEmpty( ) )?
+       dirSTL: wxGetHomeDir( ) );
+
+       if( dialog.ShowModal( ) == wxID_OK ) 
+       {
+               vtkMetaImageWriter  *writer= vtkMetaImageWriter::New();
+               writer->SetFileName( dialog.GetPath().mb_str(wxConvUTF8) );     
+               writer->SetInput(cast4->GetOutput());
+               writer->Write();
+               writer->Delete();
+       }
+}
+
+//------------------------------------------------------------------------
+void wxSTLWidget_03::OnBtnExtraction(wxCommandEvent& event)
+{
+       /*wxBusyCursor wait;
+       _minSize = _sl_minSize->GetValue();
+       _maxSize = _sl_maxSize->GetValue();
+
+       double px=_wxMaracasMPR->GetVtkMPRBaseData()->GetX();
+       double py=_wxMaracasMPR->GetVtkMPRBaseData()->GetY();
+       double pz=_wxMaracasMPR->GetVtkMPRBaseData()->GetZ();
+       ExtractSurface((int)(px),(int)(py),(int)(pz));
+       generateSTLSurfaces(); //DHC: AFTER SEGMENTATION THE TREE, THE STL SURFACES ARE CALCULATED.
+
+       Refresh();
+*/
+       //SIL//
+       wxBusyCursor wait;
+       _minSize = sl_barrange_segmentation->GetStart();
+       _maxSize = sl_barrange_segmentation->GetEnd();
+
+       double px=_wxMaracasMPR->GetVtkMPRBaseData()->GetX();
+       double py=_wxMaracasMPR->GetVtkMPRBaseData()->GetY();
+       double pz=_wxMaracasMPR->GetVtkMPRBaseData()->GetZ();
+       ExtractSurface((int)(px),(int)(py),(int)(pz));
+       generateSTLSurfaces(); //DHC: AFTER SEGMENTATION THE TREE, THE STL SURFACES ARE CALCULATED.
+
+       Refresh();
+}
+
+//------------------------------------------------------------------------
+void wxSTLWidget_03::OnOpacitySTLFile(wxScrollEvent& event)
+{
+       if (_loadActorSTL!=NULL)
+       {
+               double value = ((double)_sl_opacity_STL_file->GetValue())/100;
+               _loadActorSTL->GetProperty( )->SetOpacity( value );
+               Refresh();
+       }
+}
+//------------------------------------------------------------------------
+void wxSTLWidget_03::Reset_vtk_STLFile()
+{
+       // Remove
+       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;
+
+}
+//------------------------------------------------------------------------
+void wxSTLWidget_03::OnBtnSTLFileErase(wxCommandEvent& event)
+{
+       Reset_vtk_STLFile();
+       Refresh();
+}
+//------------------------------------------------------------------------
+void wxSTLWidget_03::OnBtnSTLFileLoad(wxCommandEvent& event)
+{
+       wxString dirSTL = _mar->_parameters->getStringParam( 
+    marParameters::e_installation_directory ); 
+       dirSTL = ( dirSTL == _T("NO_DIRECTORY") ) ? wxGetHomeDir( ) : dirSTL;
+       wxFileDialog dialog( this, _T("Choose a directory..."), ( !dirSTL.IsEmpty( ) )?
+       dirSTL: wxGetHomeDir( ) );
+
+       if( dialog.ShowModal( ) == wxID_OK ) 
+       {
+               Reset_vtk_STLFile();
+               vtkSTLReader *imgReader= vtkSTLReader::New();
+               imgReader->SetFileName( dialog.GetPath().mb_str(wxConvUTF8) );  
+               _loadSTLMapper = vtkPolyDataMapper::New();
+               _loadSTLMapper->SetInput(imgReader->GetOutput());
+               _loadActorSTL = vtkActor::New();
+               _loadActorSTL->SetMapper(_loadSTLMapper);
+               _loadActorSTL->GetProperty()->SetColor( 1, 0, 0);
+               _loadActorSTL->GetProperty()->SetOpacity( 0.5 );
+               vtkRenderer *ren = _wxMaracasMPR->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
+               ren->AddActor(_loadActorSTL);
+               imgReader->Delete();
+       }
+       //By default *always* update e_installation_directory:
+       _mar->_parameters->setStringParam( marParameters::e_installation_directory, dialog.GetPath( ) ); 
+       _mar->saveParameters( );
+}
+
+
+
+// ------------------------------------------------------------------------
+// END JOIN FUNCTIONS - DHC
+// ------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------
+// START STL FUNCTIONS - DHC
+// ------------------------------------------------------------------------
+
+void wxSTLWidget_03::ConfigureSTL()
+{
+       stlExterna = vtkPolyData::New();
+       stlInterna = vtkPolyData::New();
+
+       dsm1 = vtkPolyDataMapper ::New();
+    dsm1->SetInput (stlInterna); 
+    dsm1->ScalarVisibilityOff();
+
+    actorInternal = vtkActor::New();
+    actorInternal->SetMapper (dsm1);
+    actorInternal->GetProperty()->SetColor (0,1,0);
+
+    dsm2 = vtkPolyDataMapper ::New();
+    dsm2->SetInput (stlExterna);
+    dsm2->ScalarVisibilityOff();
+
+    actorExternal= vtkActor::New();
+    actorExternal->SetMapper (dsm2);
+    actorExternal->GetProperty()->SetRepresentationToWireframe();
+
+//    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()
+{
+// EED 09Janvier2007
+//     stlExtractor->setVolume(_2_prgov->GetVolumen());
+
+       stlExtractor->setVolume(cast4->GetOutput());
+
+       stlExtractor->setSigmaLevel(_stlDeltaGaussLevel);
+       stlExtractor->setMarchingCubesLevel(_stlMarchingCubesLevel);
+       stlExtractor->calculate();
+       stlInterna->DeepCopy(stlExtractor->getInnerSurface());
+       stlExterna->DeepCopy(stlExtractor->getOuterSurface());
+}
+
+
+void wxSTLWidget_03::OnOpacitySTLExternal(wxScrollEvent& event){
+       double value = ((double)stlSliderOpacityExternal->GetValue())/100;
+    actorExternal->GetProperty( )->SetOpacity( value );
+       Refresh();
+}
+
+
+void wxSTLWidget_03::OnOpacitySTLInternal(wxScrollEvent& event){
+       double value = ((double)stlSliderOpacityInternal->GetValue())/100;
+    actorInternal->GetProperty( )->SetOpacity( value );
+       Refresh();
+}
+
+void wxSTLWidget_03::OnBtnCreateFileSTL(wxCommandEvent& event)
+{
+
+       wxString dirSTL = _mar->_parameters->getStringParam( 
+    marParameters::e_installation_directory ); 
+       dirSTL = ( dirSTL == _T("NO_DIRECTORY") ) ? wxGetHomeDir( ) : dirSTL;
+
+       
+//     wxDirDialog dialog( this, "Choose a directory...", ( !dirSTL.IsEmpty( ) )?dirSTL: wxGetHomeDir( ) );
+       wxFileDialog dialog( this, _T("Choose a directory..."), dirSTL , _T(""), _T("*.*"), wxSAVE );
+
+
+       if( dialog.ShowModal( ) == wxID_OK ) 
+       {
+          
+       
+               // ------------------------------------------------------------------------
+               //  1.  GENERATE STL FILES
+               // ------------------------------------------------------------------------
+//             const char* fileprefix = "c:\\Creatis\\";
+               std::string prefix ( dialog.GetPath().mb_str(wxConvUTF8) );
+               std::string filename;
+
+               // 1.1. Se hace un filtro triangular puesto que el stl writer solo recibe poligonos triangulares.
+
+        vtkTriangleFilter *filtro = vtkTriangleFilter::New();
+               filtro->SetInput(stlInterna);
+               vtkPolyDataConnectivityFilter *pdcf = vtkPolyDataConnectivityFilter::New();
+        pdcf->SetInput( filtro->GetOutput() );
+        vtkClosePolyData *cpd = vtkClosePolyData::New();
+        cpd->SetInput( pdcf->GetOutput() );
+
+               // 1.2 se escribe a disco el archivo stl de la superficie interna
+        cpd->Update();
+        vtkSTLWriter *writerI = vtkSTLWriter::New();
+        writerI->SetInput( cpd->GetOutput() );
+//        prefix = fileprefix;
+               filename=prefix+"_internal.stl";
+        writerI->SetFileName(filename.c_str());
+        writerI->SetFileTypeToASCII();
+        writerI->Write();
+        writerI->Delete();
+
+               // 1.3 se escribe a disco el archivo stl de la superficie externa
+               filtro->SetInput(stlExterna);
+        cpd->Update();
+        vtkSTLWriter *writerE = vtkSTLWriter::New();
+        writerE->SetInput( cpd->GetOutput() );
+//        prefix = fileprefix;
+               filename=prefix+"_external.stl";
+        writerE->SetFileName( filename.c_str() );
+        writerE->SetFileTypeToASCII();
+        writerE->Write();
+        writerE->Delete();
+   
+        filtro->Delete();
+        cpd->Delete();
+        pdcf->Delete();
+       }
+
+       //By default *always* update e_installation_directory:
+       _mar->_parameters->setStringParam( marParameters::e_installation_directory, dialog.GetPath( ) ); 
+       _mar->saveParameters( );
+}
+
+
+void wxSTLWidget_03::OnChangeSTLGaussLevel(wxScrollEvent& event)
+{
+       wxBusyCursor wait;
+       _stlDeltaGaussLevel  = ((double)stlSliderDeltaGauss->GetValue())/100;
+       generateSTLSurfaces();
+       Refresh();
+}
+
+
+void wxSTLWidget_03::OnChangeSTLMarchingCubesLevel(wxScrollEvent& event)
+{
+       wxBusyCursor wait;
+       _stlMarchingCubesLevel = ((double)stlSliderMarchingCubes->GetValue());
+       generateSTLSurfaces();
+       Refresh();
+       
+}
+
+
+// ------------------------------------------------------------------------
+// END STL FUNCTIONS - DHC
+// ------------------------------------------------------------------------
+
+
+
+
+
+
+
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/Copie de wxSTLWidget_03.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/Copie de wxSTLWidget_03.h
new file mode 100644 (file)
index 0000000..f120b4f
--- /dev/null
@@ -0,0 +1,197 @@
+
+#ifndef WX_STL_WIDGET_03
+#define WX_STL_WIDGET_03
+
+#include <vector>
+
+#include <vtkImageData.h>
+#include <vtkActor.h>
+#include <vtkMarchingCubes.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkAppendFilter.h>
+#include <vtkImageThreshold.h>
+#include <vtkExtractVOI.h>
+#include <vtkOutlineFilter.h>
+#include <vtkImageSeedConnectivity.h>
+#include <vtkImageCast.h>
+
+#include "wxVTKRenderWindowInteractor.h"
+#include "wxSurfaceWidget.h"
+#include "wxVtkBaseView.h"
+
+
+#include "../wxMaracasMPR.h"
+#include "pPlotter/mBarRange.h"//SIL//
+
+#include <kernel/marInterface.h>
+#include <kernel/axisExtractor02.h>
+
+
+#include "kernel/vtkSTLExtractor.h"    
+#include "kernel/vtkJoiner.h"
+
+
+
+
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+
+class wxSTLWidget_03: public wxPanel{
+public:
+       wxSTLWidget_03(wxWindow *parentmar,marInterface *mar);
+       ~wxSTLWidget_03();
+       void ConfigureVTK();
+       void Refresh();
+
+       void OnOpacity_Vol(wxScrollEvent& event);               // Result Volume 
+       void OnMinSpin ( wxScrollEvent & event );
+       void OnMaxSpin ( wxScrollEvent & event ); 
+
+       //SIL new// 
+       void OnRangeSpin( wxScrollEvent & event );
+
+       //Handled events form the bar
+       void OnStartChanged_range(wxCommandEvent& event);
+       void OnEndChanged_range(wxCommandEvent& event);
+       void OnBarMoved_range(wxCommandEvent& event);
+
+
+       void OnBtnExtraction(wxCommandEvent& event);
+       void OnBtnSaveBinaryFile(wxCommandEvent& event);
+
+       //
+       void Reset_vtk_STLFile();
+       void OnBtnSTLFileLoad(wxCommandEvent& event);
+       void OnBtnSTLFileErase(wxCommandEvent& event);
+       void OnOpacitySTLFile(wxScrollEvent& event);            
+
+
+       // --------------------------------------
+       // STL FUNCTIONS DHC
+       // --------------------------------------
+       void generateSTLSurfaces();
+       void OnBtnCreateFileSTL(wxCommandEvent& event); 
+       void OnChangeSTLGaussLevel(wxScrollEvent& event);
+       void OnChangeSTLMarchingCubesLevel(wxScrollEvent& event);
+       void OnOpacitySTLExternal(wxScrollEvent& event);
+       void OnOpacitySTLInternal(wxScrollEvent& event);
+
+       
+       //---------------------------------------
+       // JOIN REGIONS FUNCTIONS
+       //---------------------------------------
+       void OnJoinRegions(wxCommandEvent& event);
+
+private:
+
+       //Processing
+       vtkImageData                            *_imagedata;
+       double                                          _range[2];
+       vtkImageCast                            *cast2;
+       vtkImageCast                            *cast3;
+       vtkImageCast                            *cast4; // binary segmentation result
+       vtkImageThreshold                       *_thresh;
+       vtkImageThreshold                       *_thresh2;
+       vtkImageSeedConnectivity        *_connect;
+       vtkImageSeedConnectivity        *_connect2;
+
+
+
+       vtkPolyDataMapper       *_2_mapfinal;
+       vtkActor                        *_2_stripfinal;
+       vtkPolyDataMapper       *_2_isoMapperMC6;
+       vtkActor                        *_2_isoActorMC6;
+       vtkMarchingCubes        *_2_isoMC6;
+       double                          _sensibility_JF;
+       int                                     _maxSize;
+       int                                     _minSize;
+
+       // Load STL file
+       vtkPolyDataMapper *_loadSTLMapper;
+       vtkActor                  *_loadActorSTL;
+
+
+       wxSlider                        *_opacity_Vol;
+       wxSlider                        *_sl_minSize;
+       wxSlider                        *_sl_maxSize;
+       wxSlider                        *_sl_minSizeSpin;
+       wxSlider                        *_sl_maxSizeSpin;
+       wxSlider                        *_sl_RangeSizeSpin;
+
+       
+       /*
+       * Represents the bar of min and max for merging the functionality of two sliders for controlling the segmentation parameters
+       */
+       mBarRange                       * sl_barrange_segmentation;
+       int                                     lastResizeRef_Value;
+       int                                     minRangeValue;
+       int                                     maxRangeValue;
+       
+       wxVtk3DBaseView         *_imageviewer3D;
+       wxPanel                         *CreateControlPanel(wxWindow *parent);
+       wxPanel                         *CreateViewPanel(wxWindow *parent);
+
+       //Maracas
+       marInterface            *_mar;
+       wxMaracasMPR            *_wxMaracasMPR;
+
+       void ResetTree2_JF();
+       void ExtractSurface(int x, int y, int z);
+
+       wxWindow* CreateSelectAPointPanel(wxWindow *parent);
+       wxWindow* CreateSegmentationPanel(wxWindow *parent);
+       wxWindow* CreateSmoothingPanel(wxWindow *parent);
+       wxWindow* CreateReadSTLFilePanel(wxWindow *parent);
+
+       //---------------------
+       // Processing
+       //---------------------
+       void ConfigureProcessing(marImageData *marimagedata, int x, int y, int z);
+
+
+       //---------------------
+       // STL SURFACES DHC
+       //---------------------
+       void            ConfigureSTL();
+       double          _stlDeltaGaussLevel;
+       double          _stlMarchingCubesLevel;
+
+       
+       vtkPolyData *stlInterna;
+       vtkPolyData *stlExterna;
+       
+       wxSlider        *stlSliderDeltaGauss;
+       wxSlider        *stlSliderMarchingCubes;
+       
+       vtkPolyDataMapper *dsm1;
+    vtkActor   *actorInternal;
+       wxSlider        *stlSliderOpacityInternal;
+    
+       vtkPolyDataMapper *dsm2; 
+    vtkActor   *actorExternal;
+       wxSlider        *stlSliderOpacityExternal;
+
+       vtkSTLExtractor *stlExtractor;   
+
+       wxSlider        *_sl_opacity_STL_file;
+
+
+
+       //--------------------------
+       // JOIN REGIONS
+       //--------------------------
+
+       vtkImageData            *arteryImageData;
+       vtkJoiner                       *joiner;
+       vtkMarchingCubes        *joinMarchingCubes;
+    vtkPolyDataMapper  *joinMapper; 
+       vtkActor                        *joinActor; 
+
+};
+
+#endif // WX_STL_WIDGET_03
+
+
+
+
index 0b432185282c1bf9da9db8b196b4e55788a8f364..06f663a90784a5acfdc739973aeb336a7bd8bb0f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: vtk3DSurfaceWidget.h,v $
   Language:  C++
-  Date:      $Date: 2008/10/31 16:32:41 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/03/24 10:49:21 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -21,7 +21,7 @@
 
 #include "vtkImagePolyDataSeedConnectivity.h"
 #include "vtkInteractorStyleCutter.h"
-#include "kernel/marInterface.h"
+#include "marInterface.h"
 #include "kernel/marInterfaceCT.h"
 #include "InterfaceVtkPanelWidgets.h"
 
index 45ef21f5d13352ab1bb9e47ab3317ada3a5f59da..9c86ffc4afd1cc37746ea8a17564d0924f61d9e4 100644 (file)
@@ -64,19 +64,22 @@ void vtkBaseData::SetZ(double z){
 //     maxZ=dim[2];
 
        int ext[6];
-       _marImageData->GetImageData()->GetWholeExtent(ext);
-       maxZ=ext[5]-ext[4]+1;
+       vtkImageData* img = _marImageData->GetImageData();
+       if(img!=NULL){
+               img->GetWholeExtent(ext);
+               maxZ=ext[5]-ext[4]+1;
 
-       if (z>=maxZ)
-       {
-               z=maxZ-1;
-       }
-       if (z<=0)
-       {
-               z=0;
-       }
+               if (z>=maxZ)
+               {
+                       z=maxZ-1;
+               }
+               if (z<=0)
+               {
+                       z=0;
+               }
 
-       _z=z;
+               _z=z;
+       }
 }
 //-------------------------------------------------------------------
 double vtkBaseData::GetZ()
@@ -122,9 +125,12 @@ vtkMPRBaseData::~vtkMPRBaseData()
 //-------------------------------------------------------------------
 void vtkMPRBaseData::Configure()
 {
-       _marImageData->GetImageData()->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2);
-       _transformOrientation=vtkTransform::New();
-       _transformOrientation->Identity();
+       vtkImageData* img = _marImageData->GetImageData();
+       if(img !=NULL){
+               img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2);
+               _transformOrientation=vtkTransform::New();
+               _transformOrientation->Identity();
+       }
 }
 //-------------------------------------------------------------------
 void vtkMPRBaseData::GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2)
@@ -167,31 +173,37 @@ double    vtkMPRBaseData::GetY()
 void vtkMPRBaseData::SetX(double x)
 {
        int dim[3];
-       _marImageData->GetImageData()->GetDimensions(dim);
-       if (x<0)
-       {
-               x=0;
+       vtkImageData* img = _marImageData->GetImageData();
+       if(img!=NULL){
+               img->GetDimensions(dim);
+               if (x<0)
+               {
+                       x=0;
+               }
+               if (x>=dim[0])
+               {
+                       x=dim[0]-1;
+               };
+               _x=x;
        }
-       if (x>=dim[0])
-       {
-               x=dim[0]-1;
-       };
-       _x=x;
 }
 //-------------------------------------------------------------------
 void vtkMPRBaseData::SetY(double y)
 {
        int dim[3];
-       _marImageData->GetImageData()->GetDimensions(dim);
-       if (y<0)
-       {
-               y=0;
+       vtkImageData* img = _marImageData->GetImageData();
+       if(img!=NULL){
+               img->GetDimensions(dim);
+               if (y<0)
+               {
+                       y=0;
+               }
+               if (y>=dim[1])
+               {
+                       y=dim[1]-1;
+               };
+               _y=y;
        }
-       if (y>=dim[1])
-       {
-               y=dim[1]-1;
-       };
-       _y=y;
 }
 //-------------------------------------------------------------------
 vtkTransform *vtkMPRBaseData::GetTransformOrientation()
index dd8804c07d8c947d65c28fdf677202b33e32c136..38720c05fa171d1f1687f091a58fc50a80cdc41c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMPRWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/11/14 16:16:32 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2009/03/24 10:49:21 $
+  Version:   $Revision: 1.5 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -1981,89 +1981,91 @@ void wxVtkMPR2DView::Configure(){
        GetVtkmprbasedata()     -> GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
 
        double spc[3];
-       GetVtkmprbasedata()->GetImageData()->GetSpacing(spc);
-       x1 = (int)(x1*spc[0]);
-       y1 = (int)(y1*spc[1]);
-       z1 = (int)(z1*spc[2]);
-
-       x2 = (int)(x2*spc[0]);
-       y2 = (int)(y2*spc[1]);
-       z2 = (int)(z2*spc[2]);
-
-       _visibleAxis = true;
-
-// Axe A
-       _ptsA = vtkPoints::New();
-       _ptsA->SetNumberOfPoints(2);
-       _ptsA->SetPoint(0, -1000        , -1000 , -1000 );
-       _ptsA->SetPoint(1,  1000        ,  1000 ,  1000 );
-       vtkCellArray *linesA;
-       linesA = vtkCellArray::New();
-       linesA->InsertNextCell(2);
-       linesA->InsertCellPoint(0);
-       linesA->InsertCellPoint(1);
-       _pdA = vtkPolyData::New();
-    _pdA->SetPoints( _ptsA );
-    _pdA->SetLines( linesA );
-       linesA->Delete();  //do not delete lines ??
-       _lineAActor                                             =       vtkActor::New();
-    _lineAMapper                                       =       vtkPolyDataMapper::New();
-       _lineAMapper->SetInput(_pdA);
-       _lineAMapper->ImmediateModeRenderingOn();
-       _lineAActor->SetMapper(_lineAMapper);
-       _lineAActor->GetProperty()->BackfaceCullingOn();
-       _lineAActor->GetProperty()->SetDiffuseColor(1,0,0);
-       _lineAActor->GetProperty()->SetLineWidth(2);
-    _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
-
-// Axe B
-       _ptsB = vtkPoints::New();
-       _ptsB->SetNumberOfPoints(2);
-       _ptsB->SetPoint(0, -1000        , -1000 , -1000 );
-       _ptsB->SetPoint(1,  1000        ,  1000 ,  1000 );
-       vtkCellArray *linesB;
-       linesB = vtkCellArray::New();
-       linesB->InsertNextCell(2);
-       linesB->InsertCellPoint(0);
-       linesB->InsertCellPoint(1);
-       _pdB = vtkPolyData::New();
-    _pdB->SetPoints( _ptsB );
-    _pdB->SetLines( linesB );
-       linesB->Delete();  //do not delete lines ??
-       _lineBActor                                             =       vtkActor::New();
-    _lineBMapper                                       =       vtkPolyDataMapper::New();
-       _lineBMapper->SetInput(_pdB);
-       _lineBMapper->ImmediateModeRenderingOn();
-       _lineBActor->SetMapper(_lineBMapper);
-       _lineBActor->GetProperty()->BackfaceCullingOn();
-       _lineBActor->GetProperty()->SetDiffuseColor(1,0,0);
-       _lineBActor->GetProperty()->SetLineWidth(2);
-    _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
-
-       vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
-       if (_direction==0) {
-           camera->SetViewUp           (   0   ,    -1         ,     0         );
-               camera->SetPosition             ( -10000,(y1+y2)/2      , (z1+z2)/2     ); 
-               camera->SetFocalPoint   (   0   , (y1+y2)/2     , (z1+z2)/2     );
-               camera->SetParallelScale( (z2-z1)/3.0 );
-       }
+       vtkImageData* img =  GetVtkmprbasedata()->GetImageData();
+       if(img!=NULL){
+               img->GetSpacing(spc);
+               x1 = (int)(x1*spc[0]);
+               y1 = (int)(y1*spc[1]);
+               z1 = (int)(z1*spc[2]);
+
+               x2 = (int)(x2*spc[0]);
+               y2 = (int)(y2*spc[1]);
+               z2 = (int)(z2*spc[2]);
+
+               _visibleAxis = true;
+
+       // Axe A
+               _ptsA = vtkPoints::New();
+               _ptsA->SetNumberOfPoints(2);
+               _ptsA->SetPoint(0, -1000        , -1000 , -1000 );
+               _ptsA->SetPoint(1,  1000        ,  1000 ,  1000 );
+               vtkCellArray *linesA;
+               linesA = vtkCellArray::New();
+               linesA->InsertNextCell(2);
+               linesA->InsertCellPoint(0);
+               linesA->InsertCellPoint(1);
+               _pdA = vtkPolyData::New();
+               _pdA->SetPoints( _ptsA );
+               _pdA->SetLines( linesA );
+               linesA->Delete();  //do not delete lines ??
+               _lineAActor                                             =       vtkActor::New();
+               _lineAMapper                                    =       vtkPolyDataMapper::New();
+               _lineAMapper->SetInput(_pdA);
+               _lineAMapper->ImmediateModeRenderingOn();
+               _lineAActor->SetMapper(_lineAMapper);
+               _lineAActor->GetProperty()->BackfaceCullingOn();
+               _lineAActor->GetProperty()->SetDiffuseColor(1,0,0);
+               _lineAActor->GetProperty()->SetLineWidth(2);
+               _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
+
+       // Axe B
+               _ptsB = vtkPoints::New();
+               _ptsB->SetNumberOfPoints(2);
+               _ptsB->SetPoint(0, -1000        , -1000 , -1000 );
+               _ptsB->SetPoint(1,  1000        ,  1000 ,  1000 );
+               vtkCellArray *linesB;
+               linesB = vtkCellArray::New();
+               linesB->InsertNextCell(2);
+               linesB->InsertCellPoint(0);
+               linesB->InsertCellPoint(1);
+               _pdB = vtkPolyData::New();
+               _pdB->SetPoints( _ptsB );
+               _pdB->SetLines( linesB );
+               linesB->Delete();  //do not delete lines ??
+               _lineBActor                                             =       vtkActor::New();
+               _lineBMapper                                    =       vtkPolyDataMapper::New();
+               _lineBMapper->SetInput(_pdB);
+               _lineBMapper->ImmediateModeRenderingOn();
+               _lineBActor->SetMapper(_lineBMapper);
+               _lineBActor->GetProperty()->BackfaceCullingOn();
+               _lineBActor->GetProperty()->SetDiffuseColor(1,0,0);
+               _lineBActor->GetProperty()->SetLineWidth(2);
+               _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
+
+               vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
+               if (_direction==0) {
+                       camera->SetViewUp               (   0   ,    -1         ,     0         );
+                       camera->SetPosition             ( -10000,(y1+y2)/2      , (z1+z2)/2     ); 
+                       camera->SetFocalPoint   (   0   , (y1+y2)/2     , (z1+z2)/2     );
+                       camera->SetParallelScale( (z2-z1)/3.0 );
+               }
 
-       if (_direction==1) { 
-           camera->SetViewUp           (       0               ,       0       ,       -1              );
-               camera->SetPosition             ((x1+x2)/2      , 10000 , (z1+z2)/2     ); 
-               camera->SetFocalPoint   ((x1+x2)/2      ,   0   , (z1+z2)/2     );
-               camera->SetParallelScale( (x2-x1)/3.0 );
-       }
+               if (_direction==1) { 
+                       camera->SetViewUp               (       0               ,       0       ,       -1              );
+                       camera->SetPosition             ((x1+x2)/2      , 10000 , (z1+z2)/2     ); 
+                       camera->SetFocalPoint   ((x1+x2)/2      ,   0   , (z1+z2)/2     );
+                       camera->SetParallelScale( (x2-x1)/3.0 );
+               }
 
-       if (_direction==2) { 
-           camera->SetViewUp           (       0               ,       -1              ,       0       );
-               camera->SetPosition             ((x1+x2)/2      , (y1+y2)/2     , -10000); 
-               camera->SetFocalPoint   ((x1+x2)/2      , (y1+y2)/2     ,       0       ); 
-               camera->SetParallelScale( (x2-x1)/3.0 );
+               if (_direction==2) { 
+                       camera->SetViewUp               (       0               ,       -1              ,       0       );
+                       camera->SetPosition             ((x1+x2)/2      , (y1+y2)/2     , -10000); 
+                       camera->SetFocalPoint   ((x1+x2)/2      , (y1+y2)/2     ,       0       ); 
+                       camera->SetParallelScale( (x2-x1)/3.0 );
+               }
        }
 
 
-
 //     _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow (160);
 //     _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel (800);
 
@@ -2102,53 +2104,57 @@ void wxVtkMPR2DView::Refresh()
        int x1,x2,y1,y2,z1,z2;
        GetVtkmprbasedata()->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
        double spc[3];
-       GetVtkmprbasedata()->GetImageData()->GetSpacing(spc);
-       x1 =  (int)(x1*spc[0]);
-       y1 =  (int)(y1*spc[1]);
-       z1 =  (int)(z1*spc[2]);
+       
+       vtkImageData* img = GetVtkmprbasedata()->GetImageData();
+       if(img!=NULL){
+               img->GetSpacing(spc);
+               x1 =  (int)(x1*spc[0]);
+               y1 =  (int)(y1*spc[1]);
+               z1 =  (int)(z1*spc[2]);
 
-       x2 =  (int)(x2*spc[0]);
-       y2 =  (int)(y2*spc[1]);
-       z2 =  (int)(z2*spc[2]);
+               x2 =  (int)(x2*spc[0]);
+               y2 =  (int)(y2*spc[1]);
+               z2 =  (int)(z2*spc[2]);
 
-       int x = (int)(GetVtkmprbasedata()->GetX());
-       int y = (int)(GetVtkmprbasedata()->GetY());
-       int z = (int)(GetVtkmprbasedata()->GetZ());
+               int x = (int)(GetVtkmprbasedata()->GetX());
+               int y = (int)(GetVtkmprbasedata()->GetY());
+               int z = (int)(GetVtkmprbasedata()->GetZ());
 
-       x =  (int)(x*spc[0]);
-       y =  (int)(y*spc[1]);
-       z =  (int)(z*spc[2]);
+               x =  (int)(x*spc[0]);
+               y =  (int)(y*spc[1]);
+               z =  (int)(z*spc[2]);
 
 
 
-       if ((x!=_backX) || (y!=_backY) || (z!=_backZ)) {
+               if ((x!=_backX) || (y!=_backY) || (z!=_backZ)) {
 
-               if (_direction==0) { 
-                       _imageViewer2XYZ->SetXSlice( (int)(GetVtkmprbasedata()->GetX()) ); 
-                       _ptsA->SetPoint(0, -x2, y1  , z );
-                       _ptsA->SetPoint(1, -x2, y2  , z );
-                       _ptsB->SetPoint(0, -x2, y   , z1);
-                       _ptsB->SetPoint(1, -x2, y   , z2);
-               }
-               if (_direction==1) { 
-                       _imageViewer2XYZ->SetYSlice( (int)(GetVtkmprbasedata()->GetY()) ); 
-                       _ptsA->SetPoint(0, x1 , y2 , z );
-                       _ptsA->SetPoint(1, x2 , y2 , z );
-                       _ptsB->SetPoint(0, x  , y2 , z1);
-                       _ptsB->SetPoint(1, x  , y2 , z2);
-               }
-               if (_direction==2) { 
-                       _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) ); 
-                       _ptsA->SetPoint(0, x1 , y , -z2 );
-                       _ptsA->SetPoint(1, x2 , y , -z2 );
-                       _ptsB->SetPoint(0, x  , y1, -z2 );
-                       _ptsB->SetPoint(1, x  , y2, -z2 );
+                       if (_direction==0) { 
+                               _imageViewer2XYZ->SetXSlice( (int)(GetVtkmprbasedata()->GetX()) ); 
+                               _ptsA->SetPoint(0, -x2, y1  , z );
+                               _ptsA->SetPoint(1, -x2, y2  , z );
+                               _ptsB->SetPoint(0, -x2, y   , z1);
+                               _ptsB->SetPoint(1, -x2, y   , z2);
+                       }
+                       if (_direction==1) { 
+                               _imageViewer2XYZ->SetYSlice( (int)(GetVtkmprbasedata()->GetY()) ); 
+                               _ptsA->SetPoint(0, x1 , y2 , z );
+                               _ptsA->SetPoint(1, x2 , y2 , z );
+                               _ptsB->SetPoint(0, x  , y2 , z1);
+                               _ptsB->SetPoint(1, x  , y2 , z2);
+                       }
+                       if (_direction==2) { 
+                               _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) ); 
+                               _ptsA->SetPoint(0, x1 , y , -z2 );
+                               _ptsA->SetPoint(1, x2 , y , -z2 );
+                               _ptsB->SetPoint(0, x  , y1, -z2 );
+                               _ptsB->SetPoint(1, x  , y2, -z2 );
+                       }
+                       _backX=x;
+                       _backY=y;
+                       _backZ=z;
                }
-               _backX=x;
-               _backY=y;
-               _backZ=z;
+               wxVtkBaseView::Refresh();
        }
-       wxVtkBaseView::Refresh();
 }
 //-------------------------------------------------------------------
 int wxVtkMPR2DView::GetActualSlice()   // virtual
@@ -5385,38 +5391,60 @@ wxMPRWidget::wxMPRWidget( wxWindow* parent,
        _vtkmprbasedata                                 = NULL;
 
 
-       _voxelSize                                              = voxelSize;
+       
        _framePanelCutting                              = NULL;
        _panelCutting                                   = NULL;
-       _marImageData                                   = marimageData;
-
-       _vtkmprbasedata                                 = new vtkMPRBaseData(); 
-       _vtkmprbasedata->SetMarImageData(_marImageData);
 
-       wxSplitterWindow        *pnlSplitter            = new wxSplitterWindow( this , -1);
 
-       wxPanel                         *MPRPanel       = CreateMPRPanel(pnlSplitter,_vtkmprbasedata);
-       wxPanel                         *controlPanel   = CreateControlPanel(pnlSplitter);
        wxBoxSizer                      *sizer          = new wxBoxSizer(wxVERTICAL  );
-       sizer           -> Add( pnlSplitter ,1,wxGROW  ,0);
 
-       int ww,hh;
-       wxWindow *pp=this;
-       while (pp->GetParent()!=NULL) pp=pp->GetParent();
-       pp->GetSize(&ww,&hh);
+       if(marimageData!=NULL){
+               _marImageData                                   = marimageData;
+               _voxelSize                                              = voxelSize;
+               _vtkmprbasedata                                 = new vtkMPRBaseData(); 
+               _vtkmprbasedata->SetMarImageData(_marImageData);
+               
+               
+               
 
-       pnlSplitter     -> SetMinimumPaneSize( 2 );
+               wxSplitterWindow        *pnlSplitter            = new wxSplitterWindow( this , -1);
+               pnlSplitter     -> SetMinimumPaneSize( 2 );
 
-       pnlSplitter     -> SplitVertically( MPRPanel, controlPanel, 550 );
+               wxPanel                         *MPRPanel       = CreateMPRPanel(pnlSplitter,_vtkmprbasedata);
+               wxPanel                         *controlPanel   = CreateControlPanel(pnlSplitter);      
+               pnlSplitter     -> SplitVertically( MPRPanel, controlPanel, 550 );
+
+               sizer           -> Add( pnlSplitter ,1,wxGROW  ,0);
+
+       }          
+
+       //int ww,hh;
+       //wxWindow *pp=this;
+       //while (pp->GetParent()!=NULL) pp=pp->GetParent();
+       //pp->GetSize(&ww,&hh);
+       
        this            -> SetAutoLayout( true );
        this            -> SetSizer(sizer);
 //     sizer           ->      Fit( this );
-
        _refreshAPage=0;
        _refreshBPage=0;
 
 }
+void wxMPRWidget::setMarImage(marImageData *marimageData, double voxelsize){
+       _marImageData                                   = marimageData;
+       _voxelSize                                              = voxelsize;
+       _vtkmprbasedata                                 = new vtkMPRBaseData(); 
+       _vtkmprbasedata->SetMarImageData(_marImageData);        
 
+       wxSplitterWindow        *pnlSplitter            = new wxSplitterWindow( this , -1);
+       pnlSplitter     -> SetMinimumPaneSize( 2 );
+
+       wxPanel                         *MPRPanel       = CreateMPRPanel(pnlSplitter,_vtkmprbasedata);
+       wxPanel                         *controlPanel   = CreateControlPanel(pnlSplitter);      
+       pnlSplitter     -> SplitVertically( MPRPanel, controlPanel, 550 );
+
+       this->GetSizer()                -> Add( pnlSplitter ,1,wxGROW  ,0);
+}
 //----------------------------------------------------------------------------
 
 wxMPRWidget::~wxMPRWidget( )
index 5f0c7593b62e9feca44ad07a01531d9260cc07fc..c98583a5eda18aa2a2cf7b95515957113b15f8d9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMPRWidget.h,v $
   Language:  C++
-  Date:      $Date: 2009/01/15 11:09:44 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2009/03/24 10:49:21 $
+  Version:   $Revision: 1.7 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -942,7 +942,7 @@ private:
 class creaMaracasVisu_EXPORT wxMPRWidget : public wxPanel
 {
 public:
-    wxMPRWidget(wxWindow* parent,marImageData *marimageData,double voxelSize);
+    wxMPRWidget(wxWindow* parent,marImageData *marimageData = NULL,double voxelSize = -1);
        ~wxMPRWidget( );
        void ConfigureVTK();
 
@@ -965,6 +965,8 @@ public:
        //returns the 2d view of the specific direction (0|1|2)
        wxVtkMPR2DView *GetWxvtkMPR2Dview(int direction);
 
+       void setMarImage(marImageData *marimageData, double voxelsize);
+
 private:
        double                                  _voxelSize;
        marImageData                    *_marImageData; 
index c24788a7b53f6e7160c07c93da0ecd436617621b..e93c05d1ec4536f439234c4951dd8adac96d5e8a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/03 11:42:54 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/03/24 10:49:21 $
+  Version:   $Revision: 1.3 $
 
   Copyright: (c) 2002, 2003
   License:
        wxMaracas_N_ViewersWidget::wxMaracas_N_ViewersWidget(wxWindow *parent, vtkImageData* imagedata, std::vector<int> *nTypeView)
                : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
        {
-               wxPanel                         *panel          = this;
-               wxWindow                                *wxwindow       = NULL;
-                                                               wxwindow1       = NULL;
-                                                               wxwindow2       = NULL;
-                                                               wxwindow3       = NULL;
-                                                               wxwindow4       = NULL;
-
-               if (nTypeView->size()==1)
-               {
-               wxwindow1 = new wxMaracas_ViewerWidget(panel, imagedata, (*nTypeView)[0]);
-               wxwindow1->ConfigureVTK();
-               wxwindow = wxwindow1;
-               }
-
-
-               if (nTypeView->size()==2)
-               {
-                       wxSplitterWindow        *spliter        = new wxSplitterWindow( panel , -1);
-                       wxwindow1 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[0]);
-                       wxwindow2 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[1]);
-                       wxwindow1->ConfigureVTK();
-                       wxwindow2->ConfigureVTK();
-                       spliter -> SplitVertically( wxwindow1 , wxwindow2  );
-                       wxwindow = spliter;
-               }
-
-
-               if (nTypeView->size()==3)
-               {
-                       wxSplitterWindow        *spliter        = new wxSplitterWindow( panel , -1);
-                       wxSplitterWindow        *spliterA       = new wxSplitterWindow( spliter , -1);
-                       wxwindow1 = new wxMaracas_ViewerWidget(spliter , imagedata, (*nTypeView)[0]);
-                       wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1]);
-                       wxwindow3 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[2]);
-                       wxwindow1->ConfigureVTK();
-                       wxwindow2->ConfigureVTK();
-                       wxwindow3->ConfigureVTK();
-                       spliter -> SplitVertically( wxwindow1 , spliterA   );
-                       spliterA-> SplitHorizontally( wxwindow2 , wxwindow3  );
-                       wxwindow = spliter;
+               wxwindow1       = NULL;
+               wxwindow2       = NULL;
+               wxwindow3       = NULL;
+               wxwindow4       = NULL;
+               currentwxwindow = NULL;
+
+               wxSizer *sizer  = new wxBoxSizer(wxVERTICAL);
+               this->SetSizer(sizer);
+               this->SetAutoLayout(true);
+               
+               
+               if(imagedata!=NULL && nTypeView!=NULL ){
+                       this->SetType(nTypeView);
+                       this->UpdateLayout(imagedata);
                }
 
-               if (nTypeView->size()>=4)
-               {
-                       wxSplitterWindow        *spliter        = new wxSplitterWindow( panel , -1);
-                       wxSplitterWindow        *spliterA       = new wxSplitterWindow( spliter , -1);
-                       wxSplitterWindow        *spliterB       = new wxSplitterWindow( spliter , -1);
-                       wxwindow1 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[0]);
-                       wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1]);
-                       wxwindow3 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[2]);
-                       wxwindow4 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[3]);
-                       wxwindow1->ConfigureVTK();
-                       wxwindow2->ConfigureVTK();
-                       wxwindow3->ConfigureVTK();
-                       wxwindow4->ConfigureVTK();
-                       spliter -> SplitVertically( spliterA , spliterB   );
-                       spliterA-> SplitHorizontally( wxwindow1 , wxwindow2  );
-                       spliterB-> SplitHorizontally( wxwindow3 , wxwindow4  );
-                       wxwindow = spliter;
-               }
-
-
-       wxBoxSizer *sizer       = new wxBoxSizer(wxVERTICAL);
-       sizer->Add( wxwindow , 1, wxEXPAND, 0);
-       panel->SetSizer(sizer);
-       panel->SetAutoLayout(true);
-       panel->Layout();
+               
        }
        //-------------------------------------------------------------------------
          
         wxPanel::Refresh(false);
  }
 
+ void wxMaracas_N_ViewersWidget::UpdateLayout(vtkImageData* imagedata){
 
+               wxPanel                         *panel          = this;
+               wxWindow                                *wxwindow       = NULL;
+               wxSizer *sizer  = panel->GetSizer();
+       
+               if(currentwxwindow!=NULL){
+                       sizer->Remove(currentwxwindow);                 
+                       delete currentwxwindow;
+               }
+
+               //std::cout<<"size "<<nTypeView->size()<<std::endl;
+               if (nTypeView->size()==1)
+               {
+
+                       std::cout<<"type "<<(*nTypeView)[0]<<std::endl;
+                       wxwindow1 = new wxMaracas_ViewerWidget(panel, imagedata, (*nTypeView)[0]);
+                       wxwindow1->ConfigureVTK();
+                       wxwindow = wxwindow1;
+               }else   if (nTypeView->size()==2)       {
+
+                       
+                       wxSplitterWindow        *spliter        = new wxSplitterWindow( panel , -1);
+                       wxwindow1 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[0]);
+                       wxwindow2 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[1]);
+                       wxwindow1->ConfigureVTK();
+                       wxwindow2->ConfigureVTK();
+                       spliter -> SplitVertically( wxwindow1 , wxwindow2  );
+                       wxwindow = spliter;
+               }else if (nTypeView->size()==3)
+               {
+                       wxSplitterWindow        *spliter        = new wxSplitterWindow( panel , -1);
+                       wxSplitterWindow        *spliterA       = new wxSplitterWindow( spliter , -1);
+                       wxwindow1 = new wxMaracas_ViewerWidget(spliter , imagedata, (*nTypeView)[0]);
+                       wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1]);
+                       wxwindow3 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[2]);
+                       wxwindow1->ConfigureVTK();
+                       wxwindow2->ConfigureVTK();
+                       wxwindow3->ConfigureVTK();
+                       spliter -> SplitVertically( wxwindow1 , spliterA   );
+                       spliterA-> SplitHorizontally( wxwindow2 , wxwindow3  );
+                       wxwindow = spliter;
+               }else if (nTypeView->size()>=4){
+                       wxSplitterWindow        *spliter        = new wxSplitterWindow( panel , -1);
+                       wxSplitterWindow        *spliterA       = new wxSplitterWindow( spliter , -1);
+                       wxSplitterWindow        *spliterB       = new wxSplitterWindow( spliter , -1);
+                       wxwindow1 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[0]);
+                       wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1]);
+                       wxwindow3 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[2]);
+                       wxwindow4 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[3]);
+                       wxwindow1->ConfigureVTK();
+                       wxwindow2->ConfigureVTK();
+                       wxwindow3->ConfigureVTK();
+                       wxwindow4->ConfigureVTK();
+                       spliter -> SplitVertically( spliterA , spliterB   );
+                       spliterA-> SplitHorizontally( wxwindow1 , wxwindow2  );
+                       spliterB-> SplitHorizontally( wxwindow3 , wxwindow4  );
+                       wxwindow = spliter;
+               }
+               
+               //panel->SetDimension()
+               sizer->Add( wxwindow , 1, wxGROW);
+               sizer->Layout();
+               currentwxwindow = wxwindow;             
+               currentwxwindow->Show(true);
+               
+               this->Layout();
+               this->Refresh();
+
+ }
+
+ void wxMaracas_N_ViewersWidget::SetType(std::vector<int>* type){
+        nTypeView = type;
+ }
  void wxMaracas_N_ViewersWidget::SetImage( vtkImageData *image )
  {
         if (wxwindow1!=NULL) { 
index fd2ed748017dfb558215d617ee65577ef17c9894..b7cf72b553f6ede6c6bbcd034513cb63666038d5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_N_ViewersWidget.h,v $
   Language:  C++
-  Date:      $Date: 2009/01/15 11:09:44 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/03/24 10:49:21 $
+  Version:   $Revision: 1.3 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -53,7 +53,7 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel
        // Constructors & Destructors
        //------------------------------------------------------------------------------------------------------------
 
-       wxMaracas_N_ViewersWidget(wxWindow *parent, vtkImageData* imagedata, std::vector<int> *nTypeView);
+       wxMaracas_N_ViewersWidget(wxWindow *parent, vtkImageData* imagedata = NULL, std::vector<int> *nTypeView = NULL);
     ~wxMaracas_N_ViewersWidget();
 
        
@@ -71,6 +71,8 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel
        wxVtkBaseView *GetwxVtkBaseView(int iWin);
        virtual void Refresh(bool eraseBackground = true,const wxRect* rect = NULL );
        void SetImage( vtkImageData *image      );
+       void SetType(std::vector<int>* type);
+       void UpdateLayout(vtkImageData* imagedata);
 //     double GetZ(int iWin);
        double GetX();
        double GetY();
@@ -87,6 +89,10 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel
        wxMaracas_ViewerWidget  *wxwindow3;
        wxMaracas_ViewerWidget  *wxwindow4;
 
+       wxWindow *currentwxwindow;
+
+
+       std::vector<int> *nTypeView;
 
   DECLARE_EVENT_TABLE( );
   };
index d81a4680e53e4807be703a387c9fcca005714678..dd6b80cf5d8c455295ab7de2ade80fae77ef488e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_ViewerWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/12/03 11:42:54 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2009/03/24 10:49:21 $
+  Version:   $Revision: 1.4 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -53,6 +53,9 @@
                mwxvtk3Dbaseview_Clipping3D     = NULL;
                mwxvtkmpr3Dview                         = NULL; 
 
+
+               std::cout<<"mtype "<<mType<<std::endl;
+               std::cout<<"type "<<type<<std::endl;
                if (type==-1)
                {
                        mvtk2Dbaseview  = new wxVtk2DBaseView(panel);
@@ -73,6 +76,7 @@
                        mvtkmpr2Dview_X->SetVtkBaseData(mvtkmprbasedata);
                        wxwindow                =       mvtkmpr2Dview_X->GetWxVTKRenderWindowInteractor();
                }
+
                if (type==2)
                {
                        mvtkmpr2Dview_Y = new wxVtkMPR2DView(panel,2);
 
 
        wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
-       sizer->Add( wxwindow , 1, wxEXPAND, 0);
+       sizer->Add( wxwindow , 1, wxGROW);      
        panel->SetSizer(sizer);
        panel->SetAutoLayout(true);
+       sizer->Layout();
        panel->Layout();
+       panel->Refresh();
 
        //   mbbtkViewerMaracas= NULL;
        }
        wxMaracas_ViewerWidget::~wxMaracas_ViewerWidget()
        {
 
+               testDelete(mvtkmprbasedata);
+               testDelete(mvtk2Dbaseview);
+               testDelete(mvtkmpr2Dview_X); 
+               testDelete(mvtkmpr2Dview_Y); 
+               testDelete(mvtkmpr2Dview_Z); 
+               testDelete(mwidgetMesure);
+               testDelete(mvtkplane2Dview);
+               testDelete(mwxsphereview); 
+               testDelete(mwxvtkclipping3Dview);
+               testDelete(mwxvtk3Dbaseview_Clipping3D);
+               testDelete(mwxvtkmpr3Dview);
+
+       }
+
+       void wxMaracas_ViewerWidget::testDelete(void* point){
+               if(point!=NULL){
+                       delete point;
+               }
        }
            
        //------------------------------------------------------------------------------------------------------------
index 7e7e49ea7e8898b16eb9a7c3c36793a285c322b0..ccba0baf5e608fb4ab60f5fcf08eed40b672ea05 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_ViewerWidget.h,v $
   Language:  C++
-  Date:      $Date: 2008/10/31 16:32:42 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/03/24 10:49:21 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -94,6 +94,7 @@
                wxVtkMPR3DView                                  *mwxvtkmpr3Dview;
 
 
+               void testDelete(void* point);
   };
 
 #endif // __WX__MARACAS__VIEWERWIDGET__H__
index 1afdbfb21c71739b3d04cfa34d040339fe354eb0..cbecc1a7f8c1a57e0aee73b95aca17708eaf16ac 100644 (file)
@@ -62,7 +62,7 @@
 //-------------------------------------------------------------------
 //-------------------------------------------------------------------
 //-------------------------------------------------------------------
-wxSTLWidget_03::wxSTLWidget_03(wxWindow *parent, marInterface* mar)
+wxSTLWidget_03::wxSTLWidget_03(wxWindow *parent)//, marInterface* mar)
 : wxPanel( parent, -1) 
 {
        _wxMaracasMPR           = NULL;
@@ -72,7 +72,7 @@ wxSTLWidget_03::wxSTLWidget_03(wxWindow *parent, marInterface* mar)
        _stlMarchingCubesLevel  = 128;
        _stlDeltaGaussLevel             = 100;
 
-       _mar=new marInterface();        
+       /*_mar=new marInterface();      
        _mar->_parameters->setRescaleSlope( mar->_parameters->getRescaleSlope() );
        _mar->_parameters->setRescaleIntercept( mar->_parameters->getRescaleIntercept() );
        _mar->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
@@ -83,7 +83,7 @@ wxSTLWidget_03::wxSTLWidget_03(wxWindow *parent, marInterface* mar)
        mar->_experiment->getVOI( voi );
        _mar->_experiment->setVOI( voi );
        _mar->SetDicom(mar->_dicom);
-       _mar->initExperiment( );
+       _mar->initExperiment( );*/
         
 
        wxBoxSizer              *sizer          = new wxBoxSizer(wxVERTICAL  );
@@ -140,11 +140,11 @@ wxPanel* wxSTLWidget_03::CreateViewPanel(wxWindow *parent)
 
 
    // MPR
-       vtkImageData *imagedata;
-       imagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
-       imagedata->Update();    
+       //vtkImageData *imagedata;
+       //imagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
+       //imagedata->Update();  
 printf("EED wxSTLWidget_03::CreateViewPanel  01 \n");
-       _wxMaracasMPR = new wxMaracasMPR( panel, new marImageData(imagedata), _mar->_parameters->getVoxelSize() );
+       _wxMaracasMPR = new wxMaracasMPR( panel);//JCP 10-03-2009, new marImageData(imagedata), 1 );
 printf("EED wxSTLWidget_03::CreateViewPanel  02 \n");
        _wxMaracasMPR->ConfigureVTK();
 printf("EED wxSTLWidget_03::CreateViewPanel  03 \n");
@@ -157,6 +157,13 @@ printf("EED wxSTLWidget_03::CreateViewPanel  03 \n");
 printf("EED wxSTLWidget_03::CreateViewPanel  04 \n");
        return panel;
 }
+
+void wxSTLWidget_03::setImage(vtkImageData* img){
+
+
+       _wxMaracasMPR->setMarImage(new marImageData(img), 1);
+       _wxMaracasMPR->ConfigureVTK();
+}
 //-------------------------------------------------------------------
 wxWindow* wxSTLWidget_03::CreateSelectAPointPanel(wxWindow *parent)
 {
@@ -544,7 +551,7 @@ void wxSTLWidget_03::ConfigureVTK()
 {
        wxBusyCursor wait;
 //     vtkImageData    *imagedata              = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
-       marImageData    *marimagedata           = _mar->_experiment->getDynData( )->GetMarImageData();
+       marImageData    *marimagedata;//                = _mar->_experiment->getDynData( )->GetMarImageData();
        
        //CONFIGURACION ADICIONAL
        this->ConfigureSTL();
@@ -761,8 +768,8 @@ void wxSTLWidget_03:: OnBarMoved_range(wxCommandEvent& event)
 
 void wxSTLWidget_03::OnBtnSaveBinaryFile(wxCommandEvent& event)
 {
-       wxString dirSTL = _mar->_parameters->getStringParam( 
-    marParameters::e_installation_directory ); 
+       wxString dirSTL;// = _mar->_parameters->getStringParam( 
+    //marParameters::e_installation_directory ); 
        dirSTL = ( dirSTL == _T("NO_DIRECTORY") ) ? wxGetHomeDir( ) : dirSTL;
        wxFileDialog dialog( this, _T("Choose a directory..."), ( !dirSTL.IsEmpty( ) )?
        dirSTL: wxGetHomeDir( ) );
@@ -843,8 +850,8 @@ void wxSTLWidget_03::OnBtnSTLFileErase(wxCommandEvent& event)
 //------------------------------------------------------------------------
 void wxSTLWidget_03::OnBtnSTLFileLoad(wxCommandEvent& event)
 {
-       wxString dirSTL = _mar->_parameters->getStringParam( 
-    marParameters::e_installation_directory ); 
+       wxString dirSTL;// = _mar->_parameters->getStringParam( 
+    //marParameters::e_installation_directory ); 
        dirSTL = ( dirSTL == _T("NO_DIRECTORY") ) ? wxGetHomeDir( ) : dirSTL;
        wxFileDialog dialog( this, _T("Choose a directory..."), ( !dirSTL.IsEmpty( ) )?
        dirSTL: wxGetHomeDir( ) );
@@ -865,8 +872,8 @@ void wxSTLWidget_03::OnBtnSTLFileLoad(wxCommandEvent& event)
                imgReader->Delete();
        }
        //By default *always* update e_installation_directory:
-       _mar->_parameters->setStringParam( marParameters::e_installation_directory, dialog.GetPath( ) ); 
-       _mar->saveParameters( );
+       //_mar->_parameters->setStringParam( marParameters::e_installation_directory, dialog.GetPath( ) ); 
+       //_mar->saveParameters( );
 }
 
 
@@ -939,8 +946,8 @@ void wxSTLWidget_03::OnOpacitySTLInternal(wxScrollEvent& event){
 void wxSTLWidget_03::OnBtnCreateFileSTL(wxCommandEvent& event)
 {
 
-       wxString dirSTL = _mar->_parameters->getStringParam( 
-    marParameters::e_installation_directory ); 
+       wxString dirSTL;// = _mar->_parameters->getStringParam( 
+    //marParameters::e_installation_directory ); 
        dirSTL = ( dirSTL == _T("NO_DIRECTORY") ) ? wxGetHomeDir( ) : dirSTL;
 
        
@@ -997,8 +1004,8 @@ void wxSTLWidget_03::OnBtnCreateFileSTL(wxCommandEvent& event)
        }
 
        //By default *always* update e_installation_directory:
-       _mar->_parameters->setStringParam( marParameters::e_installation_directory, dialog.GetPath( ) ); 
-       _mar->saveParameters( );
+       //_mar->_parameters->setStringParam( marParameters::e_installation_directory, dialog.GetPath( ) ); 
+       //_mar->saveParameters( );
 }
 
 
index f120b4fdc6417777e4a39f08a822c0e420e1a676..916ca395d252a37104542472e27cdb5be2d98222 100644 (file)
 #include <vtkImageCast.h>
 
 #include "wxVTKRenderWindowInteractor.h"
-#include "wxSurfaceWidget.h"
+//#include "wxSurfaceWidget.h"
 #include "wxVtkBaseView.h"
 
 
 #include "../wxMaracasMPR.h"
 #include "pPlotter/mBarRange.h"//SIL//
 
-#include <kernel/marInterface.h>
-#include <kernel/axisExtractor02.h>
+//#include <marInterface.h>
+#include <axisExtractor02.h>
 
 
-#include "kernel/vtkSTLExtractor.h"    
-#include "kernel/vtkJoiner.h"
+#include "vtkSTLExtractor.h"    
+#include "vtkJoiner.h"
+
+#include "marTypes.h"
 
 
 
@@ -37,9 +39,9 @@
 //------------------------------------------------------------------
 //------------------------------------------------------------------
 
-class wxSTLWidget_03: public wxPanel{
+class creaMaracasVisu_EXPORT wxSTLWidget_03: public wxPanel{
 public:
-       wxSTLWidget_03(wxWindow *parentmar,marInterface *mar);
+       wxSTLWidget_03(wxWindow *parentmar);//,marInterface *mar);
        ~wxSTLWidget_03();
        void ConfigureVTK();
        void Refresh();
@@ -83,6 +85,9 @@ public:
        //---------------------------------------
        void OnJoinRegions(wxCommandEvent& event);
 
+       //JCP 01-03-08
+       void setImage(vtkImageData* img);
+
 private:
 
        //Processing
@@ -133,7 +138,7 @@ private:
        wxPanel                         *CreateViewPanel(wxWindow *parent);
 
        //Maracas
-       marInterface            *_mar;
+       //marInterface          *_mar;
        wxMaracasMPR            *_wxMaracasMPR;
 
        void ResetTree2_JF();
index 756395ae7a0bd3a4a0c99bc8870d388b40205dfd..2fd86e88df517a8bc03366bf21076e7c074958a4 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracasMPR.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/10/31 16:32:10 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/03/24 10:49:18 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -63,6 +63,10 @@ void wxMaracasMPR::RefreshView()
        _MPR->RefreshView();
 }
 
+void wxMaracasMPR::setMarImage(marImageData *marimageData, double voxelsize){
+       _MPR->setMarImage(marimageData, voxelsize);
+
+}
 
 // EOF - wxMaracasMPR.cxx
 
index dc1dd1b576e60c3641d79361d9c6ab48a68e92e1..717047d2d7cfcbf8ed67e70611f44c3621cb4279 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracasMPR.h,v $
   Language:  C++
-  Date:      $Date: 2009/01/15 11:09:39 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2009/03/24 10:49:18 $
+  Version:   $Revision: 1.4 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -30,7 +30,7 @@
 class  creaMaracasVisu_EXPORT  wxMaracasMPR : public wxPanel
 {
 public:
-    wxMaracasMPR( wxWindow* parent, marImageData* marimagedata,double voxelSize);
+    wxMaracasMPR( wxWindow* parent, marImageData* marimagedata=NULL,double voxelSize=-1);
     ~wxMaracasMPR( );
        void ConfigureVTK();
        vtkMPRBaseData  *GetVtkMPRBaseData();
@@ -38,6 +38,8 @@ public:
        wxVtkMPR3DView  *GetWxvtkmpr3Dview_BB();
        void                    RefreshView();
 
+       void setMarImage(marImageData *marimageData, double voxelsize);
+
 private:
         wxMPRWidget* _MPR;
 };
index 88476ca82ac0b7225d243b6d16cb32059c472198..ea1927a39481e485e95e5bd1be1d9dbcda4a63ea 100644 (file)
@@ -16,7 +16,9 @@ marImageData::marImageData(vtkImageData *imagedata)
        _voiOriginal[3] = 0;
        _voiOriginal[4] = 0;
        _voiOriginal[5] = 0;
-       AddImageData(imagedata);
+       if(imagedata!=NULL){
+               AddImageData(imagedata);
+       }
 }
 // ----------------------------------------------------------------------------------------------
 marImageData::~marImageData()
@@ -71,12 +73,18 @@ void marImageData::GetVoiOriginal(int voi[6])
 // ----------------------------------------------------------------------------------------------
 vtkImageData *marImageData::GetImageDataT(int t)
 {
-       return _imagedataLST[t];
+       if(_imagedataLST.size() > t){
+               return _imagedataLST[t];
+       }
+       return NULL;
 }
 // ----------------------------------------------------------------------------------------------
 vtkImageData *marImageData::GetImageData()
 {
-       return _imagedataLST[0];
+       if(_imagedataLST.size()>0){
+               return _imagedataLST[0];
+       }
+       return NULL;
 }
 
 void marImageData::removeImageData(int index)
index 7413c9d82a40493c864669858755fbde806f9f08..cf18aba8aee7f01ab8e4ffbac7a731f1ce3c7c57 100644 (file)
@@ -3,8 +3,8 @@
  Program:   wxMaracas
  Module:    $RCSfile: marKVolume.h,v $
  Language:  C++
- Date:      $Date: 2008/10/31 16:32:55 $
- Version:   $Revision: 1.1 $
+ Date:      $Date: 2009/03/24 10:49:23 $
+ Version:   $Revision: 1.2 $
  
   Copyright: (c) 2002, 2003
   License:
@@ -21,6 +21,8 @@
 
 #include "volume.hxx"
 
+#include "marTypes.h"
+
 class MAR_KERNEL_EXPORT marKVolume {
        
 public: