]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx
#2651 creaMaracasVisu Feature New Normal - Color Layer: Transparent Base, Refresh
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ThresholdImageView / ColorLayerImageViewPanel.cxx
index ffabba162bf8ae6dbba8fbfd61921eb36bb1d96b..20a723cd68e948279419dddbffd77dd57f5b2860 100644 (file)
@@ -59,7 +59,6 @@ void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *paren
        wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,45), 3 , lstOptOperation,  3, wxRA_SPECIFY_COLS);
 
        dialSizer->Add( new wxStaticText(dial,-1,message)  , 0, wxGROW );
-       //      dialSizer->Add( new wxStaticText(dial,-1,_T("selected Roi file. Do you want to tranform it?"))  , 0, wxGROW );
        dialSizer->Add( new wxStaticText(dial,-1,_T(" "))  , 0, wxGROW );
        dialSizer->Add(radioOpts,0,wxGROW);
        dialSizer->Add( new wxStaticText(dial,-1,_T(" "))  , 0, wxGROW );
@@ -90,12 +89,10 @@ void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *paren
 ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max, int type)
 : 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;
 
-//EED01        _colorLayerImageView            = new ColorLayerImageView();
        _colorLayerImageViewManager     = new ColorLayerImageViewManager();
 
        _btn_ReadImage                  = new wxButton(this, wxID_ANY, _T("Read Image") );
@@ -189,26 +186,14 @@ ColorLayerImageViewPanel::~ColorLayerImageViewPanel()
 }
 
 
-//EED01  
-//EED01  //----------------------------------------------------------------------------
-//EED01  void ColorLayerImageViewPanel::SetColorLayerImageView(ColorLayerImageView* colorLayerImageView)
-//EED01  {
-//EED01        _colorLayerImageView = colorLayerImageView;
-//EED01  }
-//EED01  
-//EED01  //----------------------------------------------------------------------------
-//EED01  ColorLayerImageView* ColorLayerImageViewPanel::GetColorLayerImageView()
-//EED01  {
-//EED01        return _colorLayerImageView;
-//EED01  }
-
-
+//----------------------------------------------------------------------------
 ColorLayerImageViewManager* ColorLayerImageViewPanel::GetColorLayerImageViewManager()
 {
    return _colorLayerImageViewManager;
 }
 
 
+//----------------------------------------------------------------------------
 // This is the new spacing of the background image  (1,1,1)
 void ColorLayerImageViewPanel::SetBaseSpacing(double spc[3])
 {
@@ -221,6 +206,7 @@ void ColorLayerImageViewPanel::SetBaseSpacing(double spc[3])
        _spcBase[2] = 1;
 }
 
+//----------------------------------------------------------------------------
 // This is the Original spacing of the background image
 void ColorLayerImageViewPanel::SetOriginalSpacing(double spc[3])
 {
@@ -229,6 +215,7 @@ void ColorLayerImageViewPanel::SetOriginalSpacing(double spc[3])
        _spcOrg[2] = spc[2];
 }
 
+//----------------------------------------------------------------------------
 // This is the size in pixels of the background image
 void ColorLayerImageViewPanel::SetBaseDimension(int dim[3])
 {
@@ -278,9 +265,6 @@ void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
          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");
@@ -305,19 +289,16 @@ void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
 
             img->SetSpacing(spc);
         } // spc !_spcBase   dim!__dimBase
+    } // _firsttime_mode
 
-//EED01        if (_colorLayerImageView!=NULL)
-//EED01        {
-//EED01            _colorLayerImageView->onThreshold();
-               if (_active==true)
-               {
-                   _colorLayerImageViewManager->onThreshold();
-                RefreshView();
-               }
-//EED01        }
-
+printf("EED ColorLayerImageViewPanel::SetImage\n");
+       if (_active==true)
+       {
+printf("EED ColorLayerImageViewPanel::SetImage _active=true \n");
+           _colorLayerImageViewManager->onThreshold();
+               RefreshView();
+       } // _ative 
 
-    }
 }
 
 
@@ -362,72 +343,52 @@ void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event)
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onThresholdChange(wxCommandEvent& event)
 {
-//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)
 {
-//EED01        if (_colorLayerImageView!=NULL)
-//EED01        {
         _thresholdGo = _cb_ShowHide->GetValue();
+                       _active = _thresholdGo;
         if (_thresholdGo)
         {
-//EED01            _colorLayerImageView->onThreshold();
                    _colorLayerImageViewManager->onThreshold();
         }else{
-//EED01            _colorLayerImageView->onThresholdRemove( );
                    _colorLayerImageViewManager->onThresholdRemove( );
         }
             RefreshView();
-//EED01        }//_colorLayerImageView
 }
 
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onThresholdStop()
 {
-//EED01        if (_colorLayerImageView!=NULL)
-//EED01        {
                if (_thresholdGo)
                {
-//EED01                    _colorLayerImageView->onThresholdRemove( );
                    _colorLayerImageViewManager->onThresholdRemove( );
                    _thresholdGo=false;
                }
-//EED01        }//_colorLayerImageView
 }
 
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onThresholdInterpolation(wxCommandEvent& event)
 {
-//EED01        if (_colorLayerImageView!=NULL)
-//EED01        {
-//EED01                _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue());
           _colorLayerImageViewManager->onThresholdInterpolation(_interpolationCheckBox->GetValue());
                RefreshView();
-//EED01        }//_colorLayerImageView
 }
 
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onSliceFixDinamic(wxCommandEvent& event)
 {
-//EED01        if (_colorLayerImageView!=NULL)
-//EED01        {
         bool fixdin = _cb_SliceFixDinamic->GetValue();
-//EED01        _colorLayerImageView->SetSliceFixDynamic( fixdin );
         _colorLayerImageViewManager->SetSliceFixDynamic( fixdin );
         if (fixdin==false)
         {
-//EED01            _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
             _colorLayerImageViewManager->SetX2( _sl_SliceImageX->GetValue() );
             _colorLayerImageViewManager->SetY2( _sl_SliceImageY->GetValue() );
             _colorLayerImageViewManager->SetZ2( _sl_SliceImageZ->GetValue() );
@@ -435,38 +396,26 @@ void ColorLayerImageViewPanel::onSliceFixDinamic(wxCommandEvent& event)
         _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)
 {
-//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();
+   _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)
 {
-//EED01        if (_colorLayerImageView!=NULL)
-//EED01        {
-        int opacity = _opacity->GetValue();
-//EED01        _colorLayerImageView->onThresholdChangeOpacity(opacity);
-        _colorLayerImageViewManager->onThresholdChangeOpacity(opacity);
+       int opacity = _opacity->GetValue();
+       _colorLayerImageViewManager->onThresholdChangeOpacity(opacity);
        RefreshView();
-//EED01        }//_colorLayerImageView
 }