]> Creatis software - creaMaracasVisu.git/commitdiff
#2723 creaMaracasVisu Feature New Normal - ColorLayer new simple interface with...
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 23 Oct 2015 16:08:52 +0000 (18:08 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 23 Oct 2015 16:08:52 +0000 (18:08 +0200)
bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx
bbtk/src/bbcreaMaracasVisuColorLayerImageView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx

index d5860d92d6af3fd12b7d7cb48a46fa25941df569..b4922c6339ae2cf3196c60e6f418f94926897b73 100644 (file)
@@ -91,7 +91,7 @@ void ColorLayerImageView::Process()
 //=====
 void ColorLayerImageView::CreateWidget(wxWindow* parent)
 {
-  ColorLayerImageViewPanel *clivp = new ColorLayerImageViewPanel(parent, 0, 100, 1);
+  ColorLayerImageViewPanel *clivp = new ColorLayerImageViewPanel(parent, 0, 100, bbGetInputTypeControlsInterface() );
   bbSetOutputWidget( clivp );
 }
 //=====
@@ -102,6 +102,7 @@ void ColorLayerImageView::bbUserSetDefaultValues()
     firsttime=true;
     bbSetInputIn(NULL);
     bbSetInputActive(true);
+    bbSetInputTypeControlsInterface(1);
     bbSetInputWxVtkBaseView(NULL);
     bbSetInputWxVtkBaseView1(NULL);
     bbSetInputWxVtkBaseView2(NULL);
index a817bcb33d67416b2896e389970e494575512229..f608f9dcbcc469ccc0f88d0dfb0c59fdaf240956 100644 (file)
@@ -47,6 +47,7 @@ class bbcreaMaracasVisu_EXPORT ColorLayerImageView
 //=====
   BBTK_DECLARE_INPUT(In,vtkImageData*);
   BBTK_DECLARE_INPUT(Active,bool);
+  BBTK_DECLARE_INPUT(TypeControlsInterface,int);
   BBTK_DECLARE_INPUT(WxVtkBaseView,wxVtkBaseView *);
   BBTK_DECLARE_INPUT(WxVtkBaseView1,wxVtkBaseView *);
   BBTK_DECLARE_INPUT(WxVtkBaseView2,wxVtkBaseView *);
@@ -75,6 +76,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColorLayerImageView,bbtk::WxBlackBox);
   BBTK_CATEGORY("__CategoryBlackBox__");
   BBTK_INPUT(ColorLayerImageView,In,"Input Image",vtkImageData*,"");
   BBTK_INPUT(ColorLayerImageView,Active,"Active True/False (default True)",bool,"");
+  BBTK_INPUT(ColorLayerImageView,TypeControlsInterface,"1 (default) All controls, 2 just transparency",int,"");
   BBTK_INPUT(ColorLayerImageView,WxVtkBaseView," 0 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
   BBTK_INPUT(ColorLayerImageView,WxVtkBaseView1," 1 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
   BBTK_INPUT(ColorLayerImageView,WxVtkBaseView2," 2 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
index 50ee4ff5a8e7843a76e9e76c56c8bf2400b96639..cad61bd9c6b7382f286c5db306b61b9f288bcddb 100644 (file)
@@ -87,100 +87,116 @@ void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *paren
  ** Begin of the threshold panel
  **/
 ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max, int type)
-: wxPanel(parent, -1, wxDefaultPosition, wxSize(600,100), wxBORDER_SUNKEN)
-{
-
-       _spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
-       _dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
+//: wxPanel(parent, -1, wxDefaultPosition, wxSize(600,100), wxBORDER_SUNKEN)
 
-       _colorLayerImageViewManager     = new ColorLayerImageViewManager();
+: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
 
-       _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->SetValue(_thresholdGo);
 
-       _cb_SliceFixDinamic = new wxCheckBox(this, wxID_ANY, _T("Fixed/Dynamic Slice") );
-       _cb_SliceFixDinamic->SetValue(true);
-
-       _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);
+{
+printf("EED ColorLayerImageViewPanel::ColorLayerImageViewPanel Start\n");
 
-       _histogram=NULL;
-       _histogramMinMaxLevel=NULL;
+       _spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
+       _dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
 
-//     _histogram                                      = new Histogram(  this , -1, wxPoint(0,0), wxSize(400,400), /*wxNO_BORDER*/ wxBORDER_DEFAULT ); 
-//     _histogramMinMaxLevel   = new HistogramMinMaxLevel( (HistogramBase*)_histogram );
+       _cb_ShowHide                    = NULL;
+       _sl_SliceImageX                 = NULL;
+       _sl_SliceImageY                 = NULL;
+       _sl_SliceImageZ                 = NULL;
+       _histogram                              = NULL;
+       _histogramMinMaxLevel   = NULL;
 
-       if (type==0)
-       {
-       }
+       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+       _colorLayerImageViewManager     = new ColorLayerImageViewManager();
 
        if (type==1)
        {
-       }
+               _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->SetValue(_thresholdGo);
+               _cb_SliceFixDinamic                     = new wxCheckBox(this, wxID_ANY, _T("Fixed/Dynamic Slice") );
+               _cb_SliceFixDinamic->SetValue(true);
+               _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 );
+
+               Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage );
+               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_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 );
+
+               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_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 );
 
-       Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage );
-       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 );
+       } // type==1
 
-       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 );
+       if (type==2)
+       {
+               _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxSize(2,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+               Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
+//             sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level"))                     , 1, wxEXPAND );
+//             sizer -> Add( _opacity, 1, wxGROW );
+//             sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level"))  );
+               sizer -> Add( _opacity ,1,wxGROW  );
+               sizer->AddGrowableCol(0);
 
-       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 );
+       } // type==2
 
-       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("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();
+//     this->SetAutoLayout( true );
+//     this->Layout();
      
        //CM Sets the default fitting mode to Pixel mode.
        _fitting_mode = 3;
-       // EO CM
+       // EO CM  EED
 }
 
 //----------------------------------------------------------------------------
@@ -247,9 +263,14 @@ void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
         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 (_sl_SliceImageX!=NULL)
+               {
+                   _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])
@@ -297,10 +318,8 @@ void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
         } // spc !_spcBase   dim!__dimBase
     } // _firsttime_mode
 
-printf("EED ColorLayerImageViewPanel::SetImage\n");
        if (_active==true)
        {
-printf("EED ColorLayerImageViewPanel::SetImage _active=true \n");
            _colorLayerImageViewManager->onThreshold();
                RefreshView();
        } // _ative 
@@ -434,8 +453,11 @@ bool ColorLayerImageViewPanel::IsVisible()
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::SetActive(bool active)
 {
-      _active=active;
-      _cb_ShowHide->SetValue( _active );
+       _active=active;
+       if (_cb_ShowHide!=NULL)
+       {
+               _cb_ShowHide->SetValue( _active );
+       }
 }