]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx
histogram BUG
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ThresholdImageView / ColorLayerImageViewPanel.cxx
index d6efc9123ee1ebbf4b0249a3c1d2370295f6592b..50ee4ff5a8e7843a76e9e76c56c8bf2400b96639 100644 (file)
@@ -113,8 +113,11 @@ ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, in
        _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 );
+       _histogram=NULL;
+       _histogramMinMaxLevel=NULL;
+
+//     _histogram                                      = new Histogram(  this , -1, wxPoint(0,0), wxSize(400,400), /*wxNO_BORDER*/ wxBORDER_DEFAULT ); 
+//     _histogramMinMaxLevel   = new HistogramMinMaxLevel( (HistogramBase*)_histogram );
 
        if (type==0)
        {
@@ -169,7 +172,7 @@ ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, in
        sizer -> Add( _sl_SliceImageY                                                                                                           , 1, wxGROW );
        sizer -> Add( _sl_SliceImageZ                                                                                                           , 1, wxGROW );
        sizer -> Add( _cb_SliceFixDinamic                                                                                               , 1, wxGROW );
-       sizer -> Add( _histogramMinMaxLevel->GetWindow()                                                        , 1, wxGROW );
+//     sizer -> Add( _histogramMinMaxLevel->GetWindow()                                                        , 1, wxGROW );
 
        this->SetSizer( sizer );
        this->SetAutoLayout( true );
@@ -229,7 +232,10 @@ void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
 {
     if (img!=NULL)
     {
+               if (_histogramMinMaxLevel!=NULL) 
+               {
                        _histogramMinMaxLevel->Configure( img );
+               }
         _colorLayerImageViewManager->SetImage( img );
 
         double spc[3];
@@ -289,15 +295,16 @@ void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
 
             img->SetSpacing(spc);
         } // spc !_spcBase   dim!__dimBase
+    } // _firsttime_mode
 
-               if (_active==true)
-               {
-                   _colorLayerImageViewManager->onThreshold();
-                RefreshView();
-               }
-
+printf("EED ColorLayerImageViewPanel::SetImage\n");
+       if (_active==true)
+       {
+printf("EED ColorLayerImageViewPanel::SetImage _active=true \n");
+           _colorLayerImageViewManager->onThreshold();
+               RefreshView();
+       } // _ative 
 
-    }
 }
 
 
@@ -354,6 +361,7 @@ void ColorLayerImageViewPanel::onThresholdChange(wxCommandEvent& event)
 void ColorLayerImageViewPanel::onThresholdShow(wxCommandEvent& event)
 {
         _thresholdGo = _cb_ShowHide->GetValue();
+                       _active = _thresholdGo;
         if (_thresholdGo)
         {
                    _colorLayerImageViewManager->onThreshold();
@@ -411,8 +419,8 @@ void ColorLayerImageViewPanel::onSliceImage(wxScrollEvent& event)
 //----------------------------------------------------------------------------
 void ColorLayerImageViewPanel::onChangeOpacity(wxScrollEvent& event)
 {
-        int opacity = _opacity->GetValue();
-        _colorLayerImageViewManager->onThresholdChangeOpacity(opacity);
+       int opacity = _opacity->GetValue();
+       _colorLayerImageViewManager->onThresholdChangeOpacity(opacity);
        RefreshView();
 }