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:
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);
}
}
return NULL;
}
+
+void CutModelMainPanel::ShowStatistics(int id){
+
+}
/**
**
**/
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:
void ShowCurrentPanel(int id);
void ShowPopUpMenu(int id);
+
+ void ShowStatistics(int id);
private:
static CutModelMainPanel* instance;
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:
#include <OpenImage.xpm>
#include <Color.xpm>
#include <Ok1.xpm>
+#include <Statistics.xpm>
#include "vtkBoxWidget.h"
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){
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());
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);
return x;
}
bool CutModelView::isCut(){
- return _radiocutstat->GetSelection()==0;
+ return true;
+ //return _radiocutstat->GetSelection()==0;
}
bool CutModelView::isInside(){
return _radioinsideout->GetSelection()==0;
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();
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:
wxSlider* _sliderrange;
wxRadioBox* _radioinsideout;
- wxRadioBox* _radiocutstat;
+ //wxRadioBox* _radiocutstat;
wxStaticText* _currentcolor;
double* getRange();
void onOpacityChange(wxScrollEvent& event);
void onViewBoxChecked(wxCommandEvent& event);
void onShapeChange(wxCommandEvent& event);
+ void onStatistics(wxCommandEvent& event);
void onExecute(wxCommandEvent& event);
+
private:
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:
currentmatrix->Delete();
inversModel->Delete();
}
-
+void CutModelData::RefreshViewBox(){
+
+}
void CutModelData::createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer){
_boxWidgetVolume = vtkBoxWidget::New();
_boxWidgetVolume->HandlesOn ();
_boxWidgetVolume->On();
+ //_boxWidgetVolume->GetHandleProperty()->SetOpacity(0.5);
+ //_boxWidgetVolume->GetOutlineProperty()->SetOpacity(0.5);
}
void CutModelData::setTransform(vtkImageData* img)throw( CutModelException){
_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){
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]);
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();
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:
void udapteActorDirection()throw( CutModelException);
void ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException);
+
+ void RefreshViewBox();
private:
void checkInvariant()throw( CutModelException);
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:
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
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:
void ExecuteCut(int id, double* range, bool isinside)throw( CutModelException);
vtkImageData* GetResultImage();
+
+ void RefreshActor(int id);
private:
void checkInvariant() throw( CutModelException);
vtkImageData* _img;