From fc5b599e2f9a94153549471b67aaefa2afd015ea Mon Sep 17 00:00:00 2001 From: Ricardo Corredor Date: Wed, 17 Mar 2010 16:52:51 +0000 Subject: [PATCH] Divides in two panels the Surface/Volume tab. It was changed only the class "maracasVisuLib\src\interface\wxWindows\widgets\wxVtkClipping3DViewCntrlPanel.cxx" to remove the options of Volume which were added in wxVtkClipping3DViewVolCntrlPanel.cxx . To put this volume options into a notebook can be obtained from the same wxVtkClipping3DView, but it is necessary to call CreateVolControlPanel. Commentaries with //RaC tag --- .../wxWindows/widgets/wxMPRWidget.cxx | 8 +- .../widgets/wxManualTree_MPRWidget.cxx | 6 +- .../widgets/wxMaracas_ViewerWidget.cxx | 24 +- .../wxWindows/widgets/wxVtkClipping3DView.cxx | 13 +- .../wxWindows/widgets/wxVtkClipping3DView.h | 6 +- .../widgets/wxVtkClipping3DViewCntrlPanel.cxx | 39 ++- .../wxVtkClipping3DViewVolCntrlPanel.cxx | 251 ++++++++++++++++++ .../wxVtkClipping3DViewVolCntrlPanel.h | 26 ++ 8 files changed, 346 insertions(+), 27 deletions(-) create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.h diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx index 61063ce..a8b83cc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: wxMPRWidget.cxx,v $ Language: C++ - Date: $Date: 2009/11/30 20:52:50 $ - Version: $Revision: 1.15 $ + Date: $Date: 2010/03/17 16:52:51 $ + Version: $Revision: 1.16 $ Copyright: (c) 2002, 2003 License: @@ -405,7 +405,7 @@ wxPanel* wxMPRWidget::CreateView(int type,wxWindow *parent, vtkMPRBaseData *vtkm wxPanel *panelControl = new wxPanel(panelClipping3D,-1); wxPanel *controlPanelMPR3D = _wxvtkmpr3Dview_BB->CreateControlPanel(panelControl, false); - wxPanel *controlPanelClipping3D = _wxvtkclipping3Dview_BB->CreateControlPanel(panelControl); + wxPanel *controlPanelClipping3D = _wxvtkclipping3Dview_BB->CreateSurfControlPanel(panelControl); _btnCutImageData = new wxCheckBox(panelControl,-1,_T("Cut Module")); Connect(_btnCutImageData->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxMPRWidget::OnCutImagaData ); @@ -531,7 +531,7 @@ wxPanel* wxMPRWidget::CreateMPRPanel4View(wxWindow *parent, vtkMPRBaseData *vtkm wxPanel *panelControl = new wxPanel(panelMPR3D,-1); wxPanel *controlPanelMPR3D = _wxvtkmpr3Dview->CreateControlPanel(panelControl, false); - wxPanel *controlPanelClipping3D = _wxvtkclipping3Dview->CreateControlPanel(panelControl); + wxPanel *controlPanelClipping3D = _wxvtkclipping3Dview->CreateSurfControlPanel(panelControl); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxManualTree_MPRWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxManualTree_MPRWidget.cxx index d27baa5..2df266f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxManualTree_MPRWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxManualTree_MPRWidget.cxx @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: wxManualTree_MPRWidget.cxx,v $ Language: C++ - Date: $Date: 2009/11/30 20:55:40 $ - Version: $Revision: 1.3 $ + Date: $Date: 2010/03/17 16:52:51 $ + Version: $Revision: 1.4 $ Copyright: (c) 2002, 2003 License: @@ -100,7 +100,7 @@ wxPanel* wxManualTree_MPRWidget::Create3DViewContour( wxWindow *parent, vtkMPRBa wxPanel *panelControl = new wxPanel(panelClipping3D,-1); wxPanel *controlPanelMPR3D = _wxvtkmpr3Dview_C->CreateControlPanel(panelControl, false); - wxPanel *controlPanelClipping3D = _wxvtkclipping3Dview_C->CreateControlPanel(panelControl); + wxPanel *controlPanelClipping3D = _wxvtkclipping3Dview_C->CreateSurfControlPanel(panelControl); // wxBoxSizer *sizerCtrol = new wxBoxSizer(wxVERTICAL); wxFlexGridSizer *sizerCtrol = new wxFlexGridSizer(1); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx index 26f8dbf..66d647e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: wxMaracas_ViewerWidget.cxx,v $ Language: C++ - Date: $Date: 2010/03/05 23:03:18 $ - Version: $Revision: 1.23 $ + Date: $Date: 2010/03/17 16:52:51 $ + Version: $Revision: 1.24 $ Copyright: (c) 2002, 2003 License: @@ -39,7 +39,10 @@ // wxPanel *panelControl = 0; // wxFlexGridSizer *sizerCtrol = 0; wxPanel *controlPanelMPR3D = 0; - wxPanel *controlPanelClipping3D = 0; + wxPanel *controlPanelClippingSurf3D = 0; + //RaC 03-2010 Adding a tab + wxPanel *controlPanelClippingVol3D = 0; + wxBoxSizer *sizer = 0; @@ -125,10 +128,21 @@ //-- wxNotebook *notebook = new wxNotebook(panelClipping3D, -1); + + // First tab controlPanelMPR3D = mwxvtkmpr3Dview->CreateControlPanel(notebook, true); - controlPanelClipping3D = mwxvtkclipping3Dview->CreateControlPanel(notebook); notebook->AddPage(controlPanelMPR3D, _T("Planes") ); - notebook->AddPage(controlPanelClipping3D, _T("Volume / Surface") ); + + // Second Tab + 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); + notebook->AddPage(controlPanelClippingVol3D, _T("Volume") ); + + panelClipping3D -> SplitHorizontally( notebook , window3D , 10 ); panelClipping3D -> SetMinimumPaneSize( 15 ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx index 7333e93..5408597 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx @@ -1,6 +1,7 @@ #include "wxVtkClipping3DView.h" #include "wxVtkClipping3DViewCntrlPanel.h" +#include "wxVtkClipping3DViewVolCntrlPanel.h" wxVtkClipping3DView::wxVtkClipping3DView(wxVtk3DBaseView* wxvtk3Dbaseview) { @@ -49,11 +50,21 @@ void wxVtkClipping3DView::Refresh() } } //------------------------------------------------------------------- -wxPanel* wxVtkClipping3DView::CreateControlPanel(wxWindow *parent) +wxPanel* wxVtkClipping3DView::CreateSurfControlPanel(wxWindow *parent) { _wxvtkclipping3DviewCntrlPanel = new wxVtkClipping3DViewCntrlPanel(parent,this); return _wxvtkclipping3DviewCntrlPanel; } + +//RaC 03-2010 Divide in two panels +//------------------------------------------------------------------- +wxPanel* wxVtkClipping3DView::CreateVolControlPanel(wxWindow *parent) +{ + _wxvtkclipping3DviewVolCntrlPanel = new wxVtkClipping3DViewVolCntrlPanel(parent,this); + return _wxvtkclipping3DviewVolCntrlPanel; +} + + //------------------------------------------------------------------- vtkClipping3DDataViewer* wxVtkClipping3DView::GetVtkClipping3DDataViewer() { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h index badd3fd..ac6185f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.h @@ -16,7 +16,10 @@ public: virtual void Refresh(); virtual void Configure(); void SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer ); - wxPanel* CreateControlPanel(wxWindow *parent); + + wxPanel* CreateSurfControlPanel(wxWindow *parent); + wxPanel* CreateVolControlPanel(wxWindow *parent); + vtkClipping3DDataViewer* GetVtkClipping3DDataViewer(); void VisibleActor(int idTissue, bool visTissue); @@ -33,6 +36,7 @@ private: vtkBoxWidget *_boxWidgetS1; vtkBoxWidget *_boxWidgetVolume; wxPanel *_wxvtkclipping3DviewCntrlPanel; + wxPanel *_wxvtkclipping3DviewVolCntrlPanel; protected: }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx index 75a549b..44753e2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx @@ -23,9 +23,13 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w _surfC = new wxRadioButton(panel,-1,_T("C")); _surfD = new wxRadioButton(panel,-1,_T("D")); - wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Vol")); + + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Vol")); wxCheckBox *ckBoxSurface = new wxCheckBox(panel,-1,_T("Surface Box")); - wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box")); + + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box")); _color = new wxButton(panel,-1,_T("")); _visible = new wxCheckBox(panel,-1,_T("Vis")); @@ -56,12 +60,15 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w wxButton *btnSTL = new wxButton(panel,-1,_T("Create STL File")); wxButton *btnSaveRaw = new wxButton(panel,-1,_T("Save Raw Volume")); - wxButton *btnVolumeFunctions = new wxButton(panel,-1,_T("Read Volume Functions")); + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //wxButton *btnVolumeFunctions = new wxButton(panel,-1,_T("Read Volume Functions")); Connect(btnSTL->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL ); Connect(btnSaveRaw->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume ); - Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions ); + + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions ); wxButton *btnMeshVTKLoad = new wxButton(panel,-1,_T("Load Mesh")); @@ -82,7 +89,11 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w // ckVolum->Enable(false); ckBoxSurface->SetValue(false); - ckBoxVolume->SetValue(false); + + + //ckBoxVolume->SetValue(false); + + _color->SetSize(40,20); _opacity->SetSize(370,20); // ckBoxX->SetValue(true); @@ -96,8 +107,9 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w // _positionY->SetSize(400,20); // _positionZ->SetSize(400,20); - Connect(ckVolum->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleVolume ); - Connect(ckBoxVolume->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume ); + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //Connect(ckVolum->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleVolume ); + //Connect(ckBoxVolume->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume ); Connect(_surfA->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnSurface ); Connect(_surfB->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnSurface ); @@ -134,12 +146,13 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w //wxFlexGridSizer *sizerH5 = new wxFlexGridSizer(10); // JPRx //wxFlexGridSizer *sizerH6 = new wxFlexGridSizer(10); // JPRx - sizerH0->Add( ckVolum , 1, wxALL|wxEXPAND, 0); - sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - sizerH0->Add( ckBoxVolume , 1, wxALL|wxEXPAND, 0); - sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - sizerH0->Add( btnVolumeFunctions , 1, wxALL|wxEXPAND, 0); - sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + //RaC 03-2010 Divides in two panels thje last tab Surface/Volume + //sizerH0->Add( ckVolum , 1, wxALL|wxEXPAND, 0); + //sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + //sizerH0->Add( ckBoxVolume , 1, wxALL|wxEXPAND, 0); + //sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + //sizerH0->Add( btnVolumeFunctions , 1, wxALL|wxEXPAND, 0); + //sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); sizerH0->Add( btnMeshVTKLoad , 1, wxALL|wxEXPAND, 0); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx new file mode 100644 index 0000000..6a4fd6b --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx @@ -0,0 +1,251 @@ +//------------------------------------------------------------------- +//RaC 03-2010 Divides in two panels thje last tab Surface/Volume +//------------------------------------------------------------------- + +#include "wxVtkClipping3DViewVolCntrlPanel.h" +#include "wx/colordlg.h" +#include "vtkTriangleFilter.h" +#include "vtkPolyDataConnectivityFilter.h" +#include "vtkClosePolyData.h" +#include "vtkSTLWriter.h" +#include "HistogramDialog.h" +#include "marDicomBase.h" + +wxVtkClipping3DViewVolCntrlPanel::wxVtkClipping3DViewVolCntrlPanel(wxWindow *parent, wxVtkClipping3DView *wxvtkclipping3Dview ) +: wxPanel(parent, -1) +{ + wxPanel *panel = this; + _wxvtkclipping3Dview = wxvtkclipping3Dview; + + + wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Vol")); + wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box")); + + wxButton *btnVolumeFunctions = new wxButton(panel,-1,_T("Read Volume Functions")); + + Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions ); + + ckBoxVolume->SetValue(false); + + Connect(ckVolum->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume ); + Connect(ckBoxVolume->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnVisibleBoxVolume ); + + wxFlexGridSizer *sizer = new wxFlexGridSizer(1); + wxFlexGridSizer *sizerH0 = new wxFlexGridSizer(20); + + sizerH0->Add( ckVolum , 1, wxALL|wxEXPAND, 0); + sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + sizerH0->Add( ckBoxVolume , 1, wxALL|wxEXPAND, 0); + sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); + sizerH0->Add( btnVolumeFunctions , 1, wxALL|wxEXPAND, 0); + + + sizer->Add( sizerH0 , 1, wxALL|wxEXPAND, 2); + + panel->SetSize(300,60); + panel->SetAutoLayout(true); + panel->SetSizer(sizer); + panel->Layout(); + + panel->SetEventHandler((wxEvtHandler*)this); + +} +//------------------------------------------------------------------- +wxVtkClipping3DViewVolCntrlPanel::~wxVtkClipping3DViewVolCntrlPanel() +{ +} +//------------------------------------------------------------------- +void wxVtkClipping3DViewVolCntrlPanel::Refresh() +{ +} + +//------------------------------------------------------------------- +void wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume(wxCommandEvent& event) +{ + _wxvtkclipping3Dview->VisibleVolumeActor( event.IsChecked() ); + _wxvtkclipping3Dview->Refresh(); + + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); +} + +//------------------------------------------------------------------- +void wxVtkClipping3DViewVolCntrlPanel::OnVisibleBoxVolume(wxCommandEvent& event) +{ + _wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() ); + _wxvtkclipping3Dview->Refresh(); +} + +//EED 22 Fevrier 2007 +//------------------------------------------------------------------- +void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event) +{ + + int /*i=0,*/ xi,yi,r,g,b; // JPRx + vtkColorTransferFunction* ctfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetColorTransferenceFunction(); + vtkPiecewiseFunction* tfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTransferencefunction(); + std::vector* gtf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetGreyValuesTransferenceFVector(); + std::vector* itf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIntensityValuesTransferenceFVector(); + std::vector* greyctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetGreyValueColorsOfColorTransferenceFVector(); + std::vector* rctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRedColorsOfColorTransferenceFVector(); + std::vector* gctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetGreenColorsOfColorTransferenceFVector(); + std::vector* bctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetBlueColorsOfColorTransferenceFVector(); + vtkImageData *imagedata = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); + + //use for update in the refresh + /* + vtkVolumeRayCastMapper* volumeMapper = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVolumeMapper(); + vtkVolume* newvol =this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVolumeActor(); + */ + + /* + MMLR BORRAME + wxFileDialog dialog(this, _T("Choose a file"), _T("c:/Maracas_configuration"),_T(""), _T("*.MarVolConf"), wxOPEN); + if (dialog.ShowModal() == wxID_OK) + { + _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions( (char *)dialog.GetPath().c_str() ); + + + } + */ + + HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata,1); + // + // put in a method + // + int tfSize=gtf->size(); + if(tfSize>0) + { + int i=0; + hDlg->erasePointsTransferenceFunction(); + while(iaddPointToTransferenceFunction(g,in*100); + i++; + } + + } + + int ctfSize=rctf->size(); + if(ctfSize>0) + { + int i=0; + while(iaddColorPoint(gr,(int)(r*255),(int)(g*255),(int)(b*255)); + i++; + } + } + //setting variables if the user wants to do refresh + hDlg->setCTF(ctfun); + hDlg->setTF(tfun); + //hDlg->setClipping3DView(_wxvtkclipping3Dview); + /* + hDlg->setVolume(newvol); + hDlg->setVolumeMapper(volumeMapper); + */ + // + // when the user had changed the transference Function + // + if(hDlg->ShowModal()== wxID_OK ) + { + // -- vtkPiecewiseFunction -- + tfun->RemoveAllPoints(); + gtf->clear(); + itf->clear(); + + int nTFPoints=hDlg->getSizeTransferenceFunction(); + int i=0; + while(igetTransferenceFunctionPoint(i,xi,yi); + tfun->AddPoint( xi , yi/100.0 ); + gtf->push_back(xi); + itf->push_back(yi/100.0); + i++; + } + // -- vtkColorTransferFunction -- + ctfun->RemoveAllPoints (); + //clean colors + rctf->clear(); + gctf->clear(); + bctf->clear(); + greyctf->clear(); + + int nCTFpoints=hDlg->getSizeBarColor(); + i=0; + while(igetDataBarColorPoint(i,xi,r,g,b); + ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 ); + rctf->push_back(r/255.0); + gctf->push_back(g/255.0); + bctf->push_back(b/255.0); + greyctf->push_back(xi); + i++; + } + //--------------------------------- + // Refreshing and sending the event + //--------------------------------- + //_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions(); + _wxvtkclipping3Dview->Refresh(); + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); + + /* + volumeMapper->Update(); + newvol->Update(); + */ + } else { + if(hDlg->getRefreshed()) + { + int i=0,size; + //--Transference Function---- + tfun->RemoveAllPoints(); + i=0; + size=gtf->size(); + for(i=0;iAddPoint( grey1 , in2 ); + } + + // -- vtkColorTransferFunction -- + ctfun->RemoveAllPoints (); + + i=0; + size=greyctf->size(); + for(i=0;iAddRGBPoint(grey2,red,green,blue); + } + + //--------------------------------- + // Refreshing and sending the event + //--------------------------------- + //_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions(); + _wxvtkclipping3Dview->Refresh(); + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); + + /* + volumeMapper->Update(); + newvol->Update(); + */ + } + + } + //destroy the dialog + hDlg->Destroy(); +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.h new file mode 100644 index 0000000..4a7c134 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.h @@ -0,0 +1,26 @@ +#ifndef WXVTKCLIPPING3DVIEWVOLCNTRLPANEL_H_ +#define WXVTKCLIPPING3DVIEWVOLCNTRLPANEL_H_ + +#include "wxVtkClipping3DView.h" +#include "wx/wx.h" + +class wxVtkClipping3DViewVolCntrlPanel: public wxPanel +{ +public: + wxVtkClipping3DViewVolCntrlPanel(wxWindow *parent, wxVtkClipping3DView *_wxvtkclipping3Dview); + ~wxVtkClipping3DViewVolCntrlPanel(); + + void OnVisibleVolume(wxCommandEvent& event); + void OnVisibleBoxVolume(wxCommandEvent& event); + virtual void Refresh(); + void OnBtnVolumeFunctions(wxCommandEvent& event); + + +private: + wxVtkClipping3DView *_wxvtkclipping3Dview; + +protected: + +}; + +#endif /*WXVTKCLIPPING3DVIEWVOLCNTRLPANEL_H_*/ -- 2.45.1