]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
#2651 creaMaracasVisu Feature New Norma - lColor Layer: Transparent Base, Refresh
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ThresholdImageView / LayerImageBase.cxx
index f2ebd6f981d0099dcfbbb481bcefa969de89ec17..6f3762475dc2af6b361714d32f42af060db51341 100644 (file)
@@ -94,9 +94,9 @@ private:
 LayerImageBase::LayerImageBase()
 {
        _actorPresent                   =       false;
-       _X                                              =       0;
-       _Y                                              =       0;
-       _Z                                              =       0;
+       _X                                              =       -1;
+       _Y                                              =       -1;
+       _Z                                              =       -1;
        _thresholdTable                 =       NULL;
        _thresholdMapper                =       NULL;
        _scalarbarActor                 =       NULL;
@@ -212,9 +212,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 );