X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxVtkClipping3DViewVolCntrlPanel.cxx;h=feafc6e30131d95d4419a6d398d3103fd69d0bb6;hb=5a27c495a6c3899102f76eb029b6aadcee4121c1;hp=6a4fd6bc6ba9ec2accbed78a9ed4e6ca40414144;hpb=fc5b599e2f9a94153549471b67aaefa2afd015ea;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx index 6a4fd6b..feafc6e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewVolCntrlPanel.cxx @@ -18,20 +18,45 @@ wxVtkClipping3DViewVolCntrlPanel::wxVtkClipping3DViewVolCntrlPanel(wxWindow *par _wxvtkclipping3Dview = wxvtkclipping3Dview; - wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Vol")); + wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Volume")); wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box")); + ckBoxVolume->Disable(); + + rbRayCasting = new wxRadioButton(panel, -1, _T("Ray Casting"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); + rbMIP = new wxRadioButton(panel, -1, _T("MIP")); + + ckInterpolation = new wxCheckBox(panel, -1, _T("Interpolation")); + ckShade = new wxCheckBox(panel, -1, _T("Shade")); + + rbRayCasting->Disable(); + + rbMIP->Disable(); + ckInterpolation->Disable(); + ckShade->Disable(); + + wxButton *btnVolumeFunctions = new wxButton(panel,-1,_T("Read Volume Functions")); - Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions ); + 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 ); + Connect(rbRayCasting->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnRayCastingActive ); + Connect(rbMIP->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnMIPActive ); + + Connect(ckInterpolation->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnInterpolationActive ); + Connect(ckShade->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnShadeActive ); + + + wxFlexGridSizer *sizer = new wxFlexGridSizer(1); wxFlexGridSizer *sizerH0 = new wxFlexGridSizer(20); + wxFlexGridSizer *sizerH1 = new wxFlexGridSizer(20); + wxFlexGridSizer *sizerH2 = new wxFlexGridSizer(20); sizerH0->Add( ckVolum , 1, wxALL|wxEXPAND, 0); sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); @@ -39,8 +64,16 @@ wxVtkClipping3DViewVolCntrlPanel::wxVtkClipping3DViewVolCntrlPanel(wxWindow *par sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); sizerH0->Add( btnVolumeFunctions , 1, wxALL|wxEXPAND, 0); + sizerH1->Add(rbRayCasting, 1, wxALL|wxEXPAND, 0 ); + sizerH1->Add(rbMIP, 1, wxALL|wxEXPAND, 0 ); + + sizerH2->Add(ckInterpolation, 1, wxALL|wxEXPAND, 0 ); + sizerH2->Add(ckShade, 1, wxALL|wxEXPAND, 0 ); + sizer->Add( sizerH0 , 1, wxALL|wxEXPAND, 2); + sizer->Add( sizerH1 , 1, wxALL|wxEXPAND, 2); + sizer->Add( sizerH2 , 1, wxALL|wxEXPAND, 2); panel->SetSize(300,60); panel->SetAutoLayout(true); @@ -49,6 +82,8 @@ wxVtkClipping3DViewVolCntrlPanel::wxVtkClipping3DViewVolCntrlPanel(wxWindow *par panel->SetEventHandler((wxEvtHandler*)this); + rbRayCasting->SetValue(true); + } //------------------------------------------------------------------- wxVtkClipping3DViewVolCntrlPanel::~wxVtkClipping3DViewVolCntrlPanel() @@ -62,7 +97,22 @@ void wxVtkClipping3DViewVolCntrlPanel::Refresh() //------------------------------------------------------------------- void wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume(wxCommandEvent& event) { + cout<<"JPRG::wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume::event_value::"<VisibleVolumeActor( event.IsChecked() ); + if(event.IsChecked()) + { + rbRayCasting->Enable(); + rbMIP->Enable(); + ckInterpolation->Enable(); + ckShade->Enable(); + } + else + { + rbRayCasting->Disable(); + rbMIP->Disable(); + ckInterpolation->Disable(); + ckShade->Disable(); + } _wxvtkclipping3Dview->Refresh(); wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh @@ -80,7 +130,7 @@ void wxVtkClipping3DViewVolCntrlPanel::OnVisibleBoxVolume(wxCommandEvent& event) //------------------------------------------------------------------- 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(); @@ -99,18 +149,18 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even */ /* - MMLR BORRAME + 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(); @@ -125,7 +175,7 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even hDlg->addPointToTransferenceFunction(g,in*100); i++; } - + } int ctfSize=rctf->size(); @@ -154,12 +204,12 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even // 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(ipush_back(xi); itf->push_back(yi/100.0); i++; - } + } // -- vtkColorTransferFunction -- ctfun->RemoveAllPoints (); //clean colors @@ -179,7 +229,7 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even greyctf->clear(); int nCTFpoints=hDlg->getSizeBarColor(); - i=0; + i=0; while(igetDataBarColorPoint(i,xi,r,g,b); @@ -197,7 +247,7 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even _wxvtkclipping3Dview->Refresh(); wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); - + /* volumeMapper->Update(); newvol->Update(); @@ -216,12 +266,12 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even double in2=(*itf)[i]; tfun->AddPoint( grey1 , in2 ); } - + // -- vtkColorTransferFunction -- ctfun->RemoveAllPoints (); - + i=0; - size=greyctf->size(); + size=greyctf->size(); for(i=0;iAddRGBPoint(grey2,red,green,blue); } - + //--------------------------------- // Refreshing and sending the event //--------------------------------- @@ -238,14 +288,42 @@ void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& even _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(); } + +void wxVtkClipping3DViewVolCntrlPanel::OnRayCastingActive(wxCommandEvent& event){ + //If Ray Casting is active, others options are disabled. Only RayCasting is true + _wxvtkclipping3Dview->SetRayCasting(true); + _wxvtkclipping3Dview->SetMIPActive(false); + _wxvtkclipping3Dview->Refresh(); +} + +void wxVtkClipping3DViewVolCntrlPanel::OnMIPActive(wxCommandEvent& event){ + //If MIP is active, others options are disabled. Only MIP is true + _wxvtkclipping3Dview->SetMIPActive(true); + _wxvtkclipping3Dview->SetRayCasting(false); + + _wxvtkclipping3Dview->Refresh(); +} + + + +void wxVtkClipping3DViewVolCntrlPanel::OnInterpolationActive(wxCommandEvent& event){ + _wxvtkclipping3Dview->SetInterpolation(event.IsChecked()); + _wxvtkclipping3Dview->Refresh(); +} + +void wxVtkClipping3DViewVolCntrlPanel::OnShadeActive(wxCommandEvent& event){ + _wxvtkclipping3Dview->SetShade(event.IsChecked()); + _wxvtkclipping3Dview->Refresh(); +} +