]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
#3262 creaMaracasVisu Feature New Normal - Export LookupTable fron ColorLayerImageV...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ThresholdImageView / LayerImageBase.cxx
index f2ebd6f981d0099dcfbbb481bcefa969de89ec17..5fd366cd9ce03bc4f4bf3c44684e1707702fd12b 100644 (file)
@@ -94,9 +94,10 @@ private:
 LayerImageBase::LayerImageBase()
 {
        _actorPresent                   =       false;
-       _X                                              =       0;
-       _Y                                              =       0;
-       _Z                                              =       0;
+       _X                                              =       -1;
+       _Y                                              =       -1;
+       _Z                                              =       -1;
+       _opacity                                =       1;
        _thresholdTable                 =       NULL;
        _thresholdMapper                =       NULL;
        _scalarbarActor                 =       NULL;
@@ -212,9 +213,12 @@ void LayerImageBase::SetImage(vtkImageData* image)
                        SetDimensionBase(dimBase);
                        imagebase->GetSpacing(spcBase);
                        SetSpcBase(spcBase);
-                       SetX( dimBase[0]*spcBase[0]/2 );
-                       SetY( dimBase[1]*spcBase[1]/2 );
-                       SetZ( dimBase[2]*spcBase[2]/2 );
+
+                       if ((_X<0) || (_X>dimBase[0])) { SetX( dimBase[0]/2 ); } 
+                       if ((_Y<0) || (_Y>dimBase[1])) { SetY( dimBase[1]/2 ); } 
+                       if ((_Z<0) || (_Z>dimBase[2])) { SetZ( dimBase[2]/2 ); } 
+
+
                } // if imagebase
        } // if wxvtkbaseview
        _image->GetScalarRange( _range );
@@ -406,12 +410,10 @@ void LayerImageBase::onThreshold()
                double y=GetY();
                double z=GetZ();
 
-
                x = x*_spcBase[0];
                y = y*_spcBase[1];
                z = z*_spcBase[2];
 
-
                CleanXYZ(x,y,z);
 
                vtkCamera *camera = _baseView->GetRenderer()->GetActiveCamera();
@@ -446,8 +448,10 @@ void LayerImageBase::onThreshold()
                                } else {
                                        _scalarbarActor->SetDisplayPosition(0,0);
                                }
+                               _scalarbarActor->SetHeight(0.4);        //default  0.8
+                               _scalarbarActor->SetWidth(0.08);    //default  0.17
 
-                               _thresholdActor->SetOpacity( 0 );
+                               _thresholdActor->SetOpacity( 1 );
                                _thresholdActor->InterpolateOn(  );
                                
                                if (directionViewer==0)
@@ -506,7 +510,8 @@ void LayerImageBase::onThreshold()
                _thresholdMapper->SetInput( img );
                _thresholdMapper->SetLookupTable( _thresholdTable );
                _thresholdActor->SetInput( _thresholdMapper->GetOutput() );
-               
+               _thresholdActor->SetOpacity(_opacity);
+
                _scalarbarActor->SetLookupTable( _thresholdTable );
 //             _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() );
                _scalarbarActor->SetTitle("Value");
@@ -554,6 +559,8 @@ void LayerImageBase::onThresholdChangeOpacity (int opacity)
        {
                _thresholdActor->SetOpacity(opacity/100.0);
        }
+// EED 2017-12-17
+       _opacity = (double)opacity/100.0;
 }
 
 //----------------------------------------------------------------------------
@@ -591,6 +598,12 @@ void LayerImageBase::GetImageScalarRange()
        _range[1]=max;
 }
 
+vtkScalarsToColors* LayerImageBase::GetLookupTable()
+{
+       return _thresholdTable;
+}
+
+
 
 
 // EOF