From 0949d9991131d8fde35ab5fdd41a50a43a0dfd7f Mon Sep 17 00:00:00 2001 From: Juan Prieto Date: Tue, 1 Sep 2009 14:01:34 +0000 Subject: [PATCH] *** empty log message *** --- .../CutModule/interface/CutModelMainPanel.cxx | 9 +++-- .../CutModule/interface/CutModelMainPanel.h | 6 ++-- .../src/CutModule/interface/CutModelView.cxx | 36 +++++++++++++------ .../src/CutModule/interface/CutModelView.h | 8 +++-- .../src/CutModule/kernel/CutModelData.cxx | 29 +++++++++++---- .../src/CutModule/kernel/CutModelData.h | 6 ++-- .../src/CutModule/kernel/CutModelManager.cxx | 13 +++++-- .../src/CutModule/kernel/CutModelManager.h | 6 ++-- 8 files changed, 83 insertions(+), 30 deletions(-) diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx index fdd2630..f29854d 100644 --- a/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx +++ b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx @@ -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){ + +} /** ** **/ diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h index 8eb3d66..5caaa70 100644 --- a/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h +++ b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h @@ -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; diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModelView.cxx b/lib/maracasVisuLib/src/CutModule/interface/CutModelView.cxx index 0be3752..b95a815 100644 --- a/lib/maracasVisuLib/src/CutModule/interface/CutModelView.cxx +++ b/lib/maracasVisuLib/src/CutModule/interface/CutModelView.cxx @@ -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 #include #include +#include #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(); diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModelView.h b/lib/maracasVisuLib/src/CutModule/interface/CutModelView.h index 1266030..04ba996 100644 --- a/lib/maracasVisuLib/src/CutModule/interface/CutModelView.h +++ b/lib/maracasVisuLib/src/CutModule/interface/CutModelView.h @@ -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: diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx index 7396cc2..d340ec6 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx @@ -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(); diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.h index 5f6f53e..84d4e0b 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.h +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.h @@ -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); diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx index 6aa1875..796932d 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx @@ -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 diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h index 8ea3fa7..280e85c 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h @@ -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; -- 2.46.2