]> Creatis software - creaContours.git/commitdiff
*** empty log message ***
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Wed, 10 Dec 2008 16:17:15 +0000 (16:17 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Wed, 10 Dec 2008 16:17:15 +0000 (16:17 +0000)
data/Icons/Help.png [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/__wxContourEventHandler.cxx__ [deleted file]
lib/Interface_ManagerContour_NDimensions/_wxContourEventHandler.cxx_ [deleted file]
lib/Interface_ManagerContour_NDimensions/_wxContourEventHandler.h_ [deleted file]

diff --git a/data/Icons/Help.png b/data/Icons/Help.png
new file mode 100644 (file)
index 0000000..814a634
Binary files /dev/null and b/data/Icons/Help.png differ
diff --git a/lib/Interface_ManagerContour_NDimensions/__wxContourEventHandler.cxx__ b/lib/Interface_ManagerContour_NDimensions/__wxContourEventHandler.cxx__
deleted file mode 100644 (file)
index a78be78..0000000
+++ /dev/null
@@ -1,2803 +0,0 @@
-
-
-/*  Diagrama de Secuaencia de cambiar un instante
-wxContourEventHandler :: changeInstant()
-       OutlineModelManager :: ->setInstant( _actualInstant );
-               OutlineModelManager :: updateToActualInstant()
-                 OutlineModelManager :: getOutlinesAtInstant(Instant * anInstant, bool ifAnnotate)
-                   OutlineModelManager :: annotateOutlinesWrap(std::vector<std::string> kNamesVector, std::vector<ContourThing **> theOutlinesVector)
-       wxContourEventHandler :: updateInstantOutlines()
-               OutlineModelManager :: getActualInstantOutlines ()
-               wxVtkBaseView_SceneManager :: addToScene( std::vector< std::string> theKeyNameVector, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
-                       wxVtkBaseView_SceneManager :: addToScene( std::string theKeyName, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
-                               wxVtkBaseView_SceneManager :: getContourWrap_ViewControlOf
-                                       MAP  find
-                          void wxVtkBaseView_SceneManager :: addToScene( std::string theKeyName, ContourWrap_ViewControl * contourWRP, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
-
-*/
-
-
-/*!
- \mainpage NDimension with wxWidgets and maracas
-
- \section intro Introduction
-
- This is the introduction. 
-
-
-
-  \dot
-
-
-digraph example_0 {
-       graph [ ratio=fill];
-    node [shape=record, fontname=Helvetica, fontsize=10];
-
-       _wxContourGUIExample                    [ label="wxContourGUIExample"                   URL="\ref wxContourGUIExample"];
-       _wxContourEventHandler                  [ label="wxContourEventHandler"                 URL="\ref wxContourEventHandler"];
-
-       _OutlineModelManager                    [ label="OutlineModelManager"                   URL="\ref OutlineModelManager"];
-       _wxInstantChooserPanel                  [ label="wxInstantChooserPanel"                 URL="\ref wxInstantChooserPanel"];
-       _wxContourViewPanel                             [ label="wxContourViewPanel"                    URL="\ref wxContourViewPanel"];
-       _wxContour_ButtonsBar                   [ label="wxContour_ButtonsBar"                  URL="\ref wxContour_ButtonsBar"];       
-       _OutlineModelManager                    [ label="OutlineModelManager"                   URL="\ref OutlineModelManager"];
-       _wxVtkBaseView_SceneManager             [ label="wxVtkBaseView_SceneManager"    URL="\ref wxVtkBaseView_SceneManager"];
-       _SomeEnvironment                                [ label="SomeEnvironment"                               URL="\ref SomeEnvironment"];
-               
-
-       _wxContourGUIExample                    ->      _wxContourEventHandler                  [ arrowhead="open", style="dashed" ];
-       _wxContourGUIExample                    ->      _OutlineModelManager                    [ arrowhead="open", style="dashed" ];
-       _wxContourGUIExample                    ->      _wxInstantChooserPanel                  [ arrowhead="open", style="dashed" ];
-       _wxContourGUIExample                    ->      _wxContourViewPanel                             [ arrowhead="open", style="dashed" ];
-       _wxContourGUIExample                    ->      _wxContour_ButtonsBar                   [ arrowhead="open", style="dashed" ];
-       _wxContourViewPanel                             ->      wxMaracas_N_ViewersWidget               [ arrowhead="open", style="dashed" ];
-       _wxContourEventHandler                  ->      _OutlineModelManager                    [ arrowhead="open", style="dashed" ];
-       _wxContourEventHandler                  ->      _wxVtkBaseView_SceneManager             [ arrowhead="open", style="dashed" ];
-       _OutlineModelManager                    ->      _SomeEnvironment                                [ arrowhead="open", style="dashed" ];
-       
-}
-
-\enddot
-
-
-
-*/
-
-
-
-//----------------------------------------------------------------------------------------------------------------
-// Class definition include
-//----------------------------------------------------------------------------------------------------------------
-#include "wxContourEventHandler.h"
-#include <wx/filedlg.h>
-#include <wx/spinctrl.h>
-#include <iostream>
-#include <fstream>
-
-//----------------------------------------------------------------------------------------------------------------
-// Class implementation
-//----------------------------------------------------------------------------------------------------------------
-/** @file wxContourEventHandler.cxx */
-
-
-//------------------------------------------------------------------------------------------------------------
-// Includes
-//------------------------------------------------------------------------------------------------------------
-
-#include "wxContour_ActionCommnadsID.h"
-#include "NameWrapper.h"
-#include "ConceptDataWrap.h"
-#include "OutlineGroup.h"
-
-#include <manualContour.h>
-#include "Contour/ContourExtractData.h"
-#include "ImageSourceThing.h"
-
-#include "vtkImageData.h"
-#include <vtkContourFilter.h>
-#include <vtkCleanPolyData.h>
-#include <vtkPolyDataConnectivityFilter.h>         
-#include <vtkStripper.h>
-#include <vtkImageReslice.h>
-#include <vtkMetaImageWriter.h>
-#include <vtkImageMapToWindowLevelColors.h>
-
-
-
-//------------------------------------------------------------------------------------------------------------
-//------------------------------------------------------------------------------------------------------------
-//------------------------------------------------------------------------------------------------------------
-
-PanelBullEyeOptions::PanelBullEyeOptions (wxWindow * parent, wxSize size) :
-                wxPanel(parent, -1, wxDefaultPosition, size)
-{
-
-       _maxLevels              = 5;
-       _maxSections    = 10;
-       wxSize sizepanel(190,300);
-       wxPanel *panel = this;
-
-
-       wxString lstOptions[2];
-       lstOptions[0]="General options";
-       lstOptions[1]="Detail options";
-       _radioboxBullEyeGenOpt  = new wxRadioBox(panel, -1, "General/Detail options", wxDefaultPosition, wxSize(200,45), 2 , lstOptions,  2, wxRA_SPECIFY_COLS);
-       _radioboxBullEyeGenOpt->SetSelection(0);
-
-       _spinctrlBullEyeNumOfCrowns = new wxSpinCtrl( panel , -1,_T("B"),wxDefaultPosition, wxSize(40,20) );
-       _spinctrlBullEyeNumOfCrowns->SetRange(1,_maxLevels);
-       _spinctrlBullEyeNumOfCrowns->SetValue(3);
-
-       _spinctrlBullEyeNumOfSec = new wxSpinCtrl( panel , -1,_T("A"),wxDefaultPosition, wxSize(40,20) );
-       _spinctrlBullEyeNumOfSec->SetRange(1,_maxSections);
-       _spinctrlBullEyeNumOfSec->SetValue(5);
-
-
-       _sliderBullEyeAngle = new wxSlider( panel , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
-       wxFlexGridSizer * sizerGeneralOptions                           = new wxFlexGridSizer(10);
-
-       wxFlexGridSizer * sizerGeneralOptionsA                          = new wxFlexGridSizer(1);
-       wxFlexGridSizer * sizerGeneralOptionsB                          = new wxFlexGridSizer(1);
-       wxFlexGridSizer * sizerGeneralOptionsC                          = new wxFlexGridSizer(1);
-       sizerGeneralOptionsA -> Add( new wxStaticText(panel,-1,_T("Crowns")) , 1, wxGROW );
-       sizerGeneralOptionsA -> Add( _spinctrlBullEyeNumOfCrowns , 1/*, wxGROW*/ );
-       sizerGeneralOptionsB -> Add( new wxStaticText(panel,-1,_T("Sections")) , 1, wxGROW );
-       sizerGeneralOptionsB -> Add( _spinctrlBullEyeNumOfSec , 1/*, wxGROW*/ );
-       sizerGeneralOptionsC -> Add( new wxStaticText(panel,-1,_T("      Angle")) , 1, wxGROW );
-       sizerGeneralOptionsC -> Add( _sliderBullEyeAngle , 1/*, wxGROW*/ );
-
-       sizerGeneralOptions -> Add( sizerGeneralOptionsA  , 1/*, wxGROW*/ );
-       sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T("   ")) , 1, wxGROW );
-       sizerGeneralOptions -> Add( sizerGeneralOptionsB  , 1/*, wxGROW*/ );
-       sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T("   ")) , 1, wxGROW );
-       sizerGeneralOptions -> Add( sizerGeneralOptionsC  , 1/*, wxGROW*/ );
-
-
-       wxSpinCtrl      *tmpSpinSection;
-       wxSlider        *tmpSliderRadio;
-       wxSlider        *tmpSliderAng;
-
-       wxFlexGridSizer * sizerDetailOptions                            = new wxFlexGridSizer(6);
-
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("Crown ")) , 1, wxGROW );
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  Sections  ")) , 1, wxGROW );
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("      Radio %")) , 1, wxGROW );
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("      Angle")) , 1, wxGROW );
-
-       wxString tmpwxstring;
-       int i;
-       for (i=0;i<_maxLevels;i++){
-               tmpSpinSection = new wxSpinCtrl( panel  , -1,_T(""),wxDefaultPosition, wxSize(40,20) );
-               tmpSliderRadio = new wxSlider( panel    , -1 ,0,0,100, wxDefaultPosition, wxSize(110,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-               tmpSliderAng   = new wxSlider( panel    , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
-               tmpSpinSection ->SetRange(1,_maxSections);
-
-               tmpwxstring.Printf(_T("  %d.  "),i+1);
-               sizerDetailOptions -> Add( new wxStaticText(panel,-1,tmpwxstring) , 1, wxGROW );
-               sizerDetailOptions -> Add( tmpSpinSection, 1 );
-               sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
-               sizerDetailOptions -> Add( tmpSliderRadio, 1, wxGROW );
-               sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
-               sizerDetailOptions -> Add( tmpSliderAng, 1, wxGROW );
-
-               tmpSpinSection  -> SetValue(5);
-               tmpSliderRadio  -> SetValue( 100-(double)((i)*100.0/_maxLevels) );
-               tmpSliderAng    -> SetValue(0);
-               
-               Connect( tmpSliderRadio->GetId(),       wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
-               Connect( tmpSliderRadio->GetId(),       wxEVT_SCROLL_CHANGED  , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
-
-               _lstBullEyeDetailNumOfSec.push_back( tmpSpinSection );
-               _lstBullEyeDetailRadio.push_back( tmpSliderRadio );
-               _lstBullEyeDetailAngle.push_back( tmpSliderAng );
-
-       } //for
-
-       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add( _radioboxBullEyeGenOpt , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("      -- Bull Eye general options --")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add(  sizerGeneralOptions , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("      -- Bull Eye detail options --")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add(  sizerDetailOptions  , 1, wxGROW );
-
-       Connect( _radioboxBullEyeGenOpt->GetId(),       wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel ); 
-       Connect( _spinctrlBullEyeNumOfCrowns->GetId(),  wxEVT_COMMAND_TEXT_UPDATED              , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
-       
-       panel->SetSizer( sizer );
-       panel->SetSize( sizepanel );
-       panel->SetAutoLayout( true );
-       panel->Layout();
-
-       RefreshPanel();
-
-}
-
-//------------------------------------------------------------------------------------------------------------
-PanelBullEyeOptions::~PanelBullEyeOptions() 
-{
-}
-
-//------------------------------------------------------------------------------------------------------------
-void PanelBullEyeOptions::onRefreshPanel( wxCommandEvent& event )
-{
-       RefreshPanel();
-}
-
-//------------------------------------------------------------------------------------------------------------
-void PanelBullEyeOptions::RefreshPanel()
-{
-       int i;
-       bool ok;
-       if (this->_radioboxBullEyeGenOpt->GetSelection()==0){
-               for (i=0; i<_maxLevels; i++)
-               {
-                       _lstBullEyeDetailNumOfSec[i]    -> Enable(false);
-                       _lstBullEyeDetailRadio[i]               -> Enable(false);
-                       _lstBullEyeDetailAngle[i]               -> Enable(false);
-               } // for
-       } else {
-               int spinSelec = _spinctrlBullEyeNumOfCrowns->GetValue(); 
-               for (i=0; i<_maxLevels; i++)
-               {
-                       ok = (i < spinSelec);
-                       _lstBullEyeDetailNumOfSec[i]    -> Enable(ok);
-                       _lstBullEyeDetailRadio[i]               -> Enable(ok);
-                       _lstBullEyeDetailAngle[i]               -> Enable(ok);
-
-                       if (i>0){
-                               if (_lstBullEyeDetailRadio[i]->GetValue() > _lstBullEyeDetailRadio[i-1]->GetValue())
-                               {
-                                       _lstBullEyeDetailRadio[i]->SetValue( _lstBullEyeDetailRadio[i-1]->GetValue() );
-                               } 
-                       }// if i>0
-               } // for
-       } // if
-}
-
-//------------------------------------------------------------------------------------------------------------
-int PanelBullEyeOptions::GetNumberOfCrowns()
-{
-       return this->_spinctrlBullEyeNumOfCrowns->GetValue();
-}
-
-//------------------------------------------------------------------------------------------------------------
-int PanelBullEyeOptions::GetNumberOfSections(int nCrown)
-{
-       int result;
-       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
-       { 
-               result = this->_spinctrlBullEyeNumOfSec->GetValue();
-       } else {
-               result = this->_lstBullEyeDetailNumOfSec[nCrown]->GetValue();
-       }
-       return result;
-}
-
-//------------------------------------------------------------------------------------------------------------
-int PanelBullEyeOptions::GetRadioOfCrown(int nCrown)
-{
-       int result;
-       double sizeCrowns;
-       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
-       { 
-               sizeCrowns = (double)( this->_spinctrlBullEyeNumOfCrowns->GetValue() );
-               result = 100.0 * (nCrown+1)/sizeCrowns ;
-       } else {
-               result = this->_lstBullEyeDetailRadio[nCrown]->GetValue();
-       }
-       return result;
-}
-
-//------------------------------------------------------------------------------------------------------------
-double PanelBullEyeOptions::GetAngOfCrownSection(int nCrown,int section)
-{
-       double angle;
-       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
-       { 
-               angle = this->_sliderBullEyeAngle->GetValue();
-       } else {
-               angle = this->_lstBullEyeDetailAngle[nCrown]->GetValue();
-       }
-       double numOfSec = (double)GetNumberOfSections(nCrown);
-       double deltaSec = GetAngDeltaOfCrownSection(nCrown);
-       return angle + section*deltaSec ;
-}
-
-//------------------------------------------------------------------------------------------------------------
-double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
-{
-       double numOfSec = (double)GetNumberOfSections(nCrown);
-       return 360.0/numOfSec;
-}
-
-
-
-//------------------------------------------------------------------------------------------------------------
-//------------------------------------------------------------------------------------------------------------
-//------------------------------------------------------------------------------------------------------------
-
-
-       //------------------------------------------------------------------------------------------------------------
-       // Constructors & Destructors
-       //------------------------------------------------------------------------------------------------------------
-
-       wxContourEventHandler ::wxContourEventHandler()
-               :wxEvtHandler()
-       {
-        _creatingContoursActive                        = false;
-               _theViewPanel                                   = NULL;
-               _modelManager                                   = NULL;
-               _instantPanel                                   = NULL;
-               _buttonsBar                                             = NULL;
-               _gridPanel                                              = NULL; 
-               _drawToolsPanel                                 = NULL;
-               _operationsToolsPanel                   = NULL;
-               _autoFormsPanel                                 = NULL; 
-               _standardToolsPanel                             = NULL;
-               _editionToolsPanel                              = NULL;
-               _listViewPanel                                  = NULL;
-               _sceneManager                                   = NULL;
-               _actualInstant                                  = NULL;
-               _performingOperation                    = new PerformingOperation();
-
-               // EED Interface and Spread
-               _spreadFrame                                    = NULL;
-               _segmentationFrame                              = NULL;
-               _contourPropagation                             = NULL;
-               _createContourFrame                             = NULL;
-               _deleteFrame                                    = NULL;
-               _InformationContourFrame                = NULL;
-               _interfaceConfigurationFrame    = NULL;
-               _TestFrame                                              = NULL;
-               _wxtextctrlTest                                 = NULL;
-               _panelBullEyeOptions                    = NULL;
-
-               fileNameContourROI                              = "";
-               _numberOfVariablesStatistics=6+1;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       wxContourEventHandler :: ~ wxContourEventHandler()
-       {
-               delete _actualInstant;
-               /*delete _theViewPanel;         
-               delete _instantPanel;
-               delete _buttonsBar;
-               delete _actualInstant;  
-               */       
-               delete _sceneManager;
-               delete _performingOperation;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       // Configuration methods
-       //------------------------------------------------------------------------------------------------------------
-       
-       bool wxContourEventHandler :: configureEventsHandling()
-       {
-               bool configured = true;
-
-               return configured;
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       // Methods for capturing events 
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onProcessMessage( wxCommandEvent& event )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: onActionButtonPressed( wxCommandEvent& event )
-       {
-               const char buttonTool = *(char *)event.GetClientData();
-               executeActionCommand( buttonTool );             
-       }
-       //------------------------------------------------------------------------------------------------------------          
-       void wxContourEventHandler :: onChangedDeep ( wxCommandEvent& event )
-       {
-               double val = _theViewPanel->getCurrentDeep();
-               _instantPanel->setConceptValue( "Axe Depth", (int)val );
-               _theViewPanel->setActualVertical( (int)val );
-               changeInstant();
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onChangeInstant( wxCommandEvent& event )
-       {               
-               ConceptDataWrap * dataConcept = NULL; 
-               if ( _theViewPanel->GetId() == event.GetId() )
-               {
-                       dataConcept = (ConceptDataWrap *)event.GetClientData();
-                       int value = dataConcept->getActualValue();
-                       _instantPanel->setConceptValue( dataConcept->getName(), value );
-               }
-               else
-               {
-                       dataConcept = _instantPanel->getLastConceptData();
-                       if( dataConcept->getName().compare( _theViewPanel->getVerticalConceptName() ) )
-                       {
-                               _theViewPanel->setActualVertical( dataConcept->getActualValue());
-                               //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
-                       }
-                       else if( dataConcept->getName().compare( _theViewPanel->getHorizontalConceptName() ) || _instantPanel->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
-                       {
-                               _theViewPanel->setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
-                       }
-               }       
-               changeInstant();
-       }
-       //------------------------------------------------------------------------------------------------------------
-               
-       void wxContourEventHandler :: onCreateMultipleROI( wxCommandEvent& event )
-       {
-               _creatingContoursActive = !_creatingContoursActive;
-               if( _creatingContoursActive )
-               {                       
-                       createContour();
-               }
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onCreateROI( wxCommandEvent& event )
-       {
-               if( _creatingContoursActive )
-               {                       
-                       createContour();
-               }
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onStopCreateROI( wxCommandEvent& event )
-       {
-               
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onDeleterROI( wxCommandEvent& event )
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onSelectROI( wxCommandEvent& event )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-
-       void wxContourEventHandler :: onUnSelectROI( wxCommandEvent& event )
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: onManualHidedROI( wxCommandEvent& event )
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: onManualShowedROI( wxCommandEvent& event )
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: onEditingROI( wxCommandEvent& event )
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: onMovingROI( wxCommandEvent& event )
-       {
-
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       //  Model management methods
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler::onSpreadReset( wxCommandEvent& event )
-       {
-               _wxtextctrlSpread->SetValue("");
-               _contourPropagation->resetAppend();
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onSpreadAdd( wxCommandEvent& event )
-       {
-               std::vector<double> vecX; 
-               std::vector<double> vecY; 
-               std::vector<double> vecZ; 
-               _sceneManager->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
-
-               if (vecX.size()!=0){
-                       std::vector<int> tempVector;
-                       _instantPanel->getInstant( tempVector );
-                       int i,size=vecZ.size();
-                       int actualSlice = tempVector[1];
-                       for ( i=0 ; i<size ; i++ )
-                       {
-                               vecZ[i] = actualSlice;
-                       } // for
-
-                       _contourPropagation->appendContour(&vecX , &vecY , &vecZ);
-                       wxString newstring;
-                       newstring.Printf("%s %d -",_wxtextctrlSpread->GetValue(), actualSlice );
-                       _wxtextctrlSpread->SetValue(newstring);
-               } // if 
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onSpreadGo( wxCommandEvent& event )
-       {
-               wxBusyCursor wait;
-               int typeMethodFindCtrlPoints=_spreadMethodRadiobox->GetSelection();
-               int typeofcontour = 1;
-               manualContourModel *manModelContour;
-               std::vector<double> vecCtrlPointX;
-               std::vector<double> vecCtrlPointY;
-               std::vector<double> vecCtrlPointZ;
-               double  minZ,maxZ;
-               int z,j,sizeCtrPt;
-//             double idTmp;
-               int idTmp;
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-//             tempVector[1];
-
-               _contourPropagation->getMaxMinZ(&minZ,&maxZ);
-//JSTG_16-07-08_----------------------------------------------------------------
-               //_contourPropagation->setInterpolationNumber(maxZ-minZ+1);
-               _contourPropagation->setInterpolationNumber(100);
-               _contourPropagation->CalculeSplinePropagation();
-
-               double          totalZ = maxZ-minZ+1;
-               double          porcent;
-               wxString        tmpString;
-//--------------------------------------------------------------------
-               for ( z=minZ ; z<=maxZ ; z++ )
-               {
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf("  %d %c            %d/%d            %d", (int)porcent , 37 , (int)(z-minZ+1), (int)totalZ,z );
-                       _staticTextSpread->SetLabel(tmpString);
-
-                       if (_contourPropagation->ifSliceKeyContourExist(z)==false)
-                       {
-                               manModelContour = factoryManualContourModel( typeofcontour );
-                               idTmp = _contourPropagation->FindIdWithZ(z);
-                               if (typeMethodFindCtrlPoints==0) // Initial Points
-                               {   
-                                       _contourPropagation->GetInitialControlPoints( idTmp , &vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
-                               } 
-                               if (typeMethodFindCtrlPoints==1)  // Automatique Method
-                               {
-                                       _contourPropagation->GetControlPoints( idTmp  ,&vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
-                               }
-                               if (typeMethodFindCtrlPoints==2)  // sampling
-                               {
-                                       _contourPropagation->GetControlPoints( idTmp , 20.0 ,&vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
-                               }
-       //--------------------------------------------------------------------
-                               sizeCtrPt = vecCtrlPointX.size();
-                               for (j=0 ; j<sizeCtrPt ; j++)
-                               {
-       //JSTG_16-07-08_----------------------------------------------------------------
-                                       manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , -900  );
-       //--------------------------------------------------------------------
-                               } // for j
-
-                               tempVector[1]=z;
-                               std::string theName;
-                               theName = _modelManager->createOutline( manModelContour, tempVector );
-                               bool addedModel = theName.compare("") != 0;
-                               if( addedModel )
-                               {
-                                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                                       this->_theViewPanel->getSpacing(spc);                                   
-                                       //Adding the manualContourControler to interface objects structure
-                                       //Adding the manualViewContour to interface objects structure           
-                                       //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                                       _sceneManager->configureViewControlTo( theName, manModelContour,spc,typeofcontour ) ;
-                               } // if addedModel
-                       }// ifSliceKeyContourExist
-               } // for z
-               _staticTextSpread->SetLabel("   ");
-               RefreshInterface();
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onSpread( )
-       {
-               if (_spreadFrame==NULL)
-               {
-                       _contourPropagation                     = new ContourPropagation();
-                       _spreadFrame                            = new wxFrame (_theViewPanel, -1,_T("  Spread  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
-                       wxSize sizepanel(250,400);
-                       _spreadFrame->SetSize( sizepanel );
-                       wxPanel *panel                          = new wxPanel(_spreadFrame,-1);
-
-                       wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxSize(80,35) );
-                       wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxSize(80,35));
-
-                       wxString lstOptions[3];
-                       lstOptions[0]="A";
-                       lstOptions[1]="B";
-                       lstOptions[2]="C";
-                       _spreadMethodRadiobox                                           = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
-                       _spreadMethodRadiobox->SetSelection(2);
-
-                       wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("Go"),wxDefaultPosition, wxSize(80,35));
-                       _staticTextSpread                       = new wxStaticText(panel,-1,_T("    "));
-
-                       _wxtextctrlSpread           = new wxTextCtrl(panel,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_MULTILINE );
-
-                       _spreadFrame->SetEventHandler( this );
-                       Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadReset ); 
-                       Connect( spreadAddBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadAdd ); 
-                       Connect( spreadGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadGo ); 
-
-                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
-                       sizer -> Add( spreadResetBtn            , 1, wxGROW );
-                       sizer -> Add( spreadAddBtn                      , 1, wxGROW );
-                       sizer -> Add( _spreadMethodRadiobox     , 1, wxGROW );
-                       sizer -> Add( spreadGoBtn                       , 1, wxGROW );
-                       sizer -> Add( _staticTextSpread         , 1, wxGROW );
-                       sizer -> Add( _wxtextctrlSpread         , 1, wxGROW );
-
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizepanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();
-                       _spreadFrame->Show();
-               } else {
-                       if (_spreadFrame->IsShown()==true)
-                       {
-                               _spreadFrame->Show(false);
-                       } else  {
-                               _spreadFrame->Show(true);
-                       }
-               }
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onSegmentationAllSlice( wxCommandEvent& event )
-       {
-               wxBusyCursor wait;
-               int                                     x                                       = this->_theViewPanel->GetX();
-               int                                     y                                       = this->_theViewPanel->GetY();
-               int z,minZ,maxZ;
-               double porcent; 
-               wxString tmpString;
-               minZ=_mbarrange->GetStart();
-               maxZ=_mbarrange->GetEnd();
-               double totalZ = maxZ-minZ+1;
-               for( z=minZ ; z<=maxZ ; z++ )
-               {
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf("  %d %c            %d/%d            %d", (int)porcent , 37 , z-minZ+1, (int)totalZ,z );
-                       _staticTextSegmentation->SetLabel(tmpString);
-                       SegmentationOneSlice( x,y,z );
-               }
-               _staticTextSegmentation->SetLabel("   ");
-               RefreshInterface();
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onSegmentationOneSlice( wxCommandEvent& event )
-       {
-               wxBusyCursor wait;
-               int                                     x                                       = this->_theViewPanel->GetX();
-               int                                     y                                       = this->_theViewPanel->GetY();
-               int                                     z                                       = this->_theViewPanel->GetZ();
-               SegmentationOneSlice( x,y,z );
-               RefreshInterface();
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::SegmentationOneSlice( int x, int y, int z )
-       {               
-               int typeofcontour = 1;
-               //--Extracting Contour
-               vtkImageData    *imagedata      = _sceneManager->GetImageData();
-//             double                  *range          = imagedata->GetScalarRange();  
-//             double                  thr                     = 1;
-               int                             isovalue        = _isovalue->GetValue();
-               int                             sampling        = _sampling->GetValue();
-
-               vtkImageReslice *imageReslice = vtkImageReslice::New();
-//EED
-//             double spc[3];
-//             imagedata->GetSpacing(spc);
-//             x = x*spc[0];
-//             y = y*spc[1];
-//             z = z*spc[3];
-
-               imageReslice->SetInput( imagedata );
-               imageReslice->SetInformationInput(imagedata);
-               imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
-               imageReslice->SetResliceAxesOrigin(0,0,z);
-               imageReslice->SetOutputDimensionality(2);
-               imageReslice->SetInterpolationModeToLinear();
-
-               imagedata = imageReslice->GetOutput();
-               imagedata->Update();
-               imagedata->UpdateInformation();
-
-               vtkContourFilter* cntVTK = vtkContourFilter::New( );
-               cntVTK->SetInput( imagedata );
-
-               cntVTK->SetNumberOfContours( 1 );
-               //cntVTK->SetValue( 0, vmin );
-//             cntVTK->SetValue( 0, (range[1]*thr/100) );
-               cntVTK->SetValue( 1, isovalue );
-       //      cntVTK->SetValue( 1, vmax );
-               cntVTK->Update( );
-               cntVTK->UpdateInformation();
-                       
-               vtkCleanPolyData* cpd = vtkCleanPolyData::New( );
-               cpd->SetInput( cntVTK->GetOutput( ) );
-               cpd->ConvertLinesToPointsOff( );
-               cpd->Update( );
-               cpd->UpdateInformation();
-
-               vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
-               conn->SetExtractionModeToClosestPointRegion( );
-               //conn->SetMaxRecursionDepth( 3000 );
-                       
-               conn->SetInput( cpd->GetOutput( ) );
-                       
-               conn->SetClosestPoint( x, y, 0 );
-               conn->Update( );
-               conn->UpdateInformation();
-                       
-               vtkCleanPolyData* cpd2 = vtkCleanPolyData::New( );
-               cpd2->SetInput( conn->GetOutput( ) );
-               cpd2->Update();
-               cpd2->UpdateInformation();
-
-               vtkStripper* vtkstripper = vtkStripper::New( );
-               vtkstripper->SetInput( cpd2->GetOutput() );
-               vtkstripper->Update();
-               vtkstripper->UpdateInformation();
-
-
-               vtkPolyData* polyDataResult =  vtkstripper->GetOutput();
-
-               polyDataResult->Update( );
-               polyDataResult->UpdateInformation();
-
-/* EED
-ofstream myfile;
-myfile.open ("c:/temp/example.txt");
-myfile << "\n";
-polyDataResult->Print(myfile);
-myfile << "-------------------------------------\n";
-polyDataResult->GetLines()->Print(myfile);
-myfile.close();
-*/
-
-               cntVTK          -> Delete();
-               cpd2            -> Delete();
-               cpd                     -> Delete();
-               conn            -> Delete();
-
-
-//--Calculating control points
-
-               std::vector<double> vecX;
-               std::vector<double> vecY;
-               std::vector<double> vecZ;
-
-               std::vector<double> vecCtrlPointX;
-               std::vector<double> vecCtrlPointY;
-               std::vector<double> vecCtrlPointZ;
-
-
-               double *p;
-               int ii,size=polyDataResult->GetNumberOfPoints();
-               int id;
-               for (ii=1;ii<=size;ii++)
-               {
-                       id      = polyDataResult->GetLines()->GetData()->GetValue(ii);
-                       p       = polyDataResult->GetPoint(id);
-                       double x=p[0];
-                       double y=p[1];
-                       vecX.push_back( p[0] );
-                       vecY.push_back( p[1] );
-                       vecZ.push_back( -900 );
-//                     vecZ.push_back( p[2] );
-               }
-
-
-               ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
-               extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
-
-//PROOFS
-               if (methodRadiobox->GetSelection()==0){
-                       extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-               }
-               if (methodRadiobox->GetSelection()==1){
-                       extractcontrolpoints2d->GetControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-               }
-               if (methodRadiobox->GetSelection()==2){
-                       extractcontrolpoints2d->SetSamplingControlPoints( sampling );
-                       extractcontrolpoints2d->GetSamplingControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-               }
-
-               //--Adding contour to the system
-
-               std::vector<int> actualInstantVector;
-               _instantPanel->getInstant( actualInstantVector );
-               actualInstantVector[1]=z;
-
-               int j,sizeCtrPt = vecCtrlPointX.size();
-               manualContourModel *manModelContour =  factoryManualContourModel( typeofcontour );
-               manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
-               if (sizeCtrPt>=3){
-                       for (j=0 ; j<sizeCtrPt ; j++)
-                       {
-                               manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j]  );
-                       } // for
-                       std::string theName;
-                       theName = _modelManager->createOutline( manModelContour, actualInstantVector );
-                       bool addedModel = theName.compare("") != 0;
-                       if( addedModel )
-                       {
-                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                               this->_theViewPanel->getSpacing(spc);                                   
-                               //Adding the manualContourControler to interface objects structure
-                               //Adding the manualViewContour to interface objects structure           
-                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                               _sceneManager->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
-                       }       // if addedModel
-               } // if sizeCtrPt
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onAutomatiqueSegmentation( )
-       {
-               if (_segmentationFrame==NULL)
-               {
-                       int sizeZ = _sceneManager->GetImageDataSizeZ();
-                       double range[2];
-                       _sceneManager->GetImageDataRange(range);
-
-                        wxSize sizePanel( 300, 470);
-                       _segmentationFrame                                      =  new wxFrame (_theViewPanel, -1,_T("  Segmentation  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
-                       _segmentationFrame->SetSize( sizePanel );
-                       wxPanel *panel                                          = new wxPanel(_segmentationFrame,-1);
-                       wxButton *segmentationOneSliceBtn       = new wxButton(panel,-1,_T("Actual slice"), wxDefaultPosition, wxSize(200,35) );
-                       wxButton *segmentationAllSliceBtn       = new wxButton(panel,-1,_T("All slices") ,wxDefaultPosition, wxSize(200,35) );
-                       _isovalue                                                       = new wxSlider(panel, -1, 40 , (int)(range[0]), (int)(range[1]), wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-                       _sampling                                                       = new wxSlider(panel, -1, 20 , 4, 50, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-                       wxString lstOptions[3];
-                       lstOptions[0]="A";
-                       lstOptions[1]="B";
-                       lstOptions[2]="C";
-                       methodRadiobox                                          = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
-                       methodRadiobox->SetSelection(2);
-                       _staticTextSegmentation                         = new wxStaticText(panel,-1,_T("    "));
-
-
-                       _mbarrange                                      =  new mBarRange(panel,70, 65);
-                       _mbarrange->SetMin(0);
-                       _mbarrange->SetStart(0);
-
-                       _mbarrange-> SetOrientation( true );
-                       _mbarrange-> setActiveStateTo(true);
-                       _mbarrange-> setVisibleLabels( true );
-                       _mbarrange-> setDeviceEndMargin(10);
-                       _mbarrange-> setRepresentedValues( 0 , sizeZ );
-                       _mbarrange-> setDeviceBlitStart(10,10); 
-                       _mbarrange-> setIfWithActualDrawed( false );
-                       _mbarrange-> SetStart( 0 );
-                       _mbarrange-> SetEnd( sizeZ );  
-
-
-//                     _segmentationFrame->SetEventHandler( this );
-                       segmentationOneSliceBtn->SetEventHandler( this );
-                       segmentationAllSliceBtn->SetEventHandler( this );
-                       Connect( segmentationOneSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationOneSlice ); 
-                       Connect( segmentationAllSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationAllSlice ); 
-
-                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
-                       sizer -> Add( new wxStaticText(panel,-1,_T("Isovalue (Gray level)"))  , 1, wxGROW );
-                       sizer -> Add( _isovalue , 1, wxGROW );
-                       sizer -> Add( methodRadiobox , 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T("Sampling (%)"))  , 1, wxGROW );
-                       sizer -> Add( _sampling , 1, wxGROW );
-                       sizer -> Add( segmentationOneSliceBtn , 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-                       sizer -> Add( _staticTextSegmentation  , 1, wxGROW );
-                       sizer -> Add( segmentationAllSliceBtn , 1, wxGROW );
-                       sizer -> Add( _mbarrange  , 1, wxGROW );
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizePanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();
-                       _segmentationFrame->Show(true);
-                       this->_theViewPanel->SetVisibleAxis(true);
-                       this->_theViewPanel->Refresh();
-               } else {
-                       if (_segmentationFrame->IsShown()==true)
-                       {
-                               _segmentationFrame->Show(false);
-                               this->_theViewPanel->SetVisibleAxis(false);
-                               this->_theViewPanel->Refresh();
-                       } else  {
-                               _segmentationFrame->Show(true);
-                               this->_theViewPanel->SetVisibleAxis(true);
-                               this->_theViewPanel->Refresh();
-                       }
-               }
-       }
-
-       void wxContourEventHandler :: onInterfaceTestFrame( )
-       {
-               if (_TestFrame==NULL)
-               {
-                       _contourPropagation                     = new ContourPropagation();
-                       _TestFrame                                      = new wxFrame (_theViewPanel, -1,_T("  Test Segmentation  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
-                       wxSize sizepanel(200,300);
-                       _TestFrame->SetSize( sizepanel );
-                       wxPanel *panel                          = new wxPanel(_TestFrame,-1);
-                       wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxSize(80,35) );
-                       wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxSize(80,35));
-                       wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("GoA"),wxDefaultPosition, wxSize(80,35));
-                       _wxtextctrlTest                         = new wxTextCtrl(panel,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_MULTILINE );
-
-                       _TestFrame->SetEventHandler( this );
-                       Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestReset ); 
-                       Connect( spreadAddBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestAdd ); 
-                       Connect( spreadGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestGo ); 
-
-                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
-                       sizer -> Add( spreadResetBtn    , 1, wxGROW );
-                       sizer -> Add( spreadAddBtn              , 1, wxGROW );
-                       sizer -> Add( spreadGoBtn               , 1, wxGROW );
-                       sizer -> Add( _wxtextctrlTest , 1, wxGROW );
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizepanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();
-                       _TestFrame->Show();
-               } else {
-                       if (_TestFrame->IsShown()==true)
-                       {
-                               _TestFrame->Show(false);
-                       } else  {
-                               _TestFrame->Show(true);
-                       }
-               }
-       }
-
-       void wxContourEventHandler::onTestReset( wxCommandEvent& event )
-       {
-               _wxtextctrlTest->SetValue("");
-               _contourPropagation->resetAppend();
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onTestAdd( wxCommandEvent& event )
-       {
-               std::vector<double> vecX; 
-               std::vector<double> vecY; 
-               std::vector<double> vecZ; 
-               _sceneManager->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
-
-               if (vecX.size()!=0){
-                       std::vector<int> tempVector;
-                       _instantPanel->getInstant( tempVector );
-                       int i,size=vecZ.size();
-                       int actualSlice = tempVector[1];
-                       for ( i=0 ; i<size ; i++ )
-                       {
-                               vecZ[i] = actualSlice;
-                       } // for
-
-                       _contourPropagation->appendContour(&vecX , &vecY , &vecZ);
-                       wxString newstring;
-                       newstring.Printf("%s %d -",_wxtextctrlTest->GetValue(), actualSlice );
-                       _wxtextctrlTest->SetValue(newstring);
-               } // if 
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onTestGo( wxCommandEvent& event )
-       {
-               std::vector<double> vecX; 
-               std::vector<double> vecY; 
-               std::vector<double> vecZ; 
-               std::vector<int> size; 
-
-               std::vector<double> vecCtrlPointX;
-               std::vector<double> vecCtrlPointY;
-               std::vector<double> vecCtrlPointZ;
-
-               //Getting the points of the actual contour      
-
-               _contourPropagation->GetKeyContours(&vecX , &vecY , &vecZ, &size);
-               for(int i = 0; i < vecX.size();i++){
-                       vecZ[i] = -900;
-               }
-
-               /*std::vector<double> vecX1; 
-               std::vector<double> vecY1; 
-               std::vector<double> vecZ1;
-               _sceneManager->GetPointsOfActualContour( &vecX1 , &vecY1 , &vecZ1 );
-
-               std::ofstream file1;
-        file1.open( "Temp.txt" );      
-               if(file1.is_open())
-               {
-                       for(int i = 0; i < vecX.size(); i++){
-                               file1<<vecX[i] <<" X1 "<< vecX1[i] <<" Y "<<vecY[i] <<" Y1 "<< vecY1[i]  <<" Z "<<vecZ[i] <<" Z1 "<< vecZ1[i]<<std::endl;
-                               
-                       }
-                       file1.close();
-               }*/     
-                       
-               
-
-               //Setting the points of the contour 
-
-               ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
-               extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
-
-               //Getting the control points of the contour by method A
-
-               extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-               
-               std::vector<int> actualInstantVector;
-               _instantPanel->getInstant( actualInstantVector );
-               actualInstantVector[1]= this->_theViewPanel->GetZ();
-
-               //Adding the Contour to the scene
-
-               manualContourModel *manModelContour = new manualContourModel();
-               int j,sizeCtrPt = vecCtrlPointX.size();
-               if (sizeCtrPt>=3){
-                       for (j=0 ; j<sizeCtrPt ; j++)
-                       {
-                               manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j]  );
-                       } // for
-                       std::string theName;
-                       theName = _modelManager->createOutline( manModelContour, actualInstantVector );
-                       bool addedModel = theName.compare("") != 0;
-                       if( addedModel )
-                       {
-                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                               this->_theViewPanel->getSpacing(spc);                                   
-                               //Adding the manualContourControler to interface objects structure
-                               //Adding the manualViewContour to interface objects structure           
-                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                               _sceneManager->configureViewControlTo( theName, manModelContour,spc,1 ) ;
-                       }       // if addedModel
-               } // if sizeCtrPt
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::FillGridWithContoursInformation()
-       {
-               wxString tempString;
-               _grid->ClearGrid();
-               _grid->SetColLabelValue(0, _T("A") );
-               _grid->SetColLabelValue(1, _T("B") );
-               _grid->SetColLabelValue(2, _T("C") );
-               _grid->SetColLabelValue(3, _T("D") );
-               _grid->SetColLabelValue(4, _T("E") );
-               _grid->SetColLabelValue(5, _T("F") );
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-               int z,sizeZ = _sceneManager->GetImageDataSizeZ();
-               int ii,sizeLstContourThings;
-               for ( z=0 ; z<sizeZ ; z++)
-               {
-                       tempVector[1]=z;
-                       Instant instant(&tempVector);
-                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-
-                       sizeLstContourThings = lstContourThings.size();
-                       tempString.Printf("%d - %d",z, sizeLstContourThings);
-                       _grid->SetRowLabelValue(z, tempString );
-
-                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                       {
-                               ContourThing **contourthing = lstContourThings[ii];
-                               tempString = (*contourthing)->getName().c_str() ;
-                               _grid->SetCellValue( z, ii, tempString );
-                       }
-               }
-
-
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       std::vector<manualContourModel*> wxContourEventHandler::ExploseEachModel( std::vector<manualContourModel*> lstManConMod )
-       {
-               std::vector<manualContourModel*> lstTmp;
-               std::vector<manualContourModel*> lstResult;
-               int j,jSize;
-               int i,iSize=lstManConMod.size();
-               for (i=0;i<iSize;i++)
-               {
-                       lstTmp = lstManConMod[i]->ExploseModel();
-                       jSize=lstTmp.size();
-                       for (j=0;j<jSize;j++)
-                       {
-                               lstResult.push_back( lstTmp[j] );
-                       }
-               }
-               return lstResult;
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onExtractInformation( wxCommandEvent& event )
-       {
-               wxBusyCursor wait;
-               int maxContourGroup     =       0;
-
-               _grid->ClearGrid();
-
-               ContourExtractData      *contourextractdata = new ContourExtractData();
-               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
-               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
-
-               std::vector<manualContourModel*> lstManConMod;
-               std::vector<manualContourModel*> lstManConModTmp;
-               std::vector<manualContourModel*> lstManConModExp;
-               std::vector<double> pLstValue;
-               std::vector<double> pLstValuePosX;
-               std::vector<double> pLstValuePosY;
-               std::vector<double> pLstValuePosZ;
-
-               int             resultSize; 
-               int             resultGrayRangeCount;
-               double  resultMin; 
-               double  resultMax;
-               double  resultAverage;
-               double  resultStandardeviation;
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-               vtkImageData *imagedata = _sceneManager->GetImageData();
-               int sizeZ = _sceneManager->GetImageDataSizeZ();
-               int z;
-               int ii,sizeLstContourThings;
-
-
-               int minZ,maxZ;
-               double totalZ;
-               double porcent; 
-               wxString tmpString;
-
-
-               if (_informationRadiobox->GetSelection()==0 ) // actual slice
-               {
-                       std::vector<int> tempVector;
-                       _instantPanel->getInstant( tempVector );
-                       int actualSlice = tempVector[1];
-                       minZ    = actualSlice;
-                       maxZ    = actualSlice;
-               }
-               if (_informationRadiobox->GetSelection()==1 ) // slice range
-               {
-                       minZ    = _mbarrangeSliceInformation->GetStart();
-                       maxZ    = _mbarrangeSliceInformation->GetEnd();
-               }
-               if (_informationRadiobox->GetSelection()==2 ) // All slices
-               {
-                       minZ    = 0;
-                       maxZ    = sizeZ-1;
-               }
-
-               totalZ  = maxZ-minZ+1;
-               contourextractdata->SetImage( imagedata);
-
-       // For each slice..
-               for ( z=minZ ; z<=maxZ ; z++ )
-               {
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf("  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
-                       _staticTextInformation->SetLabel(tmpString);
-
-                       //Extraction data from contours of each slice
-                       contourextractdata->SetZtoBeAnalys( z);
-
-                       tempVector[1]=z;
-                       Instant instant(&tempVector);
-                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-                       sizeLstContourThings = lstContourThings.size();
-
-                       lstManConMod.clear();
-                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                       {
-                               ContourThing **contourthing = lstContourThings[ii];
-                               lstManConMod.push_back( (*contourthing)->getModel() );
-                       }
-                       lstManConModExp =  ExploseEachModel( lstManConMod );
-
-
-                       wxString tempString;
-                       tempString.Printf("%d - %d",z, sizeLstContourThings);
-                       _grid->SetRowLabelValue(z, tempString );
-//EED004
-                       int iContourGroup,sizeContourGroup;
-                       if (typeContourGroup==3) // contour separete
-                       {
-                               sizeContourGroup=lstManConModExp.size();
-                               if ( maxContourGroup<sizeContourGroup ) 
-                               {
-                                       maxContourGroup=sizeContourGroup;
-                               }
-                       } else {  // contour AND OR XOR
-                               sizeContourGroup=1;
-                               maxContourGroup=1;
-                       }
-
-                       int tmpIntA;
-
-
-
-                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
-                               lstManConModTmp.clear();
-                               if (typeContourGroup==3) // contour separete
-                               {
-                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
-                               } else {  // contour AND OR XOR
-                                       lstManConModTmp = lstManConModExp;
-                               }
-
-                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-                               pLstValue.clear();
-                               pLstValuePosX.clear();
-                               pLstValuePosY.clear();
-                               pLstValuePosZ.clear();
-                               contourextractdata->GetValuesInsideCrown(       &pLstValue,
-                                                                                                                       &pLstValuePosX,
-                                                                                                                       &pLstValuePosY,
-                                                                                                                       &pLstValuePosZ);
-                               // Statistics of each slice.
-                               contourextractdata->Statistics( &pLstValue,
-                                                                                               _mbarrangeRangeInformation->GetStart(),
-                                                                                               _mbarrangeRangeInformation->GetEnd(),
-                                                                                               &resultGrayRangeCount, 
-                                                                                               &resultSize, 
-                                                                                               &resultMin, 
-                                                                                               &resultMax,
-                                                                                               &resultAverage,
-                                                                                               &resultStandardeviation);
-                               if (_grid->GetNumberCols()<_numberOfVariablesStatistics*(iContourGroup+1)  )
-                               {
-                                       _grid->AppendCols(_numberOfVariablesStatistics);
-                               }
-
-                               tmpIntA=_numberOfVariablesStatistics*iContourGroup ;
-
-                               tempString.Printf("%d",resultSize);
-                               _grid->SetCellValue( z, tmpIntA + 0, tempString );
-                               tempString.Printf("%d",resultGrayRangeCount);
-                               _grid->SetCellValue( z, tmpIntA + 1, tempString );
-                               tempString.Printf("%f",resultMin);
-                               _grid->SetCellValue( z, tmpIntA + 2, tempString );
-                               tempString.Printf("%f",resultMax);
-                               _grid->SetCellValue( z, tmpIntA + 3, tempString );
-                               tempString.Printf("%f",resultAverage);
-                               _grid->SetCellValue( z, tmpIntA + 4, tempString );
-                               tempString.Printf("%f",resultStandardeviation);
-                               _grid->SetCellValue( z, tmpIntA + 5, tempString );
-
-                       } // for iContourGroup
-               } // for z
-
-               int iTitleGroup;
-               wxString tmpTitleString;
-               int tmpIntB;
-               for ( iTitleGroup=0 ; iTitleGroup<maxContourGroup ; iTitleGroup++ )
-               {
-                       tmpIntB =_numberOfVariablesStatistics*iTitleGroup;
-                       tmpTitleString.Printf(_T("%d-Size Data"),iTitleGroup);
-                       _grid->SetColLabelValue( tmpIntB + 0, tmpTitleString );
-                       _grid->SetColLabelValue( tmpIntB + 1, _T("Size Range") );
-                       _grid->SetColLabelValue( tmpIntB + 2, _T("Min") );
-                       _grid->SetColLabelValue( tmpIntB + 3, _T("Max") );
-                       _grid->SetColLabelValue( tmpIntB + 4, _T("Average") );
-                       _grid->SetColLabelValue( tmpIntB + 5, _T("St.Dev.") );
-                       _grid->SetColLabelValue( tmpIntB + 6, _T(" ") );
-               }
-
-               _staticTextInformation->SetLabel( _T("") );
-               delete contourextractdata;
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::SaveValuesXYZ(std::string directory,std::string namefile)
-       {
-               wxBusyCursor wait;
-               ContourExtractData      *contourextractdata = new ContourExtractData();
-               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
-               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
-
-               std::vector<manualContourModel*> lstManConMod;
-               std::vector<manualContourModel*> lstManConModTmp;
-               std::vector<manualContourModel*> lstManConModExp;
-               std::vector<double> pLstValue;
-               std::vector<double> pLstValuePosX;
-               std::vector<double> pLstValuePosY;
-               std::vector<double> pLstValuePosZ;
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-               vtkImageData *imagedata = _sceneManager->GetImageData();
-               int sizeZ = _sceneManager->GetImageDataSizeZ();
-               int z;
-               int ii,sizeLstContourThings;
-
-
-               int minZ,maxZ;
-               double totalZ;
-               double porcent; 
-               wxString tmpString;
-               minZ    = 0;// _mbarrange->GetStart();
-               maxZ    = sizeZ;//_mbarrange->GetEnd();
-               totalZ  = maxZ-minZ+1;
-
-               contourextractdata->SetImage( imagedata);
-
-       // For each slice..
-               for ( z=0 ; z<sizeZ ; z++)
-               {
-
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf("Saving Values  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
-                       _staticTextInformation->SetLabel(tmpString);
-
-
-                       //Extraction data from contours of each slice
-                       contourextractdata->SetZtoBeAnalys( z);
-
-                       tempVector[1]=z;
-                       Instant instant(&tempVector);
-                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-                       sizeLstContourThings = lstContourThings.size();
-
-                       lstManConMod.clear();
-                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                       {
-                               ContourThing **contourthing = lstContourThings[ii];
-                               lstManConMod.push_back( (*contourthing)->getModel() );
-                       }
-                       lstManConModExp =  ExploseEachModel( lstManConMod );
-
-
-//EED004
-
-                       int iContourGroup,sizeContourGroup;
-                       if (typeContourGroup==3) // contour separete
-                       {
-                               sizeContourGroup=lstManConModExp.size();
-                       } else {  // contour AND OR XOR
-                               sizeContourGroup=1;
-                       }
-
-                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
-                               lstManConModTmp.clear();
-                               if (typeContourGroup==3) // contour separete
-                               {
-                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
-                               } else {  // contour AND OR XOR
-                                       lstManConModTmp = lstManConModExp;
-                               }
-
-                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-                               pLstValue.clear();
-                               pLstValuePosX.clear();
-                               pLstValuePosY.clear();
-                               pLstValuePosZ.clear();
-                               contourextractdata->GetValuesInsideCrown(       &pLstValue,
-                                                                                                                       &pLstValuePosX,
-                                                                                                                       &pLstValuePosY,
-                                                                                                                       &pLstValuePosZ);
-
-                               wxString filename;
-                               filename.Printf("%s\\%s-slice%d-cont%d.txt",directory.c_str(),namefile.c_str(),z,iContourGroup);
-                               FILE *pFile=fopen((const char *)filename.mb_str(),"w+");
-                               fprintf(pFile,"value \t x \t y \t z\n"  );
-                               int iLstValue,sizeLstValue=pLstValue.size();
-                               for (iLstValue=0 ; iLstValue<sizeLstValue ; iLstValue++ )
-                               {
-                                       fprintf(pFile,"%f\t %f\t %f\t %f\n", (float)pLstValue[iLstValue] , (float)pLstValuePosX[iLstValue], (float)pLstValuePosY[iLstValue], (float)z );
-                               }
-                               fclose(pFile);
-                       } // for  iContourGroup
-               } // for z
-               _staticTextInformation->SetLabel( _T("") );
-               delete contourextractdata;
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::SaveImageResult(std::string directory,std::string namefile)
-       {
-               wxBusyCursor wait;
-               ContourExtractData      *contourextractdata = new ContourExtractData( true );
-               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
-               if (typeContourGroup==3)
-               {
-                       typeContourGroup=1;
-               }
-               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
-
-               std::vector<manualContourModel*> lstManConMod;
-               std::vector<manualContourModel*> lstManConModTmp;
-               std::vector<manualContourModel*> lstManConModExp;
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-               vtkImageData *imagedata = _sceneManager->GetImageData();
-               int sizeZ = _sceneManager->GetImageDataSizeZ();
-               int z;
-               int ii,sizeLstContourThings;
-
-
-               int minZ,maxZ;
-               double totalZ;
-               double porcent; 
-
-               wxString tmpString;
-
-               minZ    = 0;// _mbarrange->GetStart();
-               maxZ    = sizeZ;//_mbarrange->GetEnd();
-               totalZ  = maxZ-minZ+1;
-
-               contourextractdata->SetImage( imagedata);
-
-       // For each slice..
-               for ( z=0 ; z<sizeZ ; z++)
-               {
-
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf("Saving Values  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
-                       _staticTextInformation->SetLabel(tmpString);
-
-                       //Extraction data from contours of each slice
-                       contourextractdata->SetZtoBeAnalys( z);
-
-                       tempVector[1]=z;
-                       Instant instant(&tempVector);
-                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-                       sizeLstContourThings = lstContourThings.size();
-
-                       lstManConMod.clear();
-                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                       {
-                               ContourThing **contourthing = lstContourThings[ii];
-                               lstManConMod.push_back( (*contourthing)->getModel() );
-                       }
-                       lstManConModExp =  ExploseEachModel( lstManConMod );
-
-
-                       int iContourGroup,sizeContourGroup;
-                       if (typeContourGroup==3) // contour separete
-                       {
-                               sizeContourGroup=lstManConModExp.size();
-                       } else {  // contour AND OR XOR
-                               sizeContourGroup=1;
-                       }
-
-                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
-                               lstManConModTmp.clear();
-                               if (typeContourGroup==3) // contour separete
-                               {
-                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
-                               } else {  // contour AND OR XOR
-                                       lstManConModTmp = lstManConModExp;
-                               }
-
-                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-
-//                             for (ii=0 ; ii<sizeLstContourThings ; ii++)
-//                             {
-//                                     ContourThing **contourthing = lstContourThings[ii];
-//                                     lstManConMod.push_back( (*contourthing)->getModel() );
-//                             }
-//                             contourextractdata->SetLstManualContourModel( lstManConMod );
-
-                               contourextractdata->CalculateImageResult(); // with actual Z
-
-                       } // for  iContourGroup
-               } // for z
-
-
-               wxString filename;
-               filename.Printf("%s\\%s-Value.mhd",directory.c_str(),namefile.c_str(),z);
-
-// Image Value
-               vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
-               writerValueImage->SetInput( contourextractdata->GetVtkImageValueResult() );
-               writerValueImage->SetFileName( (const char *)filename.mb_str() );
-               writerValueImage->SetFileDimensionality( 3 );
-               writerValueImage->Write( );
-
-// Image Mask
-               filename.Printf("%s\\%s-Mask.mhd",directory.c_str(),namefile.c_str(),z);
-               vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
-               writerMaskImage->SetInput( contourextractdata->GetVtkImageMaskResult() );
-               writerMaskImage->SetFileName( (const char *)filename.mb_str() );
-               writerMaskImage->SetFileDimensionality( 3 );
-               writerMaskImage->Write( );
-
-               _staticTextInformation->SetLabel( _T("") );
-               delete contourextractdata;
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onInformationContourLabels( wxCommandEvent& event )
-       {
-               wxBusyCursor wait;
-               FillGridWithContoursInformation();
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onSaveResults( wxCommandEvent& event )
-       {
-               wxFileDialog dialog(_InformationContourFrame, _T("Choose a file"), _T(""), _T(""), _T("*.txt"), wxSAVE );
-               if (dialog.ShowModal() == wxID_OK)
-               {
-                       onExtractInformation( event );
-                       std::string directory=(const char *)(dialog.GetDirectory().mb_str());
-                       std::string namefile=(const char *)(dialog.GetFilename().mb_str());
-
-                       SaveValuesXYZ( directory , namefile );
-                       SaveImageResult( directory , namefile );
-
-                       std::string filename = (const char *)(dialog.GetPath().mb_str() );
-                       FILE *pFile=fopen(filename.c_str(),"w+");
-
-                       int sizeZ = _sceneManager->GetImageDataSizeZ();
-
-                       wxString tmpString;
-                       int i,j,maxX,maxY=sizeZ;
-                       maxX=this->_grid->GetNumberCols();
-
-                       int iTitle,sizeTitle = (maxX / _numberOfVariablesStatistics);
-                       for ( iTitle=0; iTitle<sizeTitle ; iTitle++)
-                       {
-                               fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle,tmpString.char_str() );
-                       }
-                       fprintf(pFile,"\n" );
-
-
-
-                       for ( j=0; j<maxY ; j++)
-                       {
-                               fprintf(pFile,"%d\t" , j );
-                               for (i=0 ; i<maxX ; i++){
-                                       tmpString = _grid->GetCellValue( j , i );
-                                       fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
-                               } // for i
-                               fprintf(pFile,"\n"  );
-                       } // for j
-
-                       fclose(pFile);
-               } // if  ShowModal
-
-
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onInformationContourFrame()
-       {
-               if (_InformationContourFrame==NULL)
-               {
-                       _InformationContourFrame                                                = new wxFrame (_theViewPanel, -1,_T("  Information  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
-                       _InformationContourFrame->SetSize( wxSize(500,450) );
-                       wxSize sizepanel(200,300);
-                       wxPanel *panel                                                                  = new wxPanel(_InformationContourFrame,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL);
-
-                       wxString lstOptions[4];
-                       lstOptions[0]=_T("Actual Slice");
-                       lstOptions[1]=_T("Range Slices");
-                       lstOptions[2]=_T("All Slices");
-                       _informationRadiobox                                                    = new wxRadioBox(panel, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
-
-                       wxString lstOptContOperation[5];
-                       lstOptContOperation[0]=_T("AND");
-                       lstOptContOperation[1]=_T("OR");
-                       lstOptContOperation[2]=_T("XOR");
-                       lstOptContOperation[3]=_T("ALL");
-                       _radiolstboxContourGroup                                                = new wxRadioBox(panel, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation,  4, wxRA_SPECIFY_COLS);
-
-                       wxButton *informationContourLabelsBtn                   = new wxButton(panel,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) );
-                       informationContourLabelsBtn->SetEventHandler( this );
-                       Connect( informationContourLabelsBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onInformationContourLabels ); 
-
-                       wxButton *statisticsContourBtn                                  = new wxButton(panel,-1,_T("Contour statistics"),wxDefaultPosition, wxSize(140,35) );
-                       statisticsContourBtn->SetEventHandler( this );
-                       Connect( statisticsContourBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onExtractInformation ); 
-
-                       wxButton *saveResultsBtn                                                = new wxButton(panel,-1,_T("Save statistics results"),wxDefaultPosition, wxSize(140,35) );
-                       saveResultsBtn->SetEventHandler( this );
-                       Connect( saveResultsBtn->GetId(),               wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSaveResults ); 
-
-
-                       int sizeZ = this->_sceneManager->GetImageDataSizeZ();                   
-                       _mbarrangeSliceInformation                                      =  new mBarRange(panel,65,65);
-                       _mbarrangeSliceInformation->SetMin(0);
-                       _mbarrangeSliceInformation->SetStart(0);
-                       _mbarrangeSliceInformation-> SetOrientation( true );
-                       _mbarrangeSliceInformation-> setActiveStateTo(true);
-                       _mbarrangeSliceInformation-> setVisibleLabels( true );
-                       _mbarrangeSliceInformation-> setDeviceEndMargin(10);
-                       _mbarrangeSliceInformation-> setRepresentedValues( 0 , sizeZ-1 );
-                       _mbarrangeSliceInformation-> setDeviceBlitStart(10,10); 
-                       _mbarrangeSliceInformation-> setIfWithActualDrawed( false );
-                       _mbarrangeSliceInformation-> SetStart( 0 );
-                       _mbarrangeSliceInformation-> SetEnd( sizeZ-1 );  
-
-
-                       double range[2];
-                       this->_sceneManager->GetImageDataRange(range);
-                       _mbarrangeRangeInformation                                      =  new mBarRange(panel,65,65);
-                       _mbarrangeRangeInformation->SetMin(0);
-                       _mbarrangeRangeInformation->SetStart(0);
-                       _mbarrangeRangeInformation-> SetOrientation( true );
-                       _mbarrangeRangeInformation-> setActiveStateTo(true);
-                       _mbarrangeRangeInformation-> setVisibleLabels( true );
-                       _mbarrangeRangeInformation-> setDeviceEndMargin(10);
-                       _mbarrangeRangeInformation-> setRepresentedValues( range[0] , range[1] );
-                       _mbarrangeRangeInformation-> setDeviceBlitStart(10,10); 
-                       _mbarrangeRangeInformation-> setIfWithActualDrawed( false );
-                       _mbarrangeRangeInformation-> SetStart( range[0] );
-                       _mbarrangeRangeInformation-> SetEnd( range[1] );  
-
-
-                       _staticTextInformation                                                  = new wxStaticText(panel,-1,_T("    "));
-
-
-//                     wxButton *XXXXXXXBtn                    = new wxButton(panel,-1,_T("Statistics"),wxDefaultPosition, wxSize(180,35) );
-//                     XXXXXXXBtn->SetEventHandler( this );
-//                     Connect( XXXXXXXBtn->GetId(),           wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onXXXXX ); 
-
-
-                       _grid = new wxGrid( panel,
-                       wxID_ANY,
-                       wxPoint( 0, 0 ),
-                       wxSize( 100, 100 ) );
-
-                       int i,gridCol=10,gridRow=sizeZ;
-                       _grid->CreateGrid( 0, 0 );
-                       _grid->AppendRows(gridRow);
-                       _grid->AppendCols(gridCol);
-
-                       for (i=0;i<gridRow;i++)
-                       {
-                               _grid->SetRowLabelValue(i, _T(" ") );
-                       }
-//                     _grid->SetColLabelSize(0);
-
-
-                       FillGridWithContoursInformation();
-
-                       wxFlexGridSizer * sizerA                = new wxFlexGridSizer(10);
-                       sizerA->Add( _informationRadiobox                       , 1, wxALL ,2 );
-                       sizerA->Add( _radiolstboxContourGroup           , 1, wxALL ,2 );
-
-                       wxFlexGridSizer * sizerB                = new wxFlexGridSizer(10);
-                       sizerB->Add( informationContourLabelsBtn        , 1, wxALL ,2 );
-                       sizerB->Add( statisticsContourBtn                       , 1, wxALL ,2 );
-                       sizerB->Add( saveResultsBtn                                     , 1, wxALL ,2 );
-
-                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
-                       sizer->AddGrowableCol(0);
-                       sizer->AddGrowableRow(7);
-                       sizer->Add( sizerA                                              , 1, wxALL              , 0 );
-                       sizer->Add( new wxStaticText(panel              ,-1,_T("Slice Range"))  , 1, wxALL              , 0 );
-                       sizer->Add( _mbarrangeSliceInformation  , 1, wxALL|wxGROW               , 2 );                  
-                       sizer->Add( new wxStaticText(panel              ,-1,_T("Gray Range"))   , 1, wxALL              , 0 );
-                       sizer->Add( _mbarrangeRangeInformation  , 1, wxALL|wxGROW               , 2 );                  
-                       sizer->Add( sizerB                                              , 1, wxALL              , 0 );
-                       sizer->Add( _staticTextInformation              , 1, wxALL              , 0 );
-                       sizer->Add( _grid                                               , 1, wxEXPAND   , 0 );
-
-
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( wxSize(1500,1500) );
-                       //panel->SetBackgroundColour( wxColour(100,100,100) );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();
-
-                       wxBoxSizer * sizerPanel         = new wxBoxSizer(wxHORIZONTAL);
-                       sizerPanel -> Add( panel                , 1, wxEXPAND ,0);
-                       _InformationContourFrame->SetSizer( sizerPanel );
-                       _InformationContourFrame->SetAutoLayout( true );
-                       _InformationContourFrame->Layout();
-
-                       _InformationContourFrame->Show();
-               } else {
-                       if (_InformationContourFrame->IsShown()==true)
-                       {
-                               _InformationContourFrame->Show(false);
-                       } else  {
-                               FillGridWithContoursInformation();
-                               _InformationContourFrame->Show(true);
-                       }
-               }
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onSpreadInDepth( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onOutline_Union_Of( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onOutline_Intersection_Of( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onOutline_Combination_Of( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onOutline_Fragmentation_Of( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onOutline_Agrupation_Of( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onCopyOutlines( std::vector<std::string> & keyNamesVector )
-       {
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-        _performingOperation->reset();
-               _performingOperation->setStartCommand( (char)wxContour_ActionCommnadsID::COPY_TOOL );
-               _performingOperation->setStartOperationInstantVector( tempVector );
-               _performingOperation->setKeyNamesOperationElems( keyNamesVector );
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onPasteOutlines( )
-       {
-               char theStartCommand = _performingOperation->getStartCommand();
-               if (  theStartCommand == wxContour_ActionCommnadsID::COPY_TOOL )
-               {
-                       std::vector<int> tempVector;
-                       _instantPanel->getInstant( tempVector );
-                       _performingOperation->setEndOperationInstantVector ( tempVector );
-                       std::vector<std::string> elems = _performingOperation->getKeyNamesOperationElems();
-                       int i,size = elems.size();                      
-                       for( i=0; i<size; i++ )
-                       {                               
-                               createCopyContourOf( elems[i], tempVector, i>0 );
-                       }
-               }
-               int fin = 0;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onShowOutlines( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onHideOutlines( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onSelectOutlines( std::vector<std::string> & keyNamesVector )
-       {
-               //if( keyNamesVector.empty() )
-               {
-                       _sceneManager->drawSelectionROI( );
-               }
-               /*else
-               {
-                       int ok = keyNamesVector.size();
-                       _sceneManager->selectObjects( keyNamesVector );
-                       std::string name = keyNamesVector[0];                   
-               }*/
-               /*
-               _sceneManager->drawSelectionROI( );
-               std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
-               int ok = currentSelection.size();
-               _sceneManager->selectObjects( currentSelection );*/
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onEditOutlines( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onREDO()
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onUNDO()
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: deleteContour( std::string theKeyName )
-       {
-               manualContourModel                      * cModel;
-               manualViewBaseContour           * cViewer;
-               manualContourBaseControler      * cControler;
-
-               ContourWrap_ViewControl *conwrapviewControl =  _sceneManager->getContourWrap_ViewControlOf( theKeyName );
-               cControler      = conwrapviewControl->getControler();
-               int ispartofstaticlst= _modelManager->IsPartOfStaticList(theKeyName);
-               if ((cControler!=NULL) && (cControler->IsEditable()==false)  && (ispartofstaticlst==-1) )
-               {
-                       _sceneManager->removeFromScene( theKeyName );
-                       cModel          = _modelManager->getOutlineByKeyName(theKeyName)->getModel();
-                       _modelManager->removeOutline( theKeyName );
-                       cViewer         = conwrapviewControl->getViewer();
-                       _sceneManager->removeWrap( theKeyName );
-//EED Borrame
-//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
-//fprintf(ff,"EED wxContourEventHandler::deleteContours() \n" );
-//fprintf(ff,"    %s %p\n",keyNamesVector[i].c_str(),  cControler );
-//fclose(ff);
-                       delete cModel;
-                       delete cViewer;
-                       delete cControler;
-               } // if editable
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: deleteContours( std::vector<std::string> & keyNamesVector )
-       {
-               int i,size=keyNamesVector.size();
-               for (i=0;i<size;i++)
-               {
-                       deleteContour( keyNamesVector[i] );
-               }
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: deleteAllContours(  )
-       {               
-               wxBusyCursor wait;
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-               int minZ = _mbarrangeDeleteAll->GetStart();
-               int maxZ = _mbarrangeDeleteAll->GetEnd();
-               int z;
-               int ii,sizeLstContourThings;
-               
-               if ( (minZ==0) && (maxZ==_mbarrangeDeleteAll->GetMax() ))
-               {
-                       _sceneManager->removeSceneContours( );
-                       _modelManager->removeAllOutlines();
-                       _sceneManager->removeAllOutlines();
-
-               } else {
-                       for ( z=minZ ; z<=maxZ ; z++)
-                       {
-                               tempVector[1]=z;
-                               Instant instant(&tempVector);
-                               std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-
-                               sizeLstContourThings = lstContourThings.size();
-                               for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                               {
-                                       ContourThing **contourthing = lstContourThings[ii];
-                                       deleteContour( (*contourthing)->getName() );
-                               } //for ii
-                       }// for z
-               } // if 
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::openContours( FILE *pFile, bool staticContour )
-       {
-               char tmp[255];
-               fscanf(pFile,"%s",tmp); // NumberOfContours 
-               fscanf(pFile,"%s",tmp); // ##
-               int numberOfContours = atoi(tmp);  
-
-               std::vector<int> instantVector;
-               int typeContourModel;
-               manualContourModel *manModelContour;
-               int typeView;
-
-               int i;
-               for (i=0;i<numberOfContours;i++)
-               {
-                       instantVector.clear();
-                       fscanf(pFile,"%s",tmp); // Instant
-
-                       fscanf(pFile,"%s",tmp); // 1
-                       instantVector.push_back( atoi(tmp) );
-                       fscanf(pFile,"%s",tmp); // 2
-                       instantVector.push_back( atoi(tmp) );
-                       fscanf(pFile,"%s",tmp); // 3
-                       instantVector.push_back( atoi(tmp) );
-                       fscanf(pFile,"%s",tmp); // 4
-                       instantVector.push_back( atoi(tmp) );
-                       fscanf(pFile,"%s",tmp); // 5
-                       instantVector.push_back( atoi(tmp) );
-                       fscanf(pFile,"%s",tmp); // 6
-                       instantVector.push_back( atoi(tmp) );
-
-
-                       fscanf(pFile,"%s",tmp); // TypeContourModel
-                       fscanf(pFile,"%s",tmp); // ##
-                       typeContourModel = atoi(tmp);
-
-                       manModelContour =  factoryManualContourModel(typeContourModel);
-                       manModelContour->Open(pFile);
-
-                       fscanf(pFile,"%s",tmp); // TypeView
-                       fscanf(pFile,"%s",tmp); // ##
-                       typeView = atoi(tmp);  
-
-
-//                     if (typeView==1) 
-//                     {
-//                     }
-
-
-                       std::string theName;
-                       theName = _modelManager->createOutline( manModelContour, instantVector );
-                       bool addedModel = theName.compare("") != 0;
-                       if( addedModel )
-                       {
-                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                               this->_theViewPanel->getSpacing(spc);                                   
-                               //Adding the manualContourControler to interface objects structure
-                               //Adding the manualViewContour to interface objects structure           
-                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                               _sceneManager->configureViewControlTo( theName, manModelContour,spc , typeView) ;
-                       }       
-
-                       if (staticContour==true)
-                       {
-                               Instant instant(&instantVector);
-                               changeContourOfManager( theName , &instant );
-                       }
-
-               }// for  numberOfContours
-
-
-
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::openFileWithContours()
-       {
-               char tmp[255];
-               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxOPEN );
-               if (dialog.ShowModal() == wxID_OK)
-               {
-                       fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
-                       FILE *pFile=fopen(fileNameContourROI.c_str(),"r+");
-
-                       fscanf(pFile,"%s",tmp); // --CreaContour--
-
-                       fscanf(pFile,"%s",tmp); // Version
-                       fscanf(pFile,"%s",tmp); // 1.0.1
-                       std::string version(tmp);
-
-                       openContours(pFile,false);
-                       if (version!="1.0.0"){
-                               openContours(pFile,true);
-                       }
-//                       _sceneManager->openFileWithContours(ff);
-
-                       fclose(pFile);
-               }
-               _sceneManager->removeSceneContours();
-               changeInstant();
-               //updateInstantOutlines();
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::saveFileWithContours( std::string filename )
-       {
-               FILE *pFile=fopen(filename.c_str(),"w+");
-               std::vector< std::string > lstNameThings;
-               int i,sizeLstNameThings; 
-
-               fprintf(pFile,"--CreaContour--\n");
-               fprintf(pFile,"Version %s\n", "1.0.1" );
-
-               // Normal Contours
-               lstNameThings           = _modelManager->GetLstNameThings();
-               sizeLstNameThings       = lstNameThings.size(); 
-               fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
-               for (i=0 ; i<sizeLstNameThings ; i++) 
-               {
-                       _modelManager->SaveThingName( pFile, lstNameThings[i] );
-                       _sceneManager->SaveThingName( pFile, lstNameThings[i] );
-               }// for i
-
-               //-- Contours Statics 
-               lstNameThings           = _modelManager->GetLstNameThingsStatic();
-               sizeLstNameThings       = lstNameThings.size(); 
-               fprintf(pFile,"NumberOfContoursStatic %d\n", sizeLstNameThings );
-               for (i=0 ; i<sizeLstNameThings ; i++) 
-               {
-                       _modelManager->SaveThingName( pFile, lstNameThings[i] );
-                       _sceneManager->SaveThingName( pFile, lstNameThings[i] );
-               }// for i
-               fclose(pFile);
-       }
-
-
-       //----------------------------------------------------------
-
-       void wxContourEventHandler::saveFileWithContours()
-       {
-               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE );
-               if (dialog.ShowModal() == wxID_OK)
-               {
-                       fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
-                       saveFileWithContours( fileNameContourROI );
-               } // if  ShowModal
-       } 
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: saveFileWithContoursAutomatique()
-       {
-               if (fileNameContourROI=="")
-               {
-                       saveFileWithContours();
-               } else {
-                       saveFileWithContours(fileNameContourROI);
-               }
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append )
-       {
-               std::string cloneName = _modelManager->createCopyContourOf( anExistingKName, instantNoTouchData );
-               manualContourModel * manualModel = _modelManager->getOutlineByKeyName( cloneName )->getModel();
-               _sceneManager->createCopyContourOf( anExistingKName, cloneName, manualModel , append );
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       manualContourModel * wxContourEventHandler::factoryManualContourModel(int typeContour)
-       {       
-               manualContourModel *manModelContour=NULL;
-
-               // spline
-               if (typeContour==0)
-               {
-                       manModelContour = new manualContourModel();
-               }
-
-               // spline
-               if (typeContour==1)
-               {
-                       manModelContour = new manualContourModel();
-               }
-
-               // rectangle
-               if (typeContour==2)
-               {
-                       manModelContour = new manualContourModelRoi();
-               }
-
-               // circle
-               if (typeContour==3)
-               {
-                       manModelContour = new manualContourModelCircle();
-               }
-
-               // BullEye / star
-               if (typeContour==4)
-               {
-                       manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
-                       manModelContour = manModelContourBullEye;
-                       if (_panelBullEyeOptions!=NULL){
-                               int iCrown,sizeCrowns,iSector,sizeSectors;
-                               double radioA,radioB,ang,angDelta ;
-                               sizeCrowns = _panelBullEyeOptions->GetNumberOfCrowns();
-                               for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
-                               {
-                                       sizeSectors = _panelBullEyeOptions->GetNumberOfSections(iCrown);
-                                       radioB  = _panelBullEyeOptions->GetRadioOfCrown(iCrown);
-                                       if (iCrown==sizeCrowns-1)
-                                       {
-                                               radioA  = 0;
-                                       } else {
-                                               radioA  = _panelBullEyeOptions->GetRadioOfCrown(iCrown+1);
-                                       }
-                                       radioA=radioA/100.0;
-                                       radioB=radioB/100.0;
-                                       for ( iSector=0 ; iSector<sizeSectors  ; iSector++ )
-                                       {
-                                               ang             = _panelBullEyeOptions->GetAngOfCrownSection(iCrown,iSector);
-                                               angDelta= _panelBullEyeOptions->GetAngDeltaOfCrownSection(iCrown);                                      
-                                               manModelContourBullEye->AddSector(radioA,radioB,ang,angDelta);
-                                       } // for iSector
-                               } // for iCrown
-                       } // if _panelBullEyeOptions
-               }// if typeContour==4
-
-               return manModelContour;
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: createContour( int typeContour )
-       {
-               //Creating the manualContourModel and including in the model
-               manualContourModel * manModelContour = factoryManualContourModel(typeContour);
-               std::vector<int> instantVector;
-               _instantPanel->getInstant( instantVector );
-               std::string theName;
-               theName= _modelManager->createOutline( manModelContour, instantVector );
-               bool addedModel = theName.compare("") != 0;
-               if( addedModel )
-               {
-                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                       this->_theViewPanel->getSpacing(spc);                                   
-                       //Adding the manualContourControler to interface objects structure
-                       //Adding the manualViewContour to interface objects structure           
-                       //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                       _sceneManager->configureViewControlTo( theName, manModelContour,spc , typeContour) ;
-               }       
-
-//EED Borrame
-//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
-//fprintf(ff,"EED wxContourEventHandler::createContour() \n" );
-//fprintf(ff,"    %s\n %p ",theName.c_str() ,  );
-//fclose(ff);
-
-
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       //  Attributes getters and setters
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: setModelManager( OutlineModelManager * theModelManager )
-       {
-               _modelManager = theModelManager;
-               _workSpace = _modelManager->getContourWorkspace();
-       }
-       //------------------------------------------------------------------------------------------------------------  
-       void wxContourEventHandler :: setViewPanel(  wxContourViewPanel * theViewPanel )
-       {
-               _theViewPanel = theViewPanel;
-               _theViewPanel->setWxEventHandler( this );
-
-               double spc[3];
-               this->_theViewPanel->getSpacing(spc);
-               _sceneManager           = new wxVtkBaseView_SceneManager ( this->_theViewPanel->getWxVtkBaseView(), this, spc  );
-               
-               Connect( _theViewPanel->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangeInstant );
-        Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onCreateMultipleROI );
-               Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onCreateROI );
-               Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onStopCreateROI );
-               Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangedDeep );
-               Connect( wxID_ANY,  wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler :: onActionButtonPressed ); 
-
-               
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel )
-       {
-               _instantPanel = theInstantChooserPanel;
-               _instantPanel->setWxEventHandler( this );
-
-               Connect( _instantPanel->GetId(), wxINSTANT_CHOOSER_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangeInstant );
-
-               std::vector<int> vect;
-               _instantPanel->getInstant( vect );
-               _actualInstant = new Instant( &vect );
-
-               if( _modelManager!=NULL )
-               {               
-                       std::vector<std::string> conceptNameVect;
-                       std::vector<int> conceptSizeVect;
-                       _modelManager-> getConceptsInformation(conceptNameVect, conceptSizeVect);
-                       int i=0;
-                       int max = conceptNameVect.size();                       
-                       for( ; i<max; i++)
-                       {
-                               if( conceptNameVect[i].compare("Axe Depth") == 0 )
-                               {
-                                       _instantPanel->addConcept( conceptNameVect[i], 0, conceptSizeVect[i], 1);
-                               } else {
-                                       _instantPanel->addConcept( conceptNameVect[i], 1, conceptSizeVect[i], 1);
-                               } // if
-                       } // for                
-               } else {
-                       //Should be configured later, or abort program, because Model -NEEDS- to be added before chooserPanel
-               }
-               if( _theViewPanel!=NULL )
-               {
-                       double val = _theViewPanel->getCurrentDeep();
-                       _instantPanel->setConceptValue( "Axe Depth", (int)val );
-                       ConceptDataWrap * data = _instantPanel->getConceptDataOf( "Axe Depth" );
-                       changeInstant();                        
-                       _theViewPanel->setVerticalConcept( "Axe Depth", data->getMinValue(), data->getMaxValue(), data->getMinShowedValue(),  data->getMaxShowedValue(), data->getActualValue() );                      
-               } else {
-                       //Should be configured later, or abort program, because ViewPanel -NEEDS- to be added before chooserPanel
-               }// if
-       } 
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setButtonsBar(  wxContour_ButtonsBar * theButtonsBar )
-       {
-               _buttonsBar = theButtonsBar;
-               _buttonsBar->setWxEventHandler( this );
-               Connect( _buttonsBar->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler:: onActionButtonPressed );               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setGrid(  wxContour_Grid * theGridPanel )
-       {
-               _gridPanel = theGridPanel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel )
-       {
-               _drawToolsPanel = theDrawToolsPanel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theOperationsToolsPanel )
-       {       
-               _operationsToolsPanel = theOperationsToolsPanel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel )
-       {
-               _autoFormsPanel = theAutoFormsPanel;
-       }
-
-       void wxContourEventHandler :: setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel )
-       {
-               _standardToolsPanel= theStandardToolsPanel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel )
-       {
-               _editionToolsPanel =  theEditionToolsPanel;
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setListViewPanel(  wxContour_ListViewPanel * theListViewPanel )
-       {
-               _listViewPanel = theListViewPanel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       //  Other functional methods
-       //------------------------------------------------------------------------------------------------------------
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onDeleteContour( wxCommandEvent& event )
-       {
-               int i,size=_sceneManager->getSelectedObjects().size();
-               for(i=0;i<size;i++)
-               {
-                       std::string keyName             = _sceneManager->getSelectedObjects()[i];
-                       int ispartofstaticlist  = this->_modelManager->IsPartOfStaticList( keyName );
-                       if ( ispartofstaticlist>=0 )
-                       {
-                               std::vector<int> tempVector;
-                               _instantPanel->getInstant( tempVector );
-                               Instant instant(&tempVector);
-                               this->_modelManager->ChangeContourOfList(keyName, &instant);
-                       }
-               }
-
-               std::vector<std::string> lstKeyName;
-               std::vector<std::string> lstKeyNameActualSlice;
-               std::vector<std::string> lstKeyNameToBeErase;
-
-               lstKeyNameToBeErase             = _sceneManager->getSelectedObjects();
-               lstKeyNameActualSlice   = _sceneManager->GetlstContoursNameActualSlice();
-               int k,kSize=lstKeyNameToBeErase.size();
-               int j,jSize=lstKeyNameActualSlice.size();
-               bool ok;
-               for (k=0;k<kSize; k++)
-               {
-                       ok=false;
-                       for (j=0;j<jSize; j++)
-                       {
-                               if (lstKeyNameToBeErase[k]==lstKeyNameActualSlice[j])
-                               { 
-                                       ok=true;
-                               }
-                       } // for j
-                       if (ok==true)
-                       {
-                               lstKeyName.push_back( lstKeyNameToBeErase[k] );
-                       } // if ok
-               } // for k
-
-               deleteContours( lstKeyName );
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onDeleteContoursActSlice( wxCommandEvent& event )
-       {
-               deleteContours( _sceneManager->GetlstContoursNameActualSlice() );
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onDeleteAllContours( wxCommandEvent& event )        
-       {
-               deleteAllContours(  );
-       }
-
-               //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onDeleteFrame( )
-       {
-               if (_deleteFrame==NULL)
-               {
-                       _deleteFrame                                            = new wxFrame (_theViewPanel, -1,_T("  Delete Contour "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
-                       int width=300;
-                       wxSize sizepanel(width,230);
-                       _deleteFrame->SetSize( sizepanel );
-                       wxPanel *panel                                          = new wxPanel(_deleteFrame,-1);
-                       wxButton *deleteContourBtn                      = new wxButton(panel,-1,_T("Delete contour selected"),wxDefaultPosition, wxSize(width-10,35) );
-                       wxButton *deleteContoursActSliceBtn     = new wxButton(panel,-1,_T("Delete contours of actual slice"),wxDefaultPosition, wxSize(width-10,35));
-                       wxButton *deleteAllContoursBtn          = new wxButton(panel,-1,_T("Delete all contours"),wxDefaultPosition, wxSize(width-10,35));
-
-                       int sizeZ = _sceneManager->GetImageDataSizeZ();
-                       _mbarrangeDeleteAll                                     =  new mBarRange(panel,70, 65);
-                       _mbarrangeDeleteAll->SetMin(0);
-                       _mbarrangeDeleteAll->SetStart(0);
-
-                       _mbarrangeDeleteAll-> SetOrientation( true );
-                       _mbarrangeDeleteAll-> setActiveStateTo(true);
-                       _mbarrangeDeleteAll-> setVisibleLabels( true );
-                       _mbarrangeDeleteAll-> setDeviceEndMargin(10);
-                       _mbarrangeDeleteAll-> setRepresentedValues( 0 , sizeZ );
-                       _mbarrangeDeleteAll-> setDeviceBlitStart(10,10); 
-                       _mbarrangeDeleteAll-> setIfWithActualDrawed( false );
-                       _mbarrangeDeleteAll-> SetStart( 0 );
-                       _mbarrangeDeleteAll-> SetEnd( sizeZ );  
-
-
-                       _deleteFrame->SetEventHandler( this );
-                       Connect( deleteContourBtn->GetId()                      ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteContour ); 
-                       Connect( deleteContoursActSliceBtn->GetId()     ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteContoursActSlice ); 
-                       Connect( deleteAllContoursBtn->GetId()          ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteAllContours ); 
-
-                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
-                       sizer -> Add( deleteContourBtn                          , 1, wxGROW );
-                       sizer -> Add( deleteContoursActSliceBtn         , 1, wxGROW );
-                       sizer -> Add( deleteAllContoursBtn                      , 1, wxGROW );
-                       sizer -> Add( _mbarrangeDeleteAll                       , 1, wxGROW );
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizepanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();
-                       _deleteFrame->Show(true);
-               } else {
-                       if (_deleteFrame->IsShown()==true)
-                       {
-                               _deleteFrame->Show(false);
-                       } else  {
-                               _deleteFrame->Show(true);
-                       }
-               }
-       }
-
-
-//------------------------------------------------------------------------------------------------------------
-void wxContourEventHandler::onCreateContourSpline( wxCommandEvent& event )
-{
-       createContour( 1 );
-}
-
-//------------------------------------------------------------------------------------------------------------
-void wxContourEventHandler::onCreateContourRectangle( wxCommandEvent& event )
-{
-       createContour( 2 );
-}
-
-//------------------------------------------------------------------------------------------------------------
-void wxContourEventHandler::onCreateContourCircle( wxCommandEvent& event )
-{
-       createContour( 3 );
-}
-//------------------------------------------------------------------------------------------------------------
-void wxContourEventHandler::onCreateContourBullEye( wxCommandEvent& event )
-{
-       createContour( 4 );
-}
-
-
-
-//------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onCreateContourFrame( )
-       {
-               if (_createContourFrame==NULL)
-               {
-                       _createContourFrame                                             = new wxFrame (_theViewPanel, -1,_T("  New Contour  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER );
-                       wxSize sizepanel(490,600);
-                       _createContourFrame->SetSize( sizepanel );
-                       wxPanel *panel                                          = new wxPanel(_createContourFrame,-1);
-                       wxButton *newContourSplineBtn           = new wxButton(panel,-1,_T("Interpolation B-spline (close)"),wxDefaultPosition, wxSize(180,35) );
-                       newContourSplineBtn->SetToolTip(_T("CTRL-N"));
-                       wxButton *newContourRectangleBtn        = new wxButton(panel,-1,_T("Rectangle"),wxDefaultPosition, wxSize(180,35));
-                       wxButton *newContourCircleBtn           = new wxButton(panel,-1,_T("Circle"),wxDefaultPosition, wxSize(180,35));
-                       wxButton *newContourStarBtn                     = new wxButton(panel,-1,_T("Bull eye"),wxDefaultPosition, wxSize(180,35));
-
-                       _panelBullEyeOptions = new PanelBullEyeOptions(panel, wxSize(100,200));
-
-                       _createContourFrame->SetEventHandler( this );
-                       Connect( newContourSplineBtn->GetId()           ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourSpline    ); 
-                       Connect( newContourRectangleBtn->GetId()        ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourRectangle ); 
-                       Connect( newContourCircleBtn->GetId()           ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourCircle    ); 
-                       Connect( newContourStarBtn->GetId()                     ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourBullEye   ); 
-
-                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
-                       sizer -> Add( newContourSplineBtn                       , 1, wxGROW );
-                       sizer -> Add( newContourRectangleBtn            , 1, wxGROW );
-                       sizer -> Add( newContourCircleBtn                       , 1, wxGROW );
-                       sizer -> Add( newContourStarBtn                         , 1, wxGROW );
-                       sizer -> Add( _panelBullEyeOptions                      , 1, wxGROW );
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizepanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();
-                       _createContourFrame->Show(true);
-               } else {
-                       if (_createContourFrame->IsShown()==true)
-                       {
-                               _createContourFrame->Show(false);
-                       } else  {
-                               _createContourFrame->Show(true);
-                       }
-               }
-       }
-
-
-//------------------------------------------------------------------------
-void wxContourEventHandler::RefreshInterface()
-{
-       changeInstant();
-       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
-       wxvtk2dbaseview->Refresh();
-}
-
-//------------------------------------------------------------------------
-void wxContourEventHandler::onWidthOfContour(wxScrollEvent& event){
-       _sceneManager->removeSceneContours();
-       double width = (double)_withOfContourLine->GetValue() / 2.0;
-       _sceneManager->SetWidthContour( width );
-
-       RefreshInterface();
-}
-
-//------------------------------------------------------------------------
-
-void wxContourEventHandler::onBrigthnessColorWindowLevel(wxScrollEvent& event){
-       int colorwindow                         = _brithtnessColorLevel->GetValue();
-       int windowlevel                         = _brithtnessWindowLevel->GetValue();
-       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
-       vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-       imageviewer->SetColorWindow(colorwindow);
-       imageviewer->SetColorLevel(windowlevel);        
-//     wxvtk2dbaseview->Refresh();
-       RefreshInterface();
-}
-
-void wxContourEventHandler::OnInterpolation(wxCommandEvent& event)
-{
-       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
-       vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-       if (_interpolationCheckBox->GetValue()==true)
-       {
-               imageviewer->GetImageActor()->InterpolateOn();
-       } else {
-               imageviewer->GetImageActor()->InterpolateOff();
-       }
-       RefreshInterface();
-}
-
-
-//------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onInterfaceConfigurationFrame( )
-       {
-               if (_interfaceConfigurationFrame==NULL)
-               {
-                       _interfaceConfigurationFrame                    = new wxFrame (_theViewPanel, -1,_T(" Interface Configuration "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
-                       wxSize sizepanel(190,400);
-                       _interfaceConfigurationFrame->SetSize( sizepanel );
-                       wxPanel *panel                                                  = new wxPanel(_interfaceConfigurationFrame,-1);
-                       _withOfContourLine                                              = new wxSlider(panel, -1, 1 , 1, 10, wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
-                       double range[2];
-                       this->_sceneManager->GetImageDataRange(range);
-
-                       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
-                       vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-                       int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
-                       int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();      
-
-                       _brithtnessWindowLevel                                  = new wxSlider(panel, -1, windowlevel , 1, range[1], wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-                       _brithtnessColorLevel                                   = new wxSlider(panel, -1, colorwindow , 1, range[1], wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
-                       _interpolationCheckBox = new wxCheckBox(panel, -1, _T("Image interpolation") );
-                       _interpolationCheckBox->SetValue(true);
-
-                       _interfaceConfigurationFrame->SetEventHandler( this );
-
-                       Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
-                       Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
-
-                       Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-                       Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-                       Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-                       Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-                       Connect( _interpolationCheckBox->GetId()        ,       wxEVT_COMMAND_CHECKBOX_CLICKED    , (wxObjectEventFunction) &wxContourEventHandler::OnInterpolation             );
-
-                       wxFlexGridSizer * sizer                                 = new wxFlexGridSizer(1);
-                       sizer -> Add( new wxStaticText(panel,-1,_T("Contour width"))  , 1, wxGROW );
-                       sizer -> Add( _withOfContourLine                , 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T("Brightness of the image"))  , 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T("--Window level--"))  , 1, wxGROW );
-                       sizer -> Add( _brithtnessWindowLevel            , 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T("--Color level--"))  , 1, wxGROW );
-                       sizer -> Add( _brithtnessColorLevel, 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-                       sizer -> Add( _interpolationCheckBox            , 1, wxGROW );
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizepanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();
-                       _interfaceConfigurationFrame->Show(true);
-               } else {
-                       if (_interfaceConfigurationFrame->IsShown()==true)
-                       {
-                               _interfaceConfigurationFrame->Show(false);
-                       } else  {
-                               _interfaceConfigurationFrame->Show(true);
-                       }
-               }
-       }
-
-
-       
-
-//------------------------------------------------------------------
-       void wxContourEventHandler :: changeContourOfManager(std::string keyName, Instant *instant)
-       {
-               this->_modelManager->ChangeContourOfList(keyName, instant);
-       }
-
-//------------------------------------------------------------------
-       void wxContourEventHandler :: changeContoursOfManager(  std::vector<std::string> & keyNamesVector  )
-       {
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-               Instant instant(&tempVector);
-
-               int i , size=keyNamesVector.size();
-               for ( i=0 ; i<size ; i++ )
-               {
-                       changeContourOfManager(keyNamesVector[i], &instant);
-               } // i
-       }
-
-
-//------------------------------------------------------------------
-       void wxContourEventHandler :: executeActionCommand( const char  toolCommand )
-       {
-               std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
-               int elementsSelected = currentSelection.size();
-               if( toolCommand == (wxContour_ActionCommnadsID::CREATE_TOOL) )
-               {
-                       onCreateContourFrame();
-               }
-               if( toolCommand == (wxContour_ActionCommnadsID::CREATE_CONTOUR_KEY) )
-               {
-                       createContour();
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::DELETE_TOOL )
-               {
-                       onDeleteFrame( );
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::DELETE_KEY )
-               {
-                       deleteContours( currentSelection );
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::SAVE_TOOL )
-               {
-                       saveFileWithContours(  );
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::SAVE_KEY )
-               {
-                       saveFileWithContoursAutomatique(  );
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::OPEN_TOOL )
-               {
-                       openFileWithContours(  );
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::CHANGE_TOOL )
-               {
-                       if ( elementsSelected >= 1 )
-                       {
-                               changeContoursOfManager( currentSelection );
-                       }
-
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::HIDE_TOOL )
-               {
-                       if ( elementsSelected >= 1 )
-                       {
-                               onHideOutlines( currentSelection );
-                       }                       
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::SHOW_TOOL )
-               {
-                       if ( elementsSelected >= 1 )
-                       {
-                               onShowOutlines( currentSelection );
-                       }
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::COPY_TOOL )
-               {
-                       if ( elementsSelected >= 1 )
-                       {
-                               onCopyOutlines( currentSelection );
-                       }
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::PASTE_TOOL )
-               {
-                       onPasteOutlines(  );                    
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::SPREAD_TOOL )
-               {
-                               onSpread();
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::AUTOMATIQUESEGMENTATION_TOOL )
-               {
-                       onAutomatiqueSegmentation(  );                  
-               }
-
-               else if( toolCommand == wxContour_ActionCommnadsID::SELECT_TOOL )
-               {
-                       onSelectOutlines( currentSelection );
-                       
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::EDIT_TOOL )
-               {
-                       if ( elementsSelected >= 1 )
-                       {
-                               onEditOutlines( currentSelection );
-                       }
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::UNDO_TOOL )
-               {
-                       onUNDO();
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::REDO_TOOL )
-               {
-                       onREDO();
-               }               
-               else if( toolCommand == wxContour_ActionCommnadsID::INFORMATIONCONTOUR_TOOL )
-               {
-                       onInformationContourFrame();
-               }               
-               else if( toolCommand == wxContour_ActionCommnadsID::INTERFACECONFIGURATION_TOOL )
-               {
-                       onInterfaceConfigurationFrame();
-               }
-               else if( toolCommand == wxContour_ActionCommnadsID::TEST_TOOL )
-               {
-                       onInterfaceTestFrame();
-               }               
-
-
-       }
-
-       
-       //------------------------------------------------------------------------------------------------------------
-       //  Getting information methods
-       //------------------------------------------------------------------------------------------------------------
-
-
-
-       //------------------------------------------------------------------------------------------------------------
-       //  Private methods
-       //------------------------------------------------------------------------------------------------------------
-   
-       void wxContourEventHandler :: updateInstantOutlines()
-       {
-               std::vector<NameWrapper *> namesWrapping = _modelManager->getActualInstantOutlines();
-               int size = namesWrapping.size();
-               _sceneManager->removeSceneContours();
-               for( int i=0; i<size; i++)
-               {                       
-                       _sceneManager->addToScene(namesWrapping[i]->getKeyName(), true, true, true, false, false );
-               }
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: updateInstantImageData()
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: updateInstantAxes()
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------  
-       void wxContourEventHandler :: changeInstant()
-       {
-               std::vector<int> instantVect;
-               _instantPanel->getInstant( instantVect );
-               Instant * theInstant = new Instant ( &instantVect );
-               //if( !theInstant->isEquals( _actualInstant ))
-               {       
-                       //Setting the actual instant
-                       _actualInstant = theInstant;
-                       _modelManager->setInstant( _actualInstant );
-                       
-                       updateInstantOutlines();
-                       updateInstantImageData();
-                       updateInstantAxes();
-
-                       //Searching the elements at the specified instant
-
-                       /*
-                       std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
-                       iter = contours_ViewControl->find("Outline 0");
-                       (iter->second)->getViewer()->RemoveCompleteContourActor();*/
-               }
-       }
-
diff --git a/lib/Interface_ManagerContour_NDimensions/_wxContourEventHandler.cxx_ b/lib/Interface_ManagerContour_NDimensions/_wxContourEventHandler.cxx_
deleted file mode 100644 (file)
index c6fbaf1..0000000
+++ /dev/null
@@ -1,3736 +0,0 @@
-
-
-/*  Diagrama de Secuaencia de cambiar un instante
-wxContourEventHandler :: changeInstant()
-       OutlineModelManager :: ->setInstant( _actualInstant );
-               OutlineModelManager :: updateToActualInstant()
-                 OutlineModelManager :: getOutlinesAtInstant(Instant * anInstant, bool ifAnnotate)
-                   OutlineModelManager :: annotateOutlinesWrap(std::vector<std::string> kNamesVector, std::vector<ContourThing **> theOutlinesVector)
-       wxContourEventHandler :: updateInstantOutlines()
-               OutlineModelManager :: getActualInstantOutlines ()
-               wxVtkBaseView_SceneManager :: addToScene( std::vector< std::string> theKeyNameVector, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
-                       wxVtkBaseView_SceneManager :: addToScene( std::string theKeyName, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
-                               wxVtkBaseView_SceneManager :: getContourWrap_ViewControlOf
-                                       MAP  find
-                          void wxVtkBaseView_SceneManager :: addToScene( std::string theKeyName, ContourWrap_ViewControl * contourWRP, bool append, bool visualization, bool control, bool ifActive, bool ifShowCtrlPoints )
-
-*/
-
-
-/*!
- \mainpage NDimension with wxWidgets and maracas
-
- \section intro Introduction
-
- This is the introduction. 
-
-
-
-  \dot
-
-
-digraph example_0 {
-       graph [ ratio=fill];
-    node [shape=record, fontname=Helvetica, fontsize=10];
-
-       _wxContourGUIExample                    [ label="wxContourGUIExample"                   URL="\ref wxContourGUIExample"];
-       _wxContourEventHandler                  [ label="wxContourEventHandler"                 URL="\ref wxContourEventHandler"];
-
-       _OutlineModelManager                    [ label="OutlineModelManager"                   URL="\ref OutlineModelManager"];
-       _wxInstantChooserPanel                  [ label="wxInstantChooserPanel"                 URL="\ref wxInstantChooserPanel"];
-       _wxContourViewPanel                             [ label="wxContourViewPanel"                    URL="\ref wxContourViewPanel"];
-       _wxContour_ButtonsBar                   [ label="wxContour_ButtonsBar"                  URL="\ref wxContour_ButtonsBar"];       
-       _OutlineModelManager                    [ label="OutlineModelManager"                   URL="\ref OutlineModelManager"];
-       _wxVtkBaseView_SceneManager             [ label="wxVtkBaseView_SceneManager"    URL="\ref wxVtkBaseView_SceneManager"];
-       _SomeEnvironment                                [ label="SomeEnvironment"                               URL="\ref SomeEnvironment"];
-               
-
-       _wxContourGUIExample                    ->      _wxContourEventHandler                  [ arrowhead="open", style="dashed" ];
-       _wxContourGUIExample                    ->      _OutlineModelManager                    [ arrowhead="open", style="dashed" ];
-       _wxContourGUIExample                    ->      _wxInstantChooserPanel                  [ arrowhead="open", style="dashed" ];
-       _wxContourGUIExample                    ->      _wxContourViewPanel                             [ arrowhead="open", style="dashed" ];
-       _wxContourGUIExample                    ->      _wxContour_ButtonsBar                   [ arrowhead="open", style="dashed" ];
-       _wxContourViewPanel                             ->      wxMaracas_N_ViewersWidget               [ arrowhead="open", style="dashed" ];
-       _wxContourEventHandler                  ->      _OutlineModelManager                    [ arrowhead="open", style="dashed" ];
-       _wxContourEventHandler                  ->      _wxVtkBaseView_SceneManager             [ arrowhead="open", style="dashed" ];
-       _OutlineModelManager                    ->      _SomeEnvironment                                [ arrowhead="open", style="dashed" ];
-       
-}
-
-\enddot
-
-
-
-*/
-
-
-
-//----------------------------------------------------------------------------------------------------------------
-// Class definition include
-//----------------------------------------------------------------------------------------------------------------
-#include "wxContourEventHandler.h"
-#include <wx/filedlg.h>
-#include <wx/spinctrl.h>
-#include <iostream>
-#include <fstream>
-
-//----------------------------------------------------------------------------------------------------------------
-// Class implementation
-//----------------------------------------------------------------------------------------------------------------
-/** @file wxContourEventHandler.cxx */
-
-
-//------------------------------------------------------------------------------------------------------------
-// Includes
-//------------------------------------------------------------------------------------------------------------
-
-#include "wxContour_ActionCommandsID.h"
-#include "NameWrapper.h"
-#include "ConceptDataWrap.h"
-#include "OutlineGroup.h"
-
-#include <manualContour.h>
-#include "ContourExtractData.h"
-#include "ImageSourceThing.h"
-
-#include "vtkImageData.h"
-#include <vtkContourFilter.h>
-#include <vtkCleanPolyData.h>
-#include <vtkPolyDataConnectivityFilter.h>         
-#include <vtkStripper.h>
-#include <vtkImageReslice.h>
-#include <vtkMetaImageWriter.h>
-#include <vtkImageMapToWindowLevelColors.h>
-
-
-//------------------------------------------------------------------------------------------------------------
-//------------------------------------------------------------------------------------------------------------
-//------------------------------------------------------------------------------------------------------------
-
-PanelBullEyeOptions::PanelBullEyeOptions (wxWindow * parent, wxSize size) :
-                wxPanel(parent, -1, wxDefaultPosition, size)
-{
-
-       _maxLevels              = 5;
-       _maxSections    = 10;
-       wxSize sizepanel(190,300);
-       wxPanel *panel = this;
-
-
-       wxString lstOptions[2];
-       lstOptions[0]= wxString("General options",wxConvUTF8);
-       lstOptions[1]= wxString("Detail options",wxConvUTF8);
-       _radioboxBullEyeGenOpt  = new wxRadioBox(panel, -1, wxString("General/Detail options",wxConvUTF8), wxDefaultPosition, wxSize(200,45), 2 , lstOptions,  2, wxRA_SPECIFY_COLS);
-       _radioboxBullEyeGenOpt->SetSelection(0);
-
-       _spinctrlBullEyeNumOfCrowns = new wxSpinCtrl( panel , -1,_T("B"),wxDefaultPosition, wxSize(40,20) );
-       _spinctrlBullEyeNumOfCrowns->SetRange(1,_maxLevels);
-       _spinctrlBullEyeNumOfCrowns->SetValue(3);
-
-       _spinctrlBullEyeNumOfSec = new wxSpinCtrl( panel , -1,_T("A"),wxDefaultPosition, wxSize(40,20) );
-       _spinctrlBullEyeNumOfSec->SetRange(1,_maxSections);
-       _spinctrlBullEyeNumOfSec->SetValue(5);
-
-
-       _sliderBullEyeAngle = new wxSlider( panel , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
-       wxFlexGridSizer * sizerGeneralOptions                           = new wxFlexGridSizer(10);
-
-       wxFlexGridSizer * sizerGeneralOptionsA                          = new wxFlexGridSizer(1);
-       wxFlexGridSizer * sizerGeneralOptionsB                          = new wxFlexGridSizer(1);
-       wxFlexGridSizer * sizerGeneralOptionsC                          = new wxFlexGridSizer(1);
-       sizerGeneralOptionsA -> Add( new wxStaticText(panel,-1,_T("Crowns")) , 1, wxGROW );
-       sizerGeneralOptionsA -> Add( _spinctrlBullEyeNumOfCrowns , 1/*, wxGROW*/ );
-       sizerGeneralOptionsB -> Add( new wxStaticText(panel,-1,_T("Sections")) , 1, wxGROW );
-       sizerGeneralOptionsB -> Add( _spinctrlBullEyeNumOfSec , 1/*, wxGROW*/ );
-       sizerGeneralOptionsC -> Add( new wxStaticText(panel,-1,_T("      Angle")) , 1, wxGROW );
-       sizerGeneralOptionsC -> Add( _sliderBullEyeAngle , 1/*, wxGROW*/ );
-
-       sizerGeneralOptions -> Add( sizerGeneralOptionsA  , 1/*, wxGROW*/ );
-       sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T("   ")) , 1, wxGROW );
-       sizerGeneralOptions -> Add( sizerGeneralOptionsB  , 1/*, wxGROW*/ );
-       sizerGeneralOptions -> Add( new wxStaticText(panel,-1,_T("   ")) , 1, wxGROW );
-       sizerGeneralOptions -> Add( sizerGeneralOptionsC  , 1/*, wxGROW*/ );
-
-
-       wxSpinCtrl      *tmpSpinSection;
-       wxSlider        *tmpSliderRadio;
-       wxSlider        *tmpSliderAng;
-
-       wxFlexGridSizer * sizerDetailOptions                            = new wxFlexGridSizer(6);
-
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("Crown ")) , 1, wxGROW );
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  Sections  ")) , 1, wxGROW );
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("      Radio %")) , 1, wxGROW );
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
-       sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("      Angle")) , 1, wxGROW );
-
-       wxString tmpwxstring;
-       int i;
-       for (i=0;i<_maxLevels;i++){
-               tmpSpinSection = new wxSpinCtrl( panel  , -1,_T(""),wxDefaultPosition, wxSize(40,20) );
-               tmpSliderRadio = new wxSlider( panel    , -1 ,0,0,100, wxDefaultPosition, wxSize(110,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-               tmpSliderAng   = new wxSlider( panel    , -1 ,0,0,180, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
-               tmpSpinSection ->SetRange(1,_maxSections);
-
-               tmpwxstring.Printf(_T("  %d.  "),i+1);
-               sizerDetailOptions -> Add( new wxStaticText(panel,-1,tmpwxstring) , 1, wxGROW );
-               sizerDetailOptions -> Add( tmpSpinSection, 1 );
-               sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
-               sizerDetailOptions -> Add( tmpSliderRadio, 1, wxGROW );
-               sizerDetailOptions -> Add( new wxStaticText(panel,-1,_T("  ")) , 1, wxGROW );
-               sizerDetailOptions -> Add( tmpSliderAng, 1, wxGROW );
-
-               tmpSpinSection  -> SetValue(5);
-               tmpSliderRadio  -> SetValue( 100-(double)((i)*100.0/_maxLevels) );
-               tmpSliderAng    -> SetValue(0);
-               
-               Connect( tmpSliderRadio->GetId(),       wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
-               Connect( tmpSliderRadio->GetId(),       wxEVT_SCROLL_CHANGED  , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
-
-               _lstBullEyeDetailNumOfSec.push_back( tmpSpinSection );
-               _lstBullEyeDetailRadio.push_back( tmpSliderRadio );
-               _lstBullEyeDetailAngle.push_back( tmpSliderAng );
-
-       } //for
-
-       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add( _radioboxBullEyeGenOpt , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("      -- Bull Eye general options --")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add(  sizerGeneralOptions , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("      -- Bull Eye detail options --")) , 1, wxGROW );
-       sizer -> Add( new wxStaticText(panel,-1,_T("")) , 1, wxGROW );
-       sizer -> Add(  sizerDetailOptions  , 1, wxGROW );
-
-       Connect( _radioboxBullEyeGenOpt->GetId(),       wxEVT_COMMAND_RADIOBOX_SELECTED , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel ); 
-       Connect( _spinctrlBullEyeNumOfCrowns->GetId(),  wxEVT_COMMAND_TEXT_UPDATED              , (wxObjectEventFunction) &PanelBullEyeOptions::onRefreshPanel );
-       
-       panel->SetSizer( sizer );
-       panel->SetSize( sizepanel );
-       panel->SetAutoLayout( true );
-       panel->Layout();
-
-       RefreshPanel();
-
-}
-
-//------------------------------------------------------------------------------------------------------------
-PanelBullEyeOptions::~PanelBullEyeOptions() 
-{
-}
-
-//------------------------------------------------------------------------------------------------------------
-void PanelBullEyeOptions::onRefreshPanel( wxCommandEvent& event )
-{
-       RefreshPanel();
-}
-
-//------------------------------------------------------------------------------------------------------------
-void PanelBullEyeOptions::RefreshPanel()
-{
-       int i;
-       bool ok;
-       if (this->_radioboxBullEyeGenOpt->GetSelection()==0){
-               for (i=0; i<_maxLevels; i++)
-               {
-                       _lstBullEyeDetailNumOfSec[i]    -> Enable(false);
-                       _lstBullEyeDetailRadio[i]               -> Enable(false);
-                       _lstBullEyeDetailAngle[i]               -> Enable(false);
-               } // for
-       } else {
-               int spinSelec = _spinctrlBullEyeNumOfCrowns->GetValue(); 
-               for (i=0; i<_maxLevels; i++)
-               {
-                       ok = (i < spinSelec);
-                       _lstBullEyeDetailNumOfSec[i]    -> Enable(ok);
-                       _lstBullEyeDetailRadio[i]               -> Enable(ok);
-                       _lstBullEyeDetailAngle[i]               -> Enable(ok);
-
-                       if (i>0){
-                               if (_lstBullEyeDetailRadio[i]->GetValue() > _lstBullEyeDetailRadio[i-1]->GetValue())
-                               {
-                                       _lstBullEyeDetailRadio[i]->SetValue( _lstBullEyeDetailRadio[i-1]->GetValue() );
-                               } 
-                       }// if i>0
-               } // for
-       } // if
-}
-
-//------------------------------------------------------------------------------------------------------------
-int PanelBullEyeOptions::GetNumberOfCrowns()
-{
-       return this->_spinctrlBullEyeNumOfCrowns->GetValue();
-}
-
-//------------------------------------------------------------------------------------------------------------
-int PanelBullEyeOptions::GetNumberOfSections(int nCrown)
-{
-       int result;
-       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
-       { 
-               result = this->_spinctrlBullEyeNumOfSec->GetValue();
-       } else {
-               result = this->_lstBullEyeDetailNumOfSec[nCrown]->GetValue();
-       }
-       return result;
-}
-
-//------------------------------------------------------------------------------------------------------------
-int PanelBullEyeOptions::GetRadioOfCrown(int nCrown)
-{
-       int result;
-       double sizeCrowns;
-       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
-       { 
-               sizeCrowns = (double)( this->_spinctrlBullEyeNumOfCrowns->GetValue() );
-               result = 100.0 * (nCrown+1)/sizeCrowns ;
-       } else {
-               result = this->_lstBullEyeDetailRadio[nCrown]->GetValue();
-       }
-       return result;
-}
-
-//------------------------------------------------------------------------------------------------------------
-double PanelBullEyeOptions::GetAngOfCrownSection(int nCrown,int section)
-{
-       double angle;
-       if (this->_radioboxBullEyeGenOpt->GetSelection()==0)
-       { 
-               angle = this->_sliderBullEyeAngle->GetValue();
-       } else {
-               angle = this->_lstBullEyeDetailAngle[nCrown]->GetValue();
-       }
-       double numOfSec = (double)GetNumberOfSections(nCrown);
-       double deltaSec = GetAngDeltaOfCrownSection(nCrown);
-       return angle + section*deltaSec ;
-}
-
-//------------------------------------------------------------------------------------------------------------
-double PanelBullEyeOptions::GetAngDeltaOfCrownSection(int nCrown)
-{
-       double numOfSec = (double)GetNumberOfSections(nCrown);
-       return 360.0/numOfSec;
-}
-
-
-
-//------------------------------------------------------------------------------------------------------------
-//------------------------------------------------------------------------------------------------------------
-//------------------------------------------------------------------------------------------------------------
-
-
-       //------------------------------------------------------------------------------------------------------------
-       // Constructors & Destructors
-       //------------------------------------------------------------------------------------------------------------
-
-       wxContourEventHandler ::wxContourEventHandler()
-               :wxEvtHandler()
-       {
-        _creatingContoursActive                        = false;
-               _theViewPanel                                   = NULL;
-               _modelManager                                   = NULL;
-               _instantPanel                                   = NULL;
-               _buttonsBar                                             = NULL;
-               _gridPanel                                              = NULL; 
-               _drawToolsPanel                                 = NULL;
-               _operationsToolsPanel                   = NULL;
-               _autoFormsPanel                                 = NULL; 
-               _standardToolsPanel                             = NULL;
-               _editionToolsPanel                              = NULL;
-               _listViewPanel                                  = NULL;
-               _sceneManager                                   = NULL;
-               _actualInstant                                  = NULL;
-               _performingOperation                    = new PerformingOperation();
-
-               // EED Interface and Spread
-               _spreadFrame                                    = NULL;
-               _segmentationFrame                              = NULL;
-               _contourPropagation                             = NULL;
-               _createContourFrame                             = NULL;
-               _deleteFrame                                    = NULL;
-               _InformationContourFrame                = NULL;
-               _interfaceConfigurationFrame    = NULL;
-               _TestFrame                                              = NULL;
-               _wxtextctrlTest                                 = NULL;
-               _panelBullEyeOptions                    = NULL;
-
-               fileNameContourROI                              = "";
-               _numberOfVariablesStatistics=6+1;
-
-               inundo = 0;
-               inredo = 0;
-               stundoredo = "data/temp";
-#if(WIN32)
-               mkdir(stundoredo.c_str());
-#else
-               mkdir(stundoredo.c_str(),755);
-#endif
-               stundoredo += "/cont";
-       }
-       //------------------------------------------------------------------------------------------------------------
-       wxContourEventHandler :: ~ wxContourEventHandler()
-       {
-               delete _actualInstant;
-               /*delete _theViewPanel;         
-               delete _instantPanel;
-               delete _buttonsBar;
-               delete _actualInstant;  
-               */       
-               delete _sceneManager;
-               delete _performingOperation;
-
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       // Configuration methods
-       //------------------------------------------------------------------------------------------------------------
-       
-       bool wxContourEventHandler :: configureEventsHandling()
-       {
-               bool configured = true;
-
-               return configured;
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       // Methods for capturing events 
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onProcessMessage( wxCommandEvent& event )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: onActionButtonPressed( wxCommandEvent& event )
-       {
-               const char buttonTool = *(char *)event.GetClientData();
-               executeActionCommand( buttonTool );             
-       }
-       //------------------------------------------------------------------------------------------------------------          
-       void wxContourEventHandler :: onChangedDeep ( wxCommandEvent& event )
-       {
-               double val = _theViewPanel->getCurrentDeep();
-               _instantPanel->setConceptValue( "Axe Depth", (int)val );
-               _theViewPanel->setActualVertical( (int)val );
-               changeInstant();
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onChangeInstant( wxCommandEvent& event )
-       {               
-               ConceptDataWrap * dataConcept = NULL; 
-               if ( _theViewPanel->GetId() == event.GetId() )
-               {
-                       dataConcept = (ConceptDataWrap *)event.GetClientData();
-                       int value = dataConcept->getActualValue();
-                       _instantPanel->setConceptValue( dataConcept->getName(), value );
-               }
-               else
-               {
-                       dataConcept = _instantPanel->getLastConceptData();
-                       if( dataConcept->getName().compare( _theViewPanel->getVerticalConceptName() ) == 0)
-                       {
-                               _theViewPanel->setActualVertical( dataConcept->getActualValue());
-                               //_theViewPanel->setVerticalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
-                       }
-                       else if( dataConcept->getName().compare( _theViewPanel->getHorizontalConceptName() ) == 0|| _instantPanel->getIfConceptCheckedAt( dataConcept->getName(), 0 ) )
-                       {
-                               _theViewPanel->setHorizontalConcept( dataConcept->getName(), dataConcept->getMinShowedValue()/*dataConcept->getMinValue()*/, /*dataConcept->getMaxValue()*/ dataConcept->getMaxShowedValue(), dataConcept->getMinShowedValue(), dataConcept->getMaxShowedValue(), dataConcept->getActualValue());
-                       }
-               }       
-               changeInstant();
-       }
-       //------------------------------------------------------------------------------------------------------------
-               
-       void wxContourEventHandler :: onCreateMultipleROI( wxCommandEvent& event )
-       {
-               _creatingContoursActive = !_creatingContoursActive;
-               if( _creatingContoursActive )
-               {                       
-                       createContour();
-               }
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onCreateROI( wxCommandEvent& event )
-       {
-               if( _creatingContoursActive )
-               {                       
-                       createContour();
-               }
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onStopCreateROI( wxCommandEvent& event )
-       {
-               
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onDeleterROI( wxCommandEvent& event )
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onSelectROI( wxCommandEvent& event )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-
-       void wxContourEventHandler :: onUnSelectROI( wxCommandEvent& event )
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: onManualHidedROI( wxCommandEvent& event )
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: onManualShowedROI( wxCommandEvent& event )
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: onEditingROI( wxCommandEvent& event )
-       {
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: onMovingROI( wxCommandEvent& event )
-       {
-
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       //  Model management methods
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler::onSpreadReset( wxCommandEvent& event )
-       {
-               _wxtextctrlSpread->SetValue(wxString("",wxConvUTF8));
-               _contourPropagation->resetAppend();
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onSpreadAdd( wxCommandEvent& event )
-       {
-               std::vector<double> vecX; 
-               std::vector<double> vecY; 
-               std::vector<double> vecZ; 
-               _sceneManager->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
-
-               if (vecX.size()!=0){
-                       std::vector<int> tempVector;
-                       _instantPanel->getInstant( tempVector );
-                       int i,size=vecZ.size();
-                       int actualSlice = tempVector[1];
-                       for ( i=0 ; i<size ; i++ )
-                       {
-                               vecZ[i] = actualSlice;
-                       } // for
-
-                       _contourPropagation->appendContour(&vecX , &vecY , &vecZ);
-                       wxString newstring;
-                       //newstring.Printf("%s %d -",_wxtextctrlSpread->GetValue(), actualSlice );
-                       newstring.append(wxString(_wxtextctrlSpread->GetValue(),wxConvUTF8));
-                       newstring.append(wxString(" ",wxConvUTF8));
-                       newstring.append(wxString(intToString(actualSlice).c_str(),wxConvUTF8));
-                       _wxtextctrlSpread->SetValue(newstring);
-               } // if 
-       }
-
-       
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onSpreadGo( wxCommandEvent& event )
-       {
-
-               //JCP 20-10-08 Undo redo implementation
-               saveState();
-               //JCP 20-10-08 Undo redo implementation
-
-               wxBusyCursor wait;
-               int typeMethodFindCtrlPoints=_spreadMethodRadiobox->GetSelection();
-               int typeofcontour = 1;
-               manualContourModel *manModelContour;
-               std::vector<double> vecCtrlPointX;
-               std::vector<double> vecCtrlPointY;
-               std::vector<double> vecCtrlPointZ;
-               double  minZ,maxZ;
-               int z,j,sizeCtrPt;
-//             double idTmp;
-               int idTmp;
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-//             tempVector[1];
-
-               _contourPropagation->getMaxMinZ(&minZ,&maxZ);
-//JSTG_16-07-08_----------------------------------------------------------------
-               //_contourPropagation->setInterpolationNumber(maxZ-minZ+1);
-               _contourPropagation->setInterpolationNumber(100);
-               _contourPropagation->CalculeSplinePropagation();
-
-               double          totalZ = maxZ-minZ+1;
-               double          porcent;
-               wxString        tmpString;
-//--------------------------------------------------------------------
-               for ( z=(int)minZ ; z<=(int)maxZ ; z++ )
-               {
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       int numero = (int)(z-minZ+1)/(int)totalZ;
-                       std::string stringtemp = "  "+intToString(porcent)+"%            "+intToString(numero)+"            "+intToString(z);
-                       tmpString.Append(wxString(stringtemp.c_str(),wxConvUTF8));
-
-                       //tmpString.Printf("  %d %c            %d/%d            %d", (int)porcent , 37 , (int)(z-minZ+1), (int)totalZ,z );
-                       _staticTextSpread->SetLabel(tmpString);
-
-                       if (_contourPropagation->ifSliceKeyContourExist(z)==false)
-                       {
-                               manModelContour = factoryManualContourModel( typeofcontour );
-                               idTmp = _contourPropagation->FindIdWithZ(z);
-                               if (typeMethodFindCtrlPoints==0) // Initial Points
-                               {   
-                                       _contourPropagation->GetInitialControlPoints( idTmp , &vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
-                               } 
-                               if (typeMethodFindCtrlPoints==1)  // Automatique Method
-                               {
-                                       _contourPropagation->GetControlPoints( idTmp  ,&vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
-                               }
-                               if (typeMethodFindCtrlPoints==2)  // sampling
-                               {
-                                       _contourPropagation->GetControlPoints( idTmp , 20.0 ,&vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ);
-                               }
-       //--------------------------------------------------------------------
-                               sizeCtrPt = vecCtrlPointX.size();
-                               for (j=0 ; j<sizeCtrPt ; j++)
-                               {
-       //JSTG_16-07-08_----------------------------------------------------------------
-                                       manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , -900  );
-       //--------------------------------------------------------------------
-                               } // for j
-
-                               tempVector[1]=z;
-                               std::string theName;
-                               theName = _modelManager->createOutline( manModelContour, tempVector );
-                               bool addedModel = theName.compare("") != 0;
-                               if( addedModel )
-                               {
-                                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                                       this->_theViewPanel->getSpacing(spc);                                   
-                                       //Adding the manualContourControler to interface objects structure
-                                       //Adding the manualViewContour to interface objects structure           
-                                       //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                                       _sceneManager->configureViewControlTo( theName, manModelContour,spc,typeofcontour ) ;
-                               } // if addedModel
-                       }// ifSliceKeyContourExist
-               } // for z
-               _staticTextSpread->SetLabel(wxString("   ",wxConvUTF8));
-               //RefreshInterface();
-
-
-               
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onSpread( )
-       {
-               if (_spreadFrame==NULL)
-               {
-                       
-                       _spreadFrame                            = new wxFrame (_theViewPanel, -1,_T(" Spread "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
-                       
-                       wxSize sizepanel(250,400);
-                       _spreadFrame->SetSize( sizepanel );
-                       _spreadFrame->SetEventHandler( this );
-                       wxPanel *panel                          = getSpreadPanel(_spreadFrame);
-                       panel->SetSize(sizepanel);
-                       /**new wxPanel(_spreadFrame,-1);
-
-                       wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxSize(80,35) );
-                       wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxSize(80,35));
-
-                       wxString lstOptions[3];
-                       lstOptions[0]="A";
-                       lstOptions[1]="B";
-                       lstOptions[2]="C";
-                       _spreadMethodRadiobox                                           = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
-                       _spreadMethodRadiobox->SetSelection(2);
-
-                       wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("Go"),wxDefaultPosition, wxSize(80,35));
-                       _staticTextSpread                       = new wxStaticText(panel,-1,_T("    "));
-
-                       _wxtextctrlSpread           = new wxTextCtrl(panel,-1, "",wxDefaultPosition, wxSize(200,150), wxTE_MULTILINE );
-
-                       _spreadFrame->SetEventHandler( this );
-                       Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadReset ); 
-                       Connect( spreadAddBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadAdd ); 
-                       Connect( spreadGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadGo ); 
-
-                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
-                       sizer -> Add( spreadResetBtn            , 1, wxGROW );
-                       sizer -> Add( spreadAddBtn                      , 1, wxGROW );
-                       sizer -> Add( _spreadMethodRadiobox     , 1, wxGROW );
-                       sizer -> Add( spreadGoBtn                       , 1, wxGROW );
-                       sizer -> Add( _staticTextSpread         , 1, wxGROW );
-                       sizer -> Add( _wxtextctrlSpread         , 1, wxGROW );
-
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizepanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();**/
-                       _spreadFrame->Show();
-               } else {
-                       if (_spreadFrame->IsShown()==true)
-                       {
-                               _spreadFrame->Show(false);
-                       } else  {
-                               _spreadFrame->Show(true);
-                       }
-               }
-       }
-
-       wxPanel* wxContourEventHandler::getSpreadPanel(wxWindow* parent){
-               //wxPanel *panel                                = new wxPanel(parent,-1);
-
-               _contourPropagation                     = new ContourPropagation();
-
-               wxPanel *panel                                                  = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString("",wxConvUTF8));
-
-               wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxDefaultSize );
-               wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxDefaultSize);
-
-               wxString lstOptions[3];
-               lstOptions[0]=_T("A");
-               lstOptions[1]=_T("B");
-               lstOptions[2]=_T("C");
-               _spreadMethodRadiobox                                           = new wxRadioBox(panel, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxDefaultSize, 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
-               _spreadMethodRadiobox->SetSelection(2);
-
-               wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("Go"),wxDefaultPosition, wxDefaultSize);
-               _staticTextSpread                       = new wxStaticText(panel,-1,_T("    "));
-
-               _wxtextctrlSpread           = new wxTextCtrl(panel,-1, _T(""),wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
-
-               
-               Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadReset ); 
-               Connect( spreadAddBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadAdd ); 
-               Connect( spreadGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSpreadGo ); 
-
-               wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
-               sizer -> Add( spreadResetBtn            , 1, wxGROW );
-               sizer -> Add( spreadAddBtn                      , 1, wxGROW );
-               sizer -> Add( _spreadMethodRadiobox     , 1, wxGROW );
-               sizer -> Add( spreadGoBtn                       , 1, wxGROW );
-               sizer -> Add( _staticTextSpread         , 1, wxGROW );
-               sizer -> Add( _wxtextctrlSpread         , 1, wxGROW );
-
-
-               panel->SetSizer( sizer );
-               //panel->SetSize( wxDefaultSize );
-               panel->SetAutoLayout( true );
-               panel->Layout();
-               return panel;
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onSegmentationAllSlice( wxCommandEvent& event )
-       {
-               //JCP 20-10-08 Undo redo implementation
-               saveState();
-               //JCP 20-10-08 Undo redo implementation
-               
-               wxBusyCursor wait;
-               int                                     x                                       = this->_theViewPanel->GetX();
-               int                                     y                                       = this->_theViewPanel->GetY();
-               int z,minZ,maxZ;
-               double porcent; 
-               wxString tmpString;
-               minZ=_mbarrange->GetStart();
-               maxZ=_mbarrange->GetEnd();
-               double totalZ = maxZ-minZ+1;
-               for( z=minZ ; z<=maxZ ; z++ )
-               {
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf(_T("  %d %c            %d/%d            %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ,z );
-                       _staticTextSegmentation->SetLabel(tmpString);
-                       SegmentationOneSlice( x,y,z );
-               }
-               _staticTextSegmentation->SetLabel(_T("   "));
-               RefreshInterface();
-
-               
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onSegmentationOneSlice( wxCommandEvent& event )
-       {
-               //JCP 20-10-08 Undo redo implementation
-               saveState();
-               //JCP 20-10-08 Undo redo implementation
-               
-               wxBusyCursor wait;
-               int                                     x                                       = this->_theViewPanel->GetX();
-               int                                     y                                       = this->_theViewPanel->GetY();
-               int                                     z                                       = this->_theViewPanel->GetZ();
-               SegmentationOneSlice( x,y,z );
-               RefreshInterface();
-
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::SegmentationOneSlice( int x, int y, int z )
-       {               
-               int typeofcontour = 1;
-               //--Extracting Contour
-               vtkImageData    *imagedata      = _sceneManager->GetImageData();
-//             double                  *range          = imagedata->GetScalarRange();  
-//             double                  thr                     = 1;
-               int                             isovalue        = _isovalue->GetValue();
-               int                             sampling        = _sampling->GetValue();
-
-               vtkImageReslice *imageReslice = vtkImageReslice::New();
-//EED
-//             double spc[3];
-//             imagedata->GetSpacing(spc);
-//             x = x*spc[0];
-//             y = y*spc[1];
-//             z = z*spc[3];
-
-               imageReslice->SetInput( imagedata );
-               imageReslice->SetInformationInput(imagedata);
-               imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
-               imageReslice->SetResliceAxesOrigin(0,0,z);
-               imageReslice->SetOutputDimensionality(2);
-               imageReslice->SetInterpolationModeToLinear();
-
-               imagedata = imageReslice->GetOutput();
-               imagedata->Update();
-               imagedata->UpdateInformation();
-
-               vtkContourFilter* cntVTK = vtkContourFilter::New( );
-               cntVTK->SetInput( imagedata );
-
-               cntVTK->SetNumberOfContours( 1 );
-               //cntVTK->SetValue( 0, vmin );
-//             cntVTK->SetValue( 0, (range[1]*thr/100) );
-               cntVTK->SetValue( 1, isovalue );
-       //      cntVTK->SetValue( 1, vmax );
-               cntVTK->Update( );
-               cntVTK->UpdateInformation();
-                       
-               vtkCleanPolyData* cpd = vtkCleanPolyData::New( );
-               cpd->SetInput( cntVTK->GetOutput( ) );
-               cpd->ConvertLinesToPointsOff( );
-               cpd->Update( );
-               cpd->UpdateInformation();
-
-               vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
-               conn->SetExtractionModeToClosestPointRegion( );
-               //conn->SetMaxRecursionDepth( 3000 );
-                       
-               conn->SetInput( cpd->GetOutput( ) );
-                       
-               conn->SetClosestPoint( x, y, 0 );
-               conn->Update( );
-               conn->UpdateInformation();
-                       
-               vtkCleanPolyData* cpd2 = vtkCleanPolyData::New( );
-               cpd2->SetInput( conn->GetOutput( ) );
-               cpd2->Update();
-               cpd2->UpdateInformation();
-
-               vtkStripper* vtkstripper = vtkStripper::New( );
-               vtkstripper->SetInput( cpd2->GetOutput() );
-               vtkstripper->Update();
-               vtkstripper->UpdateInformation();
-
-
-               vtkPolyData* polyDataResult =  vtkstripper->GetOutput();
-
-               polyDataResult->Update( );
-               polyDataResult->UpdateInformation();
-
-/* EED
-ofstream myfile;
-myfile.open ("c:/temp/example.txt");
-myfile << "\n";
-polyDataResult->Print(myfile);
-myfile << "-------------------------------------\n";
-polyDataResult->GetLines()->Print(myfile);
-myfile.close();
-*/
-
-               cntVTK          -> Delete();
-               cpd2            -> Delete();
-               cpd                     -> Delete();
-               conn            -> Delete();
-
-
-//--Calculating control points
-
-               std::vector<double> vecX;
-               std::vector<double> vecY;
-               std::vector<double> vecZ;
-
-               std::vector<double> vecCtrlPointX;
-               std::vector<double> vecCtrlPointY;
-               std::vector<double> vecCtrlPointZ;
-
-
-               double *p;
-               int ii,size=polyDataResult->GetNumberOfPoints();
-               int id;
-               for (ii=1;ii<=size;ii++)
-               {
-                       id      = polyDataResult->GetLines()->GetData()->GetValue(ii);
-                       p       = polyDataResult->GetPoint(id);
-                       double x=p[0];
-                       double y=p[1];
-                       vecX.push_back( p[0] );
-                       vecY.push_back( p[1] );
-                       vecZ.push_back( -900 );
-//                     vecZ.push_back( p[2] );
-               }
-
-
-               ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
-               extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
-
-//PROOFS
-               if (methodRadiobox->GetSelection()==0){
-                       extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-               }
-               if (methodRadiobox->GetSelection()==1){
-                       extractcontrolpoints2d->GetControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-               }
-               if (methodRadiobox->GetSelection()==2){
-                       extractcontrolpoints2d->SetSamplingControlPoints( sampling );
-                       extractcontrolpoints2d->GetSamplingControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-               }
-
-               //--Adding contour to the system
-
-               std::vector<int> actualInstantVector;
-               _instantPanel->getInstant( actualInstantVector );
-               actualInstantVector[1]=z;
-
-               int j,sizeCtrPt = vecCtrlPointX.size();
-               manualContourModel *manModelContour =  factoryManualContourModel( typeofcontour );
-               manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
-               if (sizeCtrPt>=3){
-                       for (j=0 ; j<sizeCtrPt ; j++)
-                       {
-                               manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j]  );
-                       } // for
-                       std::string theName;
-                       theName = _modelManager->createOutline( manModelContour, actualInstantVector );
-                       bool addedModel = theName.compare("") != 0;
-                       if( addedModel )
-                       {
-                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                               this->_theViewPanel->getSpacing(spc);                                   
-                               //Adding the manualContourControler to interface objects structure
-                               //Adding the manualViewContour to interface objects structure           
-                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                               _sceneManager->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
-                       }       // if addedModel
-               } // if sizeCtrPt
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onAutomatiqueSegmentation( )
-       {
-               if (_segmentationFrame==NULL)
-               {
-                       //JCP 13-10-09
-                       /*int sizeZ = _sceneManager->GetImageDataSizeZ();
-                       double range[2];
-                       _sceneManager->GetImageDataRange(range);*/
-                       //JCP 13-10-09
-
-                        wxSize sizePanel( 300, 470);
-                       _segmentationFrame                                      =  new wxFrame (_theViewPanel, -1,_T("  Segmentation  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
-                       _segmentationFrame->SetSize( sizePanel );
-                       wxPanel *panel                                          = getSegmentationPanel(_segmentationFrame);
-                               /*new wxPanel(_segmentationFrame,-1);
-                       wxButton *segmentationOneSliceBtn       = new wxButton(panel,-1,_T("Actual slice"), wxDefaultPosition, wxSize(200,35) );
-                       wxButton *segmentationAllSliceBtn       = new wxButton(panel,-1,_T("All slices") ,wxDefaultPosition, wxSize(200,35) );
-                       _isovalue                                                       = new wxSlider(panel, -1, 40 , (int)(range[0]), (int)(range[1]), wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-                       _sampling                                                       = new wxSlider(panel, -1, 20 , 4, 50, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-                       wxString lstOptions[3];
-                       lstOptions[0]="A";
-                       lstOptions[1]="B";
-                       lstOptions[2]="C";
-                       methodRadiobox                                          = new wxRadioBox(panel, -1, "Method (find ctrl. Points)", wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
-                       methodRadiobox->SetSelection(2);
-                       _staticTextSegmentation                         = new wxStaticText(panel,-1,_T("    "));
-
-
-                       _mbarrange                                      =  new mBarRange(panel,70, 65);
-                       _mbarrange->SetMin(0);
-                       _mbarrange->SetStart(0);
-
-                       _mbarrange-> SetOrientation( true );
-                       _mbarrange-> setActiveStateTo(true);
-                       _mbarrange-> setVisibleLabels( true );
-                       _mbarrange-> setDeviceEndMargin(10);
-                       _mbarrange-> setRepresentedValues( 0 , sizeZ );
-                       _mbarrange-> setDeviceBlitStart(10,10); 
-                       _mbarrange-> setIfWithActualDrawed( false );
-                       _mbarrange-> SetStart( 0 );
-                       _mbarrange-> SetEnd( sizeZ );  
-
-
-//                     _segmentationFrame->SetEventHandler( this );
-                       segmentationOneSliceBtn->SetEventHandler( this );
-                       segmentationAllSliceBtn->SetEventHandler( this );
-                       Connect( segmentationOneSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationOneSlice ); 
-                       Connect( segmentationAllSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationAllSlice ); 
-
-                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
-                       sizer -> Add( new wxStaticText(panel,-1,_T("Isovalue (Gray level)"))  , 1, wxGROW );
-                       sizer -> Add( _isovalue , 1, wxGROW );
-                       sizer -> Add( methodRadiobox , 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T("Sampling (%)"))  , 1, wxGROW );
-                       sizer -> Add( _sampling , 1, wxGROW );
-                       sizer -> Add( segmentationOneSliceBtn , 1, wxGROW );
-                       sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-                       sizer -> Add( _staticTextSegmentation  , 1, wxGROW );
-                       sizer -> Add( segmentationAllSliceBtn , 1, wxGROW );
-                       sizer -> Add( _mbarrange  , 1, wxGROW );
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizePanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();*/
-
-                       this->_theViewPanel->SetVisibleAxis(true);
-                       this->_theViewPanel->Refresh();
-                       _segmentationFrame->Show(true);
-//JCP 13-10-09 View the method getSegmentationPanel(), this two methods where moved to getSegmentationPanel
-                       //this->_theViewPanel->SetVisibleAxis(true);
-                       //this->_theViewPanel->Refresh();
-               } else {
-                       if (_segmentationFrame->IsShown()==true)
-                       {
-                               _segmentationFrame->Show(false);
-                               this->_theViewPanel->SetVisibleAxis(false);
-                               this->_theViewPanel->Refresh();
-                       } else  {
-                               _segmentationFrame->Show(true);
-                               this->_theViewPanel->SetVisibleAxis(true);
-                               this->_theViewPanel->Refresh();
-                       }
-               }
-       }
-
-       void wxContourEventHandler::showAxis(bool show){
-               this->_theViewPanel->SetVisibleAxis(show);
-               this->_theViewPanel->Refresh();
-       }
-       wxPanel* wxContourEventHandler::getSegmentationPanel(wxWindow* parent){
-               int sizeZ = _sceneManager->GetImageDataSizeZ();
-               double range[2];
-               _sceneManager->GetImageDataRange(range);
-
-               wxPanel *panel                                          = new wxPanel(parent,-1);
-               wxButton *segmentationOneSliceBtn       = new wxButton(panel,-1,_T("Actual slice"), wxDefaultPosition, wxSize(200,35) );
-               wxButton *segmentationAllSliceBtn       = new wxButton(panel,-1,_T("All slices") ,wxDefaultPosition, wxSize(200,35) );
-               _isovalue                                                       = new wxSlider(panel, -1, 40 , (int)(range[0]), (int)(range[1]), wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-               _sampling                                                       = new wxSlider(panel, -1, 20 , 4, 50, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-               wxString lstOptions[3];
-               lstOptions[0]=_T("A");
-               lstOptions[1]=_T("B");
-               lstOptions[2]=_T("C");
-               methodRadiobox                                          = new wxRadioBox(panel, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
-               methodRadiobox->SetSelection(2);
-               _staticTextSegmentation                         = new wxStaticText(panel,-1,_T("    "));
-
-
-               _mbarrange                                      =  new mBarRange(panel,70, 65);
-               _mbarrange->SetMin(0);
-               _mbarrange->SetStart(0);
-
-               _mbarrange-> SetOrientation( true );
-               _mbarrange-> setActiveStateTo(true);
-               _mbarrange-> setVisibleLabels( true );
-               _mbarrange-> setDeviceEndMargin(10);
-               _mbarrange-> setRepresentedValues( 0 , sizeZ );
-               _mbarrange-> setDeviceBlitStart(10,10); 
-               _mbarrange-> setIfWithActualDrawed( false );
-               _mbarrange-> SetStart( 0 );
-               _mbarrange-> SetEnd( sizeZ );  
-
-
-//                     _segmentationFrame->SetEventHandler( this );
-               segmentationOneSliceBtn->SetEventHandler( this );
-               segmentationAllSliceBtn->SetEventHandler( this );
-               Connect( segmentationOneSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationOneSlice ); 
-               Connect( segmentationAllSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationAllSlice ); 
-
-               wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
-               sizer -> Add( new wxStaticText(panel,-1,_T("Isovalue (Gray level)"))  , 1, wxGROW );
-               sizer -> Add( _isovalue , 1, wxGROW );
-               sizer -> Add( methodRadiobox , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T("Sampling (%)"))  , 1, wxGROW );
-               sizer -> Add( _sampling , 1, wxGROW );
-               sizer -> Add( segmentationOneSliceBtn , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( _staticTextSegmentation  , 1, wxGROW );
-               sizer -> Add( segmentationAllSliceBtn , 1, wxGROW );
-               sizer -> Add( _mbarrange  , 1, wxGROW );
-
-               panel->SetSizer( sizer );
-//             panel->SetSize( sizePanel );
-               panel->SetSize( wxDefaultSize );
-               panel->SetAutoLayout( true );
-               panel->Layout();
-               
-               return panel;
-       }
-       void wxContourEventHandler :: onInterfaceTestFrame( )
-       {
-               if (_TestFrame==NULL)
-               {
-                       _contourPropagation                     = new ContourPropagation();
-                       _TestFrame                                      = new wxFrame (_theViewPanel, -1,_T("  Test Segmentation  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
-                       wxSize sizepanel(200,300);
-                       _TestFrame->SetSize( sizepanel );
-                       wxPanel *panel                          = new wxPanel(_TestFrame,-1);
-                       wxButton *spreadResetBtn        = new wxButton(panel,-1,_T("Reset"),wxDefaultPosition, wxSize(80,35) );
-                       wxButton *spreadAddBtn          = new wxButton(panel,-1,_T("Add"),wxDefaultPosition, wxSize(80,35));
-                       wxButton *spreadGoBtn           = new wxButton(panel,-1,_T("GoA"),wxDefaultPosition, wxSize(80,35));
-                       _wxtextctrlTest                         = new wxTextCtrl(panel,-1, _T(""),wxDefaultPosition, wxSize(200,150), wxTE_MULTILINE );
-
-                       _TestFrame->SetEventHandler( this );
-                       Connect( spreadResetBtn->GetId(),       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestReset ); 
-                       Connect( spreadAddBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestAdd ); 
-                       Connect( spreadGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onTestGo ); 
-
-                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
-                       sizer -> Add( spreadResetBtn    , 1, wxGROW );
-                       sizer -> Add( spreadAddBtn              , 1, wxGROW );
-                       sizer -> Add( spreadGoBtn               , 1, wxGROW );
-                       sizer -> Add( _wxtextctrlTest , 1, wxGROW );
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizepanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();
-                       _TestFrame->Show();
-               } else {
-                       if (_TestFrame->IsShown()==true)
-                       {
-                               _TestFrame->Show(false);
-                       } else  {
-                               _TestFrame->Show(true);
-                       }
-               }
-       }
-
-       void wxContourEventHandler::onTestReset( wxCommandEvent& event )
-       {
-               _wxtextctrlTest->SetValue(_T(""));
-               _contourPropagation->resetAppend();
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onTestAdd( wxCommandEvent& event )
-       {
-               std::vector<double> vecX; 
-               std::vector<double> vecY; 
-               std::vector<double> vecZ; 
-               _sceneManager->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
-
-               if (vecX.size()!=0){
-                       std::vector<int> tempVector;
-                       _instantPanel->getInstant( tempVector );
-                       int i,size=vecZ.size();
-                       int actualSlice = tempVector[1];
-                       for ( i=0 ; i<size ; i++ )
-                       {
-                               vecZ[i] = actualSlice;
-                       } // for
-
-                       _contourPropagation->appendContour(&vecX , &vecY , &vecZ);
-                       wxString newstring;
-                       newstring.append(_wxtextctrlTest->GetValue());
-                       newstring.append(_T(" "));
-                       newstring.append(wxString(intToString(actualSlice).c_str(),wxConvUTF8));                        
-                       //newstring.Printf(_T("%s %d -"),,  );
-                       newstring.append(_T(" -"));
-                       _wxtextctrlTest->SetValue(newstring);
-               } // if 
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onTestGo( wxCommandEvent& event )
-       {
-               std::vector<double> vecX; 
-               std::vector<double> vecY; 
-               std::vector<double> vecZ; 
-               std::vector<int> size; 
-
-               std::vector<double> vecCtrlPointX;
-               std::vector<double> vecCtrlPointY;
-               std::vector<double> vecCtrlPointZ;
-
-               //Getting the points of the actual contour      
-
-               _contourPropagation->GetKeyContours(&vecX , &vecY , &vecZ, &size);
-               for(int i = 0; i < vecX.size();i++){
-                       vecZ[i] = -900;
-               }
-
-               /*std::vector<double> vecX1; 
-               std::vector<double> vecY1; 
-               std::vector<double> vecZ1;
-               _sceneManager->GetPointsOfActualContour( &vecX1 , &vecY1 , &vecZ1 );
-
-               std::ofstream file1;
-        file1.open( "Temp.txt" );      
-               if(file1.is_open())
-               {
-                       for(int i = 0; i < vecX.size(); i++){
-                               file1<<vecX[i] <<" X1 "<< vecX1[i] <<" Y "<<vecY[i] <<" Y1 "<< vecY1[i]  <<" Z "<<vecZ[i] <<" Z1 "<< vecZ1[i]<<std::endl;
-                               
-                       }
-                       file1.close();
-               }*/     
-                       
-               
-
-               //Setting the points of the contour 
-
-               ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
-               extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
-
-               //Getting the control points of the contour by method A
-
-               extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-               
-               std::vector<int> actualInstantVector;
-               _instantPanel->getInstant( actualInstantVector );
-               actualInstantVector[1]= this->_theViewPanel->GetZ();
-
-
-
-
-
-               //Adding the Contour to the scene
-
-               manualContourModel *manModelContour = new manualContourModel();
-               int j,sizeCtrPt = vecCtrlPointX.size();
-               if (sizeCtrPt>=3){
-                       for (j=0 ; j<sizeCtrPt ; j++)
-                       {
-                               manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j]  );
-                       } // for
-                       std::string theName;
-                       theName = _modelManager->createOutline( manModelContour, actualInstantVector );
-                       bool addedModel = theName.compare("") != 0;
-                       if( addedModel )
-                       {
-                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                               this->_theViewPanel->getSpacing(spc);                                   
-                               //Adding the manualContourControler to interface objects structure
-                               //Adding the manualViewContour to interface objects structure           
-                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                               _sceneManager->configureViewControlTo( theName, manModelContour,spc,1 ) ;
-                       }       // if addedModel
-               } // if sizeCtrPt
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::FillGridWithContoursInformation()
-       {
-               wxString tempString;
-               _grid->ClearGrid();
-               _grid->SetColLabelValue(0, _T("A") );
-               _grid->SetColLabelValue(1, _T("B") );
-               _grid->SetColLabelValue(2, _T("C") );
-               _grid->SetColLabelValue(3, _T("D") );
-               _grid->SetColLabelValue(4, _T("E") );
-               _grid->SetColLabelValue(5, _T("F") );
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-               int z,sizeZ = _sceneManager->GetImageDataSizeZ();
-               int ii,sizeLstContourThings;
-               for ( z=0 ; z<sizeZ ; z++)
-               {
-                       tempVector[1]=z;
-                       Instant instant(&tempVector);
-                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-
-                       sizeLstContourThings = lstContourThings.size();
-                       tempString.Printf(_T("%d - %d"),z, sizeLstContourThings);
-                       _grid->SetRowLabelValue(z, tempString );
-
-                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                       {
-                               ContourThing **contourthing = lstContourThings[ii];
-                               tempString = wxString((*contourthing)->getName().c_str(),wxConvUTF8) ;
-                               _grid->SetCellValue( z, ii, tempString );
-                       }
-               }
-
-
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       std::vector<manualContourModel*> wxContourEventHandler::ExploseEachModel( std::vector<manualContourModel*> lstManConMod )
-       {
-               std::vector<manualContourModel*> lstTmp;
-               std::vector<manualContourModel*> lstResult;
-               int j,jSize;
-               int i,iSize=lstManConMod.size();
-               for (i=0;i<iSize;i++)
-               {
-                       lstTmp = lstManConMod[i]->ExploseModel();
-                       jSize=lstTmp.size();
-                       for (j=0;j<jSize;j++)
-                       {
-                               lstResult.push_back( lstTmp[j] );
-                       }
-               }
-               return lstResult;
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onExtractInformation( wxCommandEvent& event )
-       {
-               wxBusyCursor wait;
-               int maxContourGroup     =       0;
-
-               _grid->ClearGrid();
-
-               ContourExtractData      *contourextractdata = new ContourExtractData();
-               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
-               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
-
-               std::vector<manualContourModel*> lstManConMod;
-               std::vector<manualContourModel*> lstManConModTmp;
-               std::vector<manualContourModel*> lstManConModExp;
-               std::vector<double> pLstValue;
-               std::vector<double> pLstValuePosX;
-               std::vector<double> pLstValuePosY;
-               std::vector<double> pLstValuePosZ;
-
-               int             resultSize; 
-               int             resultGrayRangeCount;
-               double  resultMin; 
-               double  resultMax;
-               double  resultAverage;
-               double  resultStandardeviation;
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-               vtkImageData *imagedata = _sceneManager->GetImageData();
-               int sizeZ = _sceneManager->GetImageDataSizeZ();
-               int z;
-               int ii,sizeLstContourThings;
-
-
-               int minZ,maxZ;
-               double totalZ;
-               double porcent; 
-               wxString tmpString;
-
-
-               if (_informationRadiobox->GetSelection()==0 ) // actual slice
-               {
-                       std::vector<int> tempVector;
-                       _instantPanel->getInstant( tempVector );
-                       int actualSlice = tempVector[1];
-                       minZ    = actualSlice;
-                       maxZ    = actualSlice;
-               }
-               if (_informationRadiobox->GetSelection()==1 ) // slice range
-               {
-                       minZ    = _mbarrangeSliceInformation->GetStart();
-                       maxZ    = _mbarrangeSliceInformation->GetEnd();
-               }
-               if (_informationRadiobox->GetSelection()==2 ) // All slices
-               {
-                       minZ    = 0;
-                       maxZ    = sizeZ-1;
-               }
-
-               totalZ  = maxZ-minZ+1;
-               contourextractdata->SetImage( imagedata);
-
-       // For each slice..
-               for ( z=minZ ; z<=maxZ ; z++ )
-               {
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf(_T("  %d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
-                       _staticTextInformation->SetLabel(tmpString);
-
-                       //Extraction data from contours of each slice
-                       contourextractdata->SetZtoBeAnalys( z);
-
-                       tempVector[1]=z;
-                       Instant instant(&tempVector);
-                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-                       sizeLstContourThings = lstContourThings.size();
-
-                       lstManConMod.clear();
-                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                       {
-                               ContourThing **contourthing = lstContourThings[ii];
-                               lstManConMod.push_back( (*contourthing)->getModel() );
-                       }
-                       lstManConModExp =  ExploseEachModel( lstManConMod );
-
-
-                       wxString tempString;
-                       tempString.Printf(_T("%d - %d"),z, sizeLstContourThings);
-                       _grid->SetRowLabelValue(z, tempString );
-//EED004
-                       int iContourGroup,sizeContourGroup;
-                       if (typeContourGroup==3) // contour separete
-                       {
-                               sizeContourGroup=lstManConModExp.size();
-                               if ( maxContourGroup<sizeContourGroup ) 
-                               {
-                                       maxContourGroup=sizeContourGroup;
-                               }
-                       } else {  // contour AND OR XOR
-                               sizeContourGroup=1;
-                               maxContourGroup=1;
-                       }
-
-                       int tmpIntA;
-
-
-
-                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
-                               lstManConModTmp.clear();
-                               if (typeContourGroup==3) // contour separete
-                               {
-                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
-                               } else {  // contour AND OR XOR
-                                       lstManConModTmp = lstManConModExp;
-                               }
-
-                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-                               pLstValue.clear();
-                               pLstValuePosX.clear();
-                               pLstValuePosY.clear();
-                               pLstValuePosZ.clear();
-                               contourextractdata->GetValuesInsideCrown(       &pLstValue,
-                                                                                                                       &pLstValuePosX,
-                                                                                                                       &pLstValuePosY,
-                                                                                                                       &pLstValuePosZ);
-                               // Statistics of each slice.
-                               contourextractdata->Statistics( &pLstValue,
-                                                                                               _mbarrangeRangeInformation->GetStart(),
-                                                                                               _mbarrangeRangeInformation->GetEnd(),
-                                                                                               &resultGrayRangeCount, 
-                                                                                               &resultSize, 
-                                                                                               &resultMin, 
-                                                                                               &resultMax,
-                                                                                               &resultAverage,
-                                                                                               &resultStandardeviation);
-                               if (_grid->GetNumberCols()<_numberOfVariablesStatistics*(iContourGroup+1)  )
-                               {
-                                       _grid->AppendCols(_numberOfVariablesStatistics);
-                               }
-
-                               tmpIntA=_numberOfVariablesStatistics*iContourGroup ;
-
-                               tempString.Printf(_T("%d"),resultSize);
-                               _grid->SetCellValue( z, tmpIntA + 0, tempString );
-                               tempString.Printf(_T("%d"),resultGrayRangeCount);
-                               _grid->SetCellValue( z, tmpIntA + 1, tempString );
-                               tempString.Printf(_T("%f"),resultMin);
-                               _grid->SetCellValue( z, tmpIntA + 2, tempString );
-                               tempString.Printf(_T("%f"),resultMax);
-                               _grid->SetCellValue( z, tmpIntA + 3, tempString );
-                               tempString.Printf(_T("%f"),resultAverage);
-                               _grid->SetCellValue( z, tmpIntA + 4, tempString );
-                               tempString.Printf(_T("%f"),resultStandardeviation);
-                               _grid->SetCellValue( z, tmpIntA + 5, tempString );
-
-                       } // for iContourGroup
-               } // for z
-
-               int iTitleGroup;
-               wxString tmpTitleString;
-               int tmpIntB;
-               for ( iTitleGroup=0 ; iTitleGroup<maxContourGroup ; iTitleGroup++ )
-               {
-                       tmpIntB =_numberOfVariablesStatistics*iTitleGroup;
-                       tmpTitleString.Printf(_T("%d-Size Data"),iTitleGroup);
-                       _grid->SetColLabelValue( tmpIntB + 0, tmpTitleString );
-                       _grid->SetColLabelValue( tmpIntB + 1, _T("Size Range") );
-                       _grid->SetColLabelValue( tmpIntB + 2, _T("Min") );
-                       _grid->SetColLabelValue( tmpIntB + 3, _T("Max") );
-                       _grid->SetColLabelValue( tmpIntB + 4, _T("Average") );
-                       _grid->SetColLabelValue( tmpIntB + 5, _T("St.Dev.") );
-                       _grid->SetColLabelValue( tmpIntB + 6, _T(" ") );
-               }
-
-               _staticTextInformation->SetLabel( _T("") );
-               delete contourextractdata;
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::SaveValuesXYZ(std::string directory,std::string namefile)
-       {
-               wxBusyCursor wait;
-               ContourExtractData      *contourextractdata = new ContourExtractData();
-               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
-               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
-
-               std::vector<manualContourModel*> lstManConMod;
-               std::vector<manualContourModel*> lstManConModTmp;
-               std::vector<manualContourModel*> lstManConModExp;
-               std::vector<double> pLstValue;
-               std::vector<double> pLstValuePosX;
-               std::vector<double> pLstValuePosY;
-               std::vector<double> pLstValuePosZ;
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-               vtkImageData *imagedata = _sceneManager->GetImageData();
-               int sizeZ = _sceneManager->GetImageDataSizeZ();
-               int z;
-               int ii,sizeLstContourThings;
-
-
-               int minZ,maxZ;
-               double totalZ;
-               double porcent; 
-               wxString tmpString;
-               minZ    = 0;// _mbarrange->GetStart();
-               maxZ    = sizeZ;//_mbarrange->GetEnd();
-               totalZ  = maxZ-minZ+1;
-
-               contourextractdata->SetImage( imagedata);
-
-       // For each slice..
-               for ( z=0 ; z<sizeZ ; z++)
-               {
-
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       
-                       tmpString.Printf(_T("Saving Values"));
-                       tmpString.Printf(_T("  %d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
-                       _staticTextInformation->SetLabel(tmpString);
-
-
-                       //Extraction data from contours of each slice
-                       contourextractdata->SetZtoBeAnalys( z);
-
-                       tempVector[1]=z;
-                       Instant instant(&tempVector);
-                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-                       sizeLstContourThings = lstContourThings.size();
-
-                       lstManConMod.clear();
-                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                       {
-                               ContourThing **contourthing = lstContourThings[ii];
-                               lstManConMod.push_back( (*contourthing)->getModel() );
-                       }
-                       lstManConModExp =  ExploseEachModel( lstManConMod );
-
-
-//EED004
-
-                       int iContourGroup,sizeContourGroup;
-                       if (typeContourGroup==3) // contour separete
-                       {
-                               sizeContourGroup=lstManConModExp.size();
-                       } else {  // contour AND OR XOR
-                               sizeContourGroup=1;
-                       }
-
-                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
-                               lstManConModTmp.clear();
-                               if (typeContourGroup==3) // contour separete
-                               {
-                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
-                               } else {  // contour AND OR XOR
-                                       lstManConModTmp = lstManConModExp;
-                               }
-
-                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-                               pLstValue.clear();
-                               pLstValuePosX.clear();
-                               pLstValuePosY.clear();
-                               pLstValuePosZ.clear();
-                               contourextractdata->GetValuesInsideCrown(       &pLstValue,
-                                                                                                                       &pLstValuePosX,
-                                                                                                                       &pLstValuePosY,
-                                                                                                                       &pLstValuePosZ);
-
-                               wxString filename;
-                               filename.Printf(_T("%s"),directory.c_str());
-                               filename.Printf(_T("\\"));
-                               filename.Printf(_T("%s"),namefile.c_str());
-                               filename.Printf(_T("-slice"));
-                               filename.Printf(_T("%d"),z);
-                               filename.Printf(_T("-cont"));
-                               filename.Printf(_T("%d"),iContourGroup);
-                               filename.Printf(_T(".txt"));
-                               FILE *pFile=fopen((const char *)filename.mb_str(),"w+");
-                               fprintf(pFile,"value \t x \t y \t z\n"  );
-                               int iLstValue,sizeLstValue=pLstValue.size();
-                               for (iLstValue=0 ; iLstValue<sizeLstValue ; iLstValue++ )
-                               {
-                                       fprintf(pFile,"%f\t %f\t %f\t %f\n", (float)pLstValue[iLstValue] , (float)pLstValuePosX[iLstValue], (float)pLstValuePosY[iLstValue], (float)z );
-                               }
-                               fclose(pFile);
-                       } // for  iContourGroup
-               } // for z
-               _staticTextInformation->SetLabel( _T("") );
-               delete contourextractdata;
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::SaveImageResult(std::string directory,std::string namefile)
-       {
-               wxBusyCursor wait;
-               ContourExtractData      *contourextractdata = new ContourExtractData( true );
-               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
-               if (typeContourGroup==3)
-               {
-                       typeContourGroup=1;
-               }
-               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
-
-               std::vector<manualContourModel*> lstManConMod;
-               std::vector<manualContourModel*> lstManConModTmp;
-               std::vector<manualContourModel*> lstManConModExp;
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-               vtkImageData *imagedata = _sceneManager->GetImageData();
-               int sizeZ = _sceneManager->GetImageDataSizeZ();
-               int z;
-               int ii,sizeLstContourThings;
-
-
-               int minZ,maxZ;
-               double totalZ;
-               double porcent; 
-
-               wxString tmpString;
-
-               minZ    = 0;// _mbarrange->GetStart();
-               maxZ    = sizeZ;//_mbarrange->GetEnd();
-               totalZ  = maxZ-minZ+1;
-
-               contourextractdata->SetImage( imagedata);
-
-       // For each slice..
-               for ( z=0 ; z<sizeZ ; z++)
-               {
-
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf(_T("Saving Values"));
-                       tmpString.Printf(_T("%d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
-                       _staticTextInformation->SetLabel(tmpString);
-
-                       //Extraction data from contours of each slice
-                       contourextractdata->SetZtoBeAnalys( z);
-
-                       tempVector[1]=z;
-                       Instant instant(&tempVector);
-                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-                       sizeLstContourThings = lstContourThings.size();
-
-                       lstManConMod.clear();
-                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                       {
-                               ContourThing **contourthing = lstContourThings[ii];
-                               lstManConMod.push_back( (*contourthing)->getModel() );
-                       }
-                       lstManConModExp =  ExploseEachModel( lstManConMod );
-
-
-                       int iContourGroup,sizeContourGroup;
-                       if (typeContourGroup==3) // contour separete
-                       {
-                               sizeContourGroup=lstManConModExp.size();
-                       } else {  // contour AND OR XOR
-                               sizeContourGroup=1;
-                       }
-
-                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
-                               lstManConModTmp.clear();
-                               if (typeContourGroup==3) // contour separete
-                               {
-                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
-                               } else {  // contour AND OR XOR
-                                       lstManConModTmp = lstManConModExp;
-                               }
-
-                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-
-//                             for (ii=0 ; ii<sizeLstContourThings ; ii++)
-//                             {
-//                                     ContourThing **contourthing = lstContourThings[ii];
-//                                     lstManConMod.push_back( (*contourthing)->getModel() );
-//                             }
-//                             contourextractdata->SetLstManualContourModel( lstManConMod );
-
-                               contourextractdata->CalculateImageResult(); // with actual Z
-
-                       } // for  iContourGroup
-               } // for z
-
-
-               wxString filename;
-               //filename.Printf(_T("%s\\%s-Value.mhd",directory.c_str(),namefile.c_str(),z);
-               filename.Printf(_T("%s"),directory.c_str());
-               filename.Printf(_T("\\"));
-               filename.Printf(_T("%s"),namefile.c_str());
-               filename.Printf(_T("-Value.mhd"));
-
-// Image Value
-               vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
-               writerValueImage->SetInput( contourextractdata->GetVtkImageValueResult() );
-               writerValueImage->SetFileName( (const char *)filename.mb_str() );
-               writerValueImage->SetFileDimensionality( 3 );
-               writerValueImage->Write( );
-
-// Image Mask
-               //              filename.Printf("%s\\%s-Mask.mhd",directory.c_str(),namefile.c_str(),z);
-               filename.Printf(_T("%s"),directory.c_str());
-               filename.Printf(_T("\\"));
-               filename.Printf(_T("%s"),namefile.c_str());
-               filename.Printf(_T("-Mask.mhd"));
-               vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
-               writerMaskImage->SetInput( contourextractdata->GetVtkImageMaskResult() );
-               writerMaskImage->SetFileName( (const char *)filename.mb_str() );
-               writerMaskImage->SetFileDimensionality( 3 );
-               writerMaskImage->Write( );
-
-               _staticTextInformation->SetLabel( _T("") );
-               delete contourextractdata;
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onInformationContourLabels( wxCommandEvent& event )
-       {
-               wxBusyCursor wait;
-               FillGridWithContoursInformation();
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onSaveResults( wxCommandEvent& event )
-       {
-               wxFileDialog dialog(_InformationContourFrame, _T("Choose a file"), _T(""), _T(""), _T("*.txt"), wxSAVE );
-               if (dialog.ShowModal() == wxID_OK)
-               {
-                       onExtractInformation( event );
-                       std::string directory=(const char *)(dialog.GetDirectory().mb_str());
-                       std::string namefile=(const char *)(dialog.GetFilename().mb_str());
-
-                       SaveValuesXYZ( directory , namefile );
-                       SaveImageResult( directory , namefile );
-
-                       std::string filename = (const char *)(dialog.GetPath().mb_str() );
-                       FILE *pFile=fopen(filename.c_str(),"w+");
-
-                       int sizeZ = _sceneManager->GetImageDataSizeZ();
-
-                       wxString tmpString;
-                       int i,j,maxX,maxY=sizeZ;
-                       maxX=this->_grid->GetNumberCols();
-
-                       int iTitle,sizeTitle = (maxX / _numberOfVariablesStatistics);
-                       for ( iTitle=0; iTitle<sizeTitle ; iTitle++)
-                       {
-                               fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle,tmpString.c_str() );
-                       }
-                       fprintf(pFile,"\n" );
-
-
-
-                       for ( j=0; j<maxY ; j++)
-                       {
-                               fprintf(pFile,"%d\t" , j );
-                               for (i=0 ; i<maxX ; i++){
-                                       tmpString = _grid->GetCellValue( j , i );
-                                       fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
-                               } // for i
-                               fprintf(pFile,"\n"  );
-                       } // for j
-
-                       fclose(pFile);
-               } // if  ShowModal
-
-
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onInformationContourFrame()
-       {
-               if (_InformationContourFrame==NULL)
-               {
-                       _InformationContourFrame                                                = new wxFrame (_theViewPanel, -1,_T("  Information  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
-                       _InformationContourFrame->SetSize( wxSize(500,450) );
-                       wxSize sizepanel(200,300);
-                       wxPanel *panel                                                                  = getInformationPanel(_InformationContourFrame);
-//JCP 13-10-09  Grouping the panel in a method
-                       /*new wxPanel(_InformationContourFrame,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL);
-
-                       wxString lstOptions[4];
-                       lstOptions[0]=_T("Actual Slice");
-                       lstOptions[1]=_T("Range Slices");
-                       lstOptions[2]=_T("All Slices");
-                       _informationRadiobox                                                    = new wxRadioBox(panel, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
-
-                       wxString lstOptContOperation[5];
-                       lstOptContOperation[0]=_T("AND");
-                       lstOptContOperation[1]=_T("OR");
-                       lstOptContOperation[2]=_T("XOR");
-                       lstOptContOperation[3]=_T("ALL");
-                       _radiolstboxContourGroup                                                = new wxRadioBox(panel, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation,  4, wxRA_SPECIFY_COLS);
-
-                       wxButton *informationContourLabelsBtn                   = new wxButton(panel,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) );
-                       informationContourLabelsBtn->SetEventHandler( this );
-                       Connect( informationContourLabelsBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onInformationContourLabels ); 
-
-                       wxButton *statisticsContourBtn                                  = new wxButton(panel,-1,_T("Contour statistics"),wxDefaultPosition, wxSize(140,35) );
-                       statisticsContourBtn->SetEventHandler( this );
-                       Connect( statisticsContourBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onExtractInformation ); 
-
-                       wxButton *saveResultsBtn                                                = new wxButton(panel,-1,_T("Save statistics results"),wxDefaultPosition, wxSize(140,35) );
-                       saveResultsBtn->SetEventHandler( this );
-                       Connect( saveResultsBtn->GetId(),               wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSaveResults ); 
-
-
-                       int sizeZ = this->_sceneManager->GetImageDataSizeZ();                   
-                       _mbarrangeSliceInformation                                      =  new mBarRange(panel,65,65);
-                       _mbarrangeSliceInformation->SetMin(0);
-                       _mbarrangeSliceInformation->SetStart(0);
-                       _mbarrangeSliceInformation-> SetOrientation( true );
-                       _mbarrangeSliceInformation-> setActiveStateTo(true);
-                       _mbarrangeSliceInformation-> setVisibleLabels( true );
-                       _mbarrangeSliceInformation-> setDeviceEndMargin(10);
-                       _mbarrangeSliceInformation-> setRepresentedValues( 0 , sizeZ-1 );
-                       _mbarrangeSliceInformation-> setDeviceBlitStart(10,10); 
-                       _mbarrangeSliceInformation-> setIfWithActualDrawed( false );
-                       _mbarrangeSliceInformation-> SetStart( 0 );
-                       _mbarrangeSliceInformation-> SetEnd( sizeZ-1 );  
-
-
-                       double range[2];
-                       this->_sceneManager->GetImageDataRange(range);
-                       _mbarrangeRangeInformation                                      =  new mBarRange(panel,65,65);
-                       _mbarrangeRangeInformation->SetMin(0);
-                       _mbarrangeRangeInformation->SetStart(0);
-                       _mbarrangeRangeInformation-> SetOrientation( true );
-                       _mbarrangeRangeInformation-> setActiveStateTo(true);
-                       _mbarrangeRangeInformation-> setVisibleLabels( true );
-                       _mbarrangeRangeInformation-> setDeviceEndMargin(10);
-                       _mbarrangeRangeInformation-> setRepresentedValues( range[0] , range[1] );
-                       _mbarrangeRangeInformation-> setDeviceBlitStart(10,10); 
-                       _mbarrangeRangeInformation-> setIfWithActualDrawed( false );
-                       _mbarrangeRangeInformation-> SetStart( range[0] );
-                       _mbarrangeRangeInformation-> SetEnd( range[1] );  
-
-
-                       _staticTextInformation                                                  = new wxStaticText(panel,-1,_T("    "));
-
-
-//                     wxButton *XXXXXXXBtn                    = new wxButton(panel,-1,_T("Statistics"),wxDefaultPosition, wxSize(180,35) );
-//                     XXXXXXXBtn->SetEventHandler( this );
-//                     Connect( XXXXXXXBtn->GetId(),           wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onXXXXX ); 
-
-
-                       _grid = new wxGrid( panel,
-                       wxID_ANY,
-                       wxPoint( 0, 0 ),
-                       wxSize( 100, 100 ) );
-
-                       int i,gridCol=10,gridRow=sizeZ;
-                       _grid->CreateGrid( 0, 0 );
-                       _grid->AppendRows(gridRow);
-                       _grid->AppendCols(gridCol);
-
-                       for (i=0;i<gridRow;i++)
-                       {
-                               _grid->SetRowLabelValue(i, _T(" ") );
-                       }
-//                     _grid->SetColLabelSize(0);
-
-
-                       FillGridWithContoursInformation();
-
-                       wxFlexGridSizer * sizerA                = new wxFlexGridSizer(10);
-                       sizerA->Add( _informationRadiobox                       , 1, wxALL ,2 );
-                       sizerA->Add( _radiolstboxContourGroup           , 1, wxALL ,2 );
-
-                       wxFlexGridSizer * sizerB                = new wxFlexGridSizer(10);
-                       sizerB->Add( informationContourLabelsBtn        , 1, wxALL ,2 );
-                       sizerB->Add( statisticsContourBtn                       , 1, wxALL ,2 );
-                       sizerB->Add( saveResultsBtn                                     , 1, wxALL ,2 );
-
-                       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
-                       sizer->AddGrowableCol(0);
-                       sizer->AddGrowableRow(7);
-                       sizer->Add( sizerA                                              , 1, wxALL              , 0 );
-                       sizer->Add( new wxStaticText(panel              ,-1,_T("Slice Range"))  , 1, wxALL              , 0 );
-                       sizer->Add( _mbarrangeSliceInformation  , 1, wxALL|wxGROW               , 2 );                  
-                       sizer->Add( new wxStaticText(panel              ,-1,_T("Gray Range"))   , 1, wxALL              , 0 );
-                       sizer->Add( _mbarrangeRangeInformation  , 1, wxALL|wxGROW               , 2 );                  
-                       sizer->Add( sizerB                                              , 1, wxALL              , 0 );
-                       sizer->Add( _staticTextInformation              , 1, wxALL              , 0 );
-                       sizer->Add( _grid                                               , 1, wxEXPAND   , 0 );
-
-
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( wxSize(1500,1500) );
-                       //panel->SetBackgroundColour( wxColour(100,100,100) );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();*/
-
-                       wxBoxSizer * sizerPanel         = new wxBoxSizer(wxHORIZONTAL);
-
-//                     sizerPanel->AddGrowableCol(0);
-//                     sizerPanel->AddGrowableRow(0);
-
-//JCP 14-10-09
-                       //sizerPanel -> Add( sizer              , 1, wxEXPAND ,0);
-                       sizerPanel -> Add( panel->GetSizer()            , 1, wxEXPAND ,0);
-//JCP 14-10-09
-
-
-
-                       _InformationContourFrame->SetSizer( sizerPanel );
-                       _InformationContourFrame->SetAutoLayout( true );
-                       _InformationContourFrame->Layout();
-
-                       _InformationContourFrame->Show();
-               } else {
-                       if (_InformationContourFrame->IsShown()==true)
-                       {
-                               _InformationContourFrame->Show(false);
-                       } else  {
-                               FillGridWithContoursInformation();
-                               _InformationContourFrame->Show(true);
-                       }
-               }
-       }
-
-       wxPanel* wxContourEventHandler::getInformationPanel(wxWindow* parent){
-        wxPanel *panel                                                                 = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL);
-
-               wxString lstOptions[4];
-               lstOptions[0]=_T("Actual Slice");
-               lstOptions[1]=_T("Range Slices");
-               lstOptions[2]=_T("All Slices");
-               _informationRadiobox                                                    = new wxRadioBox(panel, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
-
-               wxString lstOptContOperation[5];
-               lstOptContOperation[0]=_T("AND");
-               lstOptContOperation[1]=_T("OR");
-               lstOptContOperation[2]=_T("XOR");
-               lstOptContOperation[3]=_T("ALL");
-               _radiolstboxContourGroup                                                = new wxRadioBox(panel, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation,  4, wxRA_SPECIFY_COLS);
-
-               wxButton *informationContourLabelsBtn                   = new wxButton(panel,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) );
-               informationContourLabelsBtn->SetEventHandler( this );
-               Connect( informationContourLabelsBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onInformationContourLabels ); 
-
-               wxButton *statisticsContourBtn                                  = new wxButton(panel,-1,_T("Contour statistics"),wxDefaultPosition, wxSize(140,35) );
-               statisticsContourBtn->SetEventHandler( this );
-               Connect( statisticsContourBtn->GetId(),         wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onExtractInformation ); 
-
-               wxButton *saveResultsBtn                                                = new wxButton(panel,-1,_T("Save statistics results"),wxDefaultPosition, wxSize(140,35) );
-               saveResultsBtn->SetEventHandler( this );
-               Connect( saveResultsBtn->GetId(),               wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSaveResults ); 
-
-
-               int sizeZ = this->_sceneManager->GetImageDataSizeZ();                   
-               _mbarrangeSliceInformation                                      =  new mBarRange(panel,65,65);
-               _mbarrangeSliceInformation->SetMin(0);
-               _mbarrangeSliceInformation->SetStart(0);
-               _mbarrangeSliceInformation-> SetOrientation( true );
-               _mbarrangeSliceInformation-> setActiveStateTo(true);
-               _mbarrangeSliceInformation-> setVisibleLabels( true );
-               _mbarrangeSliceInformation-> setDeviceEndMargin(10);
-               _mbarrangeSliceInformation-> setRepresentedValues( 0 , sizeZ-1 );
-               _mbarrangeSliceInformation-> setDeviceBlitStart(10,10); 
-               _mbarrangeSliceInformation-> setIfWithActualDrawed( false );
-               _mbarrangeSliceInformation-> SetStart( 0 );
-               _mbarrangeSliceInformation-> SetEnd( sizeZ-1 );  
-
-
-               double range[2];
-               this->_sceneManager->GetImageDataRange(range);
-               _mbarrangeRangeInformation                                      =  new mBarRange(panel,65,65);
-               _mbarrangeRangeInformation->SetMin(0);
-               _mbarrangeRangeInformation->SetStart(0);
-               _mbarrangeRangeInformation-> SetOrientation( true );
-               _mbarrangeRangeInformation-> setActiveStateTo(true);
-               _mbarrangeRangeInformation-> setVisibleLabels( true );
-               _mbarrangeRangeInformation-> setDeviceEndMargin(10);
-               _mbarrangeRangeInformation-> setRepresentedValues( range[0] , range[1] );
-               _mbarrangeRangeInformation-> setDeviceBlitStart(10,10); 
-               _mbarrangeRangeInformation-> setIfWithActualDrawed( false );
-               _mbarrangeRangeInformation-> SetStart( range[0] );
-               _mbarrangeRangeInformation-> SetEnd( range[1] );  
-
-
-               _staticTextInformation                                                  = new wxStaticText(panel,-1,_T("    "));
-
-
-//                     wxButton *XXXXXXXBtn                    = new wxButton(panel,-1,_T("Statistics"),wxDefaultPosition, wxSize(180,35) );
-//                     XXXXXXXBtn->SetEventHandler( this );
-//                     Connect( XXXXXXXBtn->GetId(),           wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onXXXXX ); 
-
-
-               _grid = new wxGrid( panel,
-                    wxID_ANY,
-                    wxPoint( 0, 0 ),
-                    wxSize( 100, 100 ) );
-
-               int i,gridCol=10,gridRow=sizeZ;
-               _grid->CreateGrid( 0, 0 );
-               _grid->AppendRows(gridRow);
-               _grid->AppendCols(gridCol);
-
-               for (i=0;i<gridRow;i++)
-               {
-                       _grid->SetRowLabelValue(i, _T(" ") );
-               }
-//                     _grid->SetColLabelSize(0);
-
-
-               FillGridWithContoursInformation();
-
-               wxFlexGridSizer * sizerA                = new wxFlexGridSizer(10);
-               sizerA->Add( _informationRadiobox                       , 1, wxALL ,2 );
-               sizerA->Add( _radiolstboxContourGroup           , 1, wxALL ,2 );
-
-               wxFlexGridSizer * sizerB                = new wxFlexGridSizer(10);
-               sizerB->Add( informationContourLabelsBtn        , 1, wxALL ,2 );
-               sizerB->Add( statisticsContourBtn                       , 1, wxALL ,2 );
-               sizerB->Add( saveResultsBtn                                     , 1, wxALL ,2 );
-
-               wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
-               sizer->AddGrowableCol(0);
-               sizer->AddGrowableRow(7);
-               sizer->Add( sizerA                                              , 1, wxALL              , 0 );
-               sizer->Add( new wxStaticText(panel              ,-1,_T("Slice Range"))  , 1, wxALL              , 0 );
-               sizer->Add( _mbarrangeSliceInformation  , 1, wxALL|wxGROW               , 2 );                  
-               sizer->Add( new wxStaticText(panel              ,-1,_T("Gray Range"))   , 1, wxALL              , 0 );
-               sizer->Add( _mbarrangeRangeInformation  , 1, wxALL|wxGROW               , 2 );                  
-               sizer->Add( sizerB                                              , 1, wxALL              , 0 );
-               sizer->Add( _staticTextInformation              , 1, wxALL              , 0 );
-               sizer->Add( _grid                                               , 1, wxEXPAND   , 0 );
-
-
-
-               panel->SetSizer( sizer );
-               panel->SetSize( wxSize(1500,1500) );
-               //panel->SetBackgroundColour( wxColour(100,100,100) );
-               panel->SetAutoLayout( true );
-               panel->Layout();
-               return panel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onSpreadInDepth( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onOutline_Union_Of( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onOutline_Intersection_Of( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onOutline_Combination_Of( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onOutline_Fragmentation_Of( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onOutline_Agrupation_Of( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onCopyOutlines( std::vector<std::string> & keyNamesVector )
-       {
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-        _performingOperation->reset();
-               _performingOperation->setStartCommand( (char)wxContour_ActionCommandsID::COPY_TOOL );
-               _performingOperation->setStartOperationInstantVector( tempVector );
-               _performingOperation->setKeyNamesOperationElems( keyNamesVector );
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onPasteOutlines( )
-       {
-               char theStartCommand = _performingOperation->getStartCommand();
-               if (  theStartCommand == wxContour_ActionCommandsID::COPY_TOOL )
-               {
-                       //JCP 20-10-08 Undo redo implementation
-                       saveState();
-                       //JCP 20-10-08 Undo redo implementation
-
-
-                       std::vector<int> tempVector;
-                       _instantPanel->getInstant( tempVector );
-                       _performingOperation->setEndOperationInstantVector ( tempVector );
-                       std::vector<std::string> elems = _performingOperation->getKeyNamesOperationElems();
-                       int i,size = elems.size();                      
-                       for( i=0; i<size; i++ )
-                       {                               
-                               createCopyContourOf( elems[i], tempVector, i>0 );
-                       }
-
-                       
-               }
-               int fin = 0;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onShowOutlines( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onHideOutlines( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onSelectOutlines( std::vector<std::string> & keyNamesVector )
-       {
-               //if( keyNamesVector.empty() )
-               {
-                       _sceneManager->drawSelectionROI( );
-               }
-               /*else
-               {
-                       int ok = keyNamesVector.size();
-                       _sceneManager->selectObjects( keyNamesVector );
-                       std::string name = keyNamesVector[0];                   
-               }*/
-               /*
-               _sceneManager->drawSelectionROI( );
-               std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
-               int ok = currentSelection.size();
-               _sceneManager->selectObjects( currentSelection );*/
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onEditOutlines( std::vector<std::string> & keyNamesVector )
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: deleteContour( std::string theKeyName )
-       {
-               manualContourModel                      * cModel;
-               manualViewBaseContour           * cViewer;
-               manualContourBaseControler      * cControler;
-
-               ContourWrap_ViewControl *conwrapviewControl =  _sceneManager->getContourWrap_ViewControlOf( theKeyName );
-               cControler      = conwrapviewControl->getControler();
-               int ispartofstaticlst= _modelManager->IsPartOfStaticList(theKeyName);
-               if ((cControler!=NULL) && (cControler->IsEditable()==false)  && (ispartofstaticlst==-1) )
-               {
-                       _sceneManager->removeFromScene( theKeyName );
-                       cModel          = _modelManager->getOutlineByKeyName(theKeyName)->getModel();
-                       _modelManager->removeOutline( theKeyName );
-                       cViewer         = conwrapviewControl->getViewer();
-                       _sceneManager->removeWrap( theKeyName );
-//EED Borrame
-//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
-//fprintf(ff,"EED wxContourEventHandler::deleteContours() \n" );
-//fprintf(ff,"    %s %p\n",keyNamesVector[i].c_str(),  cControler );
-//fclose(ff);
-                       delete cModel;
-                       delete cViewer;
-                       delete cControler;
-               } // if editable
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: deleteContours( std::vector<std::string>  keyNamesVector )
-       {
-               int i,size=keyNamesVector.size();
-               for (i=0;i<size;i++)
-               {
-                       deleteContour( keyNamesVector[i] );
-               }
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: deleteAllContours(  )
-       {               
-               wxBusyCursor wait;
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-//JCP --08-09-2008 When using a diferent interface the _mbarrangeDeleteAll might not be initialize
-//             the values in GetStart and GetEnd will then not be initialize also.
-//             We use instead the values given when initializing the _deletepanel.
-
-               //int minZ = _mbarrangeDeleteAll->GetStart();
-               //int maxZ = _mbarrangeDeleteAll->GetEnd();
-               int minZ, maxZ;
-               
-               minZ = 0;
-               maxZ = _sceneManager->GetImageDataSizeZ();
-               
-//JCP --08-09-2008
-               
-               _sceneManager->removeSceneContours( );
-                       _modelManager->removeAllOutlines();
-                       _sceneManager->removeAllOutlines();
-//JCP --08-09-2008
-               /*
-               if ( (minZ==0) && (maxZ==_mbarrangeDeleteAll->GetMax() ))
-               {
-                       _sceneManager->removeSceneContours( );
-                       _modelManager->removeAllOutlines();
-                       _sceneManager->removeAllOutlines();
-
-               } else {
-                       for ( z=minZ ; z<=maxZ ; z++)
-                       {
-                               tempVector[1]=z;
-                               Instant instant(&tempVector);
-                               std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-
-                               sizeLstContourThings = lstContourThings.size();
-                               for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                               {
-                                       ContourThing **contourthing = lstContourThings[ii];
-                                       deleteContour( (*contourthing)->getName() );
-                               } //for ii
-                       }// for z
-               } // if 
-       JCP --08-09-2008 */
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::openContours( FILE *pFile, bool staticContour )
-       {
-               char tmp[255];
-               fscanf(pFile,"%s",tmp); // NumberOfContours 
-               fscanf(pFile,"%s",tmp); // ##
-               int numberOfContours = atoi(tmp);  
-
-               std::vector<int> instantVector;
-               int typeContourModel;
-               manualContourModel *manModelContour;
-               int typeView;
-
-               int i;
-               for (i=0;i<numberOfContours;i++)
-               {
-                       instantVector.clear();
-                       fscanf(pFile,"%s",tmp); // Instant
-
-                       fscanf(pFile,"%s",tmp); // 1
-                       instantVector.push_back( atoi(tmp) );
-                       fscanf(pFile,"%s",tmp); // 2
-                       instantVector.push_back( atoi(tmp) );
-                       fscanf(pFile,"%s",tmp); // 3
-                       instantVector.push_back( atoi(tmp) );
-                       fscanf(pFile,"%s",tmp); // 4
-                       instantVector.push_back( atoi(tmp) );
-                       fscanf(pFile,"%s",tmp); // 5
-                       instantVector.push_back( atoi(tmp) );
-                       fscanf(pFile,"%s",tmp); // 6
-                       instantVector.push_back( atoi(tmp) );
-
-
-                       fscanf(pFile,"%s",tmp); // TypeContourModel
-                       fscanf(pFile,"%s",tmp); // ##
-                       typeContourModel = atoi(tmp);
-
-                       manModelContour =  factoryManualContourModel(typeContourModel);
-                       manModelContour->Open(pFile);
-
-                       fscanf(pFile,"%s",tmp); // TypeView
-                       fscanf(pFile,"%s",tmp); // ##
-                       typeView = atoi(tmp);  
-
-
-//                     if (typeView==1) 
-//                     {
-//                     }
-
-
-                       std::string theName;
-                       theName = _modelManager->createOutline( manModelContour, instantVector );
-                       bool addedModel = theName.compare("") != 0;
-                       if( addedModel )
-                       {
-                               double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                               this->_theViewPanel->getSpacing(spc);                                   
-                               //Adding the manualContourControler to interface objects structure
-                               //Adding the manualViewContour to interface objects structure           
-                               //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                               _sceneManager->configureViewControlTo( theName, manModelContour,spc , typeView) ;
-                       }       
-
-                       if (staticContour==true)
-                       {
-                               Instant instant(&instantVector);
-                               changeContourOfManager( theName , &instant );
-                       }
-
-               }// for  numberOfContours
-
-
-
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::openFileWithContours()
-       {
-               char tmp[255];
-               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxOPEN );
-               if (dialog.ShowModal() == wxID_OK)
-               {
-                       fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
-                       FILE *pFile=fopen(fileNameContourROI.c_str(),"r+");
-
-                       fscanf(pFile,"%s",tmp); // --CreaContour--
-
-                       fscanf(pFile,"%s",tmp); // Version
-                       fscanf(pFile,"%s",tmp); // 1.0.1
-                       std::string version(tmp);
-
-                       openContours(pFile,false);
-                       if (version!="1.0.0"){
-                               openContours(pFile,true);
-                       }
-//                       _sceneManager->openFileWithContours(ff);
-
-                       fclose(pFile);
-               }
-               _sceneManager->removeSceneContours();
-               changeInstant();
-               //updateInstantOutlines();
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::saveFileWithContours( std::string filename )
-       {
-               FILE *pFile=fopen(filename.c_str(),"w+");
-               std::vector< std::string > lstNameThings;
-               int i,sizeLstNameThings; 
-
-               fprintf(pFile,"--CreaContour--\n");
-               fprintf(pFile,"Version %s\n", "1.0.1" );
-
-               // Normal Contours
-               lstNameThings           = _modelManager->GetLstNameThings();
-               sizeLstNameThings       = lstNameThings.size(); 
-               fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
-               for (i=0 ; i<sizeLstNameThings ; i++) 
-               {
-                       _modelManager->SaveThingName( pFile, lstNameThings[i] );
-                       _sceneManager->SaveThingName( pFile, lstNameThings[i] );
-               }// for i
-
-               //-- Contours Statics 
-               lstNameThings           = _modelManager->GetLstNameThingsStatic();
-               sizeLstNameThings       = lstNameThings.size(); 
-               fprintf(pFile,"NumberOfContoursStatic %d\n", sizeLstNameThings );
-               for (i=0 ; i<sizeLstNameThings ; i++) 
-               {
-                       _modelManager->SaveThingName( pFile, lstNameThings[i] );
-                       _sceneManager->SaveThingName( pFile, lstNameThings[i] );
-               }// for i
-               fclose(pFile);
-       }
-
-
-       //----------------------------------------------------------
-
-       void wxContourEventHandler::saveFileWithContours()
-       {
-               wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE );
-               if (dialog.ShowModal() == wxID_OK)
-               {
-                       fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
-                       saveFileWithContours( fileNameContourROI );
-               } // if  ShowModal
-       } 
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: saveFileWithContoursAutomatique()
-       {
-               if (fileNameContourROI=="")
-               {
-                       saveFileWithContours();
-               } else {
-                       saveFileWithContours(fileNameContourROI);
-               }
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append )
-       {
-               std::string cloneName = _modelManager->createCopyContourOf( anExistingKName, instantNoTouchData );
-               manualContourModel * manualModel = _modelManager->getOutlineByKeyName( cloneName )->getModel();
-               _sceneManager->createCopyContourOf( anExistingKName, cloneName, manualModel , append );
-       }
-
-
-       //------------------------------------------------------------------------------------------------------------
-       manualContourModel * wxContourEventHandler::factoryManualContourModel(int typeContour)
-       {       
-               manualContourModel *manModelContour=NULL;
-
-               // spline
-               if (typeContour==0)
-               {
-                       manModelContour = new manualContourModel();
-               }
-
-               // spline
-               if (typeContour==1)
-               {
-                       manModelContour = new manualContourModel();
-               }
-
-               // rectangle
-               if (typeContour==2)
-               {
-                       manModelContour = new manualContourModelRoi();
-               }
-
-               // circle
-               if (typeContour==3)
-               {
-                       manModelContour = new manualContourModelCircle();
-               }
-
-               // BullEye / star
-               if (typeContour==4)
-               {
-                       manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
-                       manModelContour = manModelContourBullEye;
-                       if (_panelBullEyeOptions!=NULL){
-                               int iCrown,sizeCrowns,iSector,sizeSectors;
-                               double radioA,radioB,ang,angDelta ;
-                               sizeCrowns = _panelBullEyeOptions->GetNumberOfCrowns();
-                               for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
-                               {
-                                       sizeSectors = _panelBullEyeOptions->GetNumberOfSections(iCrown);
-                                       radioB  = _panelBullEyeOptions->GetRadioOfCrown(iCrown);
-                                       if (iCrown==sizeCrowns-1)
-                                       {
-                                               radioA  = 0;
-                                       } else {
-                                               radioA  = _panelBullEyeOptions->GetRadioOfCrown(iCrown+1);
-                                       }
-                                       radioA=radioA/100.0;
-                                       radioB=radioB/100.0;
-                                       for ( iSector=0 ; iSector<sizeSectors  ; iSector++ )
-                                       {
-                                               ang             = _panelBullEyeOptions->GetAngOfCrownSection(iCrown,iSector);
-                                               angDelta= _panelBullEyeOptions->GetAngDeltaOfCrownSection(iCrown);                                      
-                                               manModelContourBullEye->AddSector(radioA,radioB,ang,angDelta);
-                                       } // for iSector
-                               } // for iCrown
-                       } // if _panelBullEyeOptions
-               }// if typeContour==4
-
-               return manModelContour;
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: createContour( int typeContour )
-       {
-               //Creating the manualContourModel and including in the model
-               manualContourModel * manModelContour = factoryManualContourModel(typeContour);
-               std::vector<int> instantVector;
-               _instantPanel->getInstant( instantVector );
-               std::string theName;
-               theName= _modelManager->createOutline( manModelContour, instantVector );
-               bool addedModel = theName.compare("") != 0;
-               if( addedModel )
-               {
-                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                       this->_theViewPanel->getSpacing(spc);                                   
-                       //Adding the manualContourControler to interface objects structure
-                       //Adding the manualViewContour to interface objects structure           
-                       //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                       _sceneManager->configureViewControlTo( theName, manModelContour,spc , typeContour) ;
-               }       
-
-//EED Borrame
-//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
-//fprintf(ff,"EED wxContourEventHandler::createContour() \n" );
-//fprintf(ff,"    %s\n %p ",theName.c_str() ,  );
-//fclose(ff);
-
-
-       }
-       manualContourModel * wxContourEventHandler::factoryManualContourModel(PanelBullEyeOptions* panel){
-
-               manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
-               manualContourModel *manModelContour=NULL;
-               manModelContour = manModelContourBullEye;
-               if (panel!=NULL){
-                       int iCrown,sizeCrowns,iSector,sizeSectors;
-                       double radioA,radioB,ang,angDelta ;
-                       sizeCrowns = panel->GetNumberOfCrowns();
-                       for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
-                       {
-                               sizeSectors = panel->GetNumberOfSections(iCrown);
-                               radioB  = panel->GetRadioOfCrown(iCrown);
-                               if (iCrown==sizeCrowns-1)
-                               {
-                                       radioA  = 0;
-                               } else {
-                                       radioA  = panel->GetRadioOfCrown(iCrown+1);
-                               }
-                               radioA=radioA/100.0;
-                               radioB=radioB/100.0;
-                               for ( iSector=0 ; iSector<sizeSectors  ; iSector++ )
-                               {
-                                       ang             = panel->GetAngOfCrownSection(iCrown,iSector);
-                                       angDelta= panel->GetAngDeltaOfCrownSection(iCrown);                                     
-                                       manModelContourBullEye->AddSector(radioA,radioB,ang,angDelta);
-                               } // for iSector
-                       } // for iCrown
-               } // if _panelBullEyeOptions
-               
-               return manModelContour;
-       }
-
-       void wxContourEventHandler :: createContourBullsEye(PanelBullEyeOptions* panel )
-       {
-               //Creating the manualContourModel and including in the model
-               manualContourModel * manModelContour = factoryManualContourModel(panel );
-               std::vector<int> instantVector;
-               _instantPanel->getInstant( instantVector );
-               std::string theName;
-               theName= _modelManager->createOutline( manModelContour, instantVector );
-               bool addedModel = theName.compare("") != 0;
-               if( addedModel )
-               {
-                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                       this->_theViewPanel->getSpacing(spc);                                   
-                       //Adding the manualContourControler to interface objects structure
-                       //Adding the manualViewContour to interface objects structure           
-                       //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
-                       _sceneManager->configureViewControlTo( theName, manModelContour,spc , 4) ;
-               }       
-
-//EED Borrame
-//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
-//fprintf(ff,"EED wxContourEventHandler::createContour() \n" );
-//fprintf(ff,"    %s\n %p ",theName.c_str() ,  );
-//fclose(ff);
-
-
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       //  Attributes getters and setters
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: setModelManager( OutlineModelManager * theModelManager )
-       {
-               _modelManager = theModelManager;
-               _workSpace = _modelManager->getContourWorkspace();
-       }
-       //------------------------------------------------------------------------------------------------------------  
-       void wxContourEventHandler :: setViewPanel(  wxContourViewPanel * theViewPanel )
-       {
-               _theViewPanel = theViewPanel;
-               _theViewPanel->setWxEventHandler( this );
-
-               double spc[3];
-               this->_theViewPanel->getSpacing(spc);
-               _sceneManager           = new wxVtkBaseView_SceneManager ( this->_theViewPanel->getWxVtkBaseView(), this, spc  );
-               
-               Connect( _theViewPanel->GetId(), wxINSTANT_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangeInstant );
-        Connect( wxID_ANY, wxEVT_START_CREATE_MULT_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onCreateMultipleROI );
-               Connect( wxID_ANY, wxEVT_START_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onCreateROI );
-               Connect( wxID_ANY, wxEVT_STOP_CREATE_ROI, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onStopCreateROI );
-               Connect( wxID_ANY, wxEVT_CHANGED_DEEP, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangedDeep );
-               Connect( wxID_ANY,  wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler :: onActionButtonPressed ); 
-
-               
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel )
-       {
-               _instantPanel = theInstantChooserPanel;
-               _instantPanel->setWxEventHandler( this );
-
-               //Connect( _instantPanel->GetId(), wxINSTANT_CHOOSER_CHANGE, (wxObjectEventFunction) (wxCommandEventFunction)  &wxContourEventHandler::onChangeInstant );
-
-               std::vector<int> vect;
-               _instantPanel->getInstant( vect );
-               _actualInstant = new Instant( &vect );
-
-               if( _modelManager!=NULL )
-               {               
-                       std::vector<std::string> conceptNameVect;
-                       std::vector<int> conceptSizeVect;
-                       _modelManager-> getConceptsInformation(conceptNameVect, conceptSizeVect);
-                       int i=0;
-                       int max = conceptNameVect.size();                       
-                       for( ; i<max; i++)
-                       {
-                               if( conceptNameVect[i].compare("Axe Depth") == 0 )
-                               {
-                                       _instantPanel->addConcept( conceptNameVect[i], 0, conceptSizeVect[i], 1);
-                               } else {
-                                       _instantPanel->addConcept( conceptNameVect[i], 1, conceptSizeVect[i], 1);
-                               } // if
-                       } // for                
-               } else {
-                       //Should be configured later, or abort program, because Model -NEEDS- to be added before chooserPanel
-               }
-               if( _theViewPanel!=NULL )
-               {
-                       double val = _theViewPanel->getCurrentDeep();
-                       _instantPanel->setConceptValue( "Axe Depth", (int)val );
-                       ConceptDataWrap * data = _instantPanel->getConceptDataOf( "Axe Depth" );
-                       changeInstant();                        
-                       _theViewPanel->setVerticalConcept( "Axe Depth", data->getMinValue(), data->getMaxValue(), data->getMinShowedValue(),  data->getMaxShowedValue(), data->getActualValue() );                      
-               } else {
-                       //Should be configured later, or abort program, because ViewPanel -NEEDS- to be added before chooserPanel
-               }// if
-       } 
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setButtonsBar(  wxContour_ButtonsBar * theButtonsBar )
-       {
-               _buttonsBar = theButtonsBar;
-               _buttonsBar->setWxEventHandler( this );
-               Connect( _buttonsBar->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler:: onActionButtonPressed );               
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setGrid(  wxContour_Grid * theGridPanel )
-       {
-               _gridPanel = theGridPanel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel )
-       {
-               _drawToolsPanel = theDrawToolsPanel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theOperationsToolsPanel )
-       {       
-               _operationsToolsPanel = theOperationsToolsPanel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel )
-       {
-               _autoFormsPanel = theAutoFormsPanel;
-       }
-
-       void wxContourEventHandler :: setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel )
-       {
-               _standardToolsPanel= theStandardToolsPanel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel )
-       {
-               _editionToolsPanel =  theEditionToolsPanel;
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: setListViewPanel(  wxContour_ListViewPanel * theListViewPanel )
-       {
-               _listViewPanel = theListViewPanel;
-       }
-       //------------------------------------------------------------------------------------------------------------
-       //  Other functional methods
-       //------------------------------------------------------------------------------------------------------------
-
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onDeleteContour( wxCommandEvent& event )
-       {
-               
-               //JCP 20-10-08 Undo redo implementation
-               saveState();
-               //JCP 20-10-08 Undo redo implementation
-
-
-               int i,size=_sceneManager->getSelectedObjects().size();
-               for(i=0;i<size;i++)
-               {
-                       std::string keyName             = _sceneManager->getSelectedObjects()[i];
-                       int ispartofstaticlist  = this->_modelManager->IsPartOfStaticList( keyName );
-                       if ( ispartofstaticlist>=0 )
-                       {
-                               std::vector<int> tempVector;
-                               _instantPanel->getInstant( tempVector );
-                               Instant instant(&tempVector);
-                               this->_modelManager->ChangeContourOfList(keyName, &instant);
-                       }
-               }
-
-               std::vector<std::string> lstKeyName;
-               std::vector<std::string> lstKeyNameActualSlice;
-               std::vector<std::string> lstKeyNameToBeErase;
-
-               lstKeyNameToBeErase             = _sceneManager->getSelectedObjects();
-               lstKeyNameActualSlice   = _sceneManager->GetlstContoursNameActualSlice();
-               int k,kSize=lstKeyNameToBeErase.size();
-               int j,jSize=lstKeyNameActualSlice.size();
-               bool ok;
-               for (k=0;k<kSize; k++)
-               {
-                       ok=false;
-                       for (j=0;j<jSize; j++)
-                       {
-                               if (lstKeyNameToBeErase[k]==lstKeyNameActualSlice[j])
-                               { 
-                                       ok=true;
-                               }
-                       } // for j
-                       if (ok==true)
-                       {
-                               lstKeyName.push_back( lstKeyNameToBeErase[k] );
-                       } // if ok
-               } // for k
-
-               deleteContours( lstKeyName );
-
-               
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onDeleteContoursActSlice( wxCommandEvent& event )
-       {
-               //JCP 20-10-08 Undo redo implementation
-               saveState();
-               //JCP 20-10-08 Undo redo implementation
-               deleteContours( (std::vector<std::string>)_sceneManager->GetlstContoursNameActualSlice() );
-
-               
-       }
-
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler::onDeleteAllContours( wxCommandEvent& event )        
-       {
-               //JCP 20-10-08 Undo redo implementation
-               saveState();
-               //JCP 20-10-08 Undo redo implementation
-               deleteAllContours(  );
-
-               
-       }
-
-               //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onDeleteFrame( )
-       {
-               if (_deleteFrame==NULL)
-               {
-                       _deleteFrame                                            = new wxFrame (_theViewPanel, -1,_T("  Delete Contour "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
-                       int width=300;
-                       wxSize sizepanel(width,230);
-                       _deleteFrame->SetSize( sizepanel );
-                       wxPanel *panel                                          = new wxPanel(_deleteFrame,-1);
-                       wxButton *deleteContourBtn                      = new wxButton(panel,-1,_T("Delete contour selected"),wxDefaultPosition, wxSize(width-10,35) );
-                       wxButton *deleteContoursActSliceBtn     = new wxButton(panel,-1,_T("Delete contours of actual slice"),wxDefaultPosition, wxSize(width-10,35));
-                       wxButton *deleteAllContoursBtn          = new wxButton(panel,-1,_T("Delete all contours"),wxDefaultPosition, wxSize(width-10,35));
-
-                       int sizeZ = _sceneManager->GetImageDataSizeZ();
-                       _mbarrangeDeleteAll                                     =  new mBarRange(panel,70, 65);
-                       _mbarrangeDeleteAll->SetMin(0);
-                       _mbarrangeDeleteAll->SetStart(0);
-
-                       _mbarrangeDeleteAll-> SetOrientation( true );
-                       _mbarrangeDeleteAll-> setActiveStateTo(true);
-                       _mbarrangeDeleteAll-> setVisibleLabels( true );
-                       _mbarrangeDeleteAll-> setDeviceEndMargin(10);
-                       _mbarrangeDeleteAll-> setRepresentedValues( 0 , sizeZ );
-                       _mbarrangeDeleteAll-> setDeviceBlitStart(10,10); 
-                       _mbarrangeDeleteAll-> setIfWithActualDrawed( false );
-                       _mbarrangeDeleteAll-> SetStart( 0 );
-                       _mbarrangeDeleteAll-> SetEnd( sizeZ );  
-
-
-                       _deleteFrame->SetEventHandler( this );
-                       Connect( deleteContourBtn->GetId()                      ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteContour ); 
-                       Connect( deleteContoursActSliceBtn->GetId()     ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteContoursActSlice ); 
-                       Connect( deleteAllContoursBtn->GetId()          ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onDeleteAllContours ); 
-
-                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
-                       sizer -> Add( deleteContourBtn                          , 1, wxGROW );
-                       sizer -> Add( deleteContoursActSliceBtn         , 1, wxGROW );
-                       sizer -> Add( deleteAllContoursBtn                      , 1, wxGROW );
-                       sizer -> Add( _mbarrangeDeleteAll                       , 1, wxGROW );
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizepanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();
-                       _deleteFrame->Show(true);
-               } else {
-                       if (_deleteFrame->IsShown()==true)
-                       {
-                               _deleteFrame->Show(false);
-                       } else  {
-                               _deleteFrame->Show(true);
-                       }
-               }
-       }
-
-
-//------------------------------------------------------------------------------------------------------------
-void wxContourEventHandler::onCreateContourSpline( wxCommandEvent& event )
-{
-       
-       //JCP 20-10-08 Undo redo implementation
-       saveState();
-       //JCP 20-10-08 Undo redo implementation
-       createContour( 1 );
-
-       
-
-}
-
-//------------------------------------------------------------------------------------------------------------
-void wxContourEventHandler::onCreateContourRectangle( wxCommandEvent& event )
-{
-       
-       //JCP 20-10-08 Undo redo implementation
-       saveState();
-       //JCP 20-10-08 Undo redo implementation 
-       createContour( 2 );
-
-       
-}
-
-//------------------------------------------------------------------------------------------------------------
-void wxContourEventHandler::onCreateContourCircle( wxCommandEvent& event )
-{
-       //JCP 20-10-08 Undo redo implementation
-       saveState();
-       //JCP 20-10-08 Undo redo implementation 
-       createContour( 3 );
-
-       
-}
-//------------------------------------------------------------------------------------------------------------
-void wxContourEventHandler::onCreateContourBullEye( wxCommandEvent& event )
-{
-       //JCP 20-10-08 Undo redo implementation
-       saveState();
-       //JCP 20-10-08 Undo redo implementation
-       createContour( 4 );
-
-       
-       
-}
-
-
-
-//------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onCreateContourFrame( )
-       {
-               if (_createContourFrame==NULL)
-               {
-                       _createContourFrame                                             = new wxFrame (_theViewPanel, -1,_T("  New Contour  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER );
-                       wxSize sizepanel(490,600);
-                       _createContourFrame->SetSize( sizepanel );
-                       wxPanel *panel                                          = new wxPanel(_createContourFrame,-1);
-                       wxButton *newContourSplineBtn           = new wxButton(panel,-1,_T("Interpolation B-spline (close)"),wxDefaultPosition, wxSize(180,35) );
-                       newContourSplineBtn->SetToolTip(_T("CTRL-N"));
-                       wxButton *newContourRectangleBtn        = new wxButton(panel,-1,_T("Rectangle"),wxDefaultPosition, wxSize(180,35));
-                       wxButton *newContourCircleBtn           = new wxButton(panel,-1,_T("Circle"),wxDefaultPosition, wxSize(180,35));
-                       wxButton *newContourStarBtn                     = new wxButton(panel,-1,_T("Bull eye"),wxDefaultPosition, wxSize(180,35));
-
-                       _panelBullEyeOptions = new PanelBullEyeOptions(panel, wxSize(100,200));
-
-                       _createContourFrame->SetEventHandler( this );
-                       Connect( newContourSplineBtn->GetId()           ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourSpline    ); 
-                       Connect( newContourRectangleBtn->GetId()        ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourRectangle ); 
-                       Connect( newContourCircleBtn->GetId()           ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourCircle    ); 
-                       Connect( newContourStarBtn->GetId()                     ,       wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onCreateContourBullEye   ); 
-
-                       wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
-                       sizer -> Add( newContourSplineBtn                       , 1, wxGROW );
-                       sizer -> Add( newContourRectangleBtn            , 1, wxGROW );
-                       sizer -> Add( newContourCircleBtn                       , 1, wxGROW );
-                       sizer -> Add( newContourStarBtn                         , 1, wxGROW );
-                       sizer -> Add( _panelBullEyeOptions                      , 1, wxGROW );
-
-                       panel->SetSizer( sizer );
-                       panel->SetSize( sizepanel );
-                       panel->SetAutoLayout( true );
-                       panel->Layout();
-                       _createContourFrame->Show(true);
-               } else {
-                       if (_createContourFrame->IsShown()==true)
-                       {
-                               _createContourFrame->Show(false);
-                       } else  {
-                               _createContourFrame->Show(true);
-                       }
-               }
-       }
-
-
-//------------------------------------------------------------------------
-void wxContourEventHandler::RefreshInterface()
-{
-       changeInstant();
-       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
-       wxvtk2dbaseview->Refresh();
-}
-
-//------------------------------------------------------------------------
-void wxContourEventHandler::onWidthOfContour(wxScrollEvent& event){
-       _sceneManager->removeSceneContours();
-       double width = (double)_withOfContourLine->GetValue() / 2.0;
-       _sceneManager->SetWidthContour( width );
-
-       RefreshInterface();
-}
-
-//------------------------------------------------------------------------
-
-void wxContourEventHandler::onBrigthnessColorWindowLevel(wxScrollEvent& event){
-       int colorwindow                         = _brithtnessColorLevel->GetValue();
-       int windowlevel                         = _brithtnessWindowLevel->GetValue();
-       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
-       vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-       imageviewer->SetColorWindow(colorwindow);
-       imageviewer->SetColorLevel(windowlevel);        
-//     wxvtk2dbaseview->Refresh();
-       RefreshInterface();
-}
-
-void wxContourEventHandler::OnInterpolation(wxCommandEvent& event)
-{
-       wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
-       vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-       if (_interpolationCheckBox->GetValue()==true)
-       {
-               imageviewer->GetImageActor()->InterpolateOn();
-       } else {
-               imageviewer->GetImageActor()->InterpolateOff();
-       }
-       RefreshInterface();
-}
-
-
-//------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onInterfaceConfigurationFrame( )
-       {
-               if (_interfaceConfigurationFrame==NULL)
-               {
-                       _interfaceConfigurationFrame                    = new wxFrame (_theViewPanel, -1,_T(" Interface Configuration "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
-                       wxSize sizepanel(190,400);
-                       _interfaceConfigurationFrame->SetSize( sizepanel );
-                       _interfaceConfigurationFrame->SetEventHandler( this );
-                       wxPanel* panel = getConfigurationPanel(_interfaceConfigurationFrame);
-                       panel->SetSize(sizepanel);
-                       _interfaceConfigurationFrame->Show(true);
-               } else {
-                       if (_interfaceConfigurationFrame->IsShown()==true)
-                       {
-                               _interfaceConfigurationFrame->Show(false);
-                       } else  {
-                               _interfaceConfigurationFrame->Show(true);
-                       }
-               }
-       }
-
-
-       //**JCP 13-10-08
-
-       wxPanel* wxContourEventHandler :: getConfigurationPanel(wxWindow* parent){
-               
-               /*wxPanel *panel                                                        = new wxPanel(parent,-1);
-               _withOfContourLine                                              = new wxSlider(panel, -1, 1 , 1, 10, wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
-               double range[2];
-               this->_sceneManager->GetImageDataRange(range);
-
-               wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
-               vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-               int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
-               int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();      
-
-               _brithtnessWindowLevel                                  = new wxSlider(panel, -1, windowlevel , 1, range[1], wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-               _brithtnessColorLevel                                   = new wxSlider(panel, -1, colorwindow , 1, range[1], wxDefaultPosition, wxSize(180,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
-               _interpolationCheckBox = new wxCheckBox(panel, -1, _T("Image interpolation") );
-               _interpolationCheckBox->SetValue(true);
-
-               _interfaceConfigurationFrame->SetEventHandler( this );
-
-               Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
-               Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
-
-               Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-               Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-               Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-               Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-               Connect( _interpolationCheckBox->GetId()        ,       wxEVT_COMMAND_CHECKBOX_CLICKED    , (wxObjectEventFunction) &wxContourEventHandler::OnInterpolation             );
-
-               wxFlexGridSizer * sizer                                 = new wxFlexGridSizer(1);
-               sizer -> Add( new wxStaticText(panel,-1,_T("Contour width"))  , 1, wxGROW );
-               sizer -> Add( _withOfContourLine                , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T("Brightness of the image"))  , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T("--Window level--"))  , 1, wxGROW );
-               sizer -> Add( _brithtnessWindowLevel            , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T("--Color level--"))  , 1, wxGROW );
-               sizer -> Add( _brithtnessColorLevel, 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( _interpolationCheckBox            , 1, wxGROW );
-
-               panel->SetSizer( sizer );
-               //JCP 13-10-08
-               //panel->SetSize( sizepanel );
-               //13-10-08
-               panel->SetAutoLayout( true );
-               panel->Layout();
-
-               return panel;*/
-
-               wxPanel *panel                                                  = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString(_T("")));
-               _withOfContourLine                                              = new wxSlider(panel, -1, 1 , 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
-               double range[2];
-               this->_sceneManager->GetImageDataRange(range);
-
-               wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
-               vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-               int colorwindow = (int)imageviewer->GetWindowLevel()->GetLevel();
-               int windowlevel = (int)imageviewer->GetWindowLevel()->GetWindow();      
-
-               _brithtnessWindowLevel                                  = new wxSlider(panel, -1, windowlevel , 1, range[1], wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-               _brithtnessColorLevel                                   = new wxSlider(panel, -1, colorwindow , 1, range[1], wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-
-               _interpolationCheckBox = new wxCheckBox(panel, -1, _T("Image interpolation") );
-               _interpolationCheckBox->SetValue(true);         
-
-               Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
-               Connect( _withOfContourLine->GetId()            ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onWidthOfContour      ); 
-
-               Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-               Connect( _brithtnessWindowLevel->GetId()        ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-               Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_CHANGED    , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-               Connect( _brithtnessColorLevel->GetId()         ,       wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &wxContourEventHandler::onBrigthnessColorWindowLevel  ); 
-               Connect( _interpolationCheckBox->GetId()        ,       wxEVT_COMMAND_CHECKBOX_CLICKED    , (wxObjectEventFunction) &wxContourEventHandler::OnInterpolation             );
-
-               wxFlexGridSizer * sizer                                 = new wxFlexGridSizer(1);
-               sizer -> Add( new wxStaticText(panel,-1,_T("Contour width"))  , 1, wxGROW );
-               sizer -> Add( _withOfContourLine                , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T("Brightness of the image"))  , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T("--Window level--"))  , 1, wxGROW );
-               sizer -> Add( _brithtnessWindowLevel            , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T("--Color level--"))  , 1, wxGROW );
-               sizer -> Add( _brithtnessColorLevel, 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( _interpolationCheckBox            , 1, wxGROW );
-
-               panel->SetSizer( sizer );
-               //JCP 13-10-08
-               //panel->SetSize( sizepanel );
-               //13-10-08
-               panel->SetAutoLayout( true );
-               panel->Layout();
-
-               return panel;
-       }
-
-//**JCP 13-10-08
-
-       
-
-//------------------------------------------------------------------
-       void wxContourEventHandler :: changeContourOfManager(std::string keyName, Instant *instant)
-       {
-               this->_modelManager->ChangeContourOfList(keyName, instant);
-       }
-
-//------------------------------------------------------------------
-       void wxContourEventHandler :: changeContoursOfManager(  std::vector<std::string> & keyNamesVector  )
-       {
-
-               //JCP 20-10-08 Undo redo implementation
-               saveState();
-               //JCP 20-10-08 Undo redo implementation
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-               Instant instant(&tempVector);
-
-               int i , size=keyNamesVector.size();
-               for ( i=0 ; i<size ; i++ )
-               {
-                       changeContourOfManager(keyNamesVector[i], &instant);
-               } // i
-
-               
-       }
-
-
-//------------------------------------------------------------------
-       void wxContourEventHandler :: executeActionCommand( const char  toolCommand )
-       {
-               std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
-               int elementsSelected = currentSelection.size();
-               if( toolCommand == (wxContour_ActionCommandsID::CREATE_TOOL) )
-               {
-                       onCreateContourFrame();
-               }
-               if( toolCommand == (wxContour_ActionCommandsID::CREATE_CONTOUR_KEY) )
-               {
-                       createContour();
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::DELETE_TOOL )
-               {
-                       onDeleteFrame( );
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::DELETE_KEY )
-               {
-                       deleteContours( currentSelection );
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::SAVE_TOOL )
-               {
-                       saveFileWithContours(  );
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::SAVE_KEY )
-               {
-                       saveFileWithContoursAutomatique(  );
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::OPEN_TOOL )
-               {
-                       openFileWithContours(  );
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::CHANGE_TOOL )
-               {
-                       if ( elementsSelected >= 1 )
-                       {
-                               changeContoursOfManager( currentSelection );
-                       }
-
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::HIDE_TOOL )
-               {
-                       if ( elementsSelected >= 1 )
-                       {
-                               onHideOutlines( currentSelection );
-                       }                       
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::SHOW_TOOL )
-               {
-                       if ( elementsSelected >= 1 )
-                       {
-                               onShowOutlines( currentSelection );
-                       }
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::COPY_TOOL )
-               {
-                       if ( elementsSelected >= 1 )
-                       {
-                               onCopyOutlines( currentSelection );
-                       }
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::PASTE_TOOL )
-               {
-                       onPasteOutlines(  );                    
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::SPREAD_TOOL )
-               {
-                               onSpread();
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::AUTOMATIQUESEGMENTATION_TOOL )
-               {
-                       onAutomatiqueSegmentation(  );                  
-               }
-
-               else if( toolCommand == wxContour_ActionCommandsID::SELECT_TOOL )
-               {
-                       onSelectOutlines( currentSelection );
-                       
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::EDIT_TOOL )
-               {
-                       if ( elementsSelected >= 1 )
-                       {
-                               onEditOutlines( currentSelection );
-                       }
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::UNDO_TOOL )
-               {
-                       onUNDO();
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::REDO_TOOL )
-               {
-                       onREDO();
-               }               
-               else if( toolCommand == wxContour_ActionCommandsID::INFORMATIONCONTOUR_TOOL )
-               {
-                       onInformationContourFrame();
-               }               
-               else if( toolCommand == wxContour_ActionCommandsID::INTERFACECONFIGURATION_TOOL )
-               {
-                       onInterfaceConfigurationFrame();
-               }
-               else if( toolCommand == wxContour_ActionCommandsID::TEST_TOOL )
-               {
-                       onInterfaceTestFrame();
-               }               
-
-
-       }
-
-       
-       //------------------------------------------------------------------------------------------------------------
-       //  Getting information methods
-       //------------------------------------------------------------------------------------------------------------
-
-
-
-       //------------------------------------------------------------------------------------------------------------
-       //  Private methods
-       //------------------------------------------------------------------------------------------------------------
-   
-       void wxContourEventHandler :: updateInstantOutlines()
-       {
-               std::vector<NameWrapper *> namesWrapping = _modelManager->getActualInstantOutlines();
-               int size = namesWrapping.size();
-               _sceneManager->removeSceneContours();
-               for( int i=0; i<size; i++)
-               {                       
-                       _sceneManager->addToScene(namesWrapping[i]->getKeyName(), true, true, true, false, false );
-               }
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: updateInstantImageData()
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------
-
-       void wxContourEventHandler :: updateInstantAxes()
-       {
-               
-       }
-       //------------------------------------------------------------------------------------------------------------  
-       void wxContourEventHandler :: changeInstant()
-       {
-               std::vector<int> instantVect;
-               _instantPanel->getInstant( instantVect );
-               Instant * theInstant = new Instant ( &instantVect );
-               //if( !theInstant->isEquals( _actualInstant ))
-               {       
-                       //Setting the actual instant
-                       _actualInstant = theInstant;
-                       _modelManager->setInstant( _actualInstant );
-                       
-                       updateInstantOutlines();
-                       updateInstantImageData();
-                       updateInstantAxes();
-
-                       //Searching the elements at the specified instant
-
-                       /*
-                       std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
-                       iter = contours_ViewControl->find("Outline 0");
-                       (iter->second)->getViewer()->RemoveCompleteContourActor();*/
-               }
-       }
-
-       void wxContourEventHandler :: saveState(){
-               
-                       
-               inredo = 0;
-
-               //char str[9000];
-               //itoa(inundo, str, 10);
-               std::string str = intToString(inundo);
-
-
-               std::string temp = stundoredo + str + ".roi";
-               saveFileWithContours(temp);
-
-               inundo++;
-       }
-
-       void wxContourEventHandler ::loadState(std::string filename){
-
-               char tmp[255];
-               FILE *pFile=fopen(filename.c_str(),"r+");
-
-               fscanf(pFile,"%s",tmp); // --CreaContour--
-
-               fscanf(pFile,"%s",tmp); // Version
-               fscanf(pFile,"%s",tmp); // 1.0.1
-               std::string version(tmp);
-
-               deleteAllContours();
-
-               openContours(pFile,false);
-               if (version!="1.0.0"){
-                       openContours(pFile,true);
-               }
-
-               fclose(pFile);
-               
-               //_sceneManager->removeSceneContours();
-               //changeInstant();
-
-       }
-void wxContourEventHandler :: onREDO()
-       {
-               if(inredo > 0){
-                       inredo--;
-                       inundo++;
-
-                       //char str[9000];
-                       //itoa(inundo, str, 10);
-                       std::string str = intToString(inundo);
-
-            
-                       std::string temp = stundoredo + str + ".roi";
-               
-                       loadState(temp);
-
-                       
-               }
-
-       }
-       //------------------------------------------------------------------------------------------------------------
-       void wxContourEventHandler :: onUNDO()
-       {
-               if(inundo>0){
-                       if(inredo==0){
-
-                               //char str[9000];
-                               //itoa(inundo, str, 10);
-                               std::string str = intToString(inundo);
-
-                               std::string temp = stundoredo + str + ".roi";
-                               saveFileWithContours(temp);                             
-
-                       }
-                       inredo++;
-                       inundo--;
-
-                       //char str[9000];
-                       //itoa(inundo, str, 10);
-                       std::string str = intToString(inundo);
-
-            
-                       std::string temp = stundoredo + str + ".roi";
-               
-                       loadState(temp);
-               }
-       }
-//JCP 21 - 10 - 09
-       void  wxContourEventHandler :: getValuesXYZ(double **vectx, double **vecty, double **vectz, std::vector<int>* size){
-
-
-               wxBusyCursor wait;
-               ContourExtractData      *contourextractdata = new ContourExtractData();
-               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
-               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
-
-               std::vector<manualContourModel*> lstManConMod;
-               std::vector<manualContourModel*> lstManConModTmp;
-               std::vector<manualContourModel*> lstManConModExp;
-               std::vector<double> pLstValue;
-               std::vector<double> pLstValuePosX;
-               std::vector<double> pLstValuePosY;
-               std::vector<double> pLstValuePosZ;
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-               vtkImageData *imagedata = _sceneManager->GetImageData();
-               int sizeZ = _sceneManager->GetImageDataSizeZ();
-               int z;
-               int ii,sizeLstContourThings;
-
-
-               int minZ,maxZ;
-               double totalZ;
-               double porcent; 
-               wxString tmpString;
-               minZ    = 0;// _mbarrange->GetStart();
-               maxZ    = sizeZ;//_mbarrange->GetEnd();
-               totalZ  = maxZ-minZ+1;
-
-               contourextractdata->SetImage( imagedata);
-
-       // For each slice..
-               vectx = new double *[sizeZ];
-               vecty = new double *[sizeZ];
-               vectz = new double *[sizeZ];
-               for ( z=0 ; z<sizeZ ; z++)
-               {
-
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       
-                       //Extraction data from contours of each slice
-                       contourextractdata->SetZtoBeAnalys( z);
-
-                       tempVector[1]=z;
-                       Instant instant(&tempVector);
-                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-                       sizeLstContourThings = lstContourThings.size();
-
-                       lstManConMod.clear();
-                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                       {
-                               ContourThing **contourthing = lstContourThings[ii];
-                               lstManConMod.push_back( (*contourthing)->getModel() );
-                       }
-                       lstManConModExp =  ExploseEachModel( lstManConMod );
-
-
-//EED004
-
-                       int iContourGroup,sizeContourGroup;
-                       if (typeContourGroup==3) // contour separete
-                       {
-                               sizeContourGroup=lstManConModExp.size();
-                       } else {  // contour AND OR XOR
-                               sizeContourGroup=1;
-                       }
-
-                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
-                               lstManConModTmp.clear();
-                               if (typeContourGroup==3) // contour separete
-                               {
-                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
-                               } else {  // contour AND OR XOR
-                                       lstManConModTmp = lstManConModExp;
-                               }
-
-                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-                               pLstValue.clear();
-                               pLstValuePosX.clear();
-                               pLstValuePosY.clear();
-                               pLstValuePosZ.clear();
-                               contourextractdata->GetValuesInsideCrown(       &pLstValue,
-                                                                                                                       &pLstValuePosX,
-                                                                                                                       &pLstValuePosY,
-                                                                                                                       &pLstValuePosZ);
-
-                               
-                               int iLstValue,sizeLstValue=pLstValue.size();
-
-                               //We initialize the pointers
-                               size->push_back(sizeLstValue);
-                               vectx[sizeZ] = new double[sizeLstValue];
-                               vecty[sizeZ] = new double[sizeLstValue];
-                               vectz[sizeZ] = new double[sizeLstValue];
-                               
-                               for (iLstValue=0 ; iLstValue<sizeLstValue ; iLstValue++ )
-                               {
-                                       
-                                       vectx[sizeZ][iLstValue] = pLstValuePosX[iLstValue];
-                                       vecty[sizeZ][iLstValue] = pLstValuePosY[iLstValue];
-                                       vectz[sizeZ][iLstValue] = pLstValuePosZ[iLstValue];
-                                       
-                               }
-                               //The size of the contour is saved
-                               
-                               
-                               
-                               //fclose(pFile);
-                       } // for  iContourGroup
-               } // for z
-               //_staticTextInformation->SetLabel( _T("") );
-               delete contourextractdata;
-
-       }
-
-
-       void  wxContourEventHandler :: getMaskValue(vtkImageData* mask, vtkImageData* value){
-
-
-               wxBusyCursor wait;
-               ContourExtractData      *contourextractdata = new ContourExtractData( true );
-               int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
-               if (typeContourGroup==3)
-               {
-                       typeContourGroup=1;
-               }
-               contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
-
-               std::vector<manualContourModel*> lstManConMod;
-               std::vector<manualContourModel*> lstManConModTmp;
-               std::vector<manualContourModel*> lstManConModExp;
-
-               std::vector<int> tempVector;
-               _instantPanel->getInstant( tempVector );
-
-               vtkImageData *imagedata = _sceneManager->GetImageData();
-               int sizeZ = _sceneManager->GetImageDataSizeZ();
-               int z;
-               int ii,sizeLstContourThings;
-
-
-               int minZ,maxZ;
-               double totalZ;
-               double porcent; 
-
-               wxString tmpString;
-
-               minZ    = 0;// _mbarrange->GetStart();
-               maxZ    = sizeZ;//_mbarrange->GetEnd();
-               totalZ  = maxZ-minZ+1;
-
-               contourextractdata->SetImage( imagedata);
-
-       // For each slice..
-               for ( z=0 ; z<sizeZ ; z++)
-               {
-
-                       porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf(_T("Saving Values"));
-                       tmpString.Printf(_T("  %d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
-                       _staticTextInformation->SetLabel(tmpString);
-
-                       //Extraction data from contours of each slice
-                       contourextractdata->SetZtoBeAnalys( z);
-
-                       tempVector[1]=z;
-                       Instant instant(&tempVector);
-                       std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
-                       sizeLstContourThings = lstContourThings.size();
-
-                       lstManConMod.clear();
-                       for (ii=0 ; ii<sizeLstContourThings ; ii++)
-                       {
-                               ContourThing **contourthing = lstContourThings[ii];
-                               lstManConMod.push_back( (*contourthing)->getModel() );
-                       }
-                       lstManConModExp =  ExploseEachModel( lstManConMod );
-
-
-                       int iContourGroup,sizeContourGroup;
-                       if (typeContourGroup==3) // contour separete
-                       {
-                               sizeContourGroup=lstManConModExp.size();
-                       } else {  // contour AND OR XOR
-                               sizeContourGroup=1;
-                       }
-
-                       for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
-                               lstManConModTmp.clear();
-                               if (typeContourGroup==3) // contour separete
-                               {
-                                       lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
-                               } else {  // contour AND OR XOR
-                                       lstManConModTmp = lstManConModExp;
-                               }
-
-                               contourextractdata->SetLstManualContourModel( lstManConModTmp );
-
-
-                               contourextractdata->CalculateImageResult(); // with actual Z
-
-                       } // for  iContourGroup
-               } // for z
-
-
-
-// Image Value
-               value = contourextractdata->GetVtkImageValueResult();
-               
-// Image Mask
-               mask = contourextractdata->GetVtkImageMaskResult();
-               
-               delete contourextractdata;
-
-
-       }
-       wxPanel* wxContourEventHandler::getSegmentationPanelITK(wxWindow* parent){
-
-               int sizeZ = _sceneManager->GetImageDataSizeZ();
-               double range[2];
-               _sceneManager->GetImageDataRange(range);
-
-               wxPanel *panel                                          = new wxPanel(parent,-1);
-               wxButton *segmentationOneSliceBtn       = new wxButton(panel,-1,_T("Actual slice"), wxDefaultPosition, wxSize(200,35) );
-               wxButton *segmentationAllSliceBtn       = new wxButton(panel,-1,_T("All slices") ,wxDefaultPosition, wxSize(200,35) );
-               _isovalue                                                       = new wxSlider(panel, -1, 40 , (int)(range[0]), (int)(range[1]), wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-               _sampling                                                       = new wxSlider(panel, -1, 20 , 4, 50, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-               wxString lstOptions[3];
-               lstOptions[0]=_T("A");
-               lstOptions[1]=_T("B");
-               lstOptions[2]=_T("C");
-               methodRadiobox                                          = new wxRadioBox(panel, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxSize(200,45), 3 , lstOptions,  3, wxRA_SPECIFY_COLS);
-               methodRadiobox->SetSelection(2);
-               _staticTextSegmentation                         = new wxStaticText(panel,-1,_T("    "));
-
-
-               _mbarrange                                      =  new mBarRange(panel,70, 65);
-               _mbarrange->SetMin(0);
-               _mbarrange->SetStart(0);
-
-               _mbarrange-> SetOrientation( true );
-               _mbarrange-> setActiveStateTo(true);
-               _mbarrange-> setVisibleLabels( true );
-               _mbarrange-> setDeviceEndMargin(10);
-               _mbarrange-> setRepresentedValues( 0 , sizeZ );
-               _mbarrange-> setDeviceBlitStart(10,10); 
-               _mbarrange-> setIfWithActualDrawed( false );
-               _mbarrange-> SetStart( 0 );
-               _mbarrange-> SetEnd( sizeZ );  
-
-
-//                     _segmentationFrame->SetEventHandler( this );
-               segmentationOneSliceBtn->SetEventHandler( this );
-               segmentationAllSliceBtn->SetEventHandler( this );
-               Connect( segmentationOneSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationOneSliceITK ); 
-               Connect( segmentationAllSliceBtn->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onSegmentationAllSliceITK ); 
-
-               wxFlexGridSizer * sizer                         = new wxFlexGridSizer(1);
-               sizer -> Add( new wxStaticText(panel,-1,_T("Isovalue (Gray level)"))  , 1, wxGROW );
-               sizer -> Add( _isovalue , 1, wxGROW );
-               sizer -> Add( methodRadiobox , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T("Sampling (%)"))  , 1, wxGROW );
-               sizer -> Add( _sampling , 1, wxGROW );
-               sizer -> Add( segmentationOneSliceBtn , 1, wxGROW );
-               sizer -> Add( new wxStaticText(panel,-1,_T(" "))  , 1, wxGROW );
-               sizer -> Add( _staticTextSegmentation  , 1, wxGROW );
-               sizer -> Add( segmentationAllSliceBtn , 1, wxGROW );
-               sizer -> Add( _mbarrange  , 1, wxGROW );
-
-               panel->SetSizer( sizer );
-//             panel->SetSize( sizePanel );
-               panel->SetSize( wxDefaultSize );
-               panel->SetAutoLayout( true );
-               panel->Layout();
-               
-               return panel;
-               
-       }
-
-       void wxContourEventHandler::onSegmentationAllSliceITK( wxCommandEvent& event ){
-               //TODO implementar el método para todos los slices ver ayuda en onSegmentationAllSlice
-       }
-       void wxContourEventHandler::onSegmentationOneSliceITK( wxCommandEvent& event ){
-               //TODO implementar el método de segmentación en ITK ver ayuda en onSegmentationOneSlice y el método
-               // SegmentationOneSlice(x, y, z) que es la implementación del método en VTK
-
-               //JCP 20-10-08 Undo redo implementation
-               saveState();
-               //JCP 20-10-08 Undo redo implementation
-               
-               wxBusyCursor wait;
-               int                                     x                                       = this->_theViewPanel->GetX();
-               int                                     y                                       = this->_theViewPanel->GetY();
-               int                                     z                                       = this->_theViewPanel->GetZ();
-               //SegmentationOneSlice( x,y,z );
-               RefreshInterface();
-       }
-       void wxContourEventHandler::onSnakePressed(wxWindow* parent){
-
-               std::vector<double> vecX; 
-               std::vector<double> vecY; 
-               std::vector<double> vecZ; 
-               _sceneManager->GetPointsOfActualContour( &vecX , &vecY , &vecZ );       
-
-               if (vecX.size()!=0){
-                       std::vector<int> tempVector;
-                       _instantPanel->getInstant( tempVector );
-                       int i,size=vecZ.size();
-                       int actualSlice = tempVector[1];
-                       for ( i=0 ; i<size ; i++ )
-                       {
-                               vecZ[i] = actualSlice;
-                       } // for
-
-                       wxDialog* dialog = new wxDialog(parent, -1, wxString(_T("Snake")));
-                       wxPanel* panel = new wxPanel(dialog,-1); 
-                       wxStaticText* sttext = new wxStaticText(panel, -1, wxString(_T("Panel para snake")));
-                       dialog->ShowModal();
-               } // if 
-
-       }
-
-       void wxContourEventHandler::checkInformationPanel(){
-               if (_InformationContourFrame==NULL){
-                       onInformationContourFrame();
-                       _InformationContourFrame->Show(false);
-               }               
-       }
-
-       std::string wxContourEventHandler::intToString(int num){
-               std::string result;
-               if(num == 0){
-                       result = "0";
-               }else{
-                       int k=num;
-                       while (k > 0){
-                               char temp = k % 10 + 48;
-                               k = k / 10;
-                               result = temp + result; 
-                       }
-               }
-               return result;
-       }
-//JCP 21 - 10 - 09
diff --git a/lib/Interface_ManagerContour_NDimensions/_wxContourEventHandler.h_ b/lib/Interface_ManagerContour_NDimensions/_wxContourEventHandler.h_
deleted file mode 100644 (file)
index 813fecd..0000000
+++ /dev/null
@@ -1,357 +0,0 @@
-#ifndef __wxContourEventHandler_h_INCLUDED_H__
-#define __wxContourEventHandler_h_INCLUDED_H__
-
-
-// -----------------------------------------------------------------------------------------------------------
-// WX headers inclusion.
-// For compilers that support precompilation, includes <wx/wx.h>.
-// -----------------------------------------------------------------------------------------------------------
-
-#include <wx/wxprec.h>
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-#ifndef WX_PRECOMP
-#include <wx/wx.h>
-#endif
-
-#include <wx/grid.h>
-
-#include <sstream>
-//------------------------------------------------------------------------------------------------------------
-// Includes
-//------------------------------------------------------------------------------------------------------------
-#include "OutlineModelManager.h"
-#include "ContourWorkspace.h"
-#include "wxContourViewPanel.h"
-#include "wxInstantChooserPanel.h"
-#include "wxContour_ButtonsBar.h"
-#include "wxContour_Grid.h"
-#include "wxContour_DrawToolsPanel.h"
-#include "wxContour_OperationsToolsPanel.h"
-#include "wxContour_AutomaticFormsToolsPanel.h"
-#include "wxContour_StandardToolsPanel.h"
-#include "wxContour_EdtionToolsPanel.h"
-#include "wxContour_ListViewPanel.h"
-#include "wxContour_ActionCommandsID.h"
-#include "PerformingOperation.h"
-
-#include "ContourThing.h"
-#include "AxeThing.h"
-#include "ImageSourceThing.h"
-#include "ImageSectionThing.h"
-#include "InstantMembersNameList.h"
-#include "OutlineGroup.h"
-#include "SomeEnvironment.h"
-#include "ContourWorkspace.h"
-#include "ContourWrap_ViewControl.h"
-#include "Instant.h"
-
-#include "wxVtkBaseView_SceneManager.h"
-
-
-#include "ContourPropagation.h"
-#include "mBarRange.h"
-
-
-/** file wxContourEventHandler.h */
-
-
-
-class  PanelBullEyeOptions : public wxPanel {
-public:
-       PanelBullEyeOptions(wxWindow* parent, wxSize size);
-       ~PanelBullEyeOptions ();
-       void onRefreshPanel( wxCommandEvent& event );
-       int GetNumberOfCrowns();
-       int GetNumberOfSections(int nCrown);
-       int GetRadioOfCrown(int nCrown);
-       double GetAngOfCrownSection(int nCrown,int section);
-       double GetAngDeltaOfCrownSection(int nCrown);
-protected:
-
-private:
-       int                                                     _maxLevels;
-       int                                                     _maxSections;
-       wxRadioBox                                      *_radioboxBullEyeGenOpt;
-       wxSpinCtrl                                      *_spinctrlBullEyeNumOfCrowns;
-       wxSpinCtrl                                      *_spinctrlBullEyeNumOfSec;
-       wxSlider                                        *_sliderBullEyeAngle;
-       std::vector<wxSpinCtrl *>       _lstBullEyeDetailNumOfSec;
-       std::vector<wxSlider *>         _lstBullEyeDetailRadio;
-       std::vector<wxSlider *>         _lstBullEyeDetailAngle;
-
-
-       
-
-       void RefreshPanel();
-};
-
-
-
-
-//------------------------------------------------------------------------------------------------------------
-// Class definition
-//------------------------------------------------------------------------------------------------------------
-class wxContourEventHandler : public wxEvtHandler {
-
-       public:
-
-       //------------------------------------------------------------------------------------------------------------
-       // Constructors & Destructors
-       //------------------------------------------------------------------------------------------------------------
-       wxContourEventHandler();
-       ~wxContourEventHandler();
-
-       //------------------------------------------------------------------------------------------------------------
-       // Configuration methods
-       //------------------------------------------------------------------------------------------------------------
-       bool configureEventsHandling();
-       
-       //------------------------------------------------------------------------------------------------------------
-       // Methods for capturing events
-       //------------------------------------------------------------------------------------------------------------
-       void onProcessMessage( wxCommandEvent& event );
-       void onActionButtonPressed( wxCommandEvent& event );
-       void onChangedDeep ( wxCommandEvent& event );
-       void onChangeInstant( wxCommandEvent& event );
-       void onCreateMultipleROI( wxCommandEvent& event );
-       void onSelectMultipleROI( wxCommandEvent& event );
-       void onCreateROI( wxCommandEvent& event );
-       void onStopCreateROI( wxCommandEvent& event );
-       void onDeleterROI( wxCommandEvent& event );
-       void onSelectROI( wxCommandEvent& event );
-       void onUnSelectROI( wxCommandEvent& event );
-       void onManualHidedROI( wxCommandEvent& event );
-       void onManualShowedROI( wxCommandEvent& event );
-       void onEditingROI( wxCommandEvent& event );
-       void onMovingROI( wxCommandEvent& event );
-
-       //------------------------------------------------------------------------------------------------------------
-       //  Model management methods
-       //------------------------------------------------------------------------------------------------------------
-
-       void createCopyContourOf( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append = false );
-       void createContour( int typeContour=1 );
-       void deleteContour( std::string theKeyName );
-       void deleteContours( std::vector<std::string>  keyNamesVector );        
-       void deleteAllContours(  );     
-       void openContours( FILE *pFile, bool staticContour );
-       void openFileWithContours();
-       void saveFileWithContours();
-       void saveFileWithContours( std::string filename );
-       void saveFileWithContoursAutomatique();
-       void onSpread( );
-       void onSpreadInDepth( std::vector<std::string> & keyNamesVector );
-       void onAutomatiqueSegmentation( );
-       void onOutline_Union_Of( std::vector<std::string> & keyNamesVector );
-       void onOutline_Intersection_Of( std::vector<std::string> & keyNamesVector );
-       void onOutline_Combination_Of( std::vector<std::string> & keyNamesVector );
-       void onOutline_Fragmentation_Of( std::vector<std::string> & keyNamesVector );
-       void onOutline_Agrupation_Of( std::vector<std::string> & keyNamesVector );
-       void onCopyOutlines( std::vector<std::string> & keyNamesVector );
-       void onPasteOutlines(  );
-       void onShowOutlines( std::vector<std::string> & keyNamesVector );
-       void onHideOutlines( std::vector<std::string> & keyNamesVector );
-       void onSelectOutlines( std::vector<std::string> & keyNamesVector );
-       void onEditOutlines( std::vector<std::string> & keyNamesVector );
-       void onREDO();
-       void onUNDO();
-       void changeContourOfManager(std::string keyName, Instant *instant);
-       void changeContoursOfManager(std::vector<std::string> & keyNamesVector);
-
-       
-       //------------------------------------------------------------------------------------------------------------
-       //  Attributes getters and setters
-       //------------------------------------------------------------------------------------------------------------
-       void setModelManager( OutlineModelManager * theModelManager );
-       void setViewPanel(  wxContourViewPanel * theViewPanel );
-       void setInstantChooserPanel(  wxInstantChooserPanel * theInstantChooserPanel );
-       void setButtonsBar(  wxContour_ButtonsBar * theButtonsBar );
-       void setGrid(  wxContour_Grid * theGridPanel );
-       void setDrawToolsPanel(  wxContour_DrawToolsPanel * theDrawToolsPanel );
-       void setOperationsToolsPanel(  wxContour_OperationsToolsPanel * theDrawToolsPanel );
-       void setAutomaticFormsPanel(  wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
-       void setStandardToolsPanel(  wxContour_StandardToolsPanel * theStandardToolsPanel );
-       void setEditionToolsPanel(  wxContour_EdtionToolsPanel * theEditionToolsPanel );
-       void setListViewPanel(  wxContour_ListViewPanel * theListViewPanel );
-
-       //------------------------------------------------------------------------------------------------------------
-       //  Other functional methods
-       //------------------------------------------------------------------------------------------------------------
-       void executeActionCommand( const char  toolCommand );
-
-       //------------------------------------------------------------------------------------------------------------
-       //  Getting information methods
-       //------------------------------------------------------------------------------------------------------------
-
-       //------------------------------------------------------------------------------------------------------------
-       //  Responding Spread Tools 
-       //------------------------------------------------------------------------------------------------------------
-       void onSpreadReset( wxCommandEvent& event );
-       void onSpreadAdd( wxCommandEvent& event );
-       void onSpreadGo( wxCommandEvent& event );
-       
-       void onSegmentationAllSlice( wxCommandEvent& event );
-       void onSegmentationOneSlice( wxCommandEvent& event );
-       void SegmentationOneSlice( int x, int y, int z );
-
-
-       void onTest( wxCommandEvent& event );
-       void onTestReset( wxCommandEvent& event );
-       void onTestAdd( wxCommandEvent& event );
-       void onTestGo( wxCommandEvent& event );
-
-
-       void onCreateContourSpline( wxCommandEvent& event );
-       void onCreateContourRectangle( wxCommandEvent& event );
-       void onCreateContourCircle( wxCommandEvent& event );
-       void onCreateContourBullEye( wxCommandEvent& event );
-       void onCreateContourFrame( );
-       void onDeleteFrame( );
-       void onDeleteContour( wxCommandEvent& event );
-       void onDeleteContoursActSlice( wxCommandEvent& event );
-       void onDeleteAllContours( wxCommandEvent& event );
-       void onInformationContourFrame();
-       void onInformationContourLabels( wxCommandEvent& event );
-       void onExtractInformation( wxCommandEvent& event );
-       void onSaveResults( wxCommandEvent& event );
-       void onInterfaceConfigurationFrame();
-       void onWidthOfContour(wxScrollEvent& event);
-       void onBrigthnessColorWindowLevel(wxScrollEvent& event);
-       void OnInterpolation(wxCommandEvent& event);
-
-       void onInterfaceTestFrame();
-
-       void SaveValuesXYZ(std::string directory,std::string namefile);
-       void SaveImageResult(std::string directory,std::string namefile);
-
-/**
-**     JCP 13-10-08 This methods group the diferent kind of panels
-**/
-       wxPanel* getInformationPanel(wxWindow* parent);
-       wxPanel* getConfigurationPanel(wxWindow* parent);
-       wxPanel* getSegmentationPanel(wxWindow* parent);
-       wxPanel* getSegmentationPanelITK(wxWindow* parent);
-       wxPanel* getSpreadPanel(wxWindow* parent);
-       void onSegmentationAllSliceITK( wxCommandEvent& event );
-       void onSegmentationOneSliceITK( wxCommandEvent& event );
-       void onSnakePressed(wxWindow* parent);
-
-       void showAxis(bool show);
-//JCP 13-10-09 Fill grid as public
-       void FillGridWithContoursInformation();
-//JCP 13-10-09
-//JCP 16-10-09
-       void createContourBullsEye(PanelBullEyeOptions* panel );
-
-       //void getValuesXYZ(std::vector<double *>* vectx, std::vector<double*>* vecty, std::vector<double*>* vectz, std::vector<int>* size);
-//JCP 22-10-09
-       /**
-       **      This method gets the information of the contours in each slice
-       **/
-       void getValuesXYZ(double ** vectx, double ** vecty, double ** vectz, std::vector<int>* size);
-       /**
-       **      This method gets the mask and value images generated by the contours
-       **/
-       void getMaskValue(vtkImageData* mask, vtkImageData* value);
-       /**This Method checks for the information panel, it initalizes all the values 
-       ** in the controls so they can be retreived
-       **/
-       void checkInformationPanel();
-//JCP 22-10-09
-
-//JCP 16-10-09
-
-
-private:
-       //------------------------------------------------------------------------------------------------------------
-       //  Private methods
-       //------------------------------------------------------------------------------------------------------------
-       void updateInstantOutlines();
-       void updateInstantImageData();
-       void updateInstantAxes();
-       void changeInstant();
-       void RefreshInterface();
-
-       // EED
-//JCP 13-10-09 must be a public method
-       //void FillGridWithContoursInformation();
-//JCP 13-10-09
-       manualContourModel * factoryManualContourModel(int typeContour);
-       manualContourModel * factoryManualContourModel(PanelBullEyeOptions* panel);
-       std::vector<manualContourModel*> ExploseEachModel( std::vector<manualContourModel*> lstManConMod );
-
-       //------------------------------------------------------------------------------------------------------------
-       // Attributtes
-       //------------------------------------------------------------------------------------------------------------
-
-       wxContourViewPanel                                      * _theViewPanel;
-       OutlineModelManager                                     * _modelManager;
-       ContourWorkspace                                        * _workSpace;
-       wxInstantChooserPanel                           * _instantPanel;
-       wxContour_ButtonsBar                            * _buttonsBar;
-
-       wxVtkBaseView_SceneManager                      * _sceneManager;
-       
-       Instant                                                         * _actualInstant;
-       wxContour_Grid                                          * _gridPanel;
-       wxContour_DrawToolsPanel                        * _drawToolsPanel;
-       wxContour_OperationsToolsPanel          * _operationsToolsPanel;
-       wxContour_AutomaticFormsToolsPanel      * _autoFormsPanel; 
-       wxContour_StandardToolsPanel            * _standardToolsPanel;
-       wxContour_EdtionToolsPanel                      * _editionToolsPanel;
-       wxContour_ListViewPanel                         * _listViewPanel;
-
-       /*DECLARE_CLASS(wxContourMainFrame)
-       // any class wishing to process wxWindows events must use this macro
-       DECLARE_EVENT_TABLE()*/
-       bool                                                            _creatingContoursActive;
-       PerformingOperation                                     * _performingOperation;
-
-       // Interface EED
-       wxFrame                                                         *_spreadFrame;
-       wxFrame                                                         *_segmentationFrame;
-       wxFrame                                                         *_createContourFrame;
-       wxFrame                                                         *_deleteFrame;
-       wxFrame                                                         *_InformationContourFrame;
-       wxFrame                                                         *_interfaceConfigurationFrame;
-       wxFrame                                                         *_TestFrame;
-       wxTextCtrl                                                      * _wxtextctrlTest;
-
-       std::string                                                     fileNameContourROI; 
-
-       wxRadioBox                                                      *methodRadiobox;
-       ContourPropagation                                      *_contourPropagation;
-       wxSlider                                                        *_isovalue;
-       wxSlider                                                        *_sampling;
-       wxStaticText                                            *_staticTextSegmentation;
-       mBarRange                                                       *_mbarrange;
-       wxTextCtrl                                                      *_wxtextctrlSpread;
-       wxRadioBox                                                      *_informationRadiobox;
-       wxListCtrl                                                      *_wxlistctrl;
-       wxGrid                                                          *_grid; 
-       wxStaticText                                            *_staticTextInformation;
-       mBarRange                                                       *_mbarrangeSliceInformation;
-       mBarRange                                                       *_mbarrangeRangeInformation;
-       wxSlider                                                        *_withOfContourLine; 
-       wxSlider                                                        *_brithtnessWindowLevel;
-       wxSlider                                                        *_brithtnessColorLevel;
-       mBarRange                                                       *_mbarrangeDeleteAll;
-       wxCheckBox                                                      *_interpolationCheckBox;
-       wxRadioBox                                                      *_spreadMethodRadiobox;
-       wxRadioBox                                                      *_radiolstboxContourGroup;
-       wxStaticText                                            *_staticTextSpread;
-       PanelBullEyeOptions                                     *_panelBullEyeOptions;
-       int                                                                     _numberOfVariablesStatistics;
-
-       int                                                     inundo;
-       int                                                     inredo;
-       std::string                                     stundoredo;
-
-       void                                            saveState();
-       void                                            loadState(std::string filename);
-
-       std::string intToString(int num);
-};
-#endif // __wxContourEventHandler_HEADER_FILE__