]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ThresholdImageView / LayerImageBase.cxx
index c079604b5debfe8a5eecf4536ee736a64003267f..beb17eadd2e087b32286cc0c074bf8137f403d0d 100644 (file)
@@ -1,7 +1,7 @@
 
 /**
- *  \file 
- *  \brief Class bbtk::ThresholdImageView . 
+ *  \file
+ *  \brief Class bbtk::ThresholdImageView .
  */
 
 #include "LayerImageBase.h"
@@ -14,6 +14,7 @@ LayerImageBase::LayerImageBase()
        _thresholdMapper                =       NULL;
        _thresholdActor                 =       NULL;
        _image                                  =       NULL;
+       _baseView               =   NULL;
        _imageReslicer                  =       vtkImageReslice::New();
 
 }
@@ -67,6 +68,14 @@ wxVtkBaseView *LayerImageBase::GetwxVtkBaseView()
        return _baseView;
 }
 
+//----------------------------------------------------------------------------
+void LayerImageBase::Refresh()
+{
+    if (_baseView!=NULL)
+    {
+        _baseView->Refresh();
+    }
+}
 
 
 //----------------------------------------------------------------------------
@@ -77,7 +86,7 @@ vtkLookupTable* LayerImageBase::GetThresholdTable()
 
 //----------------------------------------------------------------------------
 int LayerImageBase::CleanZ(int z)
-{ 
+{
        int ext[6];
        _image->GetWholeExtent(ext);
 
@@ -98,37 +107,37 @@ int LayerImageBase::CleanZ(int z)
 void LayerImageBase::onThreshold()
 {
 
-       if (_image!=NULL)
+       if ((_image!=NULL) && (_baseView!=NULL))
        {
                int z=CleanZ( GetZ() );
 
                if (!GetActorPresent())
-               {                               
+               {
                        if (_thresholdTable==NULL)
                        {
                                //Lookup Table
                                _thresholdTable = vtkLookupTable::New();
                        } // _thresholdTable
-                       
+
                        if (_thresholdMapper==NULL)
                        {
                                _thresholdMapper = vtkImageMapToColors::New( );
                        }
-                       
+
                        if (_thresholdActor==NULL)
                        {
                                _thresholdActor = vtkImageActor::New( );
                                _thresholdActor->SetOpacity( 0.6 );
                                _thresholdActor->InterpolateOn(  );
                                _thresholdActor->SetPosition( 0,0, 900-1 );
-                       } // _thresholdActor                    
+                       } // _thresholdActor
                        _baseView->GetRenderer()->AddActor( _thresholdActor );
-                       _actorPresent = true;           
+                       _actorPresent = true;
                }  // !GetActorPresent()
 
                ConfigLookupTable();  // virtual method
                _imageReslicer->SetInput( GetImage() );
-               _imageReslicer->SetInformationInput( GetImage() );                      
+               _imageReslicer->SetInformationInput( GetImage() );
                _imageReslicer->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
                _imageReslicer->SetOutputDimensionality(2);
                _imageReslicer->SetInterpolationModeToLinear();
@@ -167,7 +176,7 @@ void LayerImageBase::onThresholdInterpolation(bool interpolate)
                else
                {
                        _thresholdActor->InterpolateOff( );
-               }               
+               }
        }
 }
 
@@ -188,7 +197,7 @@ void LayerImageBase::onThresholdRemove()
                wxVtkBaseView * baseView = _baseView;
                baseView->GetRenderer()->RemoveActor( _thresholdActor );
                _actorPresent = false;
-       }       
+       }
 }