]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
#2459 creaMaracasVisu Feature New Normal - Add colorbar in the ColorLayerWidget
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ThresholdImageView / LayerImageBase.cxx
index 3884a64a55b579db0333aaa0889acf7a77d38997..25d0b62e4f349084a4a7a746ef0916c69f97ab62 100644 (file)
@@ -146,6 +146,7 @@ LayerImageBase::LayerImageBase()
        _Z                              =       0;
        _thresholdTable                 =       NULL;
        _thresholdMapper                =       NULL;
+       _scalarbarActor = NULL;
        _thresholdActor                 =       NULL;
        _image                          =       NULL;
        _baseView                       =       NULL;
@@ -327,6 +328,7 @@ void LayerImageBase::onThreshold()
                        if (_thresholdActor==NULL)
                        {
                                _thresholdActor = vtkImageActor::New( );
+                               _scalarbarActor = vtkScalarBarActor::New();
                                _thresholdActor->SetOpacity( 0.6 );
                                _thresholdActor->InterpolateOn(  );
                                if (directionViewer==0)
@@ -345,6 +347,7 @@ void LayerImageBase::onThreshold()
                                }
                        } // _thresholdActor
                        _baseView->GetRenderer()->AddActor( _thresholdActor );
+                       _baseView->GetRenderer()->AddActor2D( _scalarbarActor );
                        _actorPresent = true;
                }  // !GetActorPresent()
 
@@ -379,10 +382,18 @@ void LayerImageBase::onThreshold()
 //             img->Update();
 //             img->UpdateInformation();
 
+//             _thresholdTable->Update();
                _thresholdMapper->SetInput( img );
                _thresholdMapper->SetLookupTable( _thresholdTable );
                _thresholdActor->SetInput( _thresholdMapper->GetOutput() );
                
+//             _scalarbarActor->SetLookupTable( _thresholdTable );
+               _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() );
+
+               _scalarbarActor->SetTitle("Value");
+               _scalarbarActor->SetNumberOfLabels(5);
+//             _scalarbarActor->SetTextPad(4);  ??
+
                } // _image
 }
 
@@ -429,6 +440,8 @@ void LayerImageBase::onThresholdRemove()
        {
                wxVtkBaseView * baseView = _baseView;
                baseView->GetRenderer()->RemoveActor( _thresholdActor );
+               baseView->GetRenderer()->RemoveActor( _scalarbarActor );
+
                _actorPresent = false;
        }
 }