]> Creatis software - creaMaracasVisu.git/commitdiff
*** empty log message ***
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Tue, 1 Sep 2009 14:01:34 +0000 (14:01 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Tue, 1 Sep 2009 14:01:34 +0000 (14:01 +0000)
lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx
lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h
lib/maracasVisuLib/src/CutModule/interface/CutModelView.cxx
lib/maracasVisuLib/src/CutModule/interface/CutModelView.h
lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx
lib/maracasVisuLib/src/CutModule/kernel/CutModelData.h
lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx
lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h

index fdd26301b176256512ac50ca38ca80eba0cdc150..f29854d71a5f14001294134947cdf6778fdf0712 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelMainPanel.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/08/31 08:46:09 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/09/01 14:01:34 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -147,6 +147,7 @@ void CutModelMainPanel::ShowCurrentPanel(int id){
        for(int i = 0; i < viewpanels.size();i++){              
                if(viewpanels[i]->getId()==id){
                        _wxauimanager->GetPane(viewpanels[i]).Show(true);
+            cutmanager->RefreshActor(id);
                }else{
                        _wxauimanager->GetPane(viewpanels[i]).Show(false);
                }
@@ -267,6 +268,10 @@ vtkImageData* CutModelMainPanel::GetResultImage(){
        }
        return NULL;
 }
+
+void CutModelMainPanel::ShowStatistics(int id){
+    
+}
 /**
 **
 **/
index 8eb3d66d804ee8894b5d438d910163e894d05604..5caaa706488b4e819b7cef20853df1c30b9bc6c8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelMainPanel.h,v $
   Language:  C++
-  Date:      $Date: 2009/08/31 08:46:09 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/09/01 14:01:35 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -81,6 +81,8 @@ public:
        void ShowCurrentPanel(int id);
 
        void ShowPopUpMenu(int id);
+
+       void ShowStatistics(int id);
 private:
        static CutModelMainPanel* instance;
 
index 0be3752353bdb0a32df9631f97b88c0fadbf68b2..b95a815a835d42ac0b41e937c5801eccf33aaead 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelView.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/08/31 08:46:09 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/09/01 14:01:35 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -28,6 +28,7 @@
 #include <OpenImage.xpm>
 #include <Color.xpm>
 #include <Ok1.xpm>
+#include <Statistics.xpm>
 
 #include "vtkBoxWidget.h"
 
@@ -87,19 +88,26 @@ wxSizer* CutModelView::getBoxControls(wxWindow* parent,double* range){
        sizergreyv->Add(labelgreyv,wxSizerFlags().FixedMinSize());
        sizergreyv->Add(_sliderrange,wxSizerFlags().FixedMinSize());
        sizer->Add(sizergreyv,wxSizerFlags().FixedMinSize().Border());
-
-       wxString choices[2];
-       choices[0] = _T("Cut");
-       choices[1] = _T("Statistics");
-       _radiocutstat = new  wxRadioBox(parent,-1,_T(""), wxDefaultPosition, wxDefaultSize,2,choices);
-       sizer->Add(_radiocutstat,wxSizerFlags().FixedMinSize());
-
+       
        wxString choices0[2];
        choices0[0] = _T("inside");
        choices0[1] = _T("outside");
        _radioinsideout = new  wxRadioBox(parent,-1,_T(""), wxDefaultPosition, wxDefaultSize,2,choices0);
        sizer->Add(_radioinsideout,wxSizerFlags().FixedMinSize());
 
+       /*wxString choices[2];
+       choices[0] = _T("Cut");
+       choices[1] = _T("Statistics");
+       _radiocutstat = new  wxRadioBox(parent,-1,_T(""), wxDefaultPosition, wxDefaultSize,2,choices);
+       sizer->Add(_radiocutstat,wxSizerFlags().FixedMinSize());*/
+
+       wxBitmap bitmap(Statistics_xpm);
+       wxBitmapButton* statbut = new wxBitmapButton(parent, -1, bitmap,wxDefaultPosition,wxSize(30,30));                       
+       Connect(statbut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)(&CutModelViewEventHandler::onStatistics));      
+    sizer->Add(statbut,wxSizerFlags().FixedMinSize());
+
+       
+
        return sizer;
 }
 wxSizer* CutModelView::getActorProperties(wxWindow* parent){
@@ -122,7 +130,7 @@ wxSizer* CutModelView::getOpacityActor(wxWindow* parent){
        wxBoxSizer* sizeropacity = new wxBoxSizer(wxVERTICAL);  
 
        wxStaticText* labelopacity = new wxStaticText(parent, -1, wxString(_T("Opacity")));
-       wxSlider* slider0 = new wxSlider(parent, -1, 40,0,100,wxDefaultPosition,wxDefaultSize,wxSL_LABELS);
+       wxSlider* slider0 = new wxSlider(parent, -1, 60,0,100,wxDefaultPosition,wxDefaultSize,wxSL_LABELS);
        Connect(slider0->GetId(), wxEVT_SCROLL_THUMBRELEASE,(wxObjectEventFunction)(&CutModelViewEventHandler::onOpacityChange));       
        
        sizeropacity->Add(labelopacity,wxSizerFlags().FixedMinSize());
@@ -139,6 +147,7 @@ wxSizer* CutModelView::getColorChooseActor(wxWindow* parent){
        Connect(colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, f); 
 
        _currentcolor = new wxStaticText(parent,-1,_T(""),wxDefaultPosition,wxSize(20,20));
+       this->SetCurrentColor(wxColour(255.0,0.0,0.0));
 
        sizercolor->Add(colorchoose,wxSizerFlags().FixedMinSize());
        sizercolor->AddSpacer(5);
@@ -180,7 +189,8 @@ double* CutModelView::getRange(){
        return x;
 }
 bool CutModelView::isCut(){
-       return _radiocutstat->GetSelection()==0;
+       return true;
+       //return _radiocutstat->GetSelection()==0;
 }
 bool CutModelView::isInside(){
        return _radioinsideout->GetSelection()==0;
@@ -228,6 +238,10 @@ void CutModelViewEventHandler::onShapeChange(wxCommandEvent& event){
        CutModelMainPanel::getInstance()->ChangeShape(parent->getId(),event.GetSelection());
        //}
 }
+void CutModelViewEventHandler::onStatistics(wxCommandEvent& event){
+       CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent();
+       CutModelMainPanel::getInstance()->ShowStatistics(parent->getId());
+}
 void CutModelViewEventHandler::onExecute(wxCommandEvent& event){
      CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent();
 
index 12660307dc68287d0d152edd5e464046f8496c39..04ba996b4ed80b182cfb426bd610fcc8c2a8f3b9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelView.h,v $
   Language:  C++
-  Date:      $Date: 2009/08/31 08:46:09 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/09/01 14:01:35 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -59,7 +59,7 @@ private:
 
        wxSlider* _sliderrange;
        wxRadioBox* _radioinsideout;
-       wxRadioBox* _radiocutstat;
+       //wxRadioBox* _radiocutstat;
        wxStaticText* _currentcolor;
 
        double* getRange();
@@ -89,7 +89,9 @@ class CutModelViewEventHandler : public wxEvtHandler{
                void onOpacityChange(wxScrollEvent& event);
                void onViewBoxChecked(wxCommandEvent& event);
                void onShapeChange(wxCommandEvent& event);
+               void onStatistics(wxCommandEvent& event);
                void onExecute(wxCommandEvent& event);
+               
 
 
        private:
index 7396cc2c7104622e5a568fdb32b59e765c1c39ab..d340ec69b3c1adc1aa56c70d5bd7114a3c746638 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelData.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/08/31 08:46:11 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/09/01 14:01:36 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -43,7 +43,9 @@ CutModelData::~CutModelData(){
        currentmatrix->Delete();
        inversModel->Delete();
 }
-
+void CutModelData::RefreshViewBox(){
+               
+}
 void CutModelData::createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer){
 
        _boxWidgetVolume = vtkBoxWidget::New();
@@ -57,6 +59,8 @@ void CutModelData::createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCom
        
        _boxWidgetVolume->HandlesOn ();
        _boxWidgetVolume->On();
+       //_boxWidgetVolume->GetHandleProperty()->SetOpacity(0.5);       
+       //_boxWidgetVolume->GetOutlineProperty()->SetOpacity(0.5);      
 }
 void CutModelData::setTransform(vtkImageData* img)throw( CutModelException){
        
@@ -86,7 +90,7 @@ void CutModelData::createActor(){
        _Actor  = vtkActor::New();
        _Actor->SetMapper(_Mapper);     
        _Actor->GetProperty()->SetColor(1, 0, 0);
-       _Actor->GetProperty()->SetOpacity(0.4); 
+       _Actor->GetProperty()->SetOpacity(0.5); 
        
 }
 void CutModelData::udapteActorDirection()throw( CutModelException){
@@ -232,7 +236,18 @@ vtkTransform* CutModelData::getModelTransform(vtkImageData* copyimage){
 
        double *spc = copyimage->GetSpacing();
 
-       matrixmodel->Identity();        
+       modeltransform->Identity();
+
+       double* orient = currentmatrix->GetOrientationWXYZ();
+       modeltransform->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]);    
+
+       double* pos = currentmatrix->GetPosition();
+       modeltransform->Translate(pos[0]/spc[0],pos[1]/spc[1],pos[2]/spc[2]);
+
+       double* scal = currentmatrix->GetScale();       
+       modeltransform->Scale(scal[0]/spc[0],scal[1]/spc[1],scal[2]/spc[2]);
+
+       /*matrixmodel->Identity();      
        matrixmodel->SetElement(0,0,matrix->GetElement(0,0)/spc[0]);
        matrixmodel->SetElement(1,0,matrix->GetElement(1,0)/spc[0]);
        matrixmodel->SetElement(2,0,matrix->GetElement(2,0)/spc[0]);
@@ -244,7 +259,9 @@ vtkTransform* CutModelData::getModelTransform(vtkImageData* copyimage){
        matrixmodel->SetElement(2,2,matrix->GetElement(2,2)/spc[2]);            
        matrixmodel->SetElement(0,3,matrix->GetElement(0,3)/spc[0]);
        matrixmodel->SetElement(1,3,matrix->GetElement(1,3)/spc[1]);
-       matrixmodel->SetElement(2,3,matrix->GetElement(2,3)/spc[2]);
+       matrixmodel->SetElement(2,3,matrix->GetElement(2,3)/spc[2]);*/
+
+       //modeltransform->SetMatrix(matrixmodel);
 
 
        modeltransform->Update();
index 5f6f53e0a5b341df09d8dba0c3d2ebda865a9bb9..84d4e0bd1b8477eb2cdc06caf63bc165ec72673c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelData.h,v $
   Language:  C++
-  Date:      $Date: 2009/08/31 08:46:11 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/09/01 14:01:36 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -62,6 +62,8 @@ public:
        void udapteActorDirection()throw( CutModelException);
 
        void ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException);
+
+       void RefreshViewBox();
 private:       
        
        void checkInvariant()throw( CutModelException);
index 6aa18753a7bd70cb0604854bbe6f0a892e2efa11..796932d38addab8292b0b252313cb403e63b79f0 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelManager.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/08/31 08:46:12 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/09/01 14:01:36 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -164,4 +164,13 @@ void CutModelManager::ExecuteCut(int id, double* range, bool isinside)throw( Cut
 vtkImageData* CutModelManager::GetResultImage(){
         checkInvariant();
      return _copyimg;
+}
+
+void CutModelManager::RefreshActor(int id){
+     checkInvariant();
+       CutModelData* current = getCutModelData(id);    
+       _render->RemoveActor(current->getActor());
+       _render->AddActor(current->getActor()); 
+       current->RefreshViewBox();
+       _render->Render();
 }
\ No newline at end of file
index 8ea3fa7e1f41c50b3e369d3f46b44a703b0398b8..280e85ca4ba4cdbb2b7e01908764d6ba03122a62 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelManager.h,v $
   Language:  C++
-  Date:      $Date: 2009/08/31 08:46:12 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2009/09/01 14:01:36 $
+  Version:   $Revision: 1.2 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -62,6 +62,8 @@ public:
        void ExecuteCut(int id, double* range, bool isinside)throw( CutModelException);
 
        vtkImageData* GetResultImage();
+
+       void RefreshActor(int id);
 private:       
        void checkInvariant() throw( CutModelException);
        vtkImageData* _img;