]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxVtkClipping3DViewCntrlPanel.cxx
index 44753e2039bf269ee6c52f478003023e9f67aa3f..442fa095df3306498fd23d84e10224641338934b 100644 (file)
@@ -24,11 +24,11 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w
                                        _surfD                  = new wxRadioButton(panel,-1,_T("D"));
 
 
-       //RaC 03-2010 Divides in two panels thje last tab Surface/Volume        
+       //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"));
-       
-       //RaC 03-2010 Divides in two panels thje last tab Surface/Volume        
+
+       //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(""));
@@ -55,24 +55,24 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w
        _isoValueSpin   = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT  );
        _isoValueSpin->SetRange(1,8);
        _isoValueSpin->SetValue(5);
-       Connect(_isoValueSpin->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED   , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValueSpin ); 
+       Connect(_isoValueSpin->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED   , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValueSpin );
 
        wxButton *btnSTL                                = new wxButton(panel,-1,_T("Create STL File"));
        wxButton *btnSaveRaw                    = new wxButton(panel,-1,_T("Save Raw Volume"));
 
-       //RaC 03-2010 Divides in two panels thje last tab Surface/Volume        
+       //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    ); 
-       
-       //RaC 03-2010 Divides in two panels thje last tab Surface/Volume        
-       //Connect(btnVolumeFunctions->GetId()   , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions  ); 
+       Connect(btnSTL->GetId()                         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL    );
+       Connect(btnSaveRaw->GetId()                     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume    );
+
+       //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"));
-       Connect(btnMeshVTKLoad->GetId() , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnMeshVTKLoad      ); 
+       Connect(btnMeshVTKLoad->GetId() , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnMeshVTKLoad      );
 
 
 /*
@@ -89,8 +89,8 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w
 
 //     ckVolum->Enable(false);
        ckBoxSurface->SetValue(false);
-       
-       
+
+
        //ckBoxVolume->SetValue(false);
 
 
@@ -107,7 +107,7 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w
 //     _positionY->SetSize(400,20);
 //     _positionZ->SetSize(400,20);
 
-       //RaC 03-2010 Divides in two panels thje last tab Surface/Volume        
+       //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                  );
 
@@ -146,7 +146,7 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w
        //wxFlexGridSizer *sizerH5 = new wxFlexGridSizer(10); // JPRx
        //wxFlexGridSizer *sizerH6 = new wxFlexGridSizer(10); // JPRx
 
-       //RaC 03-2010 Divides in two panels thje last tab Surface/Volume        
+       //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);
@@ -177,12 +177,12 @@ wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, w
        sizerH2->Add( _visible                          , 1, wxALL|wxEXPAND, 0);
        sizerH2->Add( new wxStaticText(panel, -1,_T("          "))                      , 1, wxALL|wxEXPAND, 0);
 
-       
+
        sizerH2->Add( _wireFrameRep                             , 1,wxSHAPED | wxALIGN_CENTER_VERTICAL , 0);
        sizerH2->Add( new wxStaticText(panel, -1,_T("   "))                                     , 1, wxALL|wxEXPAND, 0);
        sizerH2->Add( _surfaceRep                               , 1,wxSHAPED | wxALIGN_CENTER_VERTICAL , 0);
        sizerH2->Add( new wxStaticText(panel, -1,_T("          "))                      , 1, wxALL|wxEXPAND, 0);
-       
+
        sizerH2->Add( _opacity                          , 1, wxALL|wxEXPAND, 0);
 
 
@@ -298,8 +298,8 @@ void wxVtkClipping3DViewCntrlPanel::OnSurface(wxCommandEvent& event)
                _opacity->SetValue( (int)(tmpActor->GetProperty()->GetOpacity()*100) );
 
                // Representation Type  WireFrame / Surface
-               _surfaceRep->SetValue(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue)); 
-               _wireFrameRep->SetValue(!_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue)); 
+               _surfaceRep->SetValue(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue));
+               _wireFrameRep->SetValue(!_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue));
 
                // isoValue
                int isoValue= (int)(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIsovalue(idTissue));
@@ -342,7 +342,8 @@ void wxVtkClipping3DViewCntrlPanel::OnVisibleBoxSurface(wxCommandEvent& event)
 //-------------------------------------------------------------------
 void wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume(wxCommandEvent& event)
 {
-       _wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() );
+       //_wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() );
+       this->BoundingBoxChanged(event.IsChecked());
        _wxvtkclipping3Dview->Refresh();
 }
 //-------------------------------------------------------------------
@@ -354,7 +355,7 @@ void wxVtkClipping3DViewCntrlPanel::OnColor(wxCommandEvent& event)
 // EED 17 Janvier 2007
                wxColourDialog dlgColour(this);
 //             dlgColour.ShowModal();
-               if( dlgColour.ShowModal( ) == wxID_OK ) 
+               if( dlgColour.ShowModal( ) == wxID_OK )
                {
                        vtkActor *tmpActor;
                        tmpActor = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueActor(idTissue);
@@ -431,7 +432,7 @@ void wxVtkClipping3DViewCntrlPanel::OnIsoValue(wxScrollEvent& event)
                _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetIsovalue(idTissue,isoValue);
 //             wxString tmpStr;
 //             tmpStr.Printf("%d",isoValue);
-       
+
                _wxvtkclipping3Dview->Refresh();
 
                wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
@@ -453,10 +454,10 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL(wxCommandEvent& event)
        wxString dirSTL = wxGetHomeDir( ) ;
        wxFileDialog dialog( this, _T("Choose a directory..."), dirSTL , _T(""), _T("*.*"), wxSAVE );
 
-       if( dialog.ShowModal( ) == wxID_OK ) 
+       if( dialog.ShowModal( ) == wxID_OK )
        {
-          
-       
+
+
                // ------------------------------------------------------------------------
                //  1.  GENERATE STL FILES
                // ------------------------------------------------------------------------
@@ -485,7 +486,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL(wxCommandEvent& event)
         writer->Write();
         writer->Delete();
 
-   
+
         filtro->Delete();
         cpd->Delete();
         pdcf->Delete();
@@ -525,7 +526,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume(wxCommandEvent& event)
 //-------------------------------------------------------------------
 void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
 {
-       
+
        int /*i=0,*/ xi,yi,r,g,b;  // JPRx
        vtkColorTransferFunction* ctfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetColorTransferenceFunction();
        vtkPiecewiseFunction* tfun      = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTransferencefunction();
@@ -544,18 +545,18 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
        */
 
        /*
-       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();
@@ -570,7 +571,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
                                hDlg->addPointToTransferenceFunction(g,in*100);
                                i++;
                        }
-                       
+
                }
 
        int ctfSize=rctf->size();
@@ -599,12 +600,12 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
        // 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(i<nTFPoints)
@@ -614,7 +615,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
                                gtf->push_back(xi);
                                itf->push_back(yi/100.0);
                                i++;
-                       }       
+                       }
                        // -- vtkColorTransferFunction  --
                        ctfun->RemoveAllPoints ();
                        //clean colors
@@ -624,7 +625,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
                        greyctf->clear();
 
                        int nCTFpoints=hDlg->getSizeBarColor();
-                       i=0;    
+                       i=0;
                        while(i<nCTFpoints)
                        {
                                hDlg->getDataBarColorPoint(i,xi,r,g,b);
@@ -642,7 +643,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
                        _wxvtkclipping3Dview->Refresh();
                        wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
                        _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-                       
+
                        /*
                        volumeMapper->Update();
                        newvol->Update();
@@ -661,12 +662,12 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
                                double  in2=(*itf)[i];
                                tfun->AddPoint( grey1 , in2 );
                        }
-                       
+
                        // -- vtkColorTransferFunction  --
                        ctfun->RemoveAllPoints ();
-                       
+
                        i=0;
-                       size=greyctf->size();           
+                       size=greyctf->size();
                        for(i=0;i<size;i++)
                        {
                                double grey2=(*greyctf)[i];
@@ -675,7 +676,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
                                double blue = (*bctf)[i];
                                ctfun->AddRGBPoint(grey2,red,green,blue);
                        }
-               
+
                        //---------------------------------
                        // Refreshing and sending the event
                        //---------------------------------
@@ -683,13 +684,13 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
                        _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();