From 7e651737b5c12358da7971183af61abb6381a3fc Mon Sep 17 00:00:00 2001 From: perez Date: Thu, 19 Nov 2009 16:11:23 +0000 Subject: [PATCH] *** empty log message *** --- lib/maracasVisuLib/src/CMakeLists.txt | 2 +- .../src/CutModule2/CMakeLists.txt | 26 -- .../src/CutModule2/interface/CMakeLists.txt | 51 --- .../interface/CutModel2MainPanel.cxx | 378 ----------------- .../CutModule2/interface/CutModel2MainPanel.h | 151 ------- .../CutModule2/interface/CutModel2View.cxx | 250 ----------- .../src/CutModule2/interface/CutModel2View.h | 103 ----- .../interface/CutModelMainPanel.cxx | 377 ----------------- .../CutModule2/interface/CutModelMainPanel.h | 151 ------- .../src/CutModule2/interface/CutModelView.cxx | 250 ----------- .../src/CutModule2/interface/CutModelView.h | 103 ----- .../src/CutModule2/kernel/CMakeLists.txt | 50 --- .../src/CutModule2/kernel/CutModel2Data.cxx | 388 ------------------ .../src/CutModule2/kernel/CutModel2Data.h | 118 ------ .../CutModule2/kernel/CutModel2Exception.cxx | 31 -- .../CutModule2/kernel/CutModel2Exception.h | 44 -- .../CutModule2/kernel/CutModel2Figure.cxx__ | 152 ------- .../src/CutModule2/kernel/CutModel2Figure.h | 83 ---- .../CutModule2/kernel/CutModel2FigureCube.cxx | 52 --- .../CutModule2/kernel/CutModel2FigureCube.h | 21 - .../kernel/CutModel2FigureCylinder.cxx | 45 -- .../kernel/CutModel2FigureCylinder.h | 22 - .../kernel/CutModel2FigureSphere.cxx | 49 --- .../CutModule2/kernel/CutModel2FigureSphere.h | 21 - .../CutModule2/kernel/CutModel2Manager.cxx | 280 ------------- .../src/CutModule2/kernel/CutModel2Manager.h | 99 ----- .../kernel/CutModel2SaveBinInfo.cxx | 112 ----- .../CutModule2/kernel/CutModel2SaveBinInfo.h | 111 ----- .../src/CutModule2/kernel/CutModelData.cxx | 388 ------------------ .../src/CutModule2/kernel/CutModelData.h | 118 ------ .../CutModule2/kernel/CutModelException.cxx | 31 -- .../src/CutModule2/kernel/CutModelException.h | 44 -- .../CutModule2/kernel/CutModelFigure.cxx__ | 152 ------- .../src/CutModule2/kernel/CutModelFigure.h | 83 ---- .../CutModule2/kernel/CutModelFigureCube.cxx | 52 --- .../CutModule2/kernel/CutModelFigureCube.h | 21 - .../kernel/CutModelFigureCylinder.cxx | 45 -- .../kernel/CutModelFigureCylinder.h | 22 - .../kernel/CutModelFigureSphere.cxx | 49 --- .../CutModule2/kernel/CutModelFigureSphere.h | 21 - .../src/CutModule2/kernel/CutModelManager.cxx | 280 ------------- .../src/CutModule2/kernel/CutModelManager.h | 99 ----- .../CutModule2/kernel/CutModelSaveBinInfo.cxx | 112 ----- .../CutModule2/kernel/CutModelSaveBinInfo.h | 111 ----- 44 files changed, 1 insertion(+), 5147 deletions(-) delete mode 100644 lib/maracasVisuLib/src/CutModule2/CMakeLists.txt delete mode 100644 lib/maracasVisuLib/src/CutModule2/interface/CMakeLists.txt delete mode 100644 lib/maracasVisuLib/src/CutModule2/interface/CutModel2MainPanel.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/interface/CutModel2MainPanel.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/interface/CutModel2View.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/interface/CutModel2View.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/interface/CutModelMainPanel.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/interface/CutModelMainPanel.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/interface/CutModelView.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/interface/CutModelView.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CMakeLists.txt delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Data.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Data.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Exception.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Exception.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Figure.cxx__ delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Figure.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCube.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCube.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCylinder.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCylinder.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureSphere.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureSphere.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Manager.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Manager.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2SaveBinInfo.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModel2SaveBinInfo.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelData.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelData.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelException.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelException.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigure.cxx__ delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigure.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCube.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCube.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCylinder.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCylinder.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureSphere.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureSphere.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelManager.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelManager.h delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelSaveBinInfo.cxx delete mode 100644 lib/maracasVisuLib/src/CutModule2/kernel/CutModelSaveBinInfo.h diff --git a/lib/maracasVisuLib/src/CMakeLists.txt b/lib/maracasVisuLib/src/CMakeLists.txt index 9ad8891..1182ea5 100644 --- a/lib/maracasVisuLib/src/CMakeLists.txt +++ b/lib/maracasVisuLib/src/CMakeLists.txt @@ -1,2 +1,2 @@ SUBDIRS(CutModule) -SUBDIRS(CutModule2) + diff --git a/lib/maracasVisuLib/src/CutModule2/CMakeLists.txt b/lib/maracasVisuLib/src/CutModule2/CMakeLists.txt deleted file mode 100644 index cece676..0000000 --- a/lib/maracasVisuLib/src/CutModule2/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -#---------------------------------------------------------------------------- -# SET THE NAME OF YOUR LIBRARY - - -SET ( LIBRARY_NAME creaMaracasVisu_CutModule2 ) -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# CREATES A USER OPTION IN CMAKE -OPTION ( BUILD_${LIBRARY_NAME} "Build ${LIBRARY_NAME} library ?" ON) - -#---------------------------------------------------------------------------- -IF ( BUILD_${LIBRARY_NAME} )#---------------------------------------------------------------------------- - - #---------------------------------------------------------------------------- - # BUILD LIBRARY - #---------------------------------------------------------------------------- -#jhcl-Start=========================================================================== - INCLUDE_DIRECTORIES( - interface - kernel -) - SUBDIRS(interface) - SUBDIRS(kernel) -ENDIF ( BUILD_${LIBRARY_NAME} ) - diff --git a/lib/maracasVisuLib/src/CutModule2/interface/CMakeLists.txt b/lib/maracasVisuLib/src/CutModule2/interface/CMakeLists.txt deleted file mode 100644 index 21c1ca2..0000000 --- a/lib/maracasVisuLib/src/CutModule2/interface/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -#---------------------------------------------------------------------------- -# SET THE NAME OF YOUR LIBRARY -SET ( LIBRARY_NAME creaMaracasVisu_CutModule2_interface ) -#---------------------------------------------------------------------------- -#---------------------------------------------------------------------------- - - #---------------------------------------------------------------------------- - # BUILD LIBRARY - #---------------------------------------------------------------------------- - - #---------------------------------------------------------------------------- - # LIBRARY HEADERS (TO BE INSTALLED) - # EITHER LIST ALL .h IN CURRENT DIR USING NEXT LINE: - FILE(GLOB ${LIBRARY_NAME}_HEADERS "*.h") - # OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND - # SET ( ${LIBRARY_NAME}_HEADERS - # - # ) - #---------------------------------------------------------------------------- - - #---------------------------------------------------------------------------- - # LIBRARY SOURCES (TO BE COMPILED) - # EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE: - FILE(GLOB ${LIBRARY_NAME}_SOURCES *.cxx *.cpp *.cc) - # OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION) - # SET ( ${LIBRARY_NAME}_SOURCES - # - # ) - #---------------------------------------------------------------------------- - - #---------------------------------------------------------------------------- - # LIBRARY DEPENDENCIES (LIBRARIES TO LINK WITH) - SET ( ${LIBRARY_NAME}_LINK_LIBRARIES - ${crea_LIBRARIES} - ${WXWIDGETS_LIBRARIES} - # ${VTK_LIBRARIES} - # ${ITK_LIBRARIES} - # ${GDCM_LIBRARIES} - # ${BOOST_LIBRARIES} - ) - #---------------------------------------------------------------------------- - - - #---------------------------------------------------------------------------- - # MACRO WHICH DOES ALL THE JOB : BUILD AND INSTALL - #CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) - #---------------------------------------------------------------------------- - - ADD_LIBRARY(${LIBRARY_NAME} STATIC ${${LIBRARY_NAME}_SOURCES} ${${LIBRARY_NAME}_HEADERS} ) - # LINK - TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES}) diff --git a/lib/maracasVisuLib/src/CutModule2/interface/CutModel2MainPanel.cxx b/lib/maracasVisuLib/src/CutModule2/interface/CutModel2MainPanel.cxx deleted file mode 100644 index 657ef85..0000000 --- a/lib/maracasVisuLib/src/CutModule2/interface/CutModel2MainPanel.cxx +++ /dev/null @@ -1,378 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2MainPanel.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:56 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - -// EOF - wxMaracasMPR.cxx - -#include "CutModel2MainPanel.h" -#include "HistogramDialog.h" -#include "creaSystem.h" - -#include -#include - -#include -#include -#include -#include - - - -CutModel2MainPanel* CutModel2MainPanel::instance=NULL; - -CutModel2MainPanel::CutModel2MainPanel( wxWindow* parent, std::string path) -: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){ - - cutmanager=NULL; - - initialize(path); - -} -CutModel2MainPanel::~CutModel2MainPanel( ){ - - delete cutmanager; -} - -void CutModel2MainPanel::initialize(std::string path){ - - cutmanager = new CutModel2Manager(path); - - _panelid = 0; - _wxauimanager = new wxAuiManager(this); - - wxAuiPaneInfo paneinfo; - _wxauimanager->AddPane(new ToolBarCutModel2(this),paneinfo.ToolbarPane().Top()); - - _wxauimanager->Update(); -} - -CutModel2MainPanel* CutModel2MainPanel::getInstance(wxWindow* parent, std::string path){ - if(instance==NULL){ - if(parent == NULL){ - parent = new wxFrame(); - } - instance = new CutModel2MainPanel(parent, path); - } - return instance; -} - -/*CutModel2MainPanel* CutModel2MainPanel::getInstance(){ - return instance; -}*/ - -void CutModel2MainPanel::setImageData(vtkImageData* img){ - try{ - checkInvariant(); - cutmanager->setImageData(img); - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } -} - -void CutModel2MainPanel::setInteractor(vtkRenderWindowInteractor* interactor){ - try{ - checkInvariant(); - cutmanager->setInteractor(interactor); - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } -} - -void CutModel2MainPanel::setRenderer(vtkRenderer* renderer){ - try{ - checkInvariant(); - cutmanager->setRenderer(renderer); - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } -} - -void CutModel2MainPanel::checkInvariant()throw (CutModel2Exception){ - if(cutmanager==NULL){ - throw CutModel2Exception("The manager is not initialize"); - } -} - -void CutModel2MainPanel::showErrorDialog(std::string str){ - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str.c_str(),wxConvUTF8 ), wxString(str.c_str(),wxConvUTF8 ), wxICON_ERROR); - diag->ShowModal(); -} - -void CutModel2MainPanel::RemoveActor(int id){ - try{ - checkInvariant(); - - for(int i = 0; i < viewpanels.size()-1;i++){ - if(viewpanels[i]->getId()==id){ - for(int j = i; j < viewpanels.size()-1;j++){ - viewpanels[j]=viewpanels[j+1]; - } - i = viewpanels.size(); - } - } - viewpanels.pop_back(); - - - cutmanager->RemoveActor(id); - - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } -} - -void CutModel2MainPanel::onAddCutModel2(){ - try{ - checkInvariant(); - - int id = addNewViewPanel(); - cutmanager->onAddCutModel2(id, getModelView(id)); - - _panelid++; - - ShowCurrentPanel(id); - - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } -} -void CutModel2MainPanel::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); - } - } - _wxauimanager->Update(); -} -int CutModel2MainPanel::addNewViewPanel()throw( CutModel2Exception){ - - CutModel2View* viewpanel = new CutModel2View(this,cutmanager->getImageRange()); - - wxAuiPaneInfo paneinfo0; - _wxauimanager->AddPane(viewpanel, paneinfo0.DefaultPane().DestroyOnClose().Centre()); - _wxauimanager->Update(); - - viewpanel->setId(_panelid); - viewpanels.push_back(viewpanel); - - return viewpanel->getId(); - - -} -CutModel2View* CutModel2MainPanel::getModelView(int id)throw( CutModel2Exception){ - - CutModel2View* current = NULL; - for(int i = 0; i < viewpanels.size();i++){ - if(viewpanels[i]->getId()==id){ - current = viewpanels[i]; - } - } - if(current == NULL){ - std::string s = "Id not found"; - throw CutModel2Exception(s); - } - return current; -} -void CutModel2MainPanel::onUndo(){ - try{ - checkInvariant(); - int result = cutmanager->Undo(); - - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } - -} - -void CutModel2MainPanel::onRedo(){ - - try{ - checkInvariant(); - int result = cutmanager->Redo(); - - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } - -} - -void CutModel2MainPanel::changeOpacity(int id,int opacity){ - try{ - checkInvariant(); - cutmanager->changeOpacity(id, opacity); - - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } -} - -void CutModel2MainPanel::ShowViewBox(int id,bool check){ - try{ - checkInvariant(); - cutmanager->ShowViewBox(id, check); - - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } -} -void CutModel2MainPanel::ShowPopUpMenu(int id){ - showErrorDialog("test"); -} -void CutModel2MainPanel::changeColor(int id,double r,double g,double b){ - - try{ - checkInvariant(); - cutmanager->changeColor(id, r, g, b); - - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } - -} -void CutModel2MainPanel::ChangeShape(int id,int selection){ - try{ - checkInvariant(); - - cutmanager->ChangeShape(id, selection); - - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } -} -void CutModel2MainPanel::updateActorDirection(int id){ - try{ - checkInvariant(); - - cutmanager->updateActorDirection(id); - - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } -} - -void CutModel2MainPanel::ExecuteCut(int id, double* range, bool isinside){ - try{ - checkInvariant(); - - cutmanager->ExecuteCut(id, range, isinside); - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } -} - -void CutModel2MainPanel::ExecuteAll(){ - for(int i = 0; i < viewpanels.size();i++){ - viewpanels[i]->ExecuteCut(); - } - -} -vtkImageData* CutModel2MainPanel::GetResultImage(){ - try{ - checkInvariant(); - return cutmanager->GetResultImage(); - }catch(CutModel2Exception e){ - showErrorDialog(e.getCause()); - } - return NULL; -} - -void CutModel2MainPanel::ShowStatistics(int id){ - - checkInvariant(); - HistogramDialog *histo = new HistogramDialog(this, _T("Statistics")); - - histo->initializeHistogram(cutmanager->GetResultImage()); - - histo->ShowModal(); - - delete histo; -} - -void CutModel2MainPanel::SaveCutModel2Data(std::string filename){ - cutmanager->SaveCutModel2Data(filename); -} - -void CutModel2MainPanel::LoadCutModel2Data(std::string filename){ - cutmanager->LoadCutModel2Data(filename); -} -/** -** -**/ - -ToolBarCutModel2::ToolBarCutModel2(wxWindow * parent) -: wxToolBar(parent, -1, wxDefaultPosition, wxDefaultSize) -{ - - wxBitmap bitmap10(Add_xpm); - this->AddTool(10, wxString(_T("Add")),bitmap10); - - this->AddSeparator(); - - wxBitmap bitmap20(Undo_xpm); - this->AddTool(20, wxString(_T("Undo")),bitmap20); - - wxBitmap bitmap30(Redo_xpm); - this->AddTool(30, wxString(_T("Redo")),bitmap30); - - this->AddSeparator(); - - wxBitmap bitmap40(OkAll_xpm); - this->AddTool(40, wxString(_T("Ok All")),bitmap40); - - this->Realize(); - - _evthand = new ToolBarEventHandlerCutModel2(); - this->SetEventHandler(_evthand); - -} - -ToolBarCutModel2::~ToolBarCutModel2(void){ -} - -ToolBarEventHandlerCutModel2::ToolBarEventHandlerCutModel2() -: wxEvtHandler(){ -} -ToolBarEventHandlerCutModel2::~ToolBarEventHandlerCutModel2(){ -} - -void ToolBarEventHandlerCutModel2::onAdd(wxCommandEvent& event){ - CutModel2MainPanel::getInstance()->onAddCutModel2(); -} - -void ToolBarEventHandlerCutModel2::onUndo(wxCommandEvent& event){ - CutModel2MainPanel::getInstance()->onUndo(); -} - -void ToolBarEventHandlerCutModel2::onRedo(wxCommandEvent& event){ - CutModel2MainPanel::getInstance()->onRedo(); -} - -void ToolBarEventHandlerCutModel2::onExecuteAll(wxCommandEvent& event){ - CutModel2MainPanel::getInstance()->ExecuteAll(); -} - - -BEGIN_EVENT_TABLE(ToolBarEventHandlerCutModel2, wxEvtHandler) - EVT_MENU(10, ToolBarEventHandlerCutModel2::onAdd) - EVT_MENU(20, ToolBarEventHandlerCutModel2::onUndo) - EVT_MENU(30, ToolBarEventHandlerCutModel2::onRedo) - EVT_MENU(40, ToolBarEventHandlerCutModel2::onExecuteAll) -END_EVENT_TABLE() - diff --git a/lib/maracasVisuLib/src/CutModule2/interface/CutModel2MainPanel.h b/lib/maracasVisuLib/src/CutModule2/interface/CutModel2MainPanel.h deleted file mode 100644 index 40a9274..0000000 --- a/lib/maracasVisuLib/src/CutModule2/interface/CutModel2MainPanel.h +++ /dev/null @@ -1,151 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2MainPanel.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:56 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -#ifndef __CutModel2MainPanelPanelH__ -#define __CutModel2MainPanelPanelH__ - -#include -#include -#include -#include "wx/aui/aui.h" -#include -#include -#include "marTypes.h" - - -#include "CutModel2Manager.h" -#include "CutModel2Exception.h" -#include "CutModel2View.h" - -#include "vtkImageData.h" -#include "vtkRenderWindowInteractor.h" - - -class creaMaracasVisu_EXPORT CutModel2MainPanel : public wxPanel -{ - -public: - - ~CutModel2MainPanel( ); - - static CutModel2MainPanel* getInstance(wxWindow* parent=NULL, std::string path =""); - - //static CutModel2MainPanel* getInstance(); - - void setImageData(vtkImageData* img); - - void setInteractor(vtkRenderWindowInteractor* interactor); - - void setRenderer(vtkRenderer* renderer); - - void initialize(std::string path); - - void onAddCutModel2(); - - void onUndo(); - - void onRedo(); - - void changeOpacity(int id,int opacity); - - void ShowViewBox(int id,bool check); - - void ChangeShape(int id,int selection); - - void changeColor(int id,double r,double g,double b); - - void updateActorDirection(int id); - - void RemoveActor(int id); - - void ExecuteCut(int id, double* range, bool isinside); - - void ExecuteAll(); - - vtkImageData* GetResultImage(); - - void ShowCurrentPanel(int id); - - void ShowPopUpMenu(int id); - - void ShowStatistics(int id); - - -private: - - CutModel2MainPanel( wxWindow* parent, std::string path); - - static CutModel2MainPanel* instance; - - CutModel2Manager* cutmanager; - - void checkInvariant() throw( CutModel2Exception); - - void showErrorDialog(std::string str); - - void SaveCutModel2Data(std::string filename); - - void LoadCutModel2Data(std::string filename); - - std::vector viewpanels; - - wxAuiManager* _wxauimanager; - - - int addNewViewPanel()throw( CutModel2Exception); - - CutModel2View* getModelView(int id)throw( CutModel2Exception); - - int _panelid; -}; - - -class ToolBarEventHandlerCutModel2 : public wxEvtHandler{ - - public: - ToolBarEventHandlerCutModel2(); - ~ToolBarEventHandlerCutModel2(); - - void onAdd(wxCommandEvent& event); - - void onUndo(wxCommandEvent& event); - - void onRedo(wxCommandEvent& event); - - void onExecuteAll(wxCommandEvent& event); - - private: - - DECLARE_EVENT_TABLE() - }; - -class ToolBarCutModel2 : public wxToolBar{ - - -public: - ToolBarCutModel2(wxWindow * parent); - ~ToolBarCutModel2(void); - - -private: - - ToolBarEventHandlerCutModel2* _evthand; - -}; - -#endif - diff --git a/lib/maracasVisuLib/src/CutModule2/interface/CutModel2View.cxx b/lib/maracasVisuLib/src/CutModule2/interface/CutModel2View.cxx deleted file mode 100644 index 936bc45..0000000 --- a/lib/maracasVisuLib/src/CutModule2/interface/CutModel2View.cxx +++ /dev/null @@ -1,250 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2View.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:56 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - -// EOF - wxMaracasMPR.cxx - -#include "CutModel2View.h" - - -#include -#include - -#include -#include -#include -#include - -#include "vtkBoxWidget.h" - -#include "CutModel2MainPanel.h" - -CutModel2View::CutModel2View( wxWindow* parent, double* range) -: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){ - - wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); - - this->SetSizer(sizer); - - sizer->Add(getBoxControls(this, range),wxSizerFlags().FixedMinSize()); - - sizer->AddSpacer(5); - - sizer->Add(getActorProperties(this),wxSizerFlags().FixedMinSize()); - - - wxBitmap bitmapok(Ok1_xpm); - wxBitmapButton* okbutton = new wxBitmapButton(this, -1, bitmapok,wxDefaultPosition,wxSize(30,30)); - Connect(okbutton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)(&CutModel2ViewEventHandler::onExecute)); - - sizer->AddSpacer(5); - sizer->Add(okbutton,wxSizerFlags().FixedMinSize()); - - - - - -} -CutModel2View::~CutModel2View( ){ - CutModel2MainPanel::getInstance()->RemoveActor(this->getId()); -} - -wxSizer* CutModel2View::getBoxControls(wxWindow* parent,double* range){ - - wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); - wxCheckBox* checkbox = new wxCheckBox(parent,-1,_T("View Box")); - sizer->Add(checkbox,wxSizerFlags().FixedMinSize()); - checkbox->SetValue(true); - Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)(&CutModel2ViewEventHandler::onViewBoxChecked)); - - wxString choices1[3]; - //choices1[0] = _T("Select a shape..."); - choices1[0] = _T("Sphere"); - choices1[1] = _T("Cylinder"); - choices1[2] = _T("Cube"); - wxComboBox* combo = new wxComboBox(parent, -1,_T(""),wxDefaultPosition,wxDefaultSize,3,choices1); - combo->SetValue(_T("Sphere")); - sizer->Add(combo,wxSizerFlags().FixedMinSize()); - Connect(combo->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)(&CutModel2ViewEventHandler::onShapeChange)); - - wxStaticText* labelgreyv = new wxStaticText(parent, -1, wxString(_T("Grey value range"))); - _sliderrange = new wxSlider(parent, -1, range[0],range[0],range[1],wxDefaultPosition,wxDefaultSize,wxSL_LABELS|wxSL_SELRANGE); - wxBoxSizer* sizergreyv = new wxBoxSizer(wxVERTICAL); - sizergreyv->Add(labelgreyv,wxSizerFlags().FixedMinSize()); - sizergreyv->Add(_sliderrange,wxSizerFlags().FixedMinSize()); - sizer->Add(sizergreyv,wxSizerFlags().FixedMinSize().Border()); - - 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)(&CutModel2ViewEventHandler::onStatistics)); - sizer->Add(statbut,wxSizerFlags().FixedMinSize()); - - - - return sizer; -} -wxSizer* CutModel2View::getActorProperties(wxWindow* parent){ - - wxBoxSizer* sizeractorproperties = new wxBoxSizer(wxVERTICAL); - - wxStaticText* labelshapeactor = new wxStaticText(parent, -1, wxString(_T("Actor's properties"))); - - sizeractorproperties->Add(labelshapeactor,wxSizerFlags().FixedMinSize()); - - sizeractorproperties->Add(getColorChooseActor(parent),wxSizerFlags().FixedMinSize()); - - sizeractorproperties->Add(getOpacityActor(parent),wxSizerFlags().FixedMinSize()); - - return sizeractorproperties; - -} - -wxSizer* CutModel2View::getOpacityActor(wxWindow* parent){ - wxBoxSizer* sizeropacity = new wxBoxSizer(wxVERTICAL); - - wxStaticText* labelopacity = new wxStaticText(parent, -1, wxString(_T("Opacity"))); - wxSlider* slider0 = new wxSlider(parent, -1, 60,0,100,wxDefaultPosition,wxDefaultSize,wxSL_LABELS); - Connect(slider0->GetId(), wxEVT_SCROLL_THUMBRELEASE,(wxObjectEventFunction)(&CutModel2ViewEventHandler::onOpacityChange)); - - sizeropacity->Add(labelopacity,wxSizerFlags().FixedMinSize()); - sizeropacity->Add(slider0,wxSizerFlags().FixedMinSize()); - - return sizeropacity; -} - -wxSizer* CutModel2View::getColorChooseActor(wxWindow* parent){ - wxBoxSizer* sizercolor = new wxBoxSizer(wxHORIZONTAL); - wxBitmap bitmap(Color_xpm); - wxBitmapButton* colorchoose = new wxBitmapButton(parent, -1, bitmap,wxDefaultPosition,wxSize(30,30)); - wxObjectEventFunction f = (wxObjectEventFunction)(&CutModel2ViewEventHandler::onColorChange); - 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); - sizercolor->Add(_currentcolor,wxSizerFlags().FixedMinSize().Centre()); - return sizercolor; -} - -void CutModel2View::checkInvariant()throw (CutModel2Exception){ - -} - -void CutModel2View::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual - //vtkBoxWidget *boxwidget = reinterpret_cast(wdg); - - if(eventId==vtkCommand::StartInteractionEvent){ - CutModel2MainPanel::getInstance()->ShowCurrentPanel(this->getId()); - }else if(eventId==vtkCommand::InteractionEvent){ - CutModel2MainPanel::getInstance()->updateActorDirection(this->getId()); - }else if(eventId==vtkCommand::RightButtonReleaseEvent){ - // =( - CutModel2MainPanel::getInstance()->ShowPopUpMenu(this->getId()); - } -} - -void CutModel2View::ExecuteCut(){ - if(this->isCut()){ - CutModel2MainPanel::getInstance()->ExecuteCut(this->getId(),this->getRange(),this->isInside()); - }else{ - } - -} - -double* CutModel2View::getRange(){ - double* x = new double[3]; - x[0] = 0; - x[1] = _sliderrange->GetValue(); - x[2] = 100000; - - return x; -} -bool CutModel2View::isCut(){ - return true; - //return _radiocutstat->GetSelection()==0; -} -bool CutModel2View::isInside(){ - return _radioinsideout->GetSelection()==0; -} -void CutModel2View::SetCurrentColor(wxColour colour){ - _currentcolor->SetBackgroundColour(colour); - - this->Refresh(); - this->Layout(); -} - -void CutModel2ViewEventHandler::onColorChange(wxCommandEvent& event){ - CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent(); - wxColourDialog* colourdiag = new wxColourDialog(parent); - if(colourdiag->ShowModal()==wxID_OK){ - wxColour colour = colourdiag->GetColourData().GetColour(); - - parent->SetCurrentColor(colour); - - double r = (double)(colour.Red())/255.0; - double g = (double)(colour.Green())/255.0; - double b = (double)(colour.Blue())/255.0; - CutModel2MainPanel::getInstance()->changeColor(parent->getId(),r,g,b); - - - } - delete colourdiag; -} - -void CutModel2ViewEventHandler::onOpacityChange(wxScrollEvent& event){ - CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent(); - - CutModel2MainPanel::getInstance()->changeOpacity(parent->getId(),event.GetInt()); -} -void CutModel2ViewEventHandler::onViewBoxChecked(wxCommandEvent& event){ - CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent(); - - CutModel2MainPanel::getInstance()->ShowViewBox(parent->getId(),event.IsChecked()); -} -void CutModel2ViewEventHandler::onShapeChange(wxCommandEvent& event){ - CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent(); - - //if(event.GetSelection()>0){ - //std::cout<<"id in CutModel2ViewEventHandler:: "<getId()<ChangeShape(parent->getId(),event.GetSelection()); - //} -} -void CutModel2ViewEventHandler::onStatistics(wxCommandEvent& event){ - CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent(); - CutModel2MainPanel::getInstance()->ShowStatistics(parent->getId()); -} -void CutModel2ViewEventHandler::onExecute(wxCommandEvent& event){ - CutModel2View* parent = (CutModel2View*)((wxWindow*)event.GetEventObject())->GetParent(); - - parent->ExecuteCut(); - -} diff --git a/lib/maracasVisuLib/src/CutModule2/interface/CutModel2View.h b/lib/maracasVisuLib/src/CutModule2/interface/CutModel2View.h deleted file mode 100644 index a8b9689..0000000 --- a/lib/maracasVisuLib/src/CutModule2/interface/CutModel2View.h +++ /dev/null @@ -1,103 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2View.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:56 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -#ifndef __CutModel2ViewPanelH__ -#define __CutModel2ViewPanelH__ - -#include -#include -#include -#include "wx/aui/aui.h" -#include -#include "marTypes.h" - - -#include "CutModel2Manager.h" -#include "CutModel2Exception.h" - -#include "vtkObject.h" -#include "vtkCommand.h" - - -class creaMaracasVisu_EXPORT CutModel2View : public wxPanel, public vtkCommand -{ - -public: - CutModel2View( wxWindow* parent,double* range); - ~CutModel2View( ); - - virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ; - - int getId(){ - return _id; - } - void setId(int id){ - _id = id; - } - - void ExecuteCut(); - - void SetCurrentColor(wxColour colour); - -private: - - int _id; - - wxSlider* _sliderrange; - wxRadioBox* _radioinsideout; - //wxRadioBox* _radiocutstat; - wxStaticText* _currentcolor; - - double* getRange(); - bool isCut(); - bool isInside(); - - - - wxSizer* getBoxControls(wxWindow* parent, double* range); - - - wxSizer* getActorProperties(wxWindow* parent); - wxSizer* getColorChooseActor(wxWindow* parent); - wxSizer* getOpacityActor(wxWindow* parent); - - void checkInvariant() throw( CutModel2Exception); - -}; - -class CutModel2ViewEventHandler : public wxEvtHandler{ - - public: - CutModel2ViewEventHandler(): wxEvtHandler(){}; - ~CutModel2ViewEventHandler(){}; - - void onColorChange(wxCommandEvent& event); - void onOpacityChange(wxScrollEvent& event); - void onViewBoxChecked(wxCommandEvent& event); - void onShapeChange(wxCommandEvent& event); - void onStatistics(wxCommandEvent& event); - void onExecute(wxCommandEvent& event); - - - - private: - -}; - - -#endif - diff --git a/lib/maracasVisuLib/src/CutModule2/interface/CutModelMainPanel.cxx b/lib/maracasVisuLib/src/CutModule2/interface/CutModelMainPanel.cxx deleted file mode 100644 index 862f32a..0000000 --- a/lib/maracasVisuLib/src/CutModule2/interface/CutModelMainPanel.cxx +++ /dev/null @@ -1,377 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelMainPanel.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:56 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - -// EOF - wxMaracasMPR.cxx - -#include "CutModelMainPanel.h" -#include "HistogramDialog.h" -#include "creaSystem.h" - -#include -#include - -#include -#include -#include -#include - - - -CutModelMainPanel* CutModelMainPanel::instance=NULL; - -CutModelMainPanel::CutModelMainPanel( wxWindow* parent, std::string path) -: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){ - - cutmanager=NULL; - - initialize(path); - -} -CutModelMainPanel::~CutModelMainPanel( ){ - - delete cutmanager; -} - -void CutModelMainPanel::initialize(std::string path){ - - cutmanager = new CutModelManager(path); - - _panelid = 0; - _wxauimanager = new wxAuiManager(this); - - wxAuiPaneInfo paneinfo; - _wxauimanager->AddPane(new ToolBarCutModel(this),paneinfo.ToolbarPane().Top()); - - _wxauimanager->Update(); -} - -CutModelMainPanel* CutModelMainPanel::getInstance(wxWindow* parent, std::string path){ - if(instance==NULL){ - if(parent == NULL){ - parent = new wxFrame(); - } - instance = new CutModelMainPanel(parent, path); - } - return instance; -} - -/*CutModelMainPanel* CutModelMainPanel::getInstance(){ - return instance; -}*/ - -void CutModelMainPanel::setImageData(vtkImageData* img){ - try{ - checkInvariant(); - cutmanager->setImageData(img); - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } -} - -void CutModelMainPanel::setInteractor(vtkRenderWindowInteractor* interactor){ - try{ - checkInvariant(); - cutmanager->setInteractor(interactor); - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } -} - -void CutModelMainPanel::setRenderer(vtkRenderer* renderer){ - try{ - checkInvariant(); - cutmanager->setRenderer(renderer); - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } -} - -void CutModelMainPanel::checkInvariant()throw (CutModelException){ - if(cutmanager==NULL){ - throw CutModelException("The manager is not initialize"); - } -} - -void CutModelMainPanel::showErrorDialog(std::string str){ - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str.c_str(),wxConvUTF8 ), wxString(str.c_str(),wxConvUTF8 ), wxICON_ERROR); - diag->ShowModal(); -} - -void CutModelMainPanel::RemoveActor(int id){ - try{ - checkInvariant(); - - for(int i = 0; i < viewpanels.size()-1;i++){ - if(viewpanels[i]->getId()==id){ - for(int j = i; j < viewpanels.size()-1;j++){ - viewpanels[j]=viewpanels[j+1]; - } - i = viewpanels.size(); - } - } - viewpanels.pop_back(); - - - cutmanager->RemoveActor(id); - - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } -} - -void CutModelMainPanel::onAddCutModel(){ - try{ - checkInvariant(); - - int id = addNewViewPanel(); - cutmanager->onAddCutModel(id, getModelView(id)); - - _panelid++; - - ShowCurrentPanel(id); - - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } -} -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); - } - } - _wxauimanager->Update(); -} -int CutModelMainPanel::addNewViewPanel()throw( CutModelException){ - - CutModelView* viewpanel = new CutModelView(this,cutmanager->getImageRange()); - - wxAuiPaneInfo paneinfo0; - _wxauimanager->AddPane(viewpanel, paneinfo0.DefaultPane().DestroyOnClose().Centre()); - - viewpanel->setId(_panelid); - viewpanels.push_back(viewpanel); - - return viewpanel->getId(); - - -} -CutModelView* CutModelMainPanel::getModelView(int id)throw( CutModelException){ - - CutModelView* current = NULL; - for(int i = 0; i < viewpanels.size();i++){ - if(viewpanels[i]->getId()==id){ - current = viewpanels[i]; - } - } - if(current == NULL){ - std::string s = "Id not found"; - throw CutModelException(s); - } - return current; -} -void CutModelMainPanel::onUndo(){ - try{ - checkInvariant(); - int result = cutmanager->Undo(); - - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } - -} - -void CutModelMainPanel::onRedo(){ - - try{ - checkInvariant(); - int result = cutmanager->Redo(); - - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } - -} - -void CutModelMainPanel::changeOpacity(int id,int opacity){ - try{ - checkInvariant(); - cutmanager->changeOpacity(id, opacity); - - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } -} - -void CutModelMainPanel::ShowViewBox(int id,bool check){ - try{ - checkInvariant(); - cutmanager->ShowViewBox(id, check); - - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } -} -void CutModelMainPanel::ShowPopUpMenu(int id){ - showErrorDialog("test"); -} -void CutModelMainPanel::changeColor(int id,double r,double g,double b){ - - try{ - checkInvariant(); - cutmanager->changeColor(id, r, g, b); - - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } - -} -void CutModelMainPanel::ChangeShape(int id,int selection){ - try{ - checkInvariant(); - - cutmanager->ChangeShape(id, selection); - - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } -} -void CutModelMainPanel::updateActorDirection(int id){ - try{ - checkInvariant(); - - cutmanager->updateActorDirection(id); - - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } -} - -void CutModelMainPanel::ExecuteCut(int id, double* range, bool isinside){ - try{ - checkInvariant(); - - cutmanager->ExecuteCut(id, range, isinside); - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } -} - -void CutModelMainPanel::ExecuteAll(){ - for(int i = 0; i < viewpanels.size();i++){ - viewpanels[i]->ExecuteCut(); - } - -} -vtkImageData* CutModelMainPanel::GetResultImage(){ - try{ - checkInvariant(); - return cutmanager->GetResultImage(); - }catch(CutModelException e){ - showErrorDialog(e.getCause()); - } - return NULL; -} - -void CutModelMainPanel::ShowStatistics(int id){ - - checkInvariant(); - HistogramDialog *histo = new HistogramDialog(this, _T("Statistics")); - - histo->initializeHistogram(cutmanager->GetResultImage()); - - histo->ShowModal(); - - delete histo; -} - -void CutModelMainPanel::SaveCutModelData(std::string filename){ - cutmanager->SaveCutModelData(filename); -} - -void CutModelMainPanel::LoadCutModelData(std::string filename){ - cutmanager->LoadCutModelData(filename); -} -/** -** -**/ - -ToolBarCutModel::ToolBarCutModel(wxWindow * parent) -: wxToolBar(parent, -1, wxDefaultPosition, wxDefaultSize) -{ - - wxBitmap bitmap10(Add_xpm); - this->AddTool(10, wxString(_T("Add")),bitmap10); - - this->AddSeparator(); - - wxBitmap bitmap20(Undo_xpm); - this->AddTool(20, wxString(_T("Undo")),bitmap20); - - wxBitmap bitmap30(Redo_xpm); - this->AddTool(30, wxString(_T("Redo")),bitmap30); - - this->AddSeparator(); - - wxBitmap bitmap40(OkAll_xpm); - this->AddTool(40, wxString(_T("Ok All")),bitmap40); - - this->Realize(); - - _evthand = new ToolBarEventHandlerCutModel(); - this->SetEventHandler(_evthand); - -} - -ToolBarCutModel::~ToolBarCutModel(void){ -} - -ToolBarEventHandlerCutModel::ToolBarEventHandlerCutModel() -: wxEvtHandler(){ -} -ToolBarEventHandlerCutModel::~ToolBarEventHandlerCutModel(){ -} - -void ToolBarEventHandlerCutModel::onAdd(wxCommandEvent& event){ - CutModelMainPanel::getInstance()->onAddCutModel(); -} - -void ToolBarEventHandlerCutModel::onUndo(wxCommandEvent& event){ - CutModelMainPanel::getInstance()->onUndo(); -} - -void ToolBarEventHandlerCutModel::onRedo(wxCommandEvent& event){ - CutModelMainPanel::getInstance()->onRedo(); -} - -void ToolBarEventHandlerCutModel::onExecuteAll(wxCommandEvent& event){ - CutModelMainPanel::getInstance()->ExecuteAll(); -} - - -BEGIN_EVENT_TABLE(ToolBarEventHandlerCutModel, wxEvtHandler) - EVT_MENU(10, ToolBarEventHandlerCutModel::onAdd) - EVT_MENU(20, ToolBarEventHandlerCutModel::onUndo) - EVT_MENU(30, ToolBarEventHandlerCutModel::onRedo) - EVT_MENU(40, ToolBarEventHandlerCutModel::onExecuteAll) -END_EVENT_TABLE() - diff --git a/lib/maracasVisuLib/src/CutModule2/interface/CutModelMainPanel.h b/lib/maracasVisuLib/src/CutModule2/interface/CutModelMainPanel.h deleted file mode 100644 index a05087c..0000000 --- a/lib/maracasVisuLib/src/CutModule2/interface/CutModelMainPanel.h +++ /dev/null @@ -1,151 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelMainPanel.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:56 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -#ifndef __CutModelMainPanelPanelH__ -#define __CutModelMainPanelPanelH__ - -#include -#include -#include -#include "wx/aui/aui.h" -#include -#include -#include "marTypes.h" - - -#include "CutModelManager.h" -#include "CutModelException.h" -#include "CutModelView.h" - -#include "vtkImageData.h" -#include "vtkRenderWindowInteractor.h" - - -class creaMaracasVisu_EXPORT CutModelMainPanel : public wxPanel -{ - -public: - - ~CutModelMainPanel( ); - - static CutModelMainPanel* getInstance(wxWindow* parent=NULL, std::string path =""); - - //static CutModelMainPanel* getInstance(); - - void setImageData(vtkImageData* img); - - void setInteractor(vtkRenderWindowInteractor* interactor); - - void setRenderer(vtkRenderer* renderer); - - void initialize(std::string path); - - void onAddCutModel(); - - void onUndo(); - - void onRedo(); - - void changeOpacity(int id,int opacity); - - void ShowViewBox(int id,bool check); - - void ChangeShape(int id,int selection); - - void changeColor(int id,double r,double g,double b); - - void updateActorDirection(int id); - - void RemoveActor(int id); - - void ExecuteCut(int id, double* range, bool isinside); - - void ExecuteAll(); - - vtkImageData* GetResultImage(); - - void ShowCurrentPanel(int id); - - void ShowPopUpMenu(int id); - - void ShowStatistics(int id); - - -private: - - CutModelMainPanel( wxWindow* parent, std::string path); - - static CutModelMainPanel* instance; - - CutModelManager* cutmanager; - - void checkInvariant() throw( CutModelException); - - void showErrorDialog(std::string str); - - void SaveCutModelData(std::string filename); - - void LoadCutModelData(std::string filename); - - std::vector viewpanels; - - wxAuiManager* _wxauimanager; - - - int addNewViewPanel()throw( CutModelException); - - CutModelView* getModelView(int id)throw( CutModelException); - - int _panelid; -}; - - -class ToolBarEventHandlerCutModel : public wxEvtHandler{ - - public: - ToolBarEventHandlerCutModel(); - ~ToolBarEventHandlerCutModel(); - - void onAdd(wxCommandEvent& event); - - void onUndo(wxCommandEvent& event); - - void onRedo(wxCommandEvent& event); - - void onExecuteAll(wxCommandEvent& event); - - private: - - DECLARE_EVENT_TABLE() - }; - -class ToolBarCutModel : public wxToolBar{ - - -public: - ToolBarCutModel(wxWindow * parent); - ~ToolBarCutModel(void); - - -private: - - ToolBarEventHandlerCutModel* _evthand; - -}; - -#endif - diff --git a/lib/maracasVisuLib/src/CutModule2/interface/CutModelView.cxx b/lib/maracasVisuLib/src/CutModule2/interface/CutModelView.cxx deleted file mode 100644 index a213ca3..0000000 --- a/lib/maracasVisuLib/src/CutModule2/interface/CutModelView.cxx +++ /dev/null @@ -1,250 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelView.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:56 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - -// EOF - wxMaracasMPR.cxx - -#include "CutModelView.h" - - -#include -#include - -#include -#include -#include -#include - -#include "vtkBoxWidget.h" - -#include "CutModelMainPanel.h" - -CutModelView::CutModelView( wxWindow* parent, double* range) -: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){ - - wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); - - this->SetSizer(sizer); - - sizer->Add(getBoxControls(this, range),wxSizerFlags().FixedMinSize()); - - sizer->AddSpacer(5); - - sizer->Add(getActorProperties(this),wxSizerFlags().FixedMinSize()); - - - wxBitmap bitmapok(Ok1_xpm); - wxBitmapButton* okbutton = new wxBitmapButton(this, -1, bitmapok,wxDefaultPosition,wxSize(30,30)); - Connect(okbutton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)(&CutModelViewEventHandler::onExecute)); - - sizer->AddSpacer(5); - sizer->Add(okbutton,wxSizerFlags().FixedMinSize()); - - - - - -} -CutModelView::~CutModelView( ){ - CutModelMainPanel::getInstance()->RemoveActor(this->getId()); -} - -wxSizer* CutModelView::getBoxControls(wxWindow* parent,double* range){ - - wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); - wxCheckBox* checkbox = new wxCheckBox(parent,-1,_T("View Box")); - sizer->Add(checkbox,wxSizerFlags().FixedMinSize()); - checkbox->SetValue(true); - Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)(&CutModelViewEventHandler::onViewBoxChecked)); - - wxString choices1[3]; - //choices1[0] = _T("Select a shape..."); - choices1[0] = _T("Sphere"); - choices1[1] = _T("Cylinder"); - choices1[2] = _T("Cube"); - wxComboBox* combo = new wxComboBox(parent, -1,_T(""),wxDefaultPosition,wxDefaultSize,3,choices1); - combo->SetValue(_T("Sphere")); - sizer->Add(combo,wxSizerFlags().FixedMinSize()); - Connect(combo->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)(&CutModelViewEventHandler::onShapeChange)); - - wxStaticText* labelgreyv = new wxStaticText(parent, -1, wxString(_T("Grey value range"))); - _sliderrange = new wxSlider(parent, -1, range[0],range[0],range[1],wxDefaultPosition,wxDefaultSize,wxSL_LABELS|wxSL_SELRANGE); - wxBoxSizer* sizergreyv = new wxBoxSizer(wxVERTICAL); - sizergreyv->Add(labelgreyv,wxSizerFlags().FixedMinSize()); - sizergreyv->Add(_sliderrange,wxSizerFlags().FixedMinSize()); - sizer->Add(sizergreyv,wxSizerFlags().FixedMinSize().Border()); - - 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* sizeractorproperties = new wxBoxSizer(wxVERTICAL); - - wxStaticText* labelshapeactor = new wxStaticText(parent, -1, wxString(_T("Actor's properties"))); - - sizeractorproperties->Add(labelshapeactor,wxSizerFlags().FixedMinSize()); - - sizeractorproperties->Add(getColorChooseActor(parent),wxSizerFlags().FixedMinSize()); - - sizeractorproperties->Add(getOpacityActor(parent),wxSizerFlags().FixedMinSize()); - - return sizeractorproperties; - -} - -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, 60,0,100,wxDefaultPosition,wxDefaultSize,wxSL_LABELS); - Connect(slider0->GetId(), wxEVT_SCROLL_THUMBRELEASE,(wxObjectEventFunction)(&CutModelViewEventHandler::onOpacityChange)); - - sizeropacity->Add(labelopacity,wxSizerFlags().FixedMinSize()); - sizeropacity->Add(slider0,wxSizerFlags().FixedMinSize()); - - return sizeropacity; -} - -wxSizer* CutModelView::getColorChooseActor(wxWindow* parent){ - wxBoxSizer* sizercolor = new wxBoxSizer(wxHORIZONTAL); - wxBitmap bitmap(Color_xpm); - wxBitmapButton* colorchoose = new wxBitmapButton(parent, -1, bitmap,wxDefaultPosition,wxSize(30,30)); - wxObjectEventFunction f = (wxObjectEventFunction)(&CutModelViewEventHandler::onColorChange); - 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); - sizercolor->Add(_currentcolor,wxSizerFlags().FixedMinSize().Centre()); - return sizercolor; -} - -void CutModelView::checkInvariant()throw (CutModelException){ - -} - -void CutModelView::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual - //vtkBoxWidget *boxwidget = reinterpret_cast(wdg); - - if(eventId==vtkCommand::StartInteractionEvent){ - CutModelMainPanel::getInstance()->ShowCurrentPanel(this->getId()); - }else if(eventId==vtkCommand::InteractionEvent){ - CutModelMainPanel::getInstance()->updateActorDirection(this->getId()); - }else if(eventId==vtkCommand::RightButtonReleaseEvent){ - // =( - CutModelMainPanel::getInstance()->ShowPopUpMenu(this->getId()); - } -} - -void CutModelView::ExecuteCut(){ - if(this->isCut()){ - CutModelMainPanel::getInstance()->ExecuteCut(this->getId(),this->getRange(),this->isInside()); - }else{ - } - -} - -double* CutModelView::getRange(){ - double* x = new double[3]; - x[0] = 0; - x[1] = _sliderrange->GetValue(); - x[2] = 100000; - - return x; -} -bool CutModelView::isCut(){ - return true; - //return _radiocutstat->GetSelection()==0; -} -bool CutModelView::isInside(){ - return _radioinsideout->GetSelection()==0; -} -void CutModelView::SetCurrentColor(wxColour colour){ - _currentcolor->SetBackgroundColour(colour); - - this->Refresh(); - this->Layout(); -} - -void CutModelViewEventHandler::onColorChange(wxCommandEvent& event){ - CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent(); - wxColourDialog* colourdiag = new wxColourDialog(parent); - if(colourdiag->ShowModal()==wxID_OK){ - wxColour colour = colourdiag->GetColourData().GetColour(); - - parent->SetCurrentColor(colour); - - double r = (double)(colour.Red())/255.0; - double g = (double)(colour.Green())/255.0; - double b = (double)(colour.Blue())/255.0; - CutModelMainPanel::getInstance()->changeColor(parent->getId(),r,g,b); - - - } - delete colourdiag; -} - -void CutModelViewEventHandler::onOpacityChange(wxScrollEvent& event){ - CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent(); - - CutModelMainPanel::getInstance()->changeOpacity(parent->getId(),event.GetInt()); -} -void CutModelViewEventHandler::onViewBoxChecked(wxCommandEvent& event){ - CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent(); - - CutModelMainPanel::getInstance()->ShowViewBox(parent->getId(),event.IsChecked()); -} -void CutModelViewEventHandler::onShapeChange(wxCommandEvent& event){ - CutModelView* parent = (CutModelView*)((wxWindow*)event.GetEventObject())->GetParent(); - - //if(event.GetSelection()>0){ - //std::cout<<"id in CutModelViewEventHandler:: "<getId()<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(); - - parent->ExecuteCut(); - -} diff --git a/lib/maracasVisuLib/src/CutModule2/interface/CutModelView.h b/lib/maracasVisuLib/src/CutModule2/interface/CutModelView.h deleted file mode 100644 index 9f847b9..0000000 --- a/lib/maracasVisuLib/src/CutModule2/interface/CutModelView.h +++ /dev/null @@ -1,103 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelView.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:56 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -#ifndef __CutModelViewPanelH__ -#define __CutModelViewPanelH__ - -#include -#include -#include -#include "wx/aui/aui.h" -#include -#include "marTypes.h" - - -#include "CutModelManager.h" -#include "CutModelException.h" - -#include "vtkObject.h" -#include "vtkCommand.h" - - -class creaMaracasVisu_EXPORT CutModelView : public wxPanel, public vtkCommand -{ - -public: - CutModelView( wxWindow* parent,double* range); - ~CutModelView( ); - - virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ; - - int getId(){ - return _id; - } - void setId(int id){ - _id = id; - } - - void ExecuteCut(); - - void SetCurrentColor(wxColour colour); - -private: - - int _id; - - wxSlider* _sliderrange; - wxRadioBox* _radioinsideout; - //wxRadioBox* _radiocutstat; - wxStaticText* _currentcolor; - - double* getRange(); - bool isCut(); - bool isInside(); - - - - wxSizer* getBoxControls(wxWindow* parent, double* range); - - - wxSizer* getActorProperties(wxWindow* parent); - wxSizer* getColorChooseActor(wxWindow* parent); - wxSizer* getOpacityActor(wxWindow* parent); - - void checkInvariant() throw( CutModelException); - -}; - -class CutModelViewEventHandler : public wxEvtHandler{ - - public: - CutModelViewEventHandler(): wxEvtHandler(){}; - ~CutModelViewEventHandler(){}; - - void onColorChange(wxCommandEvent& event); - void onOpacityChange(wxScrollEvent& event); - void onViewBoxChecked(wxCommandEvent& event); - void onShapeChange(wxCommandEvent& event); - void onStatistics(wxCommandEvent& event); - void onExecute(wxCommandEvent& event); - - - - private: - -}; - - -#endif - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CMakeLists.txt b/lib/maracasVisuLib/src/CutModule2/kernel/CMakeLists.txt deleted file mode 100644 index 1a4aecf..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -#---------------------------------------------------------------------------- -# SET THE NAME OF YOUR LIBRARY -SET ( LIBRARY_NAME creaMaracasVisu_CutModule2_kernel ) -#---------------------------------------------------------------------------- -#---------------------------------------------------------------------------- - - #---------------------------------------------------------------------------- - # BUILD LIBRARY - #---------------------------------------------------------------------------- - - #---------------------------------------------------------------------------- - # LIBRARY HEADERS (TO BE INSTALLED) - # EITHER LIST ALL .h IN CURRENT DIR USING NEXT LINE: - FILE(GLOB ${LIBRARY_NAME}_HEADERS "*.h") - # OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND - # SET ( ${LIBRARY_NAME}_HEADERS - # - # ) - #---------------------------------------------------------------------------- - - #---------------------------------------------------------------------------- - # LIBRARY SOURCES (TO BE COMPILED) - # EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE: - FILE(GLOB ${LIBRARY_NAME}_SOURCES *.cxx *.cpp *.cc) - # OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION) - # SET ( ${LIBRARY_NAME}_SOURCES - # - # ) - #---------------------------------------------------------------------------- - - #---------------------------------------------------------------------------- - # LIBRARY DEPENDENCIES (LIBRARIES TO LINK WITH) - SET ( ${LIBRARY_NAME}_LINK_LIBRARIES - ${crea_LIBRARIES} - # ${VTK_LIBRARIES} - # ${ITK_LIBRARIES} - # ${GDCM_LIBRARIES} - # ${BOOST_LIBRARIES} - ) - #---------------------------------------------------------------------------- - - - #---------------------------------------------------------------------------- - # MACRO WHICH DOES ALL THE JOB : BUILD AND INSTALL - #CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) - #---------------------------------------------------------------------------- - - ADD_LIBRARY(${LIBRARY_NAME} STATIC ${${LIBRARY_NAME}_SOURCES} ${${LIBRARY_NAME}_HEADERS} ) - # LINK - TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES}) \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Data.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Data.cxx deleted file mode 100644 index 5e37efb..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Data.cxx +++ /dev/null @@ -1,388 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2Data.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "CutModel2Data.h" - -/** -** Start of the manager class -**/ -CutModel2Data::CutModel2Data(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img){ - - initializeData(id, interactor, observer, img); - -} -CutModel2Data::CutModel2Data(){ - -} -void CutModel2Data::initializeData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img){ - _id = id; - _currentshape=0; - createBoxWidget(interactor, observer); - setTransform(img); - createActor(); - createShapes(); - ChangeShape(0); - checkInvariant(); -} -CutModel2Data::~CutModel2Data(){ - checkInvariant(); - _boxWidgetVolume->Off(); - _boxWidgetVolume->Delete(); - _Mapper->Delete(); - _Actor->Delete(); - delete _cubefigure; - delete _cylinderfigure; - delete _spherefigure; - currentmatrix->Delete(); - inversModel->Delete(); -} -void CutModel2Data::RefreshViewBox(){ - -} -void CutModel2Data::createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer){ - - _boxWidgetVolume = vtkBoxWidget::New(); - _boxWidgetVolume->SetInteractor( interactor ); - //_boxWidgetVolume->SetPlaceFactor(1); - //_boxWidgetVolume->SetInput( img ); - //_boxWidgetVolume->PlaceWidget(); - - _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent , observer ); - _boxWidgetVolume->AddObserver( vtkCommand::StartInteractionEvent , observer ); - _boxWidgetVolume->AddObserver( vtkCommand::RightButtonReleaseEvent , observer ); - - _boxWidgetVolume->HandlesOn (); - _boxWidgetVolume->On(); - //_boxWidgetVolume->GetHandleProperty()->SetOpacity(0.5); - //_boxWidgetVolume->GetOutlineProperty()->SetOpacity(0.5); -} -void CutModel2Data::setTransform(vtkImageData* img)throw( CutModel2Exception){ - - currentmatrix = vtkTransform::New(); - modeltransform = vtkTransform::New(); - inversModel = vtkTransform::New(); - - vtkMatrix4x4* matrix = vtkMatrix4x4::New(); - matrix->Identity(); - int *ext = img->GetExtent(); - double *spc = img->GetSpacing(); - - - matrix->SetElement(0,0,(ext[1]-ext[0])/4*spc[0]); - matrix->SetElement(1,1,(ext[3]-ext[2])/4*spc[1]); - matrix->SetElement(2,2,(ext[5]-ext[4])/4*spc[2]); - - double orgx = (ext[1]-ext[0])/2*spc[0]; - double orgy = (ext[3]-ext[2])/2*spc[1]; - double orgz = (ext[5]-ext[4])/2*spc[2]; - - matrix->SetElement(0,3,orgx); - matrix->SetElement(1,3,orgy); - matrix->SetElement(2,3,orgz); - - - currentmatrix->SetMatrix(matrix); - _boxWidgetVolume->SetTransform(currentmatrix); - -} -void CutModel2Data::createActor(){ - - _Mapper = vtkPolyDataMapper::New(); - _Actor = vtkActor::New(); - _Actor->SetMapper(_Mapper); - _Actor->GetProperty()->SetColor(1, 0, 0); - _Actor->GetProperty()->SetOpacity(0.5); - -} -void CutModel2Data::udapteActorDirection()throw( CutModel2Exception){ - checkInvariant(); - - _boxWidgetVolume->GetTransform(currentmatrix); - _Actor->SetUserMatrix(currentmatrix->GetMatrix());//SetUserTransform(currentmatrix ); -} -void CutModel2Data::createShapes(){ - _cubefigure = new CutModel2FigureCube(); - _cylinderfigure = new CutModel2FigureCylinder(); - _spherefigure = new CutModel2FigureSphere(); -} -void CutModel2Data::changeOpacity(int opacity)throw( CutModel2Exception){ - checkInvariant(); - _Actor->GetProperty()->SetOpacity((double)opacity/100.0); -} - -void CutModel2Data::ShowViewBox(bool check)throw( CutModel2Exception){ - checkInvariant(); - if(check){ - _boxWidgetVolume->On(); - }else{ - _boxWidgetVolume->Off(); - } -} - -void CutModel2Data::ChangeShape(int selection)throw( CutModel2Exception){ - checkInvariant(); - - if(selection == 0){ - _Mapper->SetInput(_spherefigure->getPolyData()); - }else if(selection == 1){ - _Mapper->SetInput(_cylinderfigure->getPolyData()); - }else if(selection == 2){ - _Mapper->SetInput(_cubefigure->getPolyData()); - }else{ - throw CutModel2Exception("Shape type not found"); - } - - _currentshape=selection; -} - -void CutModel2Data::checkInvariant()throw( CutModel2Exception){ - if(_boxWidgetVolume==NULL){ - throw CutModel2Exception("Box Widget not created"); - } - if(_Mapper==NULL){ - throw CutModel2Exception("Mapper not created"); - } - if(_Actor==NULL){ - throw CutModel2Exception("Actor not created"); - } - if(_cubefigure==NULL){ - throw CutModel2Exception("Cube not created"); - } - if(_cylinderfigure==NULL){ - throw CutModel2Exception("Cylinder not created"); - } - if(_spherefigure==NULL){ - throw CutModel2Exception("Sphere not created"); - } - -} - -vtkActor* CutModel2Data::getActor()throw( CutModel2Exception){ - checkInvariant(); - return _Actor; -} - -void CutModel2Data::changeColor(double r,double g,double b)throw( CutModel2Exception){ - checkInvariant(); - _Actor->GetProperty()->SetColor( r, g, b ); -} -CutModel2Figure* CutModel2Data::getCurentCuttingModel(){ - checkInvariant(); - - if(_currentshape == 0){ - return _spherefigure; - }else if(_currentshape == 1){ - return _cylinderfigure; - }else if(_currentshape == 2){ - return _cubefigure; - }else{ - throw CutModel2Exception("Shape type not found"); - } -} -void CutModel2Data::ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModel2Exception) -{ - - wxBusyCursor wait; - - CutModel2Figure* actualCuttingModel = getCurentCuttingModel(); - - //_boxWidgetVolume->GetTransform(currentmatrix); - actualCuttingModel->SetVtkTransform(getModelTransform(copyimage)); - //actualCuttingModel->SetVtkTransform(currentmatrix); - actualCuttingModel->SetInversVtkTransform(getModelTransformInvers()); - - bool inside; - bool volInt, volExt; - int xx,yy,zz; - unsigned short* pOrg; - int ext[6]; - double spc[3]; - long int contAfter = 0; - long int contBefor = 0; - - double minvalue = range[0]; - double value = range[1]; - double maxvalue = range[2]; - - - copyimage->GetExtent(ext); - - for (xx=ext[0];xxIfPointInside(xx,yy,zz); - if ( ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) ) - { - pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz); - - //std::cout<<"xx,yy,zz "<SetVtkTransform(getModelTransform(copyimage)); - - actualCuttingModel->SetInversVtkTransform(getModelTransformInvers()); - - bool inside; - bool volInt, volExt; - int xx,yy,zz; - unsigned short* pOrg; - int ext[6]; - double spc[3]; - long int contAfter = 0; - long int contBefor = 0; - - double value; - - - - copyimage->GetExtent(ext); - - for (xx=ext[0];xxIfPointInside(xx,yy,zz); - if ( ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) ) - { - value = *((unsigned short*)image->GetScalarPointer (xx,yy,zz)); - pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz); - //std::cout<<"CutModel2Data::ExecuteUnCut() "<GetSpacing(); - modeltransform->Identity(); - - vtkMatrix4x4* matrix = currentmatrix->GetMatrix(); - vtkMatrix4x4* matrixmodel = modeltransform->GetMatrix(); - 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(0,1,matrix->GetElement(0,1)/spc[1]); - matrixmodel->SetElement(1,1,matrix->GetElement(1,1)/spc[1]); - matrixmodel->SetElement(2,1,matrix->GetElement(2,1)/spc[1]); - matrixmodel->SetElement(0,2,matrix->GetElement(0,2)/spc[2]); - matrixmodel->SetElement(1,2,matrix->GetElement(1,2)/spc[2]); - 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]); - - /* - - 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]); - - //double* orient = currentmatrix->GetOrientation(); - //modeltransform->RotateZ(orient[2]); - //modeltransform->RotateY(orient[1]); - //modeltransform->RotateX(orient[0]); - double* orient = currentmatrix->GetOrientationWXYZ(); - modeltransform->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]); - - */ - - - modeltransform->Update(); - - return modeltransform; - - -} -void CutModel2Data::setTransform(vtkTransform* transform, vtkImageData* img)throw( CutModel2Exception){ - - - double *spc = img->GetSpacing(); - - currentmatrix->Identity(); - - /*double* orient = transform->GetOrientationWXYZ(); - currentmatrix->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]); - - double* pos = transform->GetPosition(); - currentmatrix->Translate(pos[0]/spc[0],pos[1]/spc[1],pos[2]/spc[2]); - - double* scal = transform->GetScale(); - currentmatrix->Scale(scal[0]/spc[0],scal[1]/spc[1],scal[2]/spc[2]); - - currentmatrix->Update(); */ - - _boxWidgetVolume->SetTransform(transform); - - /*vtkMatrix4x4* matrix = transform->GetMatrix(); - vtkMatrix4x4* matrixcurrent = currentmatrix->GetMatrix(); - matrixcurrent->SetElement(0,0,matrix->GetElement(0,0)/spc[0]); - matrixcurrent->SetElement(1,0,matrix->GetElement(1,0)/spc[0]); - matrixcurrent->SetElement(2,0,matrix->GetElement(2,0)/spc[0]); - matrixcurrent->SetElement(0,1,matrix->GetElement(0,1)/spc[1]); - matrixcurrent->SetElement(1,1,matrix->GetElement(1,1)/spc[1]); - matrixcurrent->SetElement(2,1,matrix->GetElement(2,1)/spc[1]); - matrixcurrent->SetElement(0,2,matrix->GetElement(0,2)/spc[2]); - matrixcurrent->SetElement(1,2,matrix->GetElement(1,2)/spc[2]); - matrixcurrent->SetElement(2,2,matrix->GetElement(2,2)/spc[2]); - matrixcurrent->SetElement(0,3,matrix->GetElement(0,3)/spc[0]); - matrixcurrent->SetElement(1,3,matrix->GetElement(1,3)/spc[1]); - matrixcurrent->SetElement(2,3,matrix->GetElement(2,3)/spc[2]); */ - - - udapteActorDirection(); - getModelTransform(img); - -} -vtkTransform* CutModel2Data::getModelTransformInvers(){ - inversModel->Identity (); - inversModel->Concatenate ( modeltransform ); - inversModel->Inverse(); - return inversModel; -} - -vtkPolyData* CutModel2Data::getPolyData()throw( CutModel2Exception){ - return _Mapper->GetInput(); -} - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Data.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Data.h deleted file mode 100644 index 85d835e..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Data.h +++ /dev/null @@ -1,118 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2Data.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - - -#ifndef __CutModel2DataH__ -#define __CutModel2DataH__ - -#include -#include - -#include "vtkImageData.h" -#include "vtkRenderWindowInteractor.h" -#include "vtkCommand.h" -#include "vtkBoxWidget.h" -#include "vtkPolyDataMapper.h" -#include "vtkActor.h" -#include "vtkProperty.h" -#include "CutModel2Exception.h" -#include "CutModel2Figure.h" -#include "CutModel2FigureCube.h" -#include "CutModel2FigureSphere.h" -#include "CutModel2FigureCylinder.h" - -#include - -class CutModel2Data { - -public: - CutModel2Data(); - CutModel2Data(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img); - ~CutModel2Data(); - void initializeData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img); - - - int getId(){ - return _id; - } - - void changeOpacity(int opacity)throw( CutModel2Exception); - - void ShowViewBox(bool check)throw( CutModel2Exception); - - void ChangeShape(int selection)throw( CutModel2Exception); - - vtkActor* getActor()throw( CutModel2Exception); - - vtkPolyData* getPolyData()throw( CutModel2Exception); - - void changeColor(double r,double g,double b)throw( CutModel2Exception); - - void udapteActorDirection()throw( CutModel2Exception); - - void ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModel2Exception); - - void ExecuteUnCut( bool isinside, vtkImageData* image, vtkImageData* copyimage)throw( CutModel2Exception); - - void RefreshViewBox(); - - vtkTransform* getCurrentMatrix(){ - return currentmatrix; - } - - int getCurrentShape(){ - return _currentshape; - } - - void setCurrentShape(int currentshape){ - _currentshape = currentshape; - } - - void setTransform(vtkTransform* transform,vtkImageData* img)throw( CutModel2Exception); -private: - - void checkInvariant()throw( CutModel2Exception); - - void createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer); - void createActor(); - void setTransform(vtkImageData* img)throw( CutModel2Exception); - void createShapes(); - - vtkBoxWidget* _boxWidgetVolume; - vtkPolyDataMapper* _Mapper; - vtkActor* _Actor; - int _id; - - int _currentshape; - - CutModel2FigureCube* _cubefigure; - CutModel2FigureCylinder* _cylinderfigure; - CutModel2FigureSphere* _spherefigure; - vtkTransform* currentmatrix; - vtkTransform* modeltransform; - vtkTransform* inversModel; - - - CutModel2Figure* getCurentCuttingModel(); - - vtkTransform* getModelTransform(vtkImageData* copyimage); - vtkTransform* getModelTransformInvers(); -}; - -#endif diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Exception.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Exception.cxx deleted file mode 100644 index a6c5793..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Exception.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2Exception.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "CutModel2Exception.h" - -/** -** Start of the manager class -**/ -CutModel2Exception::CutModel2Exception(std::string cause) -:std::exception(){ - _cause = cause; -} -CutModel2Exception::~CutModel2Exception()throw(){ -} - - - - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Exception.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Exception.h deleted file mode 100644 index 178b74e..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Exception.h +++ /dev/null @@ -1,44 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2Exception.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - - -#ifndef __CutModel2ExceptionH__ -#define __CutModel2ExceptionH__ - -#include -#include - - -class CutModel2Exception : public std::exception{ - -public: - CutModel2Exception(std::string cause); - ~CutModel2Exception() throw(); - - std::string getCause(){ - return _cause; - } - -private: - - std::string _cause; - -}; - -#endif diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Figure.cxx__ b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Figure.cxx__ deleted file mode 100644 index 6be77f5..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Figure.cxx__ +++ /dev/null @@ -1,152 +0,0 @@ - -#include "CutModelFigure.h" - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -CutModelFigure::CutModelFigure() -{ - _inversModel = vtkTransform::New(); - _matrixModel = vtkTransform::New(); - _matrixVisual = vtkTransform::New(); - - _spcX=1; - _spcY=1; - _spcZ=1; -} -//---------------------------------------------------------------------------- -CutModelFigure::~CutModelFigure() // virtual -{ - _inversModel->Delete(); -} -//---------------------------------------------------------------------------- -void CutModelFigure::SetPosition(double x,double y, double z) -{ - _px=x; - _py=y; - _pz=z; -} -//---------------------------------------------------------------------------- -void CutModelFigure::SetScale(double sx,double sy, double sz) -{ - _sx=sx; - _sy=sy; - _sz=sz; -} -//---------------------------------------------------------------------------- -void CutModelFigure::SetRotation(double alfa,double beta, double teta) -{ - _alfa=alfa; - _beta=beta; - _teta=teta; -} - -//---------------------------------------------------------------------------- -void CutModelFigure::CalculeMatrix() -{ - _matrixModel->Identity(); - _matrixModel->Translate(_px,_py,_pz); - _matrixModel->RotateY(_beta); - _matrixModel->RotateX(_alfa); - _matrixModel->RotateY(_teta); - _matrixModel->Scale(_sx,_sy,_sz); - - _matrixVisual->Identity(); - _matrixVisual->Translate( _px*_spcX , _py*_spcY , _pz*_spcZ ); - _matrixVisual->RotateY(_beta); - _matrixVisual->RotateX(_alfa); - _matrixVisual->RotateY(_teta); - _matrixVisual->Scale( _sx*_spcX , _sy*_spcY , _sz*_spcZ ); - -} - - -//---------------------------------------------------------------------------- -void CutModelFigure::CalculeInversMatrix() -{ - _inversModel->Identity (); - _inversModel->Concatenate ( _matrixModel ); - _inversModel->Inverse(); -} -//---------------------------------------------------------------------------- -bool CutModelFigure::IfPointInside(double x, double y, double z) // virtual -{ - return true; -} - -//---------------------------------------------------------------------------- -vtkTransform *CutModelFigure::GetVtkTransform() -{ - return _matrixVisual; -} - -//---------------------------------------------------------------------------- -//void CutModelFigure::SetVtkTransform(vtkTransform *matrix) -//{ -// _matrixModel = matrix; -//} - -//---------------------------------------------------------------------------- -double CutModelFigure::GetTheoricVolume() // virtual -{ - return 0; -} - -//---------------------------------------------------------------------------- -double CutModelFigure::GetPositionX() -{ - return _px; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetPositionY() -{ - return _py; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetPositionZ() -{ - return _pz; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetScaleX() -{ - return _sx; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetScaleY() -{ - return _sy; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetScaleZ() -{ - return _sz; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetAngleAlfa() -{ - return _alfa; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetAngleBeta() -{ - return _beta; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetAngleTeta() -{ - return _teta; -} -//---------------------------------------------------------------------------- -char *CutModelFigure::GetName() // virtual -{ - return "--"; -} - -//---------------------------------------------------------------------------- -void CutModelFigure::SetSpacing(double spcX,double spcY, double spcZ) -{ - _spcX = spcX; - _spcY = spcY; - _spcZ = spcZ; -} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Figure.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Figure.h deleted file mode 100644 index 82c5b8f..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Figure.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef FIGURECUTTINGMODEL_H_ -#define FIGURECUTTINGMODEL_H_ - -#include "vtkTransform.h" -#include "vtkPolyData.h" - -class CutModel2Figure -{ -public: - CutModel2Figure(){} - - //~CutModel2Figure(); - - virtual void SetPosition(double x,double y, double z){ - _px = x; - _py = y; - _pz = z; - } - - virtual void SetScale(double sx,double sy, double sz){ - _sx = sx; - _sy = sy; - _sz = sz; - } - - virtual void SetRotation(double alfa,double beta, double teta){ - _alfa = alfa; - _beta = beta; - _teta = teta; - } - - virtual void SetSpacing(double spcX,double spcY, double spcZ){ - _spcX = spcX; - _spcY = spcY; - _spcZ = spcZ; - } - - virtual void SetVtkTransform(vtkTransform *transform){ - double *orient = transform->GetOrientation(); - _alfa = orient[0]; - _beta = orient[1]; - _teta = orient[2]; - - double *scale = transform->GetScale(); - _sx = scale[0]; - _sy = scale[1]; - _sz = scale[2]; - - double *position = transform->GetPosition(); - _px = position[0]; - _py = position[1]; - _pz = position[2]; - - - } - virtual void SetInversVtkTransform(vtkTransform *inverstransform){ - _inversModel = inverstransform; - } - - virtual bool IfPointInside(double x, double y, double z) = 0; - virtual double GetTheoricVolume()=0; - virtual vtkPolyData* getPolyData()=0; - -private: - double _px; - double _py; - double _pz; - double _alfa; - double _beta; - double _teta; - double _spcX; - double _spcY; - double _spcZ; - char *GetName; -protected: - double _sx; - double _sy; - double _sz; - vtkTransform *_inversModel; - vtkTransform *_matrixModel; -}; - -#endif /*FIGURECUTTINGMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCube.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCube.cxx deleted file mode 100644 index 53aa395..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCube.cxx +++ /dev/null @@ -1,52 +0,0 @@ - -#include "CutModel2FigureCube.h" - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -CutModel2FigureCube::CutModel2FigureCube() -: CutModel2Figure() -{ - _vtkcube = vtkCubeSource::New(); - _vtkcube->SetXLength (1); - _vtkcube->SetYLength (1); - _vtkcube->SetZLength (1); -} -//---------------------------------------------------------------------------- -CutModel2FigureCube::~CutModel2FigureCube() // virtual -{ - _vtkcube->Delete(); -} -//---------------------------------------------------------------------------- -bool CutModel2FigureCube::IfPointInside(double x, double y, double z) // virtual -{ - double in[4],out[4]; - in[0]=x; - in[1]=y; - in[2]=z; - in[3]=1; - _inversModel->MultiplyPoint (in, out); - - bool result=false; - if ((out[0]>-0.5) && (out[0]<0.5) && (out[1]>-0.5) && (out[1]<0.5) && (out[2]>-0.5) && (out[2]<0.5) ) - { - result=true; - } - return result; -} -//---------------------------------------------------------------------------- -double CutModel2FigureCube::GetTheoricVolume() // virtual -{ - return _sx * _sy * _sz; -} - -//---------------------------------------------------------------------------- -char *CutModel2FigureCube::GetName() // virtual -{ - return "Cube"; -} - -vtkPolyData* CutModel2FigureCube::getPolyData(){ - return _vtkcube->GetOutput(); -} - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCube.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCube.h deleted file mode 100644 index 8f23fc8..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCube.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef CutModel2FigureCube_H_ -#define CutModel2FigureCube_H_ - -#include "CutModel2Figure.h" -#include "vtkCubeSource.h" - -class CutModel2FigureCube : public CutModel2Figure -{ -public: - CutModel2FigureCube(); - virtual ~CutModel2FigureCube(); - virtual bool IfPointInside(double x, double y, double z); - virtual double GetTheoricVolume(); - virtual vtkPolyData* getPolyData(); - virtual char *GetName(); -private: - vtkCubeSource* _vtkcube; -protected: -}; - -#endif /*FIGURECUTTINGCUBEMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCylinder.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCylinder.cxx deleted file mode 100644 index 21a746c..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCylinder.cxx +++ /dev/null @@ -1,45 +0,0 @@ - -#include "CutModel2FigureCylinder.h" - -CutModel2FigureCylinder::CutModel2FigureCylinder() -{ - _vtkcylinder = vtkCylinderSource::New(); - _vtkcylinder->SetResolution(20); -} -//---------------------------------------------------------------------------- -CutModel2FigureCylinder::~CutModel2FigureCylinder() // virtual -{ - _vtkcylinder->Delete(); -} -//---------------------------------------------------------------------------- -bool CutModel2FigureCylinder::IfPointInside(double x, double y, double z) // virtual -{ - double in[4],out[4]; - in[0]=x; - in[1]=y; - in[2]=z; - in[3]=1; - _inversModel->MultiplyPoint (in, out); - - bool result=false; - if ((sqrt( out[0]*out[0] + out[2]*out[2] )<0.5 ) && (out[1]>-0.5) && (out[1]<0.5) ) - { - result=true; - } - return result; -} -//---------------------------------------------------------------------------- -double CutModel2FigureCylinder::GetTheoricVolume() // virtual -{ - double piTMP=3.14159265; - return piTMP*(_sx/2)*(_sz/2)*_sy; -} -//---------------------------------------------------------------------------- -char *CutModel2FigureCylinder::GetName() // virtual -{ - return "Cylinder"; -} -vtkPolyData* CutModel2FigureCylinder::getPolyData(){ - return _vtkcylinder->GetOutput(); -} -//---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCylinder.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCylinder.h deleted file mode 100644 index 2468984..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureCylinder.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef CutModel2FigureCylinder_H_ -#define CutModel2FigureCylinder_H_ - -#include "CutModel2Figure.h" -#include "vtkCylinderSource.h" - -class CutModel2FigureCylinder : public CutModel2Figure -{ -public: - CutModel2FigureCylinder(); - virtual ~CutModel2FigureCylinder(); - virtual bool IfPointInside(double x, double y, double z); - virtual double GetTheoricVolume(); - virtual vtkPolyData* getPolyData(); - virtual char *GetName(); - -private: - vtkCylinderSource* _vtkcylinder; -protected: -}; - -#endif /*FIGURECUTTINGCYLINDERMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureSphere.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureSphere.cxx deleted file mode 100644 index 19d21de..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureSphere.cxx +++ /dev/null @@ -1,49 +0,0 @@ -#include "CutModel2FigureSphere.h" - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -CutModel2FigureSphere::CutModel2FigureSphere() -{ - _vtksphere = vtkSphereSource::New(); - _vtksphere->SetThetaResolution (20); - _vtksphere->SetPhiResolution (20); -} -//---------------------------------------------------------------------------- -CutModel2FigureSphere::~CutModel2FigureSphere() // virtual -{ - _vtksphere->Delete(); -} -//---------------------------------------------------------------------------- -bool CutModel2FigureSphere::IfPointInside(double x, double y, double z) // virtual -{ - double in[4],out[4]; - in[0]=x; - in[1]=y; - in[2]=z; - in[3]=1; - _inversModel->MultiplyPoint (in, out); - - bool result=false; - if (sqrt( out[0]*out[0] + out[1]*out[1] + out[2]*out[2] )<0.5 ) - { - result=true; - } - return result; -} -//---------------------------------------------------------------------------- -double CutModel2FigureSphere::GetTheoricVolume() // virtual -{ - double piTMP=3.14159265; - return (4.0/3.0) * piTMP * (_sx/2)*(_sy/2)*(_sz/2); -} -//---------------------------------------------------------------------------- -char *CutModel2FigureSphere::GetName() // virtual -{ - return "Sphere"; -} - -vtkPolyData* CutModel2FigureSphere::getPolyData(){ - return _vtksphere->GetOutput(); -} - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureSphere.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureSphere.h deleted file mode 100644 index f6cdff9..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2FigureSphere.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef CutModel2FigureSphere_H_ -#define CutModel2FigureSphere_H_ - -#include "CutModel2Figure.h" -#include "vtkSphereSource.h" - -class CutModel2FigureSphere : public CutModel2Figure -{ -public: - CutModel2FigureSphere(); - virtual ~CutModel2FigureSphere(); - virtual bool IfPointInside(double x, double y, double z); - virtual double GetTheoricVolume(); - virtual char *GetName(); - virtual vtkPolyData* getPolyData(); -private: - vtkSphereSource* _vtksphere; -protected: -}; - -#endif /*FIGURECUTTINGSPHEREMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Manager.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Manager.cxx deleted file mode 100644 index c6337ec..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Manager.cxx +++ /dev/null @@ -1,280 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2Manager.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "CutModel2Manager.h" - -/** -** Start of the manager class -**/ -CutModel2Manager::CutModel2Manager(std::string path){ - _path = path; - _img = NULL; - _copyimg = NULL; - _interactor = NULL; - _render = NULL; - _currentaction=0; -} -CutModel2Manager::~CutModel2Manager(){ - std::string files = _path; - files+="/infounrd_0_fig_0.info"; - remove(files.c_str()); -} - - -void CutModel2Manager::setImageData(vtkImageData* img){ - _img = img; - if(_copyimg!=NULL){ - _copyimg->Delete(); - } - _copyimg = vtkImageData::New(); - _copyimg->SetExtent(_img->GetExtent()); - _copyimg->SetSpacing(_img->GetSpacing()); - _copyimg->AllocateScalars(); - - _copyimg->DeepCopy(_img); - -} - -void CutModel2Manager::setInteractor(vtkRenderWindowInteractor* interactor){ - _interactor = interactor; -} - -void CutModel2Manager::setRenderer(vtkRenderer* renderer){ - _render = renderer; -} - -void CutModel2Manager::onAddCutModel2(int id, vtkCommand* observer) throw( CutModel2Exception){ - checkInvariant(); - - CutModel2Data* data = new CutModel2Data(id,_interactor, observer, _copyimg); - _vectordata.push_back(data); - - _render->AddActor(data->getActor()); - - //_render->UpdateCamera(); - _render->Render(); -} - -void CutModel2Manager::checkInvariant() throw( CutModel2Exception){ - if(_img==NULL){ - throw CutModel2Exception("The image is not set"); - } - if(_copyimg==NULL){ - throw CutModel2Exception("The image is not set"); - } - if(_interactor==NULL){ - throw CutModel2Exception("Interactor not set"); - } - if(_render==NULL){ - throw CutModel2Exception("Render not set"); - } -} - -double* CutModel2Manager::getImageRange()throw( CutModel2Exception){ - checkInvariant(); - return _copyimg->GetScalarRange(); -} - -void CutModel2Manager::changeOpacity(int id,int opacity)throw( CutModel2Exception){ - checkInvariant(); - CutModel2Data* current = getCutModel2Data(id); - current->changeOpacity(opacity); -} - -void CutModel2Manager::ShowViewBox(int id,bool check)throw( CutModel2Exception){ - checkInvariant(); - CutModel2Data* current = getCutModel2Data(id); - current->ShowViewBox(check); -} - -void CutModel2Manager::ChangeShape(int id,int selection)throw( CutModel2Exception){ - checkInvariant(); - CutModel2Data* current = getCutModel2Data(id); - current->ChangeShape(selection); - _render->Render(); -} - -CutModel2Data* CutModel2Manager::getCutModel2Data(int id)throw( CutModel2Exception){ - - CutModel2Data* current = NULL; - for(int i= 0; i < _vectordata.size();i++){ - std::cout<<"id in CutModel2Manager:: "<getId()<getId()==id){ - current = _vectordata[i]; - } - } - if(current ==NULL){ - - throw CutModel2Exception("Data not found"); - } - return current; -} - -void CutModel2Manager::updateActorDirection(int id)throw( CutModel2Exception){ - checkInvariant(); - CutModel2Data* current = getCutModel2Data(id); - current->udapteActorDirection(); - -} - -void CutModel2Manager::changeColor(int id,double r,double g,double b)throw( CutModel2Exception){ - - checkInvariant(); - CutModel2Data* current = getCutModel2Data(id); - current->changeColor(r,g,b); - _render->Render(); -} -void CutModel2Manager::RemoveActor(int id)throw( CutModel2Exception){ - - checkInvariant(); - - CutModel2Data* current = getCutModel2Data(id); - for(int i = 0; i < _vectordata.size()-1;i++){ - if(_vectordata[i]->getId()==id){ - for(int j = i; j < _vectordata.size()-1;j++){ - _vectordata[j]=_vectordata[j+1]; - } - i = _vectordata.size(); - } - } - _render->RemoveActor(current->getActor()); - delete current; - _vectordata.pop_back(); - _render->Render(); - -} - -void CutModel2Manager::ExecuteCut(int id, double* range, bool isinside)throw( CutModel2Exception){ - checkInvariant(); - - CutModel2Data* current = getCutModel2Data(id); - current->ExecuteCut(range, isinside, _img); - - - /* - Setting extra information for the undo - */ - CutModel2SaveBinInfo* undoaction = this->AddActionUndo(id, CUTMODEL2_CUT); - undoaction->setRange(range); - undoaction->setIsInside(isinside); - -} - -vtkImageData* CutModel2Manager::GetResultImage(){ - checkInvariant(); - return _copyimg; -} - -void CutModel2Manager::RefreshActor(int id){ - checkInvariant(); - CutModel2Data* current = getCutModel2Data(id); - _render->RemoveActor(current->getActor()); - _render->AddActor(current->getActor()); - current->RefreshViewBox(); - _render->Render(); -} - -void CutModel2Manager::SaveCutModel2Data(std::string filename)throw( CutModel2Exception){ - - - throw CutModel2Exception("not implemented"); - - - - -} - - - -void CutModel2Manager::LoadCutModel2Data(std::string filename)throw( CutModel2Exception){ - - throw CutModel2Exception("not implemented"); - -} - -CutModel2SaveBinInfo* CutModel2Manager::AddActionUndo(int idc, UNDOTYPE type)throw( CutModel2Exception){ - - for(int i = _undoredo.size()-1; i > _currentaction;i--){ - delete _undoredo[i]; - _undoredo.pop_back(); - } - - CutModel2SaveBinInfo* cutmodel = new CutModel2SaveBinInfo(idc, _currentaction, type, _path); - if(type == CUTMODEL2_CUT){ - cutmodel->saveMatrix4x4(this->getCutModel2Data(idc)->getCurrentMatrix()->GetMatrix()); - cutmodel->setCurrentShape(this->getCutModel2Data(idc)->getCurrentShape()); - } - - _undoredo.push_back(cutmodel); - - _currentaction++;// = _undoredo.size(); - //std::cout<<"current index "<<_currentaction; - - return cutmodel; -} - -int CutModel2Manager::Undo() throw( CutModel2Exception){ - //&& _currentaction < _undoredo.size() - if(_currentaction > 0){ - int tempaction = _currentaction-1; - CutModel2SaveBinInfo* currentundo = _undoredo[tempaction]; - CutModel2Data* currentmodel; - - if(currentundo->getActionType()==CUTMODEL2_CUT){ - //Undo the cut - vtkTransform* transform = currentundo->getTransformFromMatrixFile(); - - currentmodel = getCutModel2Data(currentundo->getId()); - - currentmodel->setTransform(transform, _img); - - currentmodel->setCurrentShape(currentundo->getCurrentShape()); - - currentmodel->ExecuteUnCut(currentundo->getIsInside(), _copyimg, _img); - - } - //Every thing ok - _currentaction--; - return 0; - } - return -1; -} - -int CutModel2Manager::Redo() throw( CutModel2Exception){ - - if(_currentaction >= 0 && _currentaction < _undoredo.size()){ - - - CutModel2SaveBinInfo* currentundo = _undoredo[_currentaction]; - CutModel2Data* currentmodel; - - if(currentundo->getActionType()==CUTMODEL2_CUT){ - //Redo the cut - vtkTransform* transform = currentundo->getTransformFromMatrixFile(); - currentmodel = getCutModel2Data(currentundo->getId()); - currentmodel->setTransform(transform, _copyimg); - currentmodel->setCurrentShape(currentundo->getCurrentShape()); - currentmodel->ExecuteCut(currentundo->getRange(), currentundo->getIsInside(), _copyimg); - } - - _currentaction++; - - return 0; - } - return -1; -} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Manager.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Manager.h deleted file mode 100644 index 23c6e67..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2Manager.h +++ /dev/null @@ -1,99 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2Manager.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - - -#ifndef __CutModel2ManagerH__ -#define __CutModel2ManagerH__ - -#include -#include -#include - -#include "vtkImageData.h" -#include "vtkRenderWindowInteractor.h" -#include "vtkRenderer.h" -#include - -#include "CutModel2Exception.h" -#include "CutModel2Data.h" -#include "CutModel2SaveBinInfo.h" - - - -class CutModel2Manager { - -public: - CutModel2Manager(std::string path); - ~CutModel2Manager(); - - void setImageData(vtkImageData* img); - - void setInteractor(vtkRenderWindowInteractor* interactor); - - void setRenderer(vtkRenderer* renderer); - - void onAddCutModel2(int id, vtkCommand* observer) throw( CutModel2Exception); - - double* getImageRange()throw( CutModel2Exception); - - void changeOpacity(int id,int opacity)throw( CutModel2Exception); - - void ShowViewBox(int id,bool check)throw( CutModel2Exception); - - void ChangeShape(int id,int selection)throw( CutModel2Exception); - - void changeColor(int id,double r,double g,double b)throw( CutModel2Exception); - - void updateActorDirection(int id)throw( CutModel2Exception); - - void RemoveActor(int id)throw( CutModel2Exception); - - void ExecuteCut(int id, double* range, bool isinside)throw( CutModel2Exception); - - vtkImageData* GetResultImage(); - - void RefreshActor(int id); - - void SaveCutModel2Data(std::string filename)throw( CutModel2Exception); - - void LoadCutModel2Data(std::string filename)throw( CutModel2Exception); - - CutModel2SaveBinInfo* AddActionUndo(int id, UNDOTYPE type)throw( CutModel2Exception); - - int Undo()throw( CutModel2Exception); - - int Redo()throw( CutModel2Exception); -private: - - int _currentaction; - - void checkInvariant() throw( CutModel2Exception); - std::string _path; - vtkImageData* _img; - vtkImageData* _copyimg; - vtkRenderer* _render; - vtkRenderWindowInteractor* _interactor; - - std::vector _vectordata; - std::vector _undoredo; - CutModel2Data* getCutModel2Data(int id)throw( CutModel2Exception); - -}; - -#endif diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2SaveBinInfo.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2SaveBinInfo.cxx deleted file mode 100644 index 64a2a4f..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2SaveBinInfo.cxx +++ /dev/null @@ -1,112 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2SaveBinInfo.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "CutModel2SaveBinInfo.h" - -/** -** Start of the manager class -**/ -CutModel2SaveBinInfo::CutModel2SaveBinInfo(int id, int currentaction, UNDOTYPE actiontype, std::string path){ - - _id = id; - - char c[100]; - sprintf(c,"/infounrd_%d_fig_%d.info",currentaction,id); - - _stdFilename = path; - _stdFilename+=c; - _stdFilename+=".poly"; - - _matrixFilename = path; - _matrixFilename+=c; - _actiontype = actiontype; - - -} -CutModel2SaveBinInfo::~CutModel2SaveBinInfo(){ - -} -void CutModel2SaveBinInfo::savePolyData(vtkPolyData* polydata){ - vtkPolyDataWriter * writer = vtkPolyDataWriter ::New(); - writer->SetFileName(_stdFilename.c_str()); - writer->SetInput(polydata); - writer->SetFileTypeToBinary(); - writer->Write(); - writer->Delete(); -} - -vtkTransform* CutModel2SaveBinInfo::getPolyDataTransform()throw( CutModel2Exception){ - vtkPolyDataReader* reader = vtkPolyDataReader::New(); - //std::cout<<"filename vtkTransform* CutModel2SaveBinInfo::getPolyDataTransform()"<getSTDFileName()<SetFileName(this->getSTDFileName().c_str()); - vtkPolyData* poly = reader->GetOutput(); - - vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); - mapper->SetInput(poly); - vtkActor* actor = vtkActor::New(); - actor->SetMapper(mapper); - vtkMatrix4x4* actmatrix = actor->GetMatrix(); - - std::cout<<"tkTransform* CutModel2SaveBinInfo::getPolyDataTransform() Actor "<Update(); - - vtkTransform* transform = vtkTransform::New(); - - transform->Identity(); - - transform->GetMatrix()->SetElement(0,0,actmatrix->GetElement(0,0)); - transform->GetMatrix()->SetElement(1,0,actmatrix->GetElement(1,0)); - transform->GetMatrix()->SetElement(2,0,actmatrix->GetElement(2,0)); - transform->GetMatrix()->SetElement(0,1,actmatrix->GetElement(0,1)); - transform->GetMatrix()->SetElement(1,1,actmatrix->GetElement(1,1)); - transform->GetMatrix()->SetElement(2,1,actmatrix->GetElement(2,1)); - transform->GetMatrix()->SetElement(0,2,actmatrix->GetElement(0,2)); - transform->GetMatrix()->SetElement(1,2,actmatrix->GetElement(1,2)); - transform->GetMatrix()->SetElement(2,2,actmatrix->GetElement(2,2)); - transform->GetMatrix()->SetElement(0,3,actmatrix->GetElement(0,3)); - transform->GetMatrix()->SetElement(1,3,actmatrix->GetElement(1,3)); - transform->GetMatrix()->SetElement(2,3,actmatrix->GetElement(2,3)); - - actor->Delete(); - mapper->Delete(); - reader->Delete(); - //poly->Delete(); - - - return transform; - -} - - -void CutModel2SaveBinInfo::saveMatrix4x4(vtkMatrix4x4* matrix){ - fstream binary_file(_matrixFilename.c_str(),ios::out|ios::binary); - binary_file.write(reinterpret_cast(matrix),sizeof(vtkMatrix4x4)); - binary_file.close(); -} -vtkTransform* CutModel2SaveBinInfo::getTransformFromMatrixFile()throw( CutModel2Exception){ - vtkMatrix4x4* matrix = vtkMatrix4x4::New(); - fstream binary_file(_matrixFilename.c_str(),ios::binary|ios::in); - binary_file.read(reinterpret_cast(matrix),sizeof(vtkMatrix4x4)); - binary_file.close(); - - vtkTransform* transform = vtkTransform::New(); - transform->SetMatrix(matrix); - - return transform; -} - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2SaveBinInfo.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2SaveBinInfo.h deleted file mode 100644 index 1a97dce..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModel2SaveBinInfo.h +++ /dev/null @@ -1,111 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModel2SaveBinInfo.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - - -#ifndef __CutModel2SaveBinInfoH__ -#define __CutModel2SaveBinInfoH__ - -#include -#include -#include "CutModel2Exception.h" - -#include -#include -#include -#include -#include -#include -#include - -enum UNDOTYPE -{ - CUTMODEL2_ADD = 0, - CUTMODEL2_REMOVE = 10, - CUTMODEL2_CUT= 20, - -}; - -class CutModel2SaveBinInfo { - -public: - - CutModel2SaveBinInfo(int id, int currentaction,UNDOTYPE actiontype, std::string path); - ~CutModel2SaveBinInfo(); - - int getId(){ - return _id; - } - - UNDOTYPE getActionType(){ - return _actiontype; - } - std::string getSTDFileName()throw( CutModel2Exception){ - if(_stdFilename==""){ - throw new CutModel2Exception("Filename undoredo does not exists"); - } - return _stdFilename; - } - - /*void setSTDFileName(std::string filename){ - _stdFilename = filename; - }*/ - - int getCurrentShape(){ - return _currentshape; - } - - void setCurrentShape(int currentshape){ - _currentshape=currentshape; - } - - void savePolyData(vtkPolyData* polydata); - - vtkTransform* getPolyDataTransform()throw( CutModel2Exception); - - void saveMatrix4x4(vtkMatrix4x4* matrix); - vtkTransform* getTransformFromMatrixFile()throw( CutModel2Exception); - - void setRange(double* range){ - _range = range; - } - void setIsInside(bool isinside){ - _isinside = isinside; - } - - double* getRange(){ - return _range; - } - bool getIsInside(){ - return _isinside; - } - -private: - - int _id; - UNDOTYPE _actiontype; - int _currentshape; - double* _range; - bool _isinside; - std::string _stdFilename; - std::string _matrixFilename; -}; - - - -#endif diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelData.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelData.cxx deleted file mode 100644 index f3dbdbd..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelData.cxx +++ /dev/null @@ -1,388 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelData.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "CutModelData.h" - -/** -** Start of the manager class -**/ -CutModelData::CutModelData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img){ - - initializeData(id, interactor, observer, img); - -} -CutModelData::CutModelData(){ - -} -void CutModelData::initializeData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img){ - _id = id; - _currentshape=0; - createBoxWidget(interactor, observer); - setTransform(img); - createActor(); - createShapes(); - ChangeShape(0); - checkInvariant(); -} -CutModelData::~CutModelData(){ - checkInvariant(); - _boxWidgetVolume->Off(); - _boxWidgetVolume->Delete(); - _Mapper->Delete(); - _Actor->Delete(); - delete _cubefigure; - delete _cylinderfigure; - delete _spherefigure; - currentmatrix->Delete(); - inversModel->Delete(); -} -void CutModelData::RefreshViewBox(){ - -} -void CutModelData::createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer){ - - _boxWidgetVolume = vtkBoxWidget::New(); - _boxWidgetVolume->SetInteractor( interactor ); - //_boxWidgetVolume->SetPlaceFactor(1); - //_boxWidgetVolume->SetInput( img ); - //_boxWidgetVolume->PlaceWidget(); - - _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent , observer ); - _boxWidgetVolume->AddObserver( vtkCommand::StartInteractionEvent , observer ); - _boxWidgetVolume->AddObserver( vtkCommand::RightButtonReleaseEvent , observer ); - - _boxWidgetVolume->HandlesOn (); - _boxWidgetVolume->On(); - //_boxWidgetVolume->GetHandleProperty()->SetOpacity(0.5); - //_boxWidgetVolume->GetOutlineProperty()->SetOpacity(0.5); -} -void CutModelData::setTransform(vtkImageData* img)throw( CutModelException){ - - currentmatrix = vtkTransform::New(); - modeltransform = vtkTransform::New(); - inversModel = vtkTransform::New(); - - vtkMatrix4x4* matrix = vtkMatrix4x4::New(); - matrix->Identity(); - int *ext = img->GetExtent(); - double *spc = img->GetSpacing(); - - - matrix->SetElement(0,0,(ext[1]-ext[0])/4*spc[0]); - matrix->SetElement(1,1,(ext[3]-ext[2])/4*spc[1]); - matrix->SetElement(2,2,(ext[5]-ext[4])/4*spc[2]); - - double orgx = (ext[1]-ext[0])/2*spc[0]; - double orgy = (ext[3]-ext[2])/2*spc[1]; - double orgz = (ext[5]-ext[4])/2*spc[2]; - - matrix->SetElement(0,3,orgx); - matrix->SetElement(1,3,orgy); - matrix->SetElement(2,3,orgz); - - - currentmatrix->SetMatrix(matrix); - _boxWidgetVolume->SetTransform(currentmatrix); - -} -void CutModelData::createActor(){ - - _Mapper = vtkPolyDataMapper::New(); - _Actor = vtkActor::New(); - _Actor->SetMapper(_Mapper); - _Actor->GetProperty()->SetColor(1, 0, 0); - _Actor->GetProperty()->SetOpacity(0.5); - -} -void CutModelData::udapteActorDirection()throw( CutModelException){ - checkInvariant(); - - _boxWidgetVolume->GetTransform(currentmatrix); - _Actor->SetUserMatrix(currentmatrix->GetMatrix());//SetUserTransform(currentmatrix ); -} -void CutModelData::createShapes(){ - _cubefigure = new CutModelFigureCube(); - _cylinderfigure = new CutModelFigureCylinder(); - _spherefigure = new CutModelFigureSphere(); -} -void CutModelData::changeOpacity(int opacity)throw( CutModelException){ - checkInvariant(); - _Actor->GetProperty()->SetOpacity((double)opacity/100.0); -} - -void CutModelData::ShowViewBox(bool check)throw( CutModelException){ - checkInvariant(); - if(check){ - _boxWidgetVolume->On(); - }else{ - _boxWidgetVolume->Off(); - } -} - -void CutModelData::ChangeShape(int selection)throw( CutModelException){ - checkInvariant(); - - if(selection == 0){ - _Mapper->SetInput(_spherefigure->getPolyData()); - }else if(selection == 1){ - _Mapper->SetInput(_cylinderfigure->getPolyData()); - }else if(selection == 2){ - _Mapper->SetInput(_cubefigure->getPolyData()); - }else{ - throw CutModelException("Shape type not found"); - } - - _currentshape=selection; -} - -void CutModelData::checkInvariant()throw( CutModelException){ - if(_boxWidgetVolume==NULL){ - throw CutModelException("Box Widget not created"); - } - if(_Mapper==NULL){ - throw CutModelException("Mapper not created"); - } - if(_Actor==NULL){ - throw CutModelException("Actor not created"); - } - if(_cubefigure==NULL){ - throw CutModelException("Cube not created"); - } - if(_cylinderfigure==NULL){ - throw CutModelException("Cylinder not created"); - } - if(_spherefigure==NULL){ - throw CutModelException("Sphere not created"); - } - -} - -vtkActor* CutModelData::getActor()throw( CutModelException){ - checkInvariant(); - return _Actor; -} - -void CutModelData::changeColor(double r,double g,double b)throw( CutModelException){ - checkInvariant(); - _Actor->GetProperty()->SetColor( r,g,b ); -} -CutModelFigure* CutModelData::getCurentCuttingModel(){ - checkInvariant(); - - if(_currentshape == 0){ - return _spherefigure; - }else if(_currentshape == 1){ - return _cylinderfigure; - }else if(_currentshape == 2){ - return _cubefigure; - }else{ - throw CutModelException("Shape type not found"); - } -} -void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException) -{ - - wxBusyCursor wait; - - CutModelFigure* actualCuttingModel = getCurentCuttingModel(); - - //_boxWidgetVolume->GetTransform(currentmatrix); - actualCuttingModel->SetVtkTransform(getModelTransform(copyimage)); - //actualCuttingModel->SetVtkTransform(currentmatrix); - actualCuttingModel->SetInversVtkTransform(getModelTransformInvers()); - - bool inside; - bool volInt, volExt; - int xx,yy,zz; - unsigned short* pOrg; - int ext[6]; - double spc[3]; - long int contAfter = 0; - long int contBefor = 0; - - double minvalue = range[0]; - double value = range[1]; - double maxvalue = range[2]; - - - copyimage->GetExtent(ext); - - for (xx=ext[0];xxIfPointInside(xx,yy,zz); - if ( ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) ) - { - pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz); - - //std::cout<<"xx,yy,zz "<SetVtkTransform(getModelTransform(copyimage)); - - actualCuttingModel->SetInversVtkTransform(getModelTransformInvers()); - - bool inside; - bool volInt, volExt; - int xx,yy,zz; - unsigned short* pOrg; - int ext[6]; - double spc[3]; - long int contAfter = 0; - long int contBefor = 0; - - double value; - - - - copyimage->GetExtent(ext); - - for (xx=ext[0];xxIfPointInside(xx,yy,zz); - if ( ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) ) - { - value = *((unsigned short*)image->GetScalarPointer (xx,yy,zz)); - pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz); - //std::cout<<"CutModelData::ExecuteUnCut() "<GetSpacing(); - modeltransform->Identity(); - - vtkMatrix4x4* matrix = currentmatrix->GetMatrix(); - vtkMatrix4x4* matrixmodel = modeltransform->GetMatrix(); - 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(0,1,matrix->GetElement(0,1)/spc[1]); - matrixmodel->SetElement(1,1,matrix->GetElement(1,1)/spc[1]); - matrixmodel->SetElement(2,1,matrix->GetElement(2,1)/spc[1]); - matrixmodel->SetElement(0,2,matrix->GetElement(0,2)/spc[2]); - matrixmodel->SetElement(1,2,matrix->GetElement(1,2)/spc[2]); - 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]); - - /* - - 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]); - - //double* orient = currentmatrix->GetOrientation(); - //modeltransform->RotateZ(orient[2]); - //modeltransform->RotateY(orient[1]); - //modeltransform->RotateX(orient[0]); - double* orient = currentmatrix->GetOrientationWXYZ(); - modeltransform->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]); - - */ - - - modeltransform->Update(); - - return modeltransform; - - -} -void CutModelData::setTransform(vtkTransform* transform, vtkImageData* img)throw( CutModelException){ - - - double *spc = img->GetSpacing(); - - currentmatrix->Identity(); - - /*double* orient = transform->GetOrientationWXYZ(); - currentmatrix->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]); - - double* pos = transform->GetPosition(); - currentmatrix->Translate(pos[0]/spc[0],pos[1]/spc[1],pos[2]/spc[2]); - - double* scal = transform->GetScale(); - currentmatrix->Scale(scal[0]/spc[0],scal[1]/spc[1],scal[2]/spc[2]); - - currentmatrix->Update(); */ - - _boxWidgetVolume->SetTransform(transform); - - /*vtkMatrix4x4* matrix = transform->GetMatrix(); - vtkMatrix4x4* matrixcurrent = currentmatrix->GetMatrix(); - matrixcurrent->SetElement(0,0,matrix->GetElement(0,0)/spc[0]); - matrixcurrent->SetElement(1,0,matrix->GetElement(1,0)/spc[0]); - matrixcurrent->SetElement(2,0,matrix->GetElement(2,0)/spc[0]); - matrixcurrent->SetElement(0,1,matrix->GetElement(0,1)/spc[1]); - matrixcurrent->SetElement(1,1,matrix->GetElement(1,1)/spc[1]); - matrixcurrent->SetElement(2,1,matrix->GetElement(2,1)/spc[1]); - matrixcurrent->SetElement(0,2,matrix->GetElement(0,2)/spc[2]); - matrixcurrent->SetElement(1,2,matrix->GetElement(1,2)/spc[2]); - matrixcurrent->SetElement(2,2,matrix->GetElement(2,2)/spc[2]); - matrixcurrent->SetElement(0,3,matrix->GetElement(0,3)/spc[0]); - matrixcurrent->SetElement(1,3,matrix->GetElement(1,3)/spc[1]); - matrixcurrent->SetElement(2,3,matrix->GetElement(2,3)/spc[2]); */ - - - udapteActorDirection(); - getModelTransform(img); - -} -vtkTransform* CutModelData::getModelTransformInvers(){ - inversModel->Identity (); - inversModel->Concatenate ( modeltransform ); - inversModel->Inverse(); - return inversModel; -} - -vtkPolyData* CutModelData::getPolyData()throw( CutModelException){ - return _Mapper->GetInput(); -} - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelData.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelData.h deleted file mode 100644 index f445719..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelData.h +++ /dev/null @@ -1,118 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelData.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - - -#ifndef __CutModelDataH__ -#define __CutModelDataH__ - -#include -#include - -#include "vtkImageData.h" -#include "vtkRenderWindowInteractor.h" -#include "vtkCommand.h" -#include "vtkBoxWidget.h" -#include "vtkPolyDataMapper.h" -#include "vtkActor.h" -#include "vtkProperty.h" -#include "CutModelException.h" -#include "CutModelFigure.h" -#include "CutModelFigureCube.h" -#include "CutModelFigureSphere.h" -#include "CutModelFigureCylinder.h" - -#include - -class CutModelData { - -public: - CutModelData(); - CutModelData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img); - ~CutModelData(); - void initializeData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img); - - - int getId(){ - return _id; - } - - void changeOpacity(int opacity)throw( CutModelException); - - void ShowViewBox(bool check)throw( CutModelException); - - void ChangeShape(int selection)throw( CutModelException); - - vtkActor* getActor()throw( CutModelException); - - vtkPolyData* getPolyData()throw( CutModelException); - - void changeColor(double r,double g,double b)throw( CutModelException); - - void udapteActorDirection()throw( CutModelException); - - void ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException); - - void ExecuteUnCut( bool isinside, vtkImageData* image, vtkImageData* copyimage)throw( CutModelException); - - void RefreshViewBox(); - - vtkTransform* getCurrentMatrix(){ - return currentmatrix; - } - - int getCurrentShape(){ - return _currentshape; - } - - void setCurrentShape(int currentshape){ - _currentshape = currentshape; - } - - void setTransform(vtkTransform* transform,vtkImageData* img)throw( CutModelException); -private: - - void checkInvariant()throw( CutModelException); - - void createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer); - void createActor(); - void setTransform(vtkImageData* img)throw( CutModelException); - void createShapes(); - - vtkBoxWidget* _boxWidgetVolume; - vtkPolyDataMapper* _Mapper; - vtkActor* _Actor; - int _id; - - int _currentshape; - - CutModelFigureCube* _cubefigure; - CutModelFigureCylinder* _cylinderfigure; - CutModelFigureSphere* _spherefigure; - vtkTransform* currentmatrix; - vtkTransform* modeltransform; - vtkTransform* inversModel; - - - CutModelFigure* getCurentCuttingModel(); - - vtkTransform* getModelTransform(vtkImageData* copyimage); - vtkTransform* getModelTransformInvers(); -}; - -#endif diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelException.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelException.cxx deleted file mode 100644 index 697ead4..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelException.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelException.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "CutModelException.h" - -/** -** Start of the manager class -**/ -CutModelException::CutModelException(std::string cause) -:std::exception(){ - _cause = cause; -} -CutModelException::~CutModelException()throw(){ -} - - - - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelException.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelException.h deleted file mode 100644 index 65517c2..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelException.h +++ /dev/null @@ -1,44 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelException.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - - -#ifndef __CutModelExceptionH__ -#define __CutModelExceptionH__ - -#include -#include - - -class CutModelException : public std::exception{ - -public: - CutModelException(std::string cause); - ~CutModelException() throw(); - - std::string getCause(){ - return _cause; - } - -private: - - std::string _cause; - -}; - -#endif diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigure.cxx__ b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigure.cxx__ deleted file mode 100644 index 6be77f5..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigure.cxx__ +++ /dev/null @@ -1,152 +0,0 @@ - -#include "CutModelFigure.h" - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -CutModelFigure::CutModelFigure() -{ - _inversModel = vtkTransform::New(); - _matrixModel = vtkTransform::New(); - _matrixVisual = vtkTransform::New(); - - _spcX=1; - _spcY=1; - _spcZ=1; -} -//---------------------------------------------------------------------------- -CutModelFigure::~CutModelFigure() // virtual -{ - _inversModel->Delete(); -} -//---------------------------------------------------------------------------- -void CutModelFigure::SetPosition(double x,double y, double z) -{ - _px=x; - _py=y; - _pz=z; -} -//---------------------------------------------------------------------------- -void CutModelFigure::SetScale(double sx,double sy, double sz) -{ - _sx=sx; - _sy=sy; - _sz=sz; -} -//---------------------------------------------------------------------------- -void CutModelFigure::SetRotation(double alfa,double beta, double teta) -{ - _alfa=alfa; - _beta=beta; - _teta=teta; -} - -//---------------------------------------------------------------------------- -void CutModelFigure::CalculeMatrix() -{ - _matrixModel->Identity(); - _matrixModel->Translate(_px,_py,_pz); - _matrixModel->RotateY(_beta); - _matrixModel->RotateX(_alfa); - _matrixModel->RotateY(_teta); - _matrixModel->Scale(_sx,_sy,_sz); - - _matrixVisual->Identity(); - _matrixVisual->Translate( _px*_spcX , _py*_spcY , _pz*_spcZ ); - _matrixVisual->RotateY(_beta); - _matrixVisual->RotateX(_alfa); - _matrixVisual->RotateY(_teta); - _matrixVisual->Scale( _sx*_spcX , _sy*_spcY , _sz*_spcZ ); - -} - - -//---------------------------------------------------------------------------- -void CutModelFigure::CalculeInversMatrix() -{ - _inversModel->Identity (); - _inversModel->Concatenate ( _matrixModel ); - _inversModel->Inverse(); -} -//---------------------------------------------------------------------------- -bool CutModelFigure::IfPointInside(double x, double y, double z) // virtual -{ - return true; -} - -//---------------------------------------------------------------------------- -vtkTransform *CutModelFigure::GetVtkTransform() -{ - return _matrixVisual; -} - -//---------------------------------------------------------------------------- -//void CutModelFigure::SetVtkTransform(vtkTransform *matrix) -//{ -// _matrixModel = matrix; -//} - -//---------------------------------------------------------------------------- -double CutModelFigure::GetTheoricVolume() // virtual -{ - return 0; -} - -//---------------------------------------------------------------------------- -double CutModelFigure::GetPositionX() -{ - return _px; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetPositionY() -{ - return _py; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetPositionZ() -{ - return _pz; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetScaleX() -{ - return _sx; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetScaleY() -{ - return _sy; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetScaleZ() -{ - return _sz; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetAngleAlfa() -{ - return _alfa; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetAngleBeta() -{ - return _beta; -} -//---------------------------------------------------------------------------- -double CutModelFigure::GetAngleTeta() -{ - return _teta; -} -//---------------------------------------------------------------------------- -char *CutModelFigure::GetName() // virtual -{ - return "--"; -} - -//---------------------------------------------------------------------------- -void CutModelFigure::SetSpacing(double spcX,double spcY, double spcZ) -{ - _spcX = spcX; - _spcY = spcY; - _spcZ = spcZ; -} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigure.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigure.h deleted file mode 100644 index 476a090..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigure.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef FIGURECUTTINGMODEL_H_ -#define FIGURECUTTINGMODEL_H_ - -#include "vtkTransform.h" -#include "vtkPolyData.h" - -class CutModelFigure -{ -public: - CutModelFigure(){} - - //~CutModelFigure(); - - virtual void SetPosition(double x,double y, double z){ - _px = x; - _py = y; - _pz = z; - } - - virtual void SetScale(double sx,double sy, double sz){ - _sx = sx; - _sy = sy; - _sz = sz; - } - - virtual void SetRotation(double alfa,double beta, double teta){ - _alfa = alfa; - _beta = beta; - _teta = teta; - } - - virtual void SetSpacing(double spcX,double spcY, double spcZ){ - _spcX = spcX; - _spcY = spcY; - _spcZ = spcZ; - } - - virtual void SetVtkTransform(vtkTransform *transform){ - double *orient = transform->GetOrientation(); - _alfa = orient[0]; - _beta = orient[1]; - _teta = orient[2]; - - double *scale = transform->GetScale(); - _sx = scale[0]; - _sy = scale[1]; - _sz = scale[2]; - - double *position = transform->GetPosition(); - _px = position[0]; - _py = position[1]; - _pz = position[2]; - - - } - virtual void SetInversVtkTransform(vtkTransform *inverstransform){ - _inversModel = inverstransform; - } - - virtual bool IfPointInside(double x, double y, double z) = 0; - virtual double GetTheoricVolume()=0; - virtual vtkPolyData* getPolyData()=0; - -private: - double _px; - double _py; - double _pz; - double _alfa; - double _beta; - double _teta; - double _spcX; - double _spcY; - double _spcZ; - char *GetName; -protected: - double _sx; - double _sy; - double _sz; - vtkTransform *_inversModel; - vtkTransform *_matrixModel; -}; - -#endif /*FIGURECUTTINGMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCube.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCube.cxx deleted file mode 100644 index 48b10a8..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCube.cxx +++ /dev/null @@ -1,52 +0,0 @@ - -#include "CutModelFigureCube.h" - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -CutModelFigureCube::CutModelFigureCube() -: CutModelFigure() -{ - _vtkcube = vtkCubeSource::New(); - _vtkcube->SetXLength (1); - _vtkcube->SetYLength (1); - _vtkcube->SetZLength (1); -} -//---------------------------------------------------------------------------- -CutModelFigureCube::~CutModelFigureCube() // virtual -{ - _vtkcube->Delete(); -} -//---------------------------------------------------------------------------- -bool CutModelFigureCube::IfPointInside(double x, double y, double z) // virtual -{ - double in[4],out[4]; - in[0]=x; - in[1]=y; - in[2]=z; - in[3]=1; - _inversModel->MultiplyPoint (in, out); - - bool result=false; - if ((out[0]>-0.5) && (out[0]<0.5) && (out[1]>-0.5) && (out[1]<0.5) && (out[2]>-0.5) && (out[2]<0.5) ) - { - result=true; - } - return result; -} -//---------------------------------------------------------------------------- -double CutModelFigureCube::GetTheoricVolume() // virtual -{ - return _sx * _sy * _sz; -} - -//---------------------------------------------------------------------------- -char *CutModelFigureCube::GetName() // virtual -{ - return "Cube"; -} - -vtkPolyData* CutModelFigureCube::getPolyData(){ - return _vtkcube->GetOutput(); -} - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCube.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCube.h deleted file mode 100644 index 31858cc..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCube.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef CutModelFigureCube_H_ -#define CutModelFigureCube_H_ - -#include "CutModelFigure.h" -#include "vtkCubeSource.h" - -class CutModelFigureCube : public CutModelFigure -{ -public: - CutModelFigureCube(); - virtual ~CutModelFigureCube(); - virtual bool IfPointInside(double x, double y, double z); - virtual double GetTheoricVolume(); - virtual vtkPolyData* getPolyData(); - virtual char *GetName(); -private: - vtkCubeSource* _vtkcube; -protected: -}; - -#endif /*FIGURECUTTINGCUBEMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCylinder.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCylinder.cxx deleted file mode 100644 index 4ef0a77..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCylinder.cxx +++ /dev/null @@ -1,45 +0,0 @@ - -#include "CutModelFigureCylinder.h" - -CutModelFigureCylinder::CutModelFigureCylinder() -{ - _vtkcylinder = vtkCylinderSource::New(); - _vtkcylinder->SetResolution(20); -} -//---------------------------------------------------------------------------- -CutModelFigureCylinder::~CutModelFigureCylinder() // virtual -{ - _vtkcylinder->Delete(); -} -//---------------------------------------------------------------------------- -bool CutModelFigureCylinder::IfPointInside(double x, double y, double z) // virtual -{ - double in[4],out[4]; - in[0]=x; - in[1]=y; - in[2]=z; - in[3]=1; - _inversModel->MultiplyPoint (in, out); - - bool result=false; - if ((sqrt( out[0]*out[0] + out[2]*out[2] )<0.5 ) && (out[1]>-0.5) && (out[1]<0.5) ) - { - result=true; - } - return result; -} -//---------------------------------------------------------------------------- -double CutModelFigureCylinder::GetTheoricVolume() // virtual -{ - double piTMP=3.14159265; - return piTMP*(_sx/2)*(_sz/2)*_sy; -} -//---------------------------------------------------------------------------- -char *CutModelFigureCylinder::GetName() // virtual -{ - return "Cylinder"; -} -vtkPolyData* CutModelFigureCylinder::getPolyData(){ - return _vtkcylinder->GetOutput(); -} -//---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCylinder.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCylinder.h deleted file mode 100644 index 410a4fa..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureCylinder.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef CutModelFigureCylinder_H_ -#define CutModelFigureCylinder_H_ - -#include "CutModelFigure.h" -#include "vtkCylinderSource.h" - -class CutModelFigureCylinder : public CutModelFigure -{ -public: - CutModelFigureCylinder(); - virtual ~CutModelFigureCylinder(); - virtual bool IfPointInside(double x, double y, double z); - virtual double GetTheoricVolume(); - virtual vtkPolyData* getPolyData(); - virtual char *GetName(); - -private: - vtkCylinderSource* _vtkcylinder; -protected: -}; - -#endif /*FIGURECUTTINGCYLINDERMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureSphere.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureSphere.cxx deleted file mode 100644 index a0e1ee5..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureSphere.cxx +++ /dev/null @@ -1,49 +0,0 @@ -#include "CutModelFigureSphere.h" - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -CutModelFigureSphere::CutModelFigureSphere() -{ - _vtksphere = vtkSphereSource::New(); - _vtksphere->SetThetaResolution (20); - _vtksphere->SetPhiResolution (20); -} -//---------------------------------------------------------------------------- -CutModelFigureSphere::~CutModelFigureSphere() // virtual -{ - _vtksphere->Delete(); -} -//---------------------------------------------------------------------------- -bool CutModelFigureSphere::IfPointInside(double x, double y, double z) // virtual -{ - double in[4],out[4]; - in[0]=x; - in[1]=y; - in[2]=z; - in[3]=1; - _inversModel->MultiplyPoint (in, out); - - bool result=false; - if (sqrt( out[0]*out[0] + out[1]*out[1] + out[2]*out[2] )<0.5 ) - { - result=true; - } - return result; -} -//---------------------------------------------------------------------------- -double CutModelFigureSphere::GetTheoricVolume() // virtual -{ - double piTMP=3.14159265; - return (4.0/3.0) * piTMP * (_sx/2)*(_sy/2)*(_sz/2); -} -//---------------------------------------------------------------------------- -char *CutModelFigureSphere::GetName() // virtual -{ - return "Sphere"; -} - -vtkPolyData* CutModelFigureSphere::getPolyData(){ - return _vtksphere->GetOutput(); -} - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureSphere.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureSphere.h deleted file mode 100644 index 4ce69c6..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelFigureSphere.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef CutModelFigureSphere_H_ -#define CutModelFigureSphere_H_ - -#include "CutModelFigure.h" -#include "vtkSphereSource.h" - -class CutModelFigureSphere : public CutModelFigure -{ -public: - CutModelFigureSphere(); - virtual ~CutModelFigureSphere(); - virtual bool IfPointInside(double x, double y, double z); - virtual double GetTheoricVolume(); - virtual char *GetName(); - virtual vtkPolyData* getPolyData(); -private: - vtkSphereSource* _vtksphere; -protected: -}; - -#endif /*FIGURECUTTINGSPHEREMODEL_H_*/ diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelManager.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelManager.cxx deleted file mode 100644 index 497f9b7..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelManager.cxx +++ /dev/null @@ -1,280 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelManager.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "CutModelManager.h" - -/** -** Start of the manager class -**/ -CutModelManager::CutModelManager(std::string path){ - _path = path; - _img = NULL; - _copyimg = NULL; - _interactor = NULL; - _render = NULL; - _currentaction=0; -} -CutModelManager::~CutModelManager(){ - std::string files = _path; - files+="/infounrd_0_fig_0.info"; - remove(files.c_str()); -} - - -void CutModelManager::setImageData(vtkImageData* img){ - _img = img; - if(_copyimg!=NULL){ - _copyimg->Delete(); - } - _copyimg = vtkImageData::New(); - _copyimg->SetExtent(_img->GetExtent()); - _copyimg->SetSpacing(_img->GetSpacing()); - _copyimg->AllocateScalars(); - - _copyimg->DeepCopy(_img); - -} - -void CutModelManager::setInteractor(vtkRenderWindowInteractor* interactor){ - _interactor = interactor; -} - -void CutModelManager::setRenderer(vtkRenderer* renderer){ - _render = renderer; -} - -void CutModelManager::onAddCutModel(int id, vtkCommand* observer) throw( CutModelException){ - checkInvariant(); - - CutModelData* data = new CutModelData(id,_interactor, observer, _img); - _vectordata.push_back(data); - - _render->AddActor(data->getActor()); - - //_render->UpdateCamera(); - _render->Render(); -} - -void CutModelManager::checkInvariant() throw( CutModelException){ - if(_img==NULL){ - throw CutModelException("The image is not set"); - } - if(_copyimg==NULL){ - throw CutModelException("The image is not set"); - } - if(_interactor==NULL){ - throw CutModelException("Interactor not set"); - } - if(_render==NULL){ - throw CutModelException("Render not set"); - } -} - -double* CutModelManager::getImageRange()throw( CutModelException){ - checkInvariant(); - return _img->GetScalarRange(); -} - -void CutModelManager::changeOpacity(int id,int opacity)throw( CutModelException){ - checkInvariant(); - CutModelData* current = getCutModelData(id); - current->changeOpacity(opacity); -} - -void CutModelManager::ShowViewBox(int id,bool check)throw( CutModelException){ - checkInvariant(); - CutModelData* current = getCutModelData(id); - current->ShowViewBox(check); -} - -void CutModelManager::ChangeShape(int id,int selection)throw( CutModelException){ - checkInvariant(); - CutModelData* current = getCutModelData(id); - current->ChangeShape(selection); - _render->Render(); -} - -CutModelData* CutModelManager::getCutModelData(int id)throw( CutModelException){ - - CutModelData* current = NULL; - for(int i= 0; i < _vectordata.size();i++){ - std::cout<<"id in CutModelManager:: "<getId()<getId()==id){ - current = _vectordata[i]; - } - } - if(current ==NULL){ - - throw CutModelException("Data not found"); - } - return current; -} - -void CutModelManager::updateActorDirection(int id)throw( CutModelException){ - checkInvariant(); - CutModelData* current = getCutModelData(id); - current->udapteActorDirection(); - -} - -void CutModelManager::changeColor(int id,double r,double g,double b)throw( CutModelException){ - - checkInvariant(); - CutModelData* current = getCutModelData(id); - current->changeColor(r,g,b); - _render->Render(); -} -void CutModelManager::RemoveActor(int id)throw( CutModelException){ - - checkInvariant(); - - CutModelData* current = getCutModelData(id); - for(int i = 0; i < _vectordata.size()-1;i++){ - if(_vectordata[i]->getId()==id){ - for(int j = i; j < _vectordata.size()-1;j++){ - _vectordata[j]=_vectordata[j+1]; - } - i = _vectordata.size(); - } - } - _render->RemoveActor(current->getActor()); - delete current; - _vectordata.pop_back(); - _render->Render(); - -} - -void CutModelManager::ExecuteCut(int id, double* range, bool isinside)throw( CutModelException){ - checkInvariant(); - - CutModelData* current = getCutModelData(id); - current->ExecuteCut(range, isinside,_copyimg); - - - /* - Setting extra information for the undo - */ - CutModelSaveBinInfo* undoaction = this->AddActionUndo(id, CUTMODEL_CUT); - undoaction->setRange(range); - undoaction->setIsInside(isinside); - -} - -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(); -} - -void CutModelManager::SaveCutModelData(std::string filename)throw( CutModelException){ - - - throw CutModelException("not implemented"); - - - - -} - - - -void CutModelManager::LoadCutModelData(std::string filename)throw( CutModelException){ - - throw CutModelException("not implemented"); - -} - -CutModelSaveBinInfo* CutModelManager::AddActionUndo(int idc, UNDOTYPE type)throw( CutModelException){ - - for(int i = _undoredo.size()-1; i > _currentaction;i--){ - delete _undoredo[i]; - _undoredo.pop_back(); - } - - CutModelSaveBinInfo* cutmodel = new CutModelSaveBinInfo(idc, _currentaction, type, _path); - if(type == CUTMODEL_CUT){ - cutmodel->saveMatrix4x4(this->getCutModelData(idc)->getCurrentMatrix()->GetMatrix()); - cutmodel->setCurrentShape(this->getCutModelData(idc)->getCurrentShape()); - } - - _undoredo.push_back(cutmodel); - - _currentaction++;// = _undoredo.size(); - //std::cout<<"current index "<<_currentaction; - - return cutmodel; -} - -int CutModelManager::Undo() throw( CutModelException){ - //&& _currentaction < _undoredo.size() - if(_currentaction > 0){ - int tempaction = _currentaction-1; - CutModelSaveBinInfo* currentundo = _undoredo[tempaction]; - CutModelData* currentmodel; - - if(currentundo->getActionType()==CUTMODEL_CUT){ - //Undo the cut - vtkTransform* transform = currentundo->getTransformFromMatrixFile(); - - currentmodel = getCutModelData(currentundo->getId()); - - currentmodel->setTransform(transform, _copyimg); - - currentmodel->setCurrentShape(currentundo->getCurrentShape()); - - currentmodel->ExecuteUnCut(currentundo->getIsInside(), _img, _copyimg); - - } - //Every thing ok - _currentaction--; - return 0; - } - return -1; -} - -int CutModelManager::Redo() throw( CutModelException){ - - if(_currentaction >= 0 && _currentaction < _undoredo.size()){ - - - CutModelSaveBinInfo* currentundo = _undoredo[_currentaction]; - CutModelData* currentmodel; - - if(currentundo->getActionType()==CUTMODEL_CUT){ - //Redo the cut - vtkTransform* transform = currentundo->getTransformFromMatrixFile(); - currentmodel = getCutModelData(currentundo->getId()); - currentmodel->setTransform(transform, _copyimg); - currentmodel->setCurrentShape(currentundo->getCurrentShape()); - currentmodel->ExecuteCut(currentundo->getRange(), currentundo->getIsInside(), _copyimg); - } - - _currentaction++; - - return 0; - } - return -1; -} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelManager.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelManager.h deleted file mode 100644 index 4fbc88e..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelManager.h +++ /dev/null @@ -1,99 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelManager.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - - -#ifndef __CutModelManagerH__ -#define __CutModelManagerH__ - -#include -#include -#include - -#include "vtkImageData.h" -#include "vtkRenderWindowInteractor.h" -#include "vtkRenderer.h" -#include - -#include "CutModelException.h" -#include "CutModelData.h" -#include "CutModelSaveBinInfo.h" - - - -class CutModelManager { - -public: - CutModelManager(std::string path); - ~CutModelManager(); - - void setImageData(vtkImageData* img); - - void setInteractor(vtkRenderWindowInteractor* interactor); - - void setRenderer(vtkRenderer* renderer); - - void onAddCutModel(int id, vtkCommand* observer) throw( CutModelException); - - double* getImageRange()throw( CutModelException); - - void changeOpacity(int id,int opacity)throw( CutModelException); - - void ShowViewBox(int id,bool check)throw( CutModelException); - - void ChangeShape(int id,int selection)throw( CutModelException); - - void changeColor(int id,double r,double g,double b)throw( CutModelException); - - void updateActorDirection(int id)throw( CutModelException); - - void RemoveActor(int id)throw( CutModelException); - - void ExecuteCut(int id, double* range, bool isinside)throw( CutModelException); - - vtkImageData* GetResultImage(); - - void RefreshActor(int id); - - void SaveCutModelData(std::string filename)throw( CutModelException); - - void LoadCutModelData(std::string filename)throw( CutModelException); - - CutModelSaveBinInfo* AddActionUndo(int id, UNDOTYPE type)throw( CutModelException); - - int Undo()throw( CutModelException); - - int Redo()throw( CutModelException); -private: - - int _currentaction; - - void checkInvariant() throw( CutModelException); - std::string _path; - vtkImageData* _img; - vtkImageData* _copyimg; - vtkRenderer* _render; - vtkRenderWindowInteractor* _interactor; - - std::vector _vectordata; - std::vector _undoredo; - CutModelData* getCutModelData(int id)throw( CutModelException); - -}; - -#endif diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelSaveBinInfo.cxx b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelSaveBinInfo.cxx deleted file mode 100644 index 2399b6f..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelSaveBinInfo.cxx +++ /dev/null @@ -1,112 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelSaveBinInfo.cxx,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "CutModelSaveBinInfo.h" - -/** -** Start of the manager class -**/ -CutModelSaveBinInfo::CutModelSaveBinInfo(int id, int currentaction, UNDOTYPE actiontype, std::string path){ - - _id = id; - - char c[100]; - sprintf(c,"/infounrd_%d_fig_%d.info",currentaction,id); - - _stdFilename = path; - _stdFilename+=c; - _stdFilename+=".poly"; - - _matrixFilename = path; - _matrixFilename+=c; - _actiontype = actiontype; - - -} -CutModelSaveBinInfo::~CutModelSaveBinInfo(){ - -} -void CutModelSaveBinInfo::savePolyData(vtkPolyData* polydata){ - vtkPolyDataWriter * writer = vtkPolyDataWriter ::New(); - writer->SetFileName(_stdFilename.c_str()); - writer->SetInput(polydata); - writer->SetFileTypeToBinary(); - writer->Write(); - writer->Delete(); -} - -vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()throw( CutModelException){ - vtkPolyDataReader* reader = vtkPolyDataReader::New(); - //std::cout<<"filename vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()"<getSTDFileName()<SetFileName(this->getSTDFileName().c_str()); - vtkPolyData* poly = reader->GetOutput(); - - vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); - mapper->SetInput(poly); - vtkActor* actor = vtkActor::New(); - actor->SetMapper(mapper); - vtkMatrix4x4* actmatrix = actor->GetMatrix(); - - std::cout<<"tkTransform* CutModelSaveBinInfo::getPolyDataTransform() Actor "<Update(); - - vtkTransform* transform = vtkTransform::New(); - - transform->Identity(); - - transform->GetMatrix()->SetElement(0,0,actmatrix->GetElement(0,0)); - transform->GetMatrix()->SetElement(1,0,actmatrix->GetElement(1,0)); - transform->GetMatrix()->SetElement(2,0,actmatrix->GetElement(2,0)); - transform->GetMatrix()->SetElement(0,1,actmatrix->GetElement(0,1)); - transform->GetMatrix()->SetElement(1,1,actmatrix->GetElement(1,1)); - transform->GetMatrix()->SetElement(2,1,actmatrix->GetElement(2,1)); - transform->GetMatrix()->SetElement(0,2,actmatrix->GetElement(0,2)); - transform->GetMatrix()->SetElement(1,2,actmatrix->GetElement(1,2)); - transform->GetMatrix()->SetElement(2,2,actmatrix->GetElement(2,2)); - transform->GetMatrix()->SetElement(0,3,actmatrix->GetElement(0,3)); - transform->GetMatrix()->SetElement(1,3,actmatrix->GetElement(1,3)); - transform->GetMatrix()->SetElement(2,3,actmatrix->GetElement(2,3)); - - actor->Delete(); - mapper->Delete(); - reader->Delete(); - //poly->Delete(); - - - return transform; - -} - - -void CutModelSaveBinInfo::saveMatrix4x4(vtkMatrix4x4* matrix){ - fstream binary_file(_matrixFilename.c_str(),ios::out|ios::binary); - binary_file.write(reinterpret_cast(matrix),sizeof(vtkMatrix4x4)); - binary_file.close(); -} -vtkTransform* CutModelSaveBinInfo::getTransformFromMatrixFile()throw( CutModelException){ - vtkMatrix4x4* matrix = vtkMatrix4x4::New(); - fstream binary_file(_matrixFilename.c_str(),ios::binary|ios::in); - binary_file.read(reinterpret_cast(matrix),sizeof(vtkMatrix4x4)); - binary_file.close(); - - vtkTransform* transform = vtkTransform::New(); - transform->SetMatrix(matrix); - - return transform; -} - diff --git a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelSaveBinInfo.h b/lib/maracasVisuLib/src/CutModule2/kernel/CutModelSaveBinInfo.h deleted file mode 100644 index 54000ce..0000000 --- a/lib/maracasVisuLib/src/CutModule2/kernel/CutModelSaveBinInfo.h +++ /dev/null @@ -1,111 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: CutModelSaveBinInfo.h,v $ - Language: C++ - Date: $Date: 2009/11/19 15:24:57 $ - Version: $Revision: 1.1 $ - - Copyright: (c) 2002, 2003 - License: - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - - - - -#ifndef __CutModelSaveBinInfoH__ -#define __CutModelSaveBinInfoH__ - -#include -#include -#include "CutModelException.h" - -#include -#include -#include -#include -#include -#include -#include - -enum UNDOTYPE -{ - CUTMODEL_ADD = 0, - CUTMODEL_REMOVE = 10, - CUTMODEL_CUT= 20, - -}; - -class CutModelSaveBinInfo { - -public: - - CutModelSaveBinInfo(int id, int currentaction,UNDOTYPE actiontype, std::string path); - ~CutModelSaveBinInfo(); - - int getId(){ - return _id; - } - - UNDOTYPE getActionType(){ - return _actiontype; - } - std::string getSTDFileName()throw( CutModelException){ - if(_stdFilename==""){ - throw new CutModelException("Filename undoredo does not exists"); - } - return _stdFilename; - } - - /*void setSTDFileName(std::string filename){ - _stdFilename = filename; - }*/ - - int getCurrentShape(){ - return _currentshape; - } - - void setCurrentShape(int currentshape){ - _currentshape=currentshape; - } - - void savePolyData(vtkPolyData* polydata); - - vtkTransform* getPolyDataTransform()throw( CutModelException); - - void saveMatrix4x4(vtkMatrix4x4* matrix); - vtkTransform* getTransformFromMatrixFile()throw( CutModelException); - - void setRange(double* range){ - _range = range; - } - void setIsInside(bool isinside){ - _isinside = isinside; - } - - double* getRange(){ - return _range; - } - bool getIsInside(){ - return _isinside; - } - -private: - - int _id; - UNDOTYPE _actiontype; - int _currentshape; - double* _range; - bool _isinside; - std::string _stdFilename; - std::string _matrixFilename; -}; - - - -#endif -- 2.45.1