]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx
#2490 creaMaracasVisu Feature New High - Histogram Interaction
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ThresholdImageView / ColorLayerImageViewPanel.cxx
index 0d6884263cc68598205d6c8d8b58779c20721216..ffabba162bf8ae6dbba8fbfd61921eb36bb1d96b 100644 (file)
@@ -1,4 +1,27 @@
-
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
 
 /**
  *  \file
 #include "OpenImageDialog.h"
 
 
+//---------------------------------------------------------
+//---------------------------------------------------------
+//---------------------------------------------------------
+
 wxDlgTransformByDimensionBySpacingByPixel::wxDlgTransformByDimensionBySpacingByPixel()
 {
 }
@@ -21,7 +48,7 @@ wxDlgTransformByDimensionBySpacingByPixel::~wxDlgTransformByDimensionBySpacingBy
 
 void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *parent , wxString message,int &typeOfTransformation,bool &dlgWxOK)
 {
-       wxDialog* dial                  = new wxDialog (parent,-1,_T("Tools"),wxDefaultPosition, wxSize(590,190));
+       wxDialog* dial                          = new wxDialog (parent,-1,_T("Tools"),wxDefaultPosition, wxSize(590,190));
        wxSizer* buttonsSizer   = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
        wxBoxSizer *dialSizer   = new wxBoxSizer(wxVERTICAL);
 
@@ -42,44 +69,56 @@ void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *paren
        dial->ShowModal();
 
        typeOfTransformation    = -1;
-       dlgWxOK                                 = false;
+       dlgWxOK                 = false;
 
        if (dial->GetReturnCode() == wxID_OK)
        {
-               typeOfTransformation    = radioOpts->GetSelection();
-               dlgWxOK                         = true;
+               typeOfTransformation    = radioOpts->GetSelection() + 1;
+               dlgWxOK                 = true;
        }
 }
 
-//---------------------------------------------------------
 
+//---------------------------------------------------------
+//---------------------------------------------------------
+//---------------------------------------------------------
 
 
 /**
  ** Begin of the threshold panel
  **/
 ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max, int type)
-: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
+: wxPanel(parent, -1, wxDefaultPosition, wxSize(600,100), wxBORDER_SUNKEN)
 {
+       printf("EED ColorLayerImageViewPanel::ColorLayerImageViewPanel start \n");
+
        _spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
        _dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
 
-       _colorLayerImageView    = new ColorLayerImageView();
+//EED01        _colorLayerImageView            = new ColorLayerImageView();
+       _colorLayerImageViewManager     = new ColorLayerImageViewManager();
+
        _btn_ReadImage                  = new wxButton(this, wxID_ANY, _T("Read Image") );
        _thresholdGo                    = true;
-       _cb_ShowHide                    = new wxCheckBox(this, wxID_ANY, _T("Show/Hide layer") );
+       _cb_ShowHide                    = new wxCheckBox(this, wxID_ANY, _T("Show/Hide Layer") );
        _cb_ShowHide->SetValue(_thresholdGo);
 
-       _cb_SliceFixDinamic = new wxCheckBox(this, wxID_ANY, _T("Slice Fix/Dinamic") );
+       _cb_SliceFixDinamic = new wxCheckBox(this, wxID_ANY, _T("Fixed/Dynamic Slice") );
        _cb_SliceFixDinamic->SetValue(true);
 
-       _sl_SliceImage = new wxSlider(this, wxID_ANY, 0, 1000, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
-       _sl_SliceImage->Enable(false);
-
-       _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") );
+       _sl_SliceImageX = new wxSlider(this, wxID_ANY, 0, 1000, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+       _sl_SliceImageY = new wxSlider(this, wxID_ANY, 0, 1000, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+       _sl_SliceImageZ = new wxSlider(this, wxID_ANY, 0, 1000, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+       _sl_SliceImageX->Enable(false);
+       _sl_SliceImageY->Enable(false);
+       _sl_SliceImageZ->Enable(false);
+       _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image Interpolation") );
        _interpolationCheckBox->SetValue(true);
        _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
 
+       _histogram                                      = new Histogram(  this , -1, wxPoint(0,0), wxSize(400,400), /*wxNO_BORDER*/ wxBORDER_DEFAULT ); 
+       _histogramMinMaxLevel   = new HistogramMinMaxLevel( (HistogramBase*)_histogram );
+
        if (type==0)
        {
        }
@@ -90,39 +129,58 @@ ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, in
 
 
        Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage );
-       Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow );
+       Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED  , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow );
        Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation );
        Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
        Connect( _cb_SliceFixDinamic->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceFixDinamic );
-       Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_THUMBTRACK       , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
-       Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_LINEUP           , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
-       Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_LINEDOWN         , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
-       Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_PAGEUP           , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
-       Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_PAGEDOWN         , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
 
+       Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_THUMBTRACK      , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_LINEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_LINEDOWN                , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_PAGEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_PAGEDOWN                , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+
+       Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_THUMBTRACK      , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_LINEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_LINEDOWN                , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_PAGEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_PAGEDOWN                , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+
+       Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_THUMBTRACK      , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_LINEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_LINEDOWN                , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEUP          , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+       Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEDOWN                , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
 
        wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
        if (type==1)
        {
-               sizer -> Add( new wxStaticText(this,-1,_T("Color Image Layer"))  , 1, wxGROW );
-               sizer -> Add( _btn_ReadImage, 1, wxGROW );
-               sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
+               sizer -> Add( new wxStaticText(this,-1,_T("Color Image Layer"))         , 1, wxGROW );
+               sizer -> Add( _btn_ReadImage                                                                                                    , 1, wxGROW );
+               sizer -> Add( new wxStaticText(this,-1,_T(" "))                                                 , 1, wxGROW );
        }
-       sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level"))  , 1, wxGROW );
-       sizer -> Add( _opacity, 1, wxGROW );
-       sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
-       sizer -> Add( _cb_ShowHide, 1, wxGROW );
-       sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
-       sizer -> Add( _interpolationCheckBox, 1, wxGROW );
-
-       sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
-       sizer -> Add( new wxStaticText(this,-1,_T("Slice "))  , 1, wxGROW );
-       sizer -> Add( _sl_SliceImage, 1, wxGROW );
-       sizer -> Add( _cb_SliceFixDinamic, 1, wxGROW );
+       sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level"))                     , 1, wxGROW );
+       sizer -> Add( _opacity                                                                                                                          , 1, wxGROW );
+       sizer -> Add( new wxStaticText(this,-1,_T(" "))                                                         , 1, wxGROW );
+       sizer -> Add( _cb_ShowHide                                                                                                                      , 1, wxGROW );
+       sizer -> Add( new wxStaticText(this,-1,_T(" "))                                                         , 1, wxGROW );
+       sizer -> Add( _interpolationCheckBox                                                                                    , 1, wxGROW );
+
+       sizer -> Add( new wxStaticText(this,-1,_T(" "))                                                         , 1, wxGROW );
+       sizer -> Add( new wxStaticText(this,-1,_T("Slice "))                                    , 1, wxGROW );
+       sizer -> Add( _sl_SliceImageX                                                                                                           , 1, wxGROW );
+       sizer -> Add( _sl_SliceImageY                                                                                                           , 1, wxGROW );
+       sizer -> Add( _sl_SliceImageZ                                                                                                           , 1, wxGROW );
+       sizer -> Add( _cb_SliceFixDinamic                                                                                               , 1, wxGROW );
+       sizer -> Add( _histogramMinMaxLevel->GetWindow()                                                        , 1, wxGROW );
 
        this->SetSizer( sizer );
        this->SetAutoLayout( true );
        this->Layout();
+     
+       //CM Sets the default fitting mode to Pixel mode.
+       _fitting_mode = 3;
+       // EO CM
 }
 
 //----------------------------------------------------------------------------
@@ -131,16 +189,23 @@ ColorLayerImageViewPanel::~ColorLayerImageViewPanel()
 }
 
 
-//----------------------------------------------------------------------------
-void ColorLayerImageViewPanel::SetColorLayerImageView(ColorLayerImageView* colorLayerImageView)
-{
-       _colorLayerImageView = colorLayerImageView;
-}
+//EED01  
+//EED01  //----------------------------------------------------------------------------
+//EED01  void ColorLayerImageViewPanel::SetColorLayerImageView(ColorLayerImageView* colorLayerImageView)
+//EED01  {
+//EED01        _colorLayerImageView = colorLayerImageView;
+//EED01  }
+//EED01  
+//EED01  //----------------------------------------------------------------------------
+//EED01  ColorLayerImageView* ColorLayerImageViewPanel::GetColorLayerImageView()
+//EED01  {
+//EED01        return _colorLayerImageView;
+//EED01  }
 
-//----------------------------------------------------------------------------
-ColorLayerImageView* ColorLayerImageViewPanel::GetColorLayerImageView()
+
+ColorLayerImageViewManager* ColorLayerImageViewPanel::GetColorLayerImageViewManager()
 {
-       return _colorLayerImageView;
+   return _colorLayerImageViewManager;
 }
 
 
@@ -173,162 +238,235 @@ void ColorLayerImageViewPanel::SetBaseDimension(int dim[3])
 }
 
 //----------------------------------------------------------------------------
-void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event)
+void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
 {
-// EED ???
-//      creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
-//      w.ShowModal();
-       printf("EED ColorLayerImageViewPanel::onReadImage ....WARNING... Read dlg. all images creaImageIO ... ???\n");
+    if (img!=NULL)
+    {
+                       _histogramMinMaxLevel->Configure( img );
+        _colorLayerImageViewManager->SetImage( img );
+
+        double spc[3];
+        img->GetSpacing(spc);
+
+        int dim[3];
+        int ext[6];
+        img->GetWholeExtent(ext);
+        dim[0] = ext[1]-ext[0];
+        dim[1] = ext[3]-ext[2];
+        dim[2] = ext[5]-ext[4];
+        _sl_SliceImageX->SetRange( 0 , dim[0] );
+        _sl_SliceImageY->SetRange( 0 , dim[1] );
+        _sl_SliceImageZ->SetRange( 0 , dim[2] );
+
+        if ( (spc[0]!=_spcBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) ||
+             (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2])
+            )
+        {
+         // CM
+         int typeOfTransformation;     
+         // In case of the option is set to create a dialog box.
+         if (_fitting_mode == -1)
+           {
+             bool transformOkDlg;
+             wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? ");
+             wxDlgTransformByDimensionBySpacingByPixel dlg;
+             dlg.GetTransformType(this,msg,typeOfTransformation,transformOkDlg);
+             // CM Reset the default value (Pixel i.e. 3) if the dialog box returned an inappropriate value.
+             if (transformOkDlg == false)
+               typeOfTransformation = 3;
+           }
+         else
+           typeOfTransformation = _fitting_mode;
+         //EO CM
+
+         printf("EED ColorLayerImageViewPanel::onReadImage call dialog spc size,dim...???\n");
+
+            if (typeOfTransformation==1)  // make dimensions equals
+            {
+                printf("EED ColorLayerImageViewPanel::onReadImage ...WARNNING.... dif size image spc*dim ofnew image ...???\n");
+                spc[0]=_spcBase[0]*_dimBase[0]/dim[0];
+                spc[1]=_spcBase[1]*_dimBase[1]/dim[1];
+                spc[2] = 1;
+            }
+
+            if (typeOfTransformation==2)  // make spacing equals
+            {
+                spc[0] = ( _spcBase[0]/spc[0] ) * _spcOrg[0];
+                spc[1] = ( _spcBase[1]/spc[1] ) * _spcOrg[1];
+                spc[2] = ( _spcBase[2]/spc[2] ) * _spcOrg[2];
+            }
+
+            if (typeOfTransformation==3)  // make spacing = 1
+            {
+                spc[0] = 1;
+                spc[1] = 1;
+                spc[2] = 1;
+            }
+
+            img->SetSpacing(spc);
+        } // spc !_spcBase   dim!__dimBase
+
+//EED01        if (_colorLayerImageView!=NULL)
+//EED01        {
+//EED01            _colorLayerImageView->onThreshold();
+               if (_active==true)
+               {
+                   _colorLayerImageViewManager->onThreshold();
+                RefreshView();
+               }
+//EED01        }
 
-       creaMaracasVisuKernel::OpenImageDialog diag = creaMaracasVisuKernel::OpenImageDialog();
-       _colorLayerImageView->SetImage( diag.getImageData() );
-
-       double spc[3];
-       diag.getImageData()->GetSpacing(spc);
-
-       int dim[3];
-       int ext[6];
-       diag.getImageData()->GetWholeExtent(ext);
-       dim[0] = ext[1]-ext[0];
-       dim[1] = ext[3]-ext[2];
-       dim[2] = ext[5]-ext[4];
-       _sl_SliceImage->SetRange( 0 , dim[2] );
-
-       if ( (spc[0]!=_spcBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) ||
-                (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2])
-               )
-       {
 
-               bool transformOkDlg;
-               int typeOfTransformation;
-               wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? ");
-           wxDlgTransformByDimensionBySpacingByPixel dlg;
-               dlg.GetTransformType(this,msg,typeOfTransformation,transformOkDlg);
+    }
+}
 
-printf("EED ColorLayerImageViewPanel::onReadImage call dialog spc size,dim...???\n");
 
-               if (typeOfTransformation==0)  // make dimensions equals
-               {
-                       printf("EED ColorLayerImageViewPanel::onReadImage ...WARNNING.... dif size image spc*dim ofnew image ...???\n");
-                       spc[0]=_spcBase[0]*_dimBase[0]/dim[0];
-                       spc[1]=_spcBase[1]*_dimBase[1]/dim[1];
-                       spc[2] = 1;
-               }
+void ColorLayerImageViewPanel::RefreshView()
+{
+//EED01        _colorLayerImageView->Refresh();
+       _colorLayerImageViewManager->Refresh();
+}
 
-               if (typeOfTransformation==1)  // make spacing equals
-               {
-                       spc[0] = ( _spcBase[0]/spc[0] ) * _spcOrg[0];
-                       spc[1] = ( _spcBase[1]/spc[1] ) * _spcOrg[1];
-                       spc[2] = ( _spcBase[2]/spc[2] ) * _spcOrg[2];
-               }
+//----------------------------------------------------------------------------
+void ColorLayerImageViewPanel::SetFittingMode(int fitting_mode)
+{
+  // CM Sets the fitting mode if an appropriate value is provided.
+  if (fitting_mode == -1 || fitting_mode == 1 || fitting_mode == 2 || fitting_mode == 3)
+    {
+      _fitting_mode = fitting_mode;
+    }
+  //Otherwise, an exception should be thrown (value 0 is fine, it corresponds to an empty field i.e. the default value is kept).
+  else if (fitting_mode != 0)
+    std::cout << "CM ERROR!!! The fitting mode provided has an inappropriate value. It should be an int between -1 ; 1 ; 2 ; 3, but its value is :" << fitting_mode << ". The default value will be set instead, i.e. Pixel transformation (3)." <<  std::endl;
+  //EO CM
+}
 
-               if (typeOfTransformation==2)  // make spacing = 1
-               {
-                       spc[0] = 1;
-                       spc[1] = 1;
-                       spc[2] = 1;
-               }
+//----------------------------------------------------------------------------
+int ColorLayerImageViewPanel::GetFittingMode()
+{
+  return _fitting_mode;
+}
 
-               diag.getImageData()->SetSpacing(spc);
-       } // spc !_spcBase   dim!__dimBase
+//----------------------------------------------------------------------------
+void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event)
+{
+// EED ???
+//      creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
+//      w.ShowModal();
+       printf("EED ColorLayerImageViewPanel::onReadImage ....WARNING... Read dlg. all images creaImageIO ... ???\n");
 
-       if (_colorLayerImageView!=NULL)
-       {
-        _colorLayerImageView->onThreshold();
-        _colorLayerImageView->Refresh();
-       }
+       creaMaracasVisuKernel::OpenImageDialog diag = creaMaracasVisuKernel::OpenImageDialog();
+       SetImage( diag.getImageData() );
 }
 
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onThresholdChange(wxCommandEvent& event)
 {
-       if (_colorLayerImageView!=NULL)
-       {
-        if (_thresholdGo)
-        {
-            _colorLayerImageView->onThresholdChange();
-            _colorLayerImageView->Refresh();
-            //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal  << std::endl;
-        } // _threshold
-       }//_colorLayerImageView
+//EED01        if (_colorLayerImageView!=NULL)
+//EED01        {
+               if (_thresholdGo)
+               {
+//EED01                 _colorLayerImageView->onThresholdChange();
+                _colorLayerImageViewManager->onThresholdChange();
+                RefreshView();
+               //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal  << std::endl;
+          } // _thresholdGo
+//EED01        }//_colorLayerImageView
 }
 
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onThresholdShow(wxCommandEvent& event)
 {
-       if (_colorLayerImageView!=NULL)
-       {
+//EED01        if (_colorLayerImageView!=NULL)
+//EED01        {
         _thresholdGo = _cb_ShowHide->GetValue();
         if (_thresholdGo)
         {
-            _colorLayerImageView->onThreshold();
+//EED01            _colorLayerImageView->onThreshold();
+                   _colorLayerImageViewManager->onThreshold();
         }else{
-            _colorLayerImageView->onThresholdRemove( );
+//EED01            _colorLayerImageView->onThresholdRemove( );
+                   _colorLayerImageViewManager->onThresholdRemove( );
         }
-        _colorLayerImageView->Refresh();
-       }//_colorLayerImageView
+            RefreshView();
+//EED01        }//_colorLayerImageView
 }
 
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onThresholdStop()
 {
-       if (_colorLayerImageView!=NULL)
-       {
-        if (_thresholdGo)
-        {
-            _colorLayerImageView->onThresholdRemove( );
-            _thresholdGo=false;
-        }
-       }//_colorLayerImageView
+//EED01        if (_colorLayerImageView!=NULL)
+//EED01        {
+               if (_thresholdGo)
+               {
+//EED01                    _colorLayerImageView->onThresholdRemove( );
+                   _colorLayerImageViewManager->onThresholdRemove( );
+                   _thresholdGo=false;
+               }
+//EED01        }//_colorLayerImageView
 }
 
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onThresholdInterpolation(wxCommandEvent& event)
 {
-       if (_colorLayerImageView!=NULL)
-       {
-        _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue());
-        _colorLayerImageView->Refresh();
-       }//_colorLayerImageView
+//EED01        if (_colorLayerImageView!=NULL)
+//EED01        {
+//EED01                _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue());
+          _colorLayerImageViewManager->onThresholdInterpolation(_interpolationCheckBox->GetValue());
+               RefreshView();
+//EED01        }//_colorLayerImageView
 }
 
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onSliceFixDinamic(wxCommandEvent& event)
 {
-       if (_colorLayerImageView!=NULL)
-       {
+//EED01        if (_colorLayerImageView!=NULL)
+//EED01        {
         bool fixdin = _cb_SliceFixDinamic->GetValue();
-        _colorLayerImageView->SetSliceFixDinamic( fixdin );
+//EED01        _colorLayerImageView->SetSliceFixDynamic( fixdin );
+        _colorLayerImageViewManager->SetSliceFixDynamic( fixdin );
         if (fixdin==false)
         {
-            _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
+//EED01            _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
+            _colorLayerImageViewManager->SetX2( _sl_SliceImageX->GetValue() );
+            _colorLayerImageViewManager->SetY2( _sl_SliceImageY->GetValue() );
+            _colorLayerImageViewManager->SetZ2( _sl_SliceImageZ->GetValue() );
         }
-        _sl_SliceImage->Enable(!fixdin);
-        _colorLayerImageView->onThreshold();
-        _colorLayerImageView->Refresh();
-       }//_colorLayerImageView
+        _sl_SliceImageX->Enable(!fixdin);
+        _sl_SliceImageY->Enable(!fixdin);
+        _sl_SliceImageZ->Enable(!fixdin);
+//EED01        _colorLayerImageView->onThreshold();
+        _colorLayerImageViewManager->onThreshold();
+       RefreshView();
+//EED01        }//_colorLayerImageView
 }
 
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onSliceImage(wxScrollEvent& event)
 {
-       if (_colorLayerImageView!=NULL)
-       {
-        _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
-        _colorLayerImageView->onThreshold();
-        _colorLayerImageView->Refresh();
-       }//_colorLayerImageView
+//EED01        if (_colorLayerImageView!=NULL)
+//EED01        {
+//EED01        _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
+//EED01        _colorLayerImageView->onThreshold();
+//EED01        RefreshView();
+         _colorLayerImageViewManager->SetX2( _sl_SliceImageX->GetValue() );
+         _colorLayerImageViewManager->SetY2( _sl_SliceImageY->GetValue() );
+         _colorLayerImageViewManager->SetZ2( _sl_SliceImageZ->GetValue() );
+         _colorLayerImageViewManager->onThreshold();
+       RefreshView();
+//EED01        }//_colorLayerImageView
 }
 
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onChangeOpacity(wxScrollEvent& event)
 {
-       if (_colorLayerImageView!=NULL)
-       {
+//EED01        if (_colorLayerImageView!=NULL)
+//EED01        {
         int opacity = _opacity->GetValue();
-        _colorLayerImageView->onThresholdChangeOpacity(opacity);
-        _colorLayerImageView->Refresh();
-       }//_colorLayerImageView
+//EED01        _colorLayerImageView->onThresholdChangeOpacity(opacity);
+        _colorLayerImageViewManager->onThresholdChangeOpacity(opacity);
+       RefreshView();
+//EED01        }//_colorLayerImageView
 }
 
 
@@ -338,6 +476,12 @@ bool ColorLayerImageViewPanel::IsVisible()
        return _thresholdGo;
 }
 
+//----------------------------------------------------------------------------
+void ColorLayerImageViewPanel::SetActive(bool active)
+{
+      _active=active;
+      _cb_ShowHide->SetValue( _active );
+}
 
 
 // EOF