]> Creatis software - creaMaracasVisu.git/commitdiff
3263 creaMaracasVisu Feature New Normal - ViewerNV sync ParallelScale Camera
authorEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Thu, 6 Jun 2019 09:26:22 +0000 (11:26 +0200)
committerEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Thu, 6 Jun 2019 09:26:22 +0000 (11:26 +0200)
12 files changed:
bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx
bbtk/src/bbcreaMaracasVisuColorLayerImageView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx

index e63f5da2d4a14ca66c3ab32be1463cd1541dbc7b..1d85ad87684167d3ace2e6ed7d1748fdd0b81827 100644 (file)
@@ -74,6 +74,9 @@ void ColorLayerImageView::Process()
     clivp->SetImage( bbGetInputIn() );
 
     bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) );
+    bbSetOutputLookupTable( clivp->GetColorLayerImageViewManager()->GetLookupTable(0) );
+printf("EED ColorLayerImageView::Process A ptrLookupTable:%p\n",clivp->GetColorLayerImageViewManager()->GetLookupTable(0));
+printf("EED ColorLayerImageView::Process B ptrLookupTable:%p\n",bbGetOutputLookupTable() );
 
         if (firsttime==true)
         {
index 7abb52f075c90123308407dd79087ace627f6bb2..934b0fe66745ff9982858fc61347fc6746ed6aa2 100644 (file)
@@ -34,6 +34,9 @@
 
 #include "wxVtkBaseView.h"
 
+#include <vtkScalarsToColors.h>
+
+
 namespace bbcreaMaracasVisu
 {
 
@@ -60,6 +63,7 @@ class bbcreaMaracasVisu_EXPORT ColorLayerImageView
   BBTK_DECLARE_INPUT(FittingMode,int);
   BBTK_DECLARE_INPUT(ColorBarPosition,std::vector<int>);
   BBTK_DECLARE_OUTPUT(NewImage,vtkImageData*);
+  BBTK_DECLARE_OUTPUT(LookupTable,vtkScalarsToColors*);
   BBTK_PROCESS(Process);
   void Process();
   BBTK_CREATE_WIDGET(CreateWidget);
@@ -98,7 +102,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColorLayerImageView,bbtk::WxBlackBox);
   BBTK_INPUT(ColorLayerImageView,ColorBarPosition,"default (10,105)",std::vector<int>,"");
 
   BBTK_OUTPUT(ColorLayerImageView,NewImage,"Image with correct Spacing",vtkImageData*,"");
-
+  BBTK_OUTPUT(ColorLayerImageView,LookupTable,"Image with correct Spacing",vtkScalarsToColors*,"");
 
 BBTK_END_DESCRIBE_BLACK_BOX(ColorLayerImageView);
 //=====
index 8fdaa7c2b4a53befbf1fc84cdeac8e8ea0bfef25..774d66383e84f740de12ced2a54fcb472bc3c47b 100644 (file)
@@ -408,6 +408,19 @@ vtkImageData* ColorLayerImageViewManager::GetImageChangeInformation(int id)
        return NULL;
 }
 
+//----------------------------------------------------------------------------
+vtkLookupTable*        ColorLayerImageViewManager::GetLookupTable(int id)
+{
+printf("EED ColorLayerImageViewManager::GetLookupTable 0 \n");
+       if (_colorLayerImageViewLst[id]!=NULL)
+       {
+printf("EED ColorLayerImageViewManager::GetLookupTable 1 \n");
+          return _colorLayerImageViewLst[id]->GetThresholdTable( );
+       } // if 
+printf("EED ColorLayerImageViewManager::GetLookupTable 2 \n");
+       return NULL;
+}
+
 //----------------------------------------------------------------------------
 void ColorLayerImageViewManager::GetDimensionBase(int id,int *dim)
 {
index f5c9c4cf6a9c76c22057ae3343cd5472726090c9..6a4f95f57b6d1899d0d27790da79c6891144d8fc 100644 (file)
@@ -77,6 +77,7 @@ class  ColorLayerImageViewManager
          void                          GetSpcOriginalLayer                     (int id,double  *spc);
          void                          SetNewSpacingLayer                      (double *spc);
 
+         vtkLookupTable*       GetLookupTable(int id);
   private:
 
        std::vector< ColorLayerImageView* >     _colorLayerImageViewLst;
index 9078a7e5203fac78717151d040a81f8ef8928ad2..1a494c76043f5225386ac034b07dfa23aa9df8e3 100644 (file)
@@ -236,7 +236,7 @@ void LayerImageBase::SetImage(vtkImageData* image)
                } // if imagebase
        } // if wxvtkbaseview
        _image->GetScalarRange( _range );
-       _thresholdTable = vtkLookupTable::New();
+//     _thresholdTable = vtkLookupTable::New();
 
 
 //EED 2017-01-01 Migration VTK7
@@ -386,6 +386,7 @@ void LayerImageBase::Refresh()
 //----------------------------------------------------------------------------
 vtkLookupTable* LayerImageBase::GetThresholdTable()
 {
+printf("EED LayerImageBase::GetThresholdTable\n");
        return _thresholdTable;
 }
 
@@ -616,17 +617,10 @@ void LayerImageBase::onThresholdRemove()
                wxVtkBaseView * baseView = _baseView;
                baseView->GetRenderer()->RemoveActor( _thresholdActor );
                baseView->GetRenderer()->RemoveActor( _scalarbarActor );
-
                _actorPresent = false;
        }  // if _actorPresent
 }
 
-//----------------------------------------------------------------------------
-vtkLookupTable *LayerImageBase::GetvtkLookupTable()
-{
-    return _thresholdTable;
-}
-
 //----------------------------------------------------------------------------
 vtkImageReslice *LayerImageBase::GetvtkImageReslice()
 {
index e9eec4326fb1accd52bf854fb4da8b5fe686ee7f..52235c38fa18e764911bd0e43c870386f7da51e5 100644 (file)
@@ -47,7 +47,6 @@
 #include "InteractorStyleMaracas.h"
 #include "vtkImageChangeInformation.h"
 
-
 //----------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------
@@ -102,7 +101,8 @@ class LayerImageBase
                void onThresholdRemove();
                wxVtkBaseView *GetwxVtkBaseView();
                void Refresh();
-               vtkLookupTable *GetvtkLookupTable();
+               vtkLookupTable *GetThresholdTable();
+
                vtkImageReslice *GetvtkImageReslice();
                virtual int GetX();
                virtual int GetY();
@@ -144,7 +144,6 @@ class LayerImageBase
                void                                            CleanXYZ(double &x, double &y, double &z);
 
   protected:
-               vtkLookupTable                          *GetThresholdTable();
                double                                          _range[2];
                std::vector<double>             _rangeForColorBar;
                std::vector<int>                        _colorBarPosition;
index 8ecfd9e6e32c385c490dec4096200e2682867a84..48b3a4ddeea7463afcb6af56b8256a1a242970ef 100644 (file)
@@ -49,6 +49,24 @@ manualInteractorWindowLevel::~manualInteractorWindowLevel()
 
 bool manualInteractorWindowLevel::OnMouseMove()                        // virtual 
 {
+
+printf("EED Warning manualInteractorWindowLevel::OnMouseMove    Clean this put in a specific class for camera Interaction ....\n");
+printf("EED Warning manualInteractorWindowLevel::OnMouseMove    Clean this put in a specific class for camera Interaction ....\n");
+printf("EED Warning manualInteractorWindowLevel::OnMouseMove    Clean this put in a specific class for camera Interaction ....\n");
+printf("EED Warning manualInteractorWindowLevel::OnMouseMove    Clean this put in a specific class for camera Interaction ....\n");
+printf("EED Warning manualInteractorWindowLevel::OnMouseMove    Clean this put in a specific class for camera Interaction ....\n");
+printf("EED Warning manualInteractorWindowLevel::OnMouseMove    Clean this put in a specific class for camera Interaction ....\n");
+printf("EED Warning manualInteractorWindowLevel::OnMouseMove    Clean this put in a specific class for camera Interaction ....\n");
+
+// EED Mising in the wheal event  and the ctrl+MouseRight Event
+       wxVtk2DBaseView *wxvtk2Dbaseview        = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+       vtkBaseData *vtkbasedata                        = wxvtk2Dbaseview->GetVtkBaseData();
+       double parallelscaling=wxvtk2Dbaseview->GetRenderer()->GetActiveCamera()->GetParallelScale();
+       vtkbasedata->SetCameraParallelScale( parallelscaling );
+       this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+//-----------------
+
+
        if (_stateWindowLevel==true)
        {
                int tmpPx,tmpPy;
index 3cf6b7e2b7a849b7814ca33f9577599e733f4c21..dfc847270e8e5f066b60dfd036eae91d10b3cf4d 100644 (file)
 //-------------------------------------------------------------------
 vtkBaseData::vtkBaseData()
 {
-       _z              = 0;
-       _t              = 0;
-       _marImageData   = 0;
-       _interpolate    = true;
-       _fixAxis2D              = false;
-       _opacityAxis    = 1.0;
-       _observable     = vtkObject::New();
+       _z                              = 0;
+       _t                              = 0;
+       _marImageData                   = 0;
+       _interpolate                    = true;
+       _fixAxis2D                              = false;
+       _opacityAxis                    = 1.0;
+       _observable                     = vtkObject::New();
+       _cameraparallelScale    = 100.0;
 }
 
 //-------------------------------------------------------------------
@@ -232,3 +233,18 @@ void vtkBaseData::SetOpacityAxis(double value)
 {
        _opacityAxis = value;
 }
+
+//-------------------------------------------------------------------
+double vtkBaseData::GetCameraParallelScale()
+{
+       return _cameraparallelScale;
+}
+
+//-------------------------------------------------------------------
+void vtkBaseData::SetCameraParallelScale(double value)
+{
+       _cameraparallelScale=value;
+}
+
+
+
index 6870e0189568da85d478ea4509bc77b65219fa49..4047fc9636920d00efcac3ef5985def86e91977a 100644 (file)
@@ -54,8 +54,10 @@ public:
        bool                    GetFixAxis2D();
        void                    SetFixAxis2D(bool value);
        double                  GetOpacityAxis();
-       void                    SetOpacityAxis(double value);
-       
+       void                    SetOpacityAxis(double value);   
+       double                  GetCameraParallelScale();
+       void                    SetCameraParallelScale(double value);
+
 protected:
        marImageData    *_marImageData;
        double                  _z;
@@ -66,6 +68,7 @@ protected:
        bool                    _fixAxis2D;
        double                  _opacityAxis;
        vtkObject*              _observable;
+       double                  _cameraparallelScale;
 private:
 
 };
index dc7c52e7268c06804b39c549675c2968955453ed..4ade1682394fa7df720fd625f3bcad94066d87e0 100644 (file)
@@ -271,7 +271,10 @@ void wxVtk2DBaseView::Configure(bool okimage)
                        
                        camera->SetClippingRange( 0.01                  , 1000000 );
                        camera->ComputeViewPlaneNormal();
-                       camera->SetParallelScale( spx*(x2-x1)/3.0 );
+               
+                       double cameraparallelScale=spx*(x2-x1)/3.0;     
+                       camera->SetParallelScale( cameraparallelScale );
+                       GetVtkBaseData()->SetCameraParallelScale( cameraparallelScale );
 
                        // text information over the graphic window
                        if(_vtkIinfoTextImage == NULL){
@@ -307,18 +310,19 @@ void wxVtk2DBaseView::UpdateColorWindowLevel()
        //EED 24oct2010
        //EED 02nov2012
        
-//     vtkImageViewer2 *vtkimageviewer2        = _imageViewer2XYZ->GetVtkImageViewer2();               
-       
        vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel();
        imagemaptowindowlevel->SetWindow( GetVtkBaseData()->GetColorWindow() );
        imagemaptowindowlevel->SetLevel( GetVtkBaseData()->GetColorLevel() );
-       
-// EED Borrame
-//     vtkimageviewer2->SetColorWindow( GetVtkBaseData()->GetColorWindow() );
-//     vtkimageviewer2->SetColorLevel(  GetVtkBaseData()->GetColorLevel() );
        _imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->Modified();
 }
 
+//-------------------------------------------------------------------
+void wxVtk2DBaseView::UpdateCameraParallelScale()
+{
+       vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
+       camera->SetParallelScale( GetVtkBaseData()->GetCameraParallelScale() );
+}
+
 //-------------------------------------------------------------------
 void wxVtk2DBaseView::Refresh()
 {
@@ -329,6 +333,7 @@ void wxVtk2DBaseView::Refresh()
        imageactor->SetInterpolate( GetVtkBaseData()->GetInterpolate() );
        //EED 01nov2012
        UpdateColorWindowLevel();       
+       UpdateCameraParallelScale();    
        wxVtkBaseView::Refresh();
 }
 
index 380d5a7d228f054501ea83dbdec1a79d0c73716b..93e3eee5d5b4b3e6e79ea1eedf7ece2307d46da4 100644 (file)
@@ -67,6 +67,9 @@ public:
        //EED 01nov2012
        void UpdateColorWindowLevel();
 
+       //EED 05juin2019
+       void UpdateCameraParallelScale();
+
 private:
        vtkInfoTextImage                                *_vtkIinfoTextImage;
        vtkInfoTextImageInteractor              *_vtkIinfoTextImageInteractor;
index 01c7e1400cc3f42652651dfc2c562649779e7fdf..d4752bd5f9ed62d1205455a8e350ac860dc7d69a 100644 (file)
@@ -395,6 +395,8 @@ void wxVtkMPR2DView::Refresh()
        imageactor->SetInterpolate( GetVtkBaseData()->GetInterpolate() );
 //EED 01nov2012
                UpdateColorWindowLevel();
+//EED 05juin2019
+               UpdateCameraParallelScale();
                wxVtkBaseView::Refresh();
        }
 }