From d8f0f440b39735c1abd142530c9bea2b15ccc62d Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 29 Nov 2021 15:20:44 +0100 Subject: [PATCH] #3475 wxVtkBaseView export parameters Point Normal --- .../bbcreaMaracasVisuwxVtkBaseView_Info.cxx | 23 ++++++++++++------ .../src/bbcreaMaracasVisuwxVtkBaseView_Info.h | 4 ++++ .../wxWindows/widgets/vtkBaseData.cxx | 12 ++++++++++ .../interface/wxWindows/widgets/vtkBaseData.h | 3 +++ .../wxWindows/widgets/wxVtk2DBaseView.cxx | 24 +++++++++++++++++++ .../wxWindows/widgets/wxVtk2DBaseView.h | 4 +++- .../wxWindows/widgets/wxVtkBaseView.cxx | 12 +++++++--- .../wxWindows/widgets/wxVtkBaseView.h | 1 + 8 files changed, 72 insertions(+), 11 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx index 9a7c660..27a43f4 100644 --- a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx +++ b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx @@ -33,10 +33,10 @@ void wxVtkBaseView_Info::Process() { bbSetOutputvtkRenderer( bbGetInputwxVtkBaseView()->GetRenderer() ); bbSetOutputDirection( bbGetInputwxVtkBaseView()->GetDirection() ); - vtkBaseData *vtkbasedata = bbGetInputwxVtkBaseView()->GetVtkBaseData(); if (vtkbasedata!=NULL) { + printf(" wxVtkBaseView_Info::Process %f %f %f\n", vtkbasedata->GetX(), vtkbasedata->GetY(), vtkbasedata->GetZ() ); marImageData *marimagedata = vtkbasedata->GetMarImageData(); if (marimagedata!=NULL) { @@ -46,22 +46,32 @@ void wxVtkBaseView_Info::Process() LstWindowColorLevel.push_back( vtkbasedata->GetColorWindow() ); LstWindowColorLevel.push_back( vtkbasedata->GetColorLevel() ); bbSetOutputWindowColorLevel( LstWindowColorLevel ); - bbSetOutputInterpolation( vtkbasedata->GetInterpolate() ); + std::vector lstPoint; + lstPoint.push_back( vtkbasedata->GetX() ); + lstPoint.push_back( vtkbasedata->GetY() ); + lstPoint.push_back( vtkbasedata->GetZ() ); + bbSetOutputPoint( lstPoint ); + + double normal[3]; + std::vector lstNormal; + bbGetInputwxVtkBaseView()->GetNormal( normal ); + lstNormal.push_back( normal[0] ); + lstNormal.push_back( normal[1] ); + lstNormal.push_back( normal[2] ); + bbSetOutputNormal( lstNormal ); + + bbSetOutputInterpolation( vtkbasedata->GetInterpolate() ); } // BaseData } - - } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void wxVtkBaseView_Info::bbUserSetDefaultValues() { - // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 - std::vector LstWindowColorLevel; LstWindowColorLevel.push_back( 1000 ); LstWindowColorLevel.push_back( 500 ); @@ -69,7 +79,6 @@ void wxVtkBaseView_Info::bbUserSetDefaultValues() bbSetOutputDirection(2); bbSetOutputInterpolation(true); bbSetOutputvtkRenderer(NULL); - } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) diff --git a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h index 379860a..4a32c0f 100644 --- a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h +++ b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h @@ -27,6 +27,8 @@ class bbcreaMaracasVisu_EXPORT wxVtkBaseView_Info BBTK_DECLARE_OUTPUT(Image,vtkImageData*); BBTK_DECLARE_OUTPUT(WindowColorLevel,std::vector); BBTK_DECLARE_OUTPUT(Interpolation,bool); + BBTK_DECLARE_OUTPUT(Point,std::vector); + BBTK_DECLARE_OUTPUT(Normal,std::vector); BBTK_PROCESS(Process); void Process(); @@ -48,6 +50,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(wxVtkBaseView_Info,bbtk::AtomicBlackBox); BBTK_OUTPUT(wxVtkBaseView_Info,Image,"vtkImageData",vtkImageData*,""); BBTK_OUTPUT(wxVtkBaseView_Info,WindowColorLevel,"List [Window, Level]",std::vector,""); BBTK_OUTPUT(wxVtkBaseView_Info,Interpolation,"(default true) true/false",bool,""); + BBTK_OUTPUT(wxVtkBaseView_Info,Point,"Axis positon of the viewer",std::vector,""); + BBTK_OUTPUT(wxVtkBaseView_Info,Normal,"Normal of plane viewe",std::vector,""); BBTK_END_DESCRIBE_BLACK_BOX(wxVtkBaseView_Info); //===== diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx index dfc8472..3fdede1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx @@ -151,6 +151,18 @@ int vtkBaseData::GetT() return _t; } +//------------------------------------------------------------------- +double vtkBaseData::GetX() // virtual +{ + return 0; +} +//------------------------------------------------------------------- +double vtkBaseData::GetY() // virtual +{ + return 0; +} + + //------------------------------------------------------------------- void vtkBaseData::SetT(double t) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h index 4047fc9..de5b86c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h @@ -44,6 +44,8 @@ public: void SetZ(double z); int GetT(); void SetT(double t); + virtual double GetX(); + virtual double GetY(); void SetColorWindow(double colorWindow); void SetColorLevel(double colorLevel); double GetColorWindow(); @@ -58,6 +60,7 @@ public: double GetCameraParallelScale(); void SetCameraParallelScale(double value); + protected: marImageData *_marImageData; double _z; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx index 42b8651..4d9a3ed 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx @@ -418,6 +418,30 @@ int wxVtk2DBaseView::GetDirection() // virtual return 2; } +//------------------------------------------------------------------- +void wxVtk2DBaseView::GetNormal(double normal[3] ) // virtual +{ + if (GetDirection()==0 ) + { + normal[0]=1; + normal[1]=0; + normal[2]=0; + } // if + if (GetDirection()==1 ) + { + normal[0]=0; + normal[1]=1; + normal[2]=0; + } // if + if (GetDirection()==2 ) + { + normal[0]=0; + normal[1]=0; + normal[2]=1; + } // if +} + + //------------------------------------------------------------------- void wxVtk2DBaseView::SetOpacityText(double opacity) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h index 784f2e6..2e3b712 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h @@ -61,7 +61,9 @@ public: void SetColorLevel(double level); void SetInterpolate(bool iterpolate); - virtual int GetDirection(); + virtual int GetDirection(); + virtual void GetNormal(double normal[3] ); + void SetImageToVtkViewer(vtkImageData *imageData); //EED 01nov2012 diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx index 6c58988..763931d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx @@ -210,11 +210,17 @@ void wxVtkBaseView::SetInteractorStyleBaseView( vtkInteractorStyleImage* interac void wxVtkBaseView::GetSpacing(double spc[3]) // virtual { - spc[0]=1; - spc[1]=1; - spc[2]=1; + spc[0] = 1; + spc[1] = 1; + spc[2] = 1; } +void wxVtkBaseView::GetNormal(double normal[3]) // virtual +{ + normal[0] = 0; + normal[1] = 0; + normal[2] = 0; +} //--------------------------------------------------------------------------- int wxVtkBaseView::GetDirection() // virtual diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h index 54d036f..24515d0 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h @@ -93,6 +93,7 @@ public: virtual int GetDirection(); vtkBaseData* GetVtkBaseData(); void SetVtkBaseData(vtkBaseData *vtkbasedata); + virtual void GetNormal(double nomal[3]); private: wxWindow *_parent; -- 2.45.1