]> Creatis software - creaMaracasVisu.git/commitdiff
*** empty log message ***
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Thu, 19 Nov 2009 15:50:32 +0000 (15:50 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Thu, 19 Nov 2009 15:50:32 +0000 (15:50 +0000)
23 files changed:
lib/maracasVisuLib/src/CutModule/CMakeLists.txt
lib/maracasVisuLib/src/CutModule/interface/CMakeLists.txt
lib/maracasVisuLib/src/CutModule/interface/CutModel2MainPanel.cxx [deleted file]
lib/maracasVisuLib/src/CutModule/interface/CutModel2MainPanel.h [deleted file]
lib/maracasVisuLib/src/CutModule/interface/CutModel2View.cxx [deleted file]
lib/maracasVisuLib/src/CutModule/interface/CutModel2View.h [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CMakeLists.txt
lib/maracasVisuLib/src/CutModule/kernel/CutModel2Data.cxx [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2Data.h [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2Exception.cxx [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2Exception.h [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2Figure.cxx__ [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2Figure.h [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureCube.cxx [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureCube.h [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureCylinder.cxx [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureCylinder.h [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureSphere.cxx [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureSphere.h [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2Manager.cxx [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2Manager.h [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2SaveBinInfo.cxx [deleted file]
lib/maracasVisuLib/src/CutModule/kernel/CutModel2SaveBinInfo.h [deleted file]

index cece67664cd6d910207b58f6f44ad83d6d8e085b..a52a32a5a92032a795b2febb484340c5353a3507 100644 (file)
@@ -2,7 +2,7 @@
 # SET THE NAME OF YOUR LIBRARY
 
 
-SET ( LIBRARY_NAME   creaMaracasVisu_CutModule2  )
+SET ( LIBRARY_NAME   creaMaracasVisu_CutModule  )
 #----------------------------------------------------------------------------
 
 #----------------------------------------------------------------------------
index 21c1ca20615ff5dbb49abad18e5bacda30a9dcba..2a594649b9ab794bba891ff55761ded0f2ccc627 100644 (file)
@@ -1,6 +1,6 @@
 #----------------------------------------------------------------------------
 # SET THE NAME OF YOUR LIBRARY
-SET ( LIBRARY_NAME   creaMaracasVisu_CutModule2_interface  )
+SET ( LIBRARY_NAME   creaMaracasVisu_CutModule_interface  )
 #----------------------------------------------------------------------------
 #----------------------------------------------------------------------------
 
diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModel2MainPanel.cxx b/lib/maracasVisuLib/src/CutModule/interface/CutModel2MainPanel.cxx
deleted file mode 100644 (file)
index a953a03..0000000
+++ /dev/null
@@ -1,378 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2MainPanel.cxx,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:32 $
-  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 <wx/colordlg.h>
-#include <wx/bmpbuttn.h>
-
-#include <Add.xpm>
-#include <Undo.xpm>
-#include <Redo.xpm>
-#include <OkAll.xpm>
-
-
-
-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/CutModule/interface/CutModel2MainPanel.h b/lib/maracasVisuLib/src/CutModule/interface/CutModel2MainPanel.h
deleted file mode 100644 (file)
index 589106a..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2MainPanel.h,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:32 $
-  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 <vector>
-#include <wx/wx.h>
-#include <wx/treebook.h>
-#include "wx/aui/aui.h"
-#include <wx/toolbar.h>
-#include <iostream>
-#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<CutModel2View*> 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/CutModule/interface/CutModel2View.cxx b/lib/maracasVisuLib/src/CutModule/interface/CutModel2View.cxx
deleted file mode 100644 (file)
index 7f636cb..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2View.cxx,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:32 $
-  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 <wx/colordlg.h>
-#include <wx/bmpbuttn.h>
-
-#include <OpenImage.xpm>
-#include <Color.xpm>
-#include <Ok1.xpm>
-#include <Statistics.xpm>
-
-#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<vtkBoxWidget*>(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:: "<<parent->getId()<<std::endl;
-       CutModel2MainPanel::getInstance()->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/CutModule/interface/CutModel2View.h b/lib/maracasVisuLib/src/CutModule/interface/CutModel2View.h
deleted file mode 100644 (file)
index 3acd567..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2View.h,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:32 $
-  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 <vector>
-#include <wx/wx.h>
-#include <wx/radiobut.h>
-#include "wx/aui/aui.h"
-#include <iostream>
-#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
-
index 1a4aecfe31ff8fcd78a5148923d179bc265858e7..96115d860915a1f57160791f5ec27f71812b5c51 100644 (file)
@@ -1,6 +1,6 @@
 #----------------------------------------------------------------------------
 # SET THE NAME OF YOUR LIBRARY
-SET ( LIBRARY_NAME   creaMaracasVisu_CutModule2_kernel  )
+SET ( LIBRARY_NAME   creaMaracasVisu_CutModule_kernel  )
 #----------------------------------------------------------------------------
 #----------------------------------------------------------------------------
 
diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModel2Data.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2Data.cxx
deleted file mode 100644 (file)
index a48ff5e..0000000
+++ /dev/null
@@ -1,388 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2Data.cxx,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:33 $
-  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];xx<ext[1]; xx++)
-       {
-               for (yy=ext[2];yy<ext[3]; yy++)
-               {
-                       for (zz=ext[4];zz<ext[5];zz++)
-                       {
-                               inside=actualCuttingModel->IfPointInside(xx,yy,zz);
-                               if (  ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) )
-                               {
-                                       pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz); 
-
-                                       //std::cout<<"xx,yy,zz "<<xx<<","<<yy<<","<<zz<<" "<<*pOrg<<std::endl;
-                                       if ((unsigned short)minvalue <=(*pOrg)&&(*pOrg)<=(unsigned short)maxvalue)
-                                       {       
-                                               
-                                               *pOrg=(unsigned short)value;
-                                               
-                                       }                                       
-                               } // if inside
-                       } // for zz
-               } // for yy
-       } // for xx
-       
-}
-
-void CutModel2Data::ExecuteUnCut(bool isinside, vtkImageData* image, vtkImageData* copyimage)throw( CutModel2Exception)
-{
-
-       wxBusyCursor wait;
-
-       CutModel2Figure* actualCuttingModel = getCurentCuttingModel();
-       
-       actualCuttingModel->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];xx<ext[1]; xx++)
-       {
-               for (yy=ext[2];yy<ext[3]; yy++)
-               {
-                       for (zz=ext[4];zz<ext[5];zz++)
-                       {
-                               inside=actualCuttingModel->IfPointInside(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() "<<value<<" "<<*pOrg<<std::endl;
-                                       *pOrg=(unsigned short)value;
-                               } // if inside
-                       } // for zz
-               } // for yy
-       } // for xx
-       
-}
-
-vtkTransform* CutModel2Data::getModelTransform(vtkImageData* copyimage){
-
-       double *spc = copyimage->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/CutModule/kernel/CutModel2Data.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2Data.h
deleted file mode 100644 (file)
index 40904e1..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2Data.h,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:33 $
-  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 <iostream>
-#include <vector>
-
-#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 <wx/utils.h>
-
-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/CutModule/kernel/CutModel2Exception.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2Exception.cxx
deleted file mode 100644 (file)
index b77dcab..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2Exception.cxx,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:33 $
-  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/CutModule/kernel/CutModel2Exception.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2Exception.h
deleted file mode 100644 (file)
index cf3ae14..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2Exception.h,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:33 $
-  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 <iostream>
-#include <vector>
-
-
-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/CutModule/kernel/CutModel2Figure.cxx__ b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2Figure.cxx__
deleted file mode 100644 (file)
index 6be77f5..0000000
+++ /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/CutModule/kernel/CutModel2Figure.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2Figure.h
deleted file mode 100644 (file)
index 82c5b8f..0000000
+++ /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/CutModule/kernel/CutModel2FigureCube.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureCube.cxx
deleted file mode 100644 (file)
index 53aa395..0000000
+++ /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/CutModule/kernel/CutModel2FigureCube.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureCube.h
deleted file mode 100644 (file)
index 8f23fc8..0000000
+++ /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/CutModule/kernel/CutModel2FigureCylinder.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureCylinder.cxx
deleted file mode 100644 (file)
index 21a746c..0000000
+++ /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/CutModule/kernel/CutModel2FigureCylinder.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureCylinder.h
deleted file mode 100644 (file)
index 2468984..0000000
+++ /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/CutModule/kernel/CutModel2FigureSphere.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureSphere.cxx
deleted file mode 100644 (file)
index 19d21de..0000000
+++ /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/CutModule/kernel/CutModel2FigureSphere.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureSphere.h
deleted file mode 100644 (file)
index f6cdff9..0000000
+++ /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/CutModule/kernel/CutModel2Manager.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2Manager.cxx
deleted file mode 100644 (file)
index e472bec..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2Manager.cxx,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:33 $
-  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:: "<<id<<std::endl;
-               std::cout<<"vectordataid in CutModel2Manager:: "<<_vectordata[i]->getId()<<std::endl;
-
-               if(_vectordata[i]->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/CutModule/kernel/CutModel2Manager.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2Manager.h
deleted file mode 100644 (file)
index e5c3f63..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2Manager.h,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:33 $
-  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 <iostream>
-#include <stdio.h>
-#include <vector>
-
-#include "vtkImageData.h"
-#include "vtkRenderWindowInteractor.h"
-#include "vtkRenderer.h"
-#include <vtkPolyDataWriter.h>
-
-#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<CutModel2Data*> _vectordata;
-       std::vector<CutModel2SaveBinInfo*> _undoredo;
-       CutModel2Data* getCutModel2Data(int id)throw( CutModel2Exception);
-       
-};
-
-#endif 
diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModel2SaveBinInfo.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2SaveBinInfo.cxx
deleted file mode 100644 (file)
index a5ce4cb..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2SaveBinInfo.cxx,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:33 $
-  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()"<<this->getSTDFileName()<<std::endl;
-       reader->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 "<<actor<<std::endl;
-       std::cout<<"tkTransform* CutModel2SaveBinInfo::getPolyDataTransform() Actor Matrix "<<actmatrix<<std::endl;
-
-       mapper->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<char *>(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<char *>(matrix),sizeof(vtkMatrix4x4));
-       binary_file.close();
-
-       vtkTransform* transform = vtkTransform::New();
-       transform->SetMatrix(matrix);
-
-       return transform;
-}
-
diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModel2SaveBinInfo.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModel2SaveBinInfo.h
deleted file mode 100644 (file)
index 06283ed..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*=========================================================================
-
-  Program:   wxMaracas
-  Module:    $RCSfile: CutModel2SaveBinInfo.h,v $
-  Language:  C++
-  Date:      $Date: 2009/11/19 15:00:33 $
-  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 <iostream>
-#include <vector>
-#include "CutModel2Exception.h"
-
-#include <vtkPolyData.h>
-#include <vtkPolyDataWriter.h>
-#include <vtkPolyDataReader.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkTransform.h>
-#include <vtkMatrix4x4.h>
-#include <vtkActor.h>
-
-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