From 4767ea16c820745084faecb4a62d5bf73a0beef1 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 6 Jun 2019 11:26:22 +0200 Subject: [PATCH] 3263 creaMaracasVisu Feature New Normal - ViewerNV sync ParallelScale Camera --- .../bbcreaMaracasVisuColorLayerImageView.cxx | 3 ++ .../bbcreaMaracasVisuColorLayerImageView.h | 6 +++- .../ColorLayerImageViewManager.cxx | 13 ++++++++ .../ColorLayerImageViewManager.h | 1 + .../ThresholdImageView/LayerImageBase.cxx | 10 ++----- .../ThresholdImageView/LayerImageBase.h | 5 ++-- .../widgets/manualInteractorWindowLevel.cxx | 18 +++++++++++ .../wxWindows/widgets/vtkBaseData.cxx | 30 ++++++++++++++----- .../interface/wxWindows/widgets/vtkBaseData.h | 7 +++-- .../wxWindows/widgets/wxVtk2DBaseView.cxx | 19 +++++++----- .../wxWindows/widgets/wxVtk2DBaseView.h | 3 ++ .../wxWindows/widgets/wxVtkMPR2DView.cxx | 2 ++ 12 files changed, 89 insertions(+), 28 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx index e63f5da..1d85ad8 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx @@ -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) { diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h index 7abb52f..934b0fe 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h @@ -34,6 +34,9 @@ #include "wxVtkBaseView.h" +#include + + namespace bbcreaMaracasVisu { @@ -60,6 +63,7 @@ class bbcreaMaracasVisu_EXPORT ColorLayerImageView BBTK_DECLARE_INPUT(FittingMode,int); BBTK_DECLARE_INPUT(ColorBarPosition,std::vector); 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,""); BBTK_OUTPUT(ColorLayerImageView,NewImage,"Image with correct Spacing",vtkImageData*,""); - + BBTK_OUTPUT(ColorLayerImageView,LookupTable,"Image with correct Spacing",vtkScalarsToColors*,""); BBTK_END_DESCRIBE_BLACK_BOX(ColorLayerImageView); //===== diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx index 8fdaa7c..774d663 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx @@ -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) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h index f5c9c4c..6a4f95f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h @@ -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; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index 9078a7e..1a494c7 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -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() { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h index e9eec43..52235c3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h @@ -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 _rangeForColorBar; std::vector _colorBarPosition; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx index 8ecfd9e..48b3a4d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx @@ -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; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx index 3cf6b7e..dfc8472 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx @@ -28,13 +28,14 @@ //------------------------------------------------------------------- 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; +} + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h index 6870e01..4047fc9 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h @@ -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: }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx index dc7c52e..4ade168 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx @@ -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(); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h index 380d5a7..93e3eee 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h @@ -67,6 +67,9 @@ public: //EED 01nov2012 void UpdateColorWindowLevel(); + //EED 05juin2019 + void UpdateCameraParallelScale(); + private: vtkInfoTextImage *_vtkIinfoTextImage; vtkInfoTextImageInteractor *_vtkIinfoTextImageInteractor; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx index 01c7e14..d4752bd 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx @@ -395,6 +395,8 @@ void wxVtkMPR2DView::Refresh() imageactor->SetInterpolate( GetVtkBaseData()->GetInterpolate() ); //EED 01nov2012 UpdateColorWindowLevel(); +//EED 05juin2019 + UpdateCameraParallelScale(); wxVtkBaseView::Refresh(); } } -- 2.47.1