From: Eduardo Davila Date: Sat, 23 Oct 2010 12:01:31 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: ManualPaint~16 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=60a203a08c56a0485114ef9a5287440100c22075;p=creaMaracasVisu.git *** empty log message *** --- diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index 0dae95a..719c0df 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -84,11 +84,12 @@ void ViewerNV::Process() //mwxwidget->UpdateLayout(img); } - if (firsttime==true) // EED 21 aout 2010 - { - firsttime=false; - mwxwidget->ConfigureVTK(); - } +// if (firsttime==true) // EED 21 aout 2010 +// { +// firsttime=false; +// mwxwidget->ConfigureVTK(); +// } + mwxwidget->RefreshView(); currenttype = type; @@ -164,7 +165,7 @@ void ViewerNV::CreateWidget(wxWindow* parent) //------------------------------------------------------------- void ViewerNV::bbUserSetDefaultValues() { - firsttime=true; +// firsttime=true; mwxwidget = NULL; bbSetInputIn(NULL); diff --git a/bbtk/src/bbmaracasvisuViewerNV.h b/bbtk/src/bbmaracasvisuViewerNV.h index 5407a00..658c2c1 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.h +++ b/bbtk/src/bbmaracasvisuViewerNV.h @@ -68,7 +68,7 @@ class /*BBTK_EXPORT*/ ViewerNV std::vector point; private: - bool firsttime; +// bool firsttime; vtkImageData* currentimg; std::vector currenttype; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx index b89ff63..38da613 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx @@ -3,14 +3,14 @@ Program: wxMaracas Module: $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $ Language: C++ - Date: $Date: 2010/08/25 17:51:12 $ - Version: $Revision: 1.19 $ + Date: $Date: 2010/10/23 12:01:32 $ + Version: $Revision: 1.20 $ Copyright: (c) 2002, 2003 License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ @@ -35,7 +35,7 @@ EVT_MENU( 12122, wxMaracas_N_ViewersWidget::OnDClickLeft ) END_EVENT_TABLE( ); - + //------------------------------------------------------------------------------------------------------------ // Constructors & Destructors //------------------------------------------------------------------------------------------------------------ @@ -51,25 +51,25 @@ wxwindow4 = NULL; _currentwxw = NULL; mvtkmprbasedata = NULL; - + wxSizer *sizer = new wxBoxSizer(wxVERTICAL); this->SetSizer(sizer); this->SetAutoLayout(true); - - + + if(imagedata!=NULL && nTypeView!=NULL ){ this->SetType(nTypeView); this->UpdateLayout(imagedata); } - + } /** * @pre A wxWindow* object must be provided as a parent for the viewer and the type of layout for the viewer - * @post The layout of the viewer is initialized, if no image is provided at first, a default image is + * @post The layout of the viewer is initialized, if no image is provided at first, a default image is * used * @param wxWindow* parent of the window - * @param std::vector* vector of the type for the viewer + * @param std::vector* vector of the type for the viewer * @param vtkImageData* imagedata of the viewer */ wxMaracas_N_ViewersWidget::wxMaracas_N_ViewersWidget(wxWindow *parent, std::vector *nTypeView, vtkImageData* imagedata) @@ -80,13 +80,13 @@ wxwindow4 = NULL; _currentwxw = NULL; mvtkmprbasedata = NULL; - + wxSizer *sizer = new wxBoxSizer(wxVERTICAL); this->SetSizer(sizer); this->SetAutoLayout(true); - + this->SetType(nTypeView); - + /*if(imagedata==NULL){ double spc[3]; spc[0] = 1; @@ -99,18 +99,18 @@ extent[3] = 1; extent[4] = 0; extent[5] = 0; - + imagedata = vtkImageData::New(); imagedata->SetSpacing(spc); imagedata->SetExtent(extent); imagedata->SetScalarTypeToUnsignedChar(); imagedata->AllocateScalars(); }*/ - + this->UpdateLayout(imagedata); } //------------------------------------------------------------------------- - + wxMaracas_N_ViewersWidget::~wxMaracas_N_ViewersWidget() { if (mvtkmprbasedata!=NULL) @@ -135,12 +135,12 @@ //------------------------------------------------------------------------- - void wxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event) + void wxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event) { RefreshView(); } //---------------------------------------------------------------------------- - void wxMaracas_N_ViewersWidget::OnDClickLeft(wxCommandEvent & event) + void wxMaracas_N_ViewersWidget::OnDClickLeft(wxCommandEvent & event) { RefreshView(); } @@ -153,7 +153,8 @@ } void wxMaracas_N_ViewersWidget::RefreshView() - { + { + if (wxwindow1!=NULL) {wxwindow1->RefreshView(); } if (wxwindow2!=NULL) {wxwindow2->RefreshView(); } if (wxwindow3!=NULL) {wxwindow3->RefreshView(); } @@ -161,7 +162,7 @@ } //------------------------------------------------------------------------- - wxMaracas_ViewerWidget *wxMaracas_N_ViewersWidget::GetWindow(int iWin) + wxMaracas_ViewerWidget *wxMaracas_N_ViewersWidget::GetWindow(int iWin) { wxMaracas_ViewerWidget *tmpWin=NULL; if (iWin==1) @@ -185,13 +186,13 @@ //------------------------------------------------------------------------- wxVtkBaseView *wxMaracas_N_ViewersWidget::GetwxVtkBaseView(int iWin) - { + { wxVtkBaseView *wxvtkbaseview=NULL; wxMaracas_ViewerWidget *tmpWin=GetWindow(iWin); if (tmpWin!=NULL){ wxvtkbaseview = tmpWin->GetwxVtkBaseView(); } return wxvtkbaseview; } - + //------------------------------------------------------------------------- void wxMaracas_N_ViewersWidget::Refresh(bool eraseBackground, const wxRect* rect ) { @@ -201,23 +202,22 @@ //------------------------------------------------------------------------- void wxMaracas_N_ViewersWidget::UpdateLayout(vtkImageData* imagedata) { - wxWindow *wxwindow = NULL; - wxSizer *sizer = this->GetSizer(); - + wxSizer *sizer = this->GetSizer(); + if (mvtkmprbasedata!=NULL) { delete mvtkmprbasedata; } - - marImageData *marimagedata = new marImageData( imagedata ); - mvtkmprbasedata = new vtkMPRBaseData(); + + marImageData *marimagedata = new marImageData( imagedata ); + mvtkmprbasedata = new vtkMPRBaseData(); mvtkmprbasedata->SetMarImageData(marimagedata); - + if(_currentwxw != NULL){ _currentwxw->Show(false); delete _currentwxw; - //sizer->Remove(currentwxwindow); + //sizer->Remove(currentwxwindow); //delete currentwxwindow; } @@ -225,18 +225,14 @@ if (nTypeView->size()==1) { wxwindow1 = new wxMaracas_ViewerWidget(this, imagedata, (*nTypeView)[0], mvtkmprbasedata); - - wxwindow1->ConfigureVTK(); wxwindow = wxwindow1; }else if (nTypeView->size()==2) { wxSplitterWindow *spliter = new wxSplitterWindow( this , -1); spliter->SetMinimumPaneSize(1); wxwindow1 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[0], mvtkmprbasedata); wxwindow2 = new wxMaracas_ViewerWidget(spliter, imagedata, (*nTypeView)[1], mvtkmprbasedata); - wxwindow1->ConfigureVTK(); - wxwindow2->ConfigureVTK(); spliter -> SplitVertically( wxwindow1 , wxwindow2 ); - wxwindow = spliter; + wxwindow = spliter; }else if (nTypeView->size()==3) { wxSplitterWindow *spliter = new wxSplitterWindow( this , -1); @@ -246,9 +242,6 @@ wxwindow1 = new wxMaracas_ViewerWidget(spliter , imagedata, (*nTypeView)[0], mvtkmprbasedata); wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1], mvtkmprbasedata); wxwindow3 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[2], mvtkmprbasedata); - wxwindow1->ConfigureVTK(); - wxwindow2->ConfigureVTK(); - wxwindow3->ConfigureVTK(); spliter -> SplitVertically( wxwindow1 , spliterA ); spliterA-> SplitHorizontally( wxwindow2 , wxwindow3 ); wxwindow = spliter; @@ -259,28 +252,33 @@ spliter->SetMinimumPaneSize(1); spliterA->SetMinimumPaneSize(1); spliterB->SetMinimumPaneSize(1); + + spliter -> SplitVertically( spliterA , spliterB ); wxwindow1 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[0], mvtkmprbasedata); wxwindow2 = new wxMaracas_ViewerWidget(spliterA, imagedata, (*nTypeView)[1], mvtkmprbasedata); + spliterA-> SplitHorizontally( wxwindow1 , wxwindow2 ); wxwindow3 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[2], mvtkmprbasedata); wxwindow4 = new wxMaracas_ViewerWidget(spliterB, imagedata, (*nTypeView)[3], mvtkmprbasedata); - wxwindow1->ConfigureVTK(); - wxwindow2->ConfigureVTK(); - wxwindow3->ConfigureVTK(); - wxwindow4->ConfigureVTK(); - spliter -> SplitVertically( spliterA , spliterB ); - spliterA-> SplitHorizontally( wxwindow1 , wxwindow2 ); spliterB-> SplitHorizontally( wxwindow3 , wxwindow4 ); wxwindow = spliter; } - + + //panel->SetDimension() sizer->Add( wxwindow , 1, wxGROW); sizer->Layout(); - //_currentwxw = wxwindow; + //_currentwxw = wxwindow; //_currentwxw->Show(true); - + //this->Layout(); //this->Refresh(); + + +// I don't undestand how this works and not the opposite ... + if (wxwindow4!=NULL) {wxwindow4->ConfigureVTK(); } + if (wxwindow3!=NULL) {wxwindow3->ConfigureVTK(); } + if (wxwindow2!=NULL) {wxwindow2->ConfigureVTK(); } + if (wxwindow1!=NULL) {wxwindow1->ConfigureVTK(); } } @@ -293,13 +291,13 @@ //----------------------------------------------------------------------------------- void wxMaracas_N_ViewersWidget::SetImage( vtkImageData *image ) - { + { if (wxwindow1!=NULL) { wxwindow1->SetImage(image); } - if (wxwindow2!=NULL) { wxwindow2->SetImage(image); } + if (wxwindow2!=NULL) { wxwindow2->SetImage(image); } if (wxwindow3!=NULL) { wxwindow3->SetImage(image); } if (wxwindow4!=NULL) { wxwindow4->SetImage(image); } ConfigureVTK(); - + } //----------------------------------------------------------------------------------- @@ -313,7 +311,7 @@ //----------------------------------------------------------------------------------- double wxMaracas_N_ViewersWidget :: GetX() -{ +{ invariant(); return mvtkmprbasedata->GetX(); // return wxwindow1->GetX(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h index 19bd3c2..b20c91f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h @@ -3,14 +3,14 @@ Program: wxMaracas Module: $RCSfile: wxMaracas_N_ViewersWidget.h,v $ Language: C++ - Date: $Date: 2010/08/04 18:45:27 $ - Version: $Revision: 1.11 $ + Date: $Date: 2010/10/23 12:01:32 $ + Version: $Revision: 1.12 $ Copyright: (c) 2002, 2003 License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ @@ -48,30 +48,30 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel { public: - + //------------------------------------------------------------------------------------------------------------ // Constructors & Destructors //------------------------------------------------------------------------------------------------------------ /** * @pre A wxWindow* object must be provided as a parent for the viewer - * @post The layout of the viewer is initialize, if there is no image or type set, + * @post The layout of the viewer is initialize, if there is no image or type set, only the panel of the viwer is created with no vtk objects * @param wxWindow* parent of the window * @param vtkImageData* imagedata of the viewer * @param std::vector* vector of the type for the viewer - * @deprecated This method will be eliminated in future versions, - * @deprecated the viewers will start with a default image if it is not specified, - * @deprecated this is in order to create the layout of the viewer, - * @deprecated the vtkInteractors* and the object vtkRenderer* use second constructor + * @deprecated This method will be eliminated in future versions, + * @deprecated the viewers will start with a default image if it is not specified, + * @deprecated this is in order to create the layout of the viewer, + * @deprecated the vtkInteractors* and the object vtkRenderer* use second constructor */ wxMaracas_N_ViewersWidget(wxWindow *parent, vtkImageData* imagedata = NULL, std::vector *nTypeView = NULL); /** * @pre A wxWindow* object must be provided as a parent for the viewer and the type of layout for the viewer - * @post The layout of the viewer is initialized, if no image is provided at first, a default image is + * @post The layout of the viewer is initialized, if no image is provided at first, a default image is * used * @param wxWindow* parent of the window - * @param std::vector* vector of the type for the viewer + * @param std::vector* vector of the type for the viewer * @param vtkImageData* imagedata of the viewer */ wxMaracas_N_ViewersWidget(wxWindow *parent, std::vector *nTypeView, vtkImageData* imagedata = NULL); @@ -81,7 +81,7 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel */ ~wxMaracas_N_ViewersWidget(); - + //------------------------------------------------------------------------------------------------------------ // Methods //------------------------------------------------------------------------------------------------------------ @@ -114,7 +114,11 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel //------------------------------------------------------------------------------------------------------------ private: - + + wxPanel *wxw1; + wxPanel *wxw2; + wxPanel *wxw3; + wxPanel *wxw4; wxMaracas_ViewerWidget *wxwindow1; wxMaracas_ViewerWidget *wxwindow2; wxMaracas_ViewerWidget *wxwindow3; @@ -125,8 +129,8 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel std::vector *nTypeView; - vtkMPRBaseData* mvtkmprbasedata; - + vtkMPRBaseData* mvtkmprbasedata; + void invariant(); DECLARE_EVENT_TABLE( ); }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx index 1ae47ff..53b7f5f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx @@ -3,14 +3,14 @@ Program: wxMaracas Module: $RCSfile: wxMaracas_ViewerWidget.cxx,v $ Language: C++ - Date: $Date: 2010/08/25 17:51:12 $ - Version: $Revision: 1.30 $ + Date: $Date: 2010/10/23 12:01:32 $ + Version: $Revision: 1.31 $ Copyright: (c) 2002, 2003 License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ @@ -35,7 +35,7 @@ wxWindow *wxwindow = NULL, *window3D = 0; wxSplitterWindow *panelClipping3D= 0; // wxPanel *panelControl = 0; -// wxFlexGridSizer *sizerCtrol = 0; +// wxFlexGridSizer *sizerCtrol = 0; wxPanel *controlPanelMPR3D = 0; wxPanel *controlPanelClippingSurf3D = 0; //RaC 03-2010 Adding a tab @@ -47,13 +47,13 @@ if (vtkmprbasedata==NULL) { - minternalVtkmprbasedata = true; - mvtkmprbasedata = new vtkMPRBaseData(); - marImageData *marimagedata = new marImageData( imagedata ); + minternalVtkmprbasedata = true; + mvtkmprbasedata = new vtkMPRBaseData(); + marImageData *marimagedata = new marImageData( imagedata ); mvtkmprbasedata->SetMarImageData(marimagedata); } else { minternalVtkmprbasedata = false; - mvtkmprbasedata = vtkmprbasedata; + mvtkmprbasedata = vtkmprbasedata; } mvtk2Dbaseview = NULL; @@ -72,22 +72,22 @@ { mvtk2Dbaseview = new wxVtk2DBaseView(panel); mvtk2Dbaseview->SetVtkBaseData(mvtkmprbasedata); - wxwindow = mvtk2Dbaseview->GetWxVTKRenderWindowInteractor(); + wxwindow = mvtk2Dbaseview->GetWxVTKRenderWindowInteractor(); }else if (type==0) { mvtkmpr2Dview_Z = new wxVtkMPR2DView(panel,2); mvtkmpr2Dview_Z->SetVtkBaseData(mvtkmprbasedata); - wxwindow = mvtkmpr2Dview_Z->GetWxVTKRenderWindowInteractor(); + wxwindow = mvtkmpr2Dview_Z->GetWxVTKRenderWindowInteractor(); }else if (type==1) { mvtkmpr2Dview_X = new wxVtkMPR2DView(panel,0); mvtkmpr2Dview_X->SetVtkBaseData(mvtkmprbasedata); - wxwindow = mvtkmpr2Dview_X->GetWxVTKRenderWindowInteractor(); + wxwindow = mvtkmpr2Dview_X->GetWxVTKRenderWindowInteractor(); }else if (type==2) { mvtkmpr2Dview_Y = new wxVtkMPR2DView(panel,1); mvtkmpr2Dview_Y->SetVtkBaseData(mvtkmprbasedata); - wxwindow = mvtkmpr2Dview_Y->GetWxVTKRenderWindowInteractor(); + wxwindow = mvtkmpr2Dview_Y->GetWxVTKRenderWindowInteractor(); }else if (type==3) { mwidgetMesure = new wxWidgetMesure2D_Plane_in_MPR(panel); @@ -106,13 +106,13 @@ mwxvtk3Dbaseview_Clipping3D = new wxVtk3DBaseView( panelClipping3D ); mwxvtkclipping3Dview = new wxVtkClipping3DView(mwxvtk3Dbaseview_Clipping3D); - vtkClipping3DDataViewer *vtkclipping3Ddataviewer = new vtkClipping3DDataViewer(); + vtkClipping3DDataViewer *vtkclipping3Ddataviewer = new vtkClipping3DDataViewer(); vtkclipping3Ddataviewer->SetVtkMPRBaseData(mvtkmprbasedata); vtkclipping3Ddataviewer->Configure(); mwxvtkclipping3Dview->SetVtkClipping3DDataViewer(vtkclipping3Ddataviewer); mwxvtkmpr3Dview = new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D ); - vtkMPR3DDataViewer *vtkmpr3Ddataviewer = new vtkMPR3DDataViewer(); + vtkMPR3DDataViewer *vtkmpr3Ddataviewer = new vtkMPR3DDataViewer(); vtkmpr3Ddataviewer->SetVtkMPRBaseData(mvtkmprbasedata); vtkmpr3Ddataviewer->Configure(); mwxvtkmpr3Dview->SetVtkMPR3DDataViewer(vtkmpr3Ddataviewer); @@ -127,9 +127,9 @@ notebook->AddPage(controlPanelMPR3D, _T("Planes") ); // Second Tab - controlPanelClippingSurf3D = mwxvtkclipping3Dview->CreateSurfControlPanel(notebook); + controlPanelClippingSurf3D = mwxvtkclipping3Dview->CreateSurfControlPanel(notebook); notebook->AddPage(controlPanelClippingSurf3D, _T("Surface") ); - + //Third tab //RaC 03-2010 Moving the volume functionnality to other tab. The changes were realized only in the wxVtkClipping3DViewCntrlPanel class controlPanelClippingVol3D = mwxvtkclipping3Dview->CreateVolControlPanel(notebook); @@ -137,10 +137,10 @@ panelClipping3D->SplitHorizontally( notebook , window3D , 10 ); //panelClipping3D->SetMinimumPaneSize( 15 ); - panelClipping3D->SetMinimumPaneSize( 70 ); // JPR - + panelClipping3D->SetMinimumPaneSize( 70 ); // JPR + /* EED 04 / Febrary / 2010 - panelControl = new wxPanel(panelClipping3D,-1); + panelControl = new wxPanel(panelClipping3D,-1); controlPanelMPR3D = mwxvtkmpr3Dview->CreateControlPanel(panelControl, false); controlPanelClipping3D = mwxvtkclipping3Dview->CreateControlPanel(panelControl); // mbtnCutImageData = new wxCheckBox(panelControl,-1,_T("Cut Module")); @@ -157,19 +157,19 @@ panelClipping3D -> SetMinimumPaneSize( 5 ); */ wxwindow=panelClipping3D; - + } else if (type==6) { panelClipping3D = new wxSplitterWindow( panel , -1); mwxvtk3Dbaseview_Clipping3D = new wxVtk3DBaseView( panelClipping3D ); mwxvtkmpr3Dview = new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D ); - vtkmpr3Ddataviewer = new vtkMPR3DDataViewer(); - + vtkmpr3Ddataviewer = new vtkMPR3DDataViewer(); + wxWindow *window3D = mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor(); - wxPanel *panelControl = new wxPanel(panelClipping3D,-1); - wxPanel *controlPanelMPR3D = mwxvtkmpr3Dview->CreateControlPanel(panelControl, false); + wxPanel *panelControl = new wxPanel(panelClipping3D,-1); + wxPanel *controlPanelMPR3D = mwxvtkmpr3Dview->CreateControlPanel(panelControl, true); wxFlexGridSizer *sizerCtrol = new wxFlexGridSizer(1); sizerCtrol->Add(controlPanelMPR3D, 1, wxALL|wxEXPAND, 2); @@ -184,19 +184,19 @@ panelClipping3D->SplitHorizontally( panelControl , window3D , 10 ); wxwindow=panelClipping3D; - vtkmpr3Ddataviewer->SetVtkMPRBaseData(mvtkmprbasedata); + vtkmpr3Ddataviewer->SetVtkMPRBaseData(mvtkmprbasedata); //vtkmpr3Ddataviewer->Configure(); mwxvtkmpr3Dview->SetVtkMPR3DDataViewer(vtkmpr3Ddataviewer); - + }else if (type==7) { - mwxvtk3Dbaseview_Clipping3D = new wxVtk3DBaseView( panel ); + mwxvtk3Dbaseview_Clipping3D = new wxVtk3DBaseView( panel ); wxwindow = (wxWindow*) mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor(); } sizer = new wxBoxSizer(wxVERTICAL); - sizer->Add( wxwindow, 1, wxGROW); + sizer->Add( wxwindow, 1, wxGROW); panel->SetSizer(sizer); panel->SetAutoLayout(true); sizer->Layout(); @@ -212,7 +212,7 @@ if (minternalVtkmprbasedata==true) { if (mvtkmprbasedata) { delete mvtkmprbasedata;} - } + } if (mvtk2Dbaseview) { delete mvtk2Dbaseview; } if (mvtkmpr2Dview_X) { delete mvtkmpr2Dview_X;} @@ -244,7 +244,7 @@ ext[5]=0; */ int ext[] = {0, 0, 0, 0, 0, 0}; //JPR - + /*double org[3],spc[3]; org[0]=0; org[1]=0; @@ -261,8 +261,8 @@ /* x = mvtkmprbasedata->GetMaxPositionX()/2; y = mvtkmprbasedata->GetMaxPositionY()/2; - z = mvtkmprbasedata->GetMaxPositionZ()/2; - */ + z = mvtkmprbasedata->GetMaxPositionZ()/2; + */ if(mvtkmprbasedata->GetImageData() != NULL) { @@ -285,7 +285,7 @@ mvtkmprbasedata->SetZ( 0 ); } } - + if ( mvtk2Dbaseview !=NULL ) { mvtk2Dbaseview->Configure(); } if ( mvtkmpr2Dview_X !=NULL ) { mvtkmpr2Dview_X->Configure(); } if ( mvtkmpr2Dview_Y !=NULL ) { mvtkmpr2Dview_Y->Configure(); } @@ -296,43 +296,37 @@ if ( mwidgetMesure !=NULL ) { mwidgetMesure->SetActiveLink(true); } if ( mwidgetMesure !=NULL ) { mwidgetMesure->SetMesureScale( 1 ); } if ( mwxsphereview !=NULL ) { mwxsphereview->Configure(); } - - if (mwxvtk3Dbaseview_Clipping3D !=NULL) + if (mwxvtk3Dbaseview_Clipping3D !=NULL) { - mwxvtk3Dbaseview_Clipping3D->Configure(); + mwxvtk3Dbaseview_Clipping3D->Configure(); } if (vtkmpr3Ddataviewer !=NULL) - { - vtkmpr3Ddataviewer->Configure(); + { + vtkmpr3Ddataviewer->Configure(); } - - if (mwxvtkmpr3Dview !=NULL) - { - + { mwxvtkmpr3Dview->Configure(); mwxvtkmpr3Dview->ResetCamera(ext,org,spc); } - if (mwxvtkclipping3Dview !=NULL) - { - mwxvtkclipping3Dview->Configure(); + if (mwxvtkclipping3Dview !=NULL) + { + mwxvtkclipping3Dview->Configure(); } - - if (mwxvtkclipping3Dview !=NULL) { mwxvtkclipping3Dview->Configure(); } - //if(vtkmpr3Ddataviewer!=NULL){vtkmpr3Ddataviewer->Configure();} // RefreshView(); //if (mwxvtkmpr3Dview !=NULL) { // mwxvtkmpr3Dview->ResetCamera(); //} + } //------------------------------------------------------------------------- @@ -362,25 +356,25 @@ wxVtkBaseView *wxMaracas_ViewerWidget::GetwxVtkBaseView() { wxVtkBaseView *wxvtkbaseview=NULL; - if (mvtk2Dbaseview!=NULL){ - wxvtkbaseview = mvtk2Dbaseview; + if (mvtk2Dbaseview!=NULL){ + wxvtkbaseview = mvtk2Dbaseview; } - if (mvtkmpr2Dview_X!=NULL){ + if (mvtkmpr2Dview_X!=NULL){ wxvtkbaseview = mvtkmpr2Dview_X; } - if (mvtkmpr2Dview_Y!=NULL){ + if (mvtkmpr2Dview_Y!=NULL){ wxvtkbaseview = mvtkmpr2Dview_Y; } - if (mvtkmpr2Dview_Z!=NULL){ - wxvtkbaseview = mvtkmpr2Dview_Z; + if (mvtkmpr2Dview_Z!=NULL){ + wxvtkbaseview = mvtkmpr2Dview_Z; } if (mvtkplane2Dview!=NULL){ - wxvtkbaseview = mvtkplane2Dview; + wxvtkbaseview = mvtkplane2Dview; } - if (mwxsphereview!=NULL){ + if (mwxsphereview!=NULL){ wxvtkbaseview = mwxsphereview; } - if (mwxvtk3Dbaseview_Clipping3D!=NULL){ + if (mwxvtk3Dbaseview_Clipping3D!=NULL){ wxvtkbaseview = mwxvtk3Dbaseview_Clipping3D; } return wxvtkbaseview ; @@ -431,7 +425,7 @@ // return mvtk2Dbaseview->GetVtkBaseData()->GetZ(); } - void wxMaracas_ViewerWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){ + void wxMaracas_ViewerWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){ if(mvtkmpr2Dview_X!=NULL){ mvtkmpr2Dview_X->setColorTransferFunction(colortable); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index 67ecb3f..319e00c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -20,19 +20,19 @@ wxVtkMPR3DView::wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview ) { _wxvtk3Dbaseview = wxvtk3Dbaseview; _vtkmpr3Ddataviewer = NULL; - _wxvtkmpr3DviewCntrlPanel = NULL; + _wxvtkmpr3DviewCntrlPanel = NULL; //_myCallback = NULL; _pointWidget = NULL; _planeWidget = NULL; _vtkplane = NULL; _probe = NULL; _contourMapper = NULL; - + _planeWidgetX = 0; _planeWidgetY = 0; _planeWidgetZ = 0; //EED Fev 3 2010 - //Free Planes + //Free Planes } @@ -41,37 +41,37 @@ wxVtkMPR3DView::~wxVtkMPR3DView() { VisiblePointWidget( false ); VisiblePlaneWidget( false ); - + if(_pointWidget!=NULL){ _pointWidget->Delete(); } if(_planeWidget!=NULL){ _planeWidget->Delete(); } - + if(_vtkplane!=NULL){ - _vtkplane->Delete(); + _vtkplane->Delete(); _probe->Delete(); - _contourMapper->Delete(); - _contourPlaneActor->Delete(); + _contourMapper->Delete(); + _contourPlaneActor->Delete(); } - + } //------------------------------------------------------------------- void wxVtkMPR3DView::RemoveActor(vtkActor* actor) -{ - _wxvtk3Dbaseview->GetRenderer()->RemoveActor(actor); +{ + _wxvtk3Dbaseview->GetRenderer()->RemoveActor(actor); } //------------------------------------------------------------------- void wxVtkMPR3DView::ResetCamera(int* ext, double* origin,double* spc) { if(ext == NULL){ - _wxvtk3Dbaseview->GetRenderer()->ResetCamera (); - _wxvtk3Dbaseview->GetCamera()->Dolly(1.5); + _wxvtk3Dbaseview->GetRenderer()->ResetCamera (); + _wxvtk3Dbaseview->GetCamera()->Dolly(1.5); }else{ - /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0)); + /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0)); double y = (spc[1])*(origin[1]+(double)ext[3]); double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/ /*double x0=(spc[0])*((double)ext[0]+origin[0]); @@ -86,47 +86,46 @@ void wxVtkMPR3DView::ResetCamera(int* ext, double* origin,double* spc) double y1=(spc[1])*((double)ext[3]); double z0=(spc[2])*((double)ext[4]); double z1=(spc[2])*((double)ext[5]); - + _wxvtk3Dbaseview->GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1); //_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z); - _wxvtk3Dbaseview->GetCamera()->Dolly(1.5); + _wxvtk3Dbaseview->GetCamera()->Dolly(1.5); } } //------------------------------------------------------------------- -void wxVtkMPR3DView::Configure(){ - - +void wxVtkMPR3DView::Configure() +{ vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); _wxvtk3Dbaseview->Configure(); _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel(); - -//EED 27 Mai 2009 -// _wxvtk3Dbaseview->GetRenderer()->Clear(); - - // Actors are added to the renderer. + +//EED 27 Mai 2009 +// _wxvtk3Dbaseview->GetRenderer()->Clear(); + + // Actors are added to the renderer. vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor(); - _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); + _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); // _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(0) ); // _saggital // _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(1) ); // _axial // _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(2) ); // _coronal - // An initial camera view is created. The Dolly() method moves - // the camera towards the FocalPoint, thereby enlarging the image. + // An initial camera view is created. The Dolly() method moves + // the camera towards the FocalPoint, thereby enlarging the image. _wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera()); this->ResetCamera(); - + // Set a background color for the renderer and set the size of the // render window (expressed in pixels). _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.36 , 0.36 , 0.36 ); - _wxvtk3Dbaseview->GetRenWin()->SetSize(400, 400); +//EED 23oct2010 _wxvtk3Dbaseview->GetRenWin()->SetSize(400, 400); // Note that when camera movement occurs (as it does in the Dolly() // method), the clipping planes often need adjusting. Clipping planes - // consist of two planes: near and far along the view direction. The + // consist of two planes: near and far along the view direction. The // near plane clips out objects in front of the plane; the far plane // clips out objects behind the plane. This way only what is drawn // between the planes is actually rendered. @@ -140,50 +139,49 @@ void wxVtkMPR3DView::Configure(){ //} vtkmyPWCallback_3DPointWidget *_myCallback = vtkmyPWCallback_3DPointWidget::New(); _myCallback->SetWxVtkMPR3DView(this); - - + + if(imageData){ if(_pointWidget==NULL){ _pointWidget = vtkPointWidget::New(); } _pointWidget->SetInput( imageData ); _myCallback->SetVtkPointWidget(_pointWidget); - _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); + _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); _pointWidget->AllOff(); _pointWidget->PlaceWidget(); - + _pointWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback); - - + if(_planeWidget==NULL) { _planeWidget = vtkPlaneWidget::New(); } _planeWidget->SetInput( imageData ); - + _myCallback->SetVtkPlaneWidget(_planeWidget); _planeWidget->NormalToXAxisOn(); _planeWidget->SetResolution(50); _planeWidget->SetRepresentationToOutline(); - + int dim[3]; - + imageData->GetDimensions(dim); int px=(dim[0]/2); int py=(dim[1]/2); int pz=(dim[2]/2); int dd=20; _planeWidget->PlaceWidget( px-dd , px+dd , py-dd , py+dd , pz-dd , pz+dd ); - + if(_vtkplane==NULL){ _vtkplane = vtkPolyData::New(); - + _probe = vtkProbeFilter::New(); _probe->SetInput(_vtkplane); _contourMapper = vtkPolyDataMapper::New(); - + _contourMapper->SetInput( _probe->GetPolyDataOutput() ); _contourPlaneActor = vtkActor::New(); @@ -195,37 +193,26 @@ void wxVtkMPR3DView::Configure(){ _planeWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback); _planeWidget->Off(); - _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor ); + _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor ); } _planeWidget->GetPolyData(_vtkplane); _probe->SetSource( imageData ); _contourMapper->SetScalarRange( imageData->GetScalarRange() ); - - + + ConfigureFreePlanes(); } - -// _pointWidget->SetPosition( x,y,z ); - + +// _pointWidget->SetPosition( x,y,z ); + //EED01 29Mars2009 -// MACOS probleme vtk-window out of wx-window +// MACOS probleme vtk-window out of wx-window // _pointWidget->On(); - - - // PlaneWidget - - - - - - - - } //------------------------------------------------------------------- @@ -237,58 +224,53 @@ void wxVtkMPR3DView::ConfigureFreePlanes() vtkCellPicker* picker = vtkCellPicker::New(); picker->SetTolerance(0.005); - // The 3 image plane widgets + // The 3 image plane widgets _planeWidgetX = GetPlaneWidget('x', 1, 0, 0, picker); _planeWidgetY = GetPlaneWidget('y', 1, 1, 0, picker); - _planeWidgetZ = GetPlaneWidget('z', 0, 0, 1, picker); - + _planeWidgetZ = GetPlaneWidget('z', 0, 0, 1, picker); + _planeWidgetY->SetLookupTable(_planeWidgetX->GetLookupTable()); _planeWidgetZ->SetLookupTable(_planeWidgetX->GetLookupTable()); - + picker->UnRegister(NULL); - + } //------------------------------------------------------------------- vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker) { - vtkProperty* prop1 = 0; + vtkProperty* prop1 = 0; vtkImagePlaneWidget* planeWidget = 0; planeWidget = vtkImagePlaneWidget::New(); - planeWidget->EnabledOff(); planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); + planeWidget->EnabledOff(); vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); int xMin = 0, xMax = 0, yMin = 0, yMax = 0, zMin = 0, zMax = 0; double xSpacing = 0, ySpacing = 0, zSpacing = 0; if(image){ planeWidget->SetInput( image ); - image->GetExtent(xMin, xMax, yMin, yMax, zMin, zMax); + image->GetExtent(xMin, xMax, yMin, yMax, zMin, zMax); image->GetSpacing(xSpacing, ySpacing, zSpacing); } - - - - - if (activationkey=='x') { - planeWidget->SetPlaneOrientationToXAxes(); + planeWidget->SetPlaneOrientationToXAxes(); planeWidget->SetSlicePosition((xMax+xMin)/2.*xSpacing); } - + if (activationkey=='y') { planeWidget->SetPlaneOrientationToYAxes(); planeWidget->SetSlicePosition((yMax+yMin)/2.*ySpacing); } - + if (activationkey=='z') { planeWidget->SetPlaneOrientationToZAxes(); planeWidget->SetSlicePosition((zMax+zMin)/2.*zSpacing); } - + planeWidget->DisplayTextOn(); planeWidget->SetPicker(picker); planeWidget->SetKeyPressActivationValue(activationkey); @@ -331,7 +313,7 @@ void wxVtkMPR3DView::FreePlaneInteraction(bool ok) //------------------------------------------------------------------- void wxVtkMPR3DView::setColorTransferFunction(vtkColorTransferFunction* colortable) { - GetVtkMPR3DDataViewer ()->setColorTransferFunction(colortable); + GetVtkMPR3DDataViewer ()->setColorTransferFunction(colortable); } //------------------------------------------------------------------- @@ -350,7 +332,7 @@ void wxVtkMPR3DView::RefreshView() // virtual { double spc[3]; vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); - + if(image){ image->GetSpacing(spc); }else{ @@ -371,10 +353,10 @@ void wxVtkMPR3DView::RefreshView() // virtual z=z*spc[2]; if(_pointWidget){ - _pointWidget->SetPosition( x,y,z ); + _pointWidget->SetPosition( x,y,z ); - double in[3]; + double in[3]; double normal[3]; vtkTransform *transform = GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetTransformOrientation(); in[0]=1; in[1]=0; in[2]=0; @@ -394,9 +376,9 @@ wxPanel* wxVtkMPR3DView::CreateControlPanel(wxWindow *parent, bool align) return _wxvtkmpr3DviewCntrlPanel; } //------------------------------------------------------------------- -vtkMPR3DDataViewer* wxVtkMPR3DView::GetVtkMPR3DDataViewer() +vtkMPR3DDataViewer* wxVtkMPR3DView::GetVtkMPR3DDataViewer() { - return _vtkmpr3Ddataviewer; + return _vtkmpr3Ddataviewer; } //------------------------------------------------------------------- wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() throw (char*) @@ -420,9 +402,9 @@ void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){ */ if (visible!=_vtkmpr3Ddataviewer->GetVisiblePosition(idPosition)){ if (visible==false){ - _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) ); + _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) ); } else { - _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) ); + _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) ); } _vtkmpr3Ddataviewer->SetVisiblePosition(idPosition,visible); } @@ -464,11 +446,11 @@ void wxVtkMPR3DView::showOutlineActor(bool value) vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor(); if(value == true) { - _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); + _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); } else { - _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _outlineActor ); + _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _outlineActor ); } } @@ -481,7 +463,7 @@ void wxVtkMPR3DView::SetVtkMPR3DDataViewer(vtkMPR3DDataViewer *vtkmpr3Ddataviewe //------------------------------------------------------------------- void wxVtkMPR3DView::InitOrientationPointWidget() { - this->_planeWidget->SetNormal(1,0,0); + this->_planeWidget->SetNormal(1,0,0); } @@ -533,7 +515,7 @@ void wxVtkMPR3DView::TestLoic1() stPoints -> Update(); vtkImageChangeInformation *change = vtkImageChangeInformation ::New(); - change -> SetInput( stPoints ); + change -> SetInput( stPoints ); change -> Update(); //important double _range[2]; @@ -546,7 +528,7 @@ void wxVtkMPR3DView::TestLoic1() _bwlookup->SetValueRange( 0 , 1 ); _bwlookup->SetAlphaRange( 1 , 1 ); _bwlookup->Build( ); - + vtkLookupTable * _collookup = vtkLookupTable::New( ); _collookup->SetNumberOfColors( 256 ); _collookup->SetTableRange( 0 , 255 ); @@ -589,7 +571,7 @@ void wxVtkMPR3DView::TestLoic1() renderer->SetActiveCamera(camera); renderer->ResetCamera(); renderer->SetBackground(1,1,1); - + renWin->SetSize(300,300); // interact with data @@ -616,7 +598,7 @@ void wxVtkMPR3DView::TestLoic2() vtkPlane *slicePlane = vtkPlane::New(); this->_planeWidget->GetPlane( slicePlane ); - + vtkCutter* sliceCutter = vtkCutter::New(); vtkImageData *vtkimagedata = this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); sliceCutter->SetInput( vtkimagedata ); @@ -645,7 +627,7 @@ void wxVtkMPR3DView::TestLoic2() contourMapper->SetScalarRange( range ); // contourMapper->SetLookupTable( lut ); - + vtkActor *contourActor = vtkActor::New(); contourActor->SetMapper( contourMapper ); @@ -668,7 +650,7 @@ void wxVtkMPR3DView::TestLoic2() renderer->SetActiveCamera(camera); renderer->ResetCamera(); renderer->SetBackground(1,1,1); - + renWin->SetSize(300,300); // interact with data