From: Juan Prieto Date: Tue, 28 Jun 2011 16:39:47 +0000 (+0000) Subject: remove surface rendering files from folder X-Git-Tag: v1.0.4~93 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=907984518f52f5839509f70c7d861d3cf2b2c985;p=creaMaracasVisu.git remove surface rendering files from folder --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRendering.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRendering.cxx deleted file mode 100644 index 57beff0..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRendering.cxx +++ /dev/null @@ -1,295 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: wxMaracasSurfaceRendering.cxx,v $ - Language: C++ - Date: $Date: 2010/01/21 13:54:15 $ - Version: $Revision: 1.11 $ - - 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 "wxMaracasSurfaceRendering.h" -#include "wxMaracasSurfaceRenderingProp3DMHD.h" -#include "wxMaracasSurfaceRenderingProp3D.h" - -#include -#include - -#include -#include - -wxMaracasSurfaceRendering* wxMaracasSurfaceRendering::instance=NULL; - -wxMaracasSurfaceRendering::wxMaracasSurfaceRendering( wxWindow* parent,std::string path) -: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){ - - surrendmanager = new wxMaracasSurfaceRenderingManager(); - - wxauimanager = new wxAuiManager(this); - - _path = path; - - std::string iconsdir = path; - iconsdir+="/data/Icons"; - this->_toolb = new ToolBar(this,iconsdir); - - wxStaticText* txt = new wxStaticText(this, -1, wxString(_T(" Surface Rendering "))); - wxAuiPaneInfo paneinfo; - wxauimanager->AddPane(txt,paneinfo.ToolbarPane().Top()); - wxauimanager->AddPane(_toolb,paneinfo.ToolbarPane().Top()); - - wxauimanager->Update(); - createFileChooser(); -} -wxMaracasSurfaceRendering::~wxMaracasSurfaceRendering( ){ - delete _toolb; -} - -std::string wxMaracasSurfaceRendering::getPath(){ - return _path; -} - -void wxMaracasSurfaceRendering::createFileChooser(){ - -} - -wxMaracasSurfaceRendering* wxMaracasSurfaceRendering::getInstance(wxWindow* parent,std::string path){ - if(instance==NULL){ - instance = new wxMaracasSurfaceRendering(parent,path); - } - return instance; -} - -wxMaracasSurfaceRendering* wxMaracasSurfaceRendering::getInstance(){ - return instance; -} - -void wxMaracasSurfaceRendering::setRenderer(vtkRenderer* renderer){ - surrendmanager->setRenderer(renderer); -} - -void wxMaracasSurfaceRendering::setInteractor(vtkRenderWindowInteractor* interactor){ - surrendmanager->setInteractor(interactor); -} - -void wxMaracasSurfaceRendering::addRemoveActor(int propid, bool addremove){ - try{ - surrendmanager->addRemoveActor(propid, addremove); - } - catch(char* str){ - std::cout << "Exception : " << str << '\n'; - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR); - diag->ShowModal(); - delete diag; - } -} -void wxMaracasSurfaceRendering::addRemoveSurfaceBox(int propid, bool addremove){ - try{ - surrendmanager->addRemoveSurfaceBox(propid, addremove); - } - catch(char* str){ - std::cout << "Exception : " << str << '\n'; - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR); - diag->ShowModal(); - delete diag; - } -} - - -void wxMaracasSurfaceRendering::changeOpacity(int _propid, int value){ - try{ - surrendmanager->changeOpacity(_propid,value); - } - catch(char* str){ - std::cout << "Exception : " << str << '\n'; - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR); - diag->ShowModal(); - delete diag; - } -} - -void wxMaracasSurfaceRendering::changeIsoValue(int propid, double value){ - try{ - surrendmanager->changeIsoValue(propid, value); - } - catch(char* str){ - std::cout << "Exception : " << str << '\n'; - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR); - diag->ShowModal(); - delete diag; - } -} - -void wxMaracasSurfaceRendering::changeColor(int propid, double red, double green, double blue){ - try{ - surrendmanager->changeColor(propid, red, green, blue); - - }catch(char* str){ - - wxString s( str,wxConvUTF8 ); - wxMessageDialog* diag = new wxMessageDialog(this, s, s, wxICON_ERROR); - diag->ShowModal(); - delete diag; - } -} - -void wxMaracasSurfaceRendering::onLoadImageFile(){ - - wxString mhd(_T("mhd")); - wxString stl(_T("stl")); - - wxFileDialog* fildial = new wxFileDialog(this, wxString(_T("Select a STL file")),wxString(_T("")), - wxString(_T("")),wxString(_T("STL files (*.stl)|*.stl|MHD files (*.mhd)|*.mhd")) ); - - if(fildial->ShowModal()==wxID_OK){ - wxString filename = fildial->GetFilename(); - wxString pathfile(fildial->GetDirectory() + _T("/") + filename); - - if(filename.EndsWith(mhd)) - { - loadPropMHD(pathfile,filename); - } - else if(filename.EndsWith(stl)){ - loadProp3D(pathfile,filename); - } - } - delete fildial; -} - -void wxMaracasSurfaceRendering::loadPropMHD(wxString filename, wxString dataname){ - - std::string s = std::string(filename.mb_str()); - vtkImageData* img = surrendmanager->getImageData(s); - if(img!=NULL){ - s = std::string(dataname.mb_str()); - addPropMHD(img, s); - } -} - -void wxMaracasSurfaceRendering::addPropMHD(vtkImageData* imgdata, std::string dataname){ - try{ - int id = surrendmanager->addPropMHD(-1, imgdata,dataname); - if(id!=-1){ - - wxMaracasSurfaceRenderingPanel* controlpan = new wxMaracasSurfaceRenderingProp3DMHD(this, id, false, -1); - int maxiso = surrendmanager->getMaxIsoValue(id); - ((wxMaracasSurfaceRenderingProp3DMHD*)controlpan)->createControls(maxiso); - addSurfaceRenderingPanel(controlpan, dataname); - } - - }catch(char* str){ - - std::cout << "Exception : " << str << '\n'; - wxMessageDialog* diag = new wxMessageDialog(this, wxString( str,wxConvUTF8 ), wxString( str,wxConvUTF8 ), wxICON_ERROR); - diag->ShowModal(); - delete diag; - } -} - -void wxMaracasSurfaceRendering::loadProp3D(wxString filename, wxString dataname){ - std::string s = std::string(filename.mb_str()); - vtkProp3D* prop3D = surrendmanager->getProp3D(s); - if(prop3D != NULL){ - s = std::string(dataname.mb_str() ); - this->addProp3D(prop3D,s); - }else{ - //TODO msj to the user indicating error in file - } -} - -void wxMaracasSurfaceRendering::addProp3D(vtkProp3D* prop3D, std::string dataname){ - try{ - int id = surrendmanager->addProp3D(-1, prop3D,dataname); - if(id!=-1){ - wxMaracasSurfaceRenderingPanel* controlpan = new wxMaracasSurfaceRenderingProp3D(this, id, false, -1); - addSurfaceRenderingPanel(controlpan, dataname); - } - }catch(char* str){ - std::cout << "Exception : " << str << '\n'; - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR); - diag->ShowModal(); - delete diag; - } -} -void wxMaracasSurfaceRendering::addSurfaceRenderingPanel(wxMaracasSurfaceRenderingPanel* surrend, std::string dataname){ - - wxString s(dataname.c_str(),wxConvUTF8 ); - wxAuiPaneInfo paneinfo; - wxauimanager->AddPane(surrend, paneinfo.DefaultPane().Centre().DestroyOnClose().Caption(s)); - wxauimanager->Update(); -} - -void wxMaracasSurfaceRendering::deleteActor(int propid){ - try{ - surrendmanager->deleteActor(propid); - }catch(char* str){ - //CPR - std::cout << "Exception : " << str << '\n'; - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR); - diag->ShowModal(); - delete diag; - } -} - -bool wxMaracasSurfaceRendering::interactorSet(){ - return surrendmanager->interactorSet(); -} - -/** -** -**/ - -ToolBar::ToolBar(wxWindow * parent,std::string iconsdir) -: wxToolBar(parent, -1, wxDefaultPosition, wxDefaultSize) -{ - std::string iconfil = iconsdir; - - //iconfil+= "/OpenImage.png"; - //wxBitmap* bitmap0 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG); - wxBitmap bitmap0(OpenImage_xpm); - this->AddTool(1, wxString(_T("test")),bitmap0, NULL, wxITEM_NORMAL, wxString(_T("Open File"))); - - /*iconfil+= "/Open.png"; - wxBitmap* bitmap2 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG); - this->AddTool(2, wxString(_T("test")),*bitmap2); */ - - /*iconfil = iconsdir; - iconfil+= "/Open.png"; - wxBitmap* bitmap30 = new wxBitmap(wxString(iconfil.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG); - this->AddTool(30, wxString(_T("test")),*bitmap30);*/ - - this->Realize(); - - _evthand = new ToolBarEventHandler(); - this->SetEventHandler(_evthand); -} - -ToolBar::~ToolBar(void){ -} - -ToolBarEventHandler::ToolBarEventHandler() -: wxEvtHandler(){ -} - -ToolBarEventHandler::~ToolBarEventHandler(){ -} - -void ToolBarEventHandler::onLoadImageFile(wxCommandEvent& event){ - wxMaracasSurfaceRendering::getInstance()->onLoadImageFile(); -} - - -BEGIN_EVENT_TABLE(ToolBarEventHandler, wxEvtHandler) - EVT_MENU(1, ToolBarEventHandler::onLoadImageFile) -END_EVENT_TABLE() - - diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRendering.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRendering.h deleted file mode 100644 index 3aec4f7..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRendering.h +++ /dev/null @@ -1,112 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: wxMaracasSurfaceRendering.h,v $ - Language: C++ - Date: $Date: 2010/01/22 17:00:52 $ - Version: $Revision: 1.5 $ - - 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 __wxMaracasSurfaceRenderingPanelH__ -#define __wxMaracasSurfaceRenderingPanelH__ - -#include -#include -#include "wx/aui/aui.h" -#include -#include "marTypes.h" -#include "vtkProp3D.h" - -#include "wxMaracasSurfaceRenderingManager.h" -#include "wxMaracasSurfaceRenderingPanel.h" - -class creaMaracasVisu_EXPORT wxMaracasSurfaceRendering : public wxPanel -{ - -public: - wxMaracasSurfaceRendering( wxWindow* parent, std::string path); - ~wxMaracasSurfaceRendering( ); - - static wxMaracasSurfaceRendering* getInstance(wxWindow* parent,std::string path=""); - - static wxMaracasSurfaceRendering* getInstance(); - - void setRenderer(vtkRenderer* renderer); - - void setInteractor(vtkRenderWindowInteractor* interactor); - - void changeOpacity(int propid, int value); - - void changeIsoValue(int propid, double value); - - void addRemoveActor(int propid, bool addremove); - - void addRemoveSurfaceBox(int propid, bool addremove); - - void changeColor(int propid, double red, double green, double blue); - - void addProp3D(vtkProp3D* prop3D, std::string dataname=""); - - void addPropMHD(vtkImageData* imgdata, std::string dataname=""); - - void loadProp3D(wxString filename, wxString dataname); - - void loadPropMHD(wxString filename, wxString dataname); - - void onLoadImageFile(); - - void addSurfaceRenderingPanel(wxMaracasSurfaceRenderingPanel* surrend, std::string dataname=""); - - std::string getPath(); - - void deleteActor(int propid); - - bool interactorSet(); - -private: - static wxMaracasSurfaceRendering* instance; - - wxMaracasSurfaceRenderingManager* surrendmanager; - - wxAuiManager* wxauimanager; - - wxToolBar* _toolb; - - std::string _path; - - void createFileChooser(); -}; - -class ToolBarEventHandler : public wxEvtHandler{ - - public: - ToolBarEventHandler(); - ~ToolBarEventHandler(); - - void onLoadImageFile(wxCommandEvent& event); - - private: - - DECLARE_EVENT_TABLE() - }; - -class ToolBar : public wxToolBar{ - -public: - ToolBar(wxWindow * parent,std::string iconsdir); - ~ToolBar(void); - -private: - - ToolBarEventHandler* _evthand; -}; - -#endif diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManager.cxx deleted file mode 100644 index e43f19e..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManager.cxx +++ /dev/null @@ -1,271 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: wxMaracasSurfaceRenderingManager.cxx,v $ - Language: C++ - Date: $Date: 2010/01/21 13:54:15 $ - Version: $Revision: 1.7 $ - - 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 "wxMaracasSurfaceRenderingManager.h" -#include "wxMaracasSurfaceRenderingManagerDataMhd.h" - -/** -** Start of the manager class -**/ -wxMaracasSurfaceRenderingManager::wxMaracasSurfaceRenderingManager(){ - _renderer = NULL; - _interactor = NULL; - _idCount=0; -} -wxMaracasSurfaceRenderingManager::~wxMaracasSurfaceRenderingManager(){ -} - -/** -** Sets the renderer to manage the prop3D from the surface render -**/ -void wxMaracasSurfaceRenderingManager::setRenderer(vtkRenderer* renderer){ - _renderer = renderer; -} - -/** -** Sets the renderer to manage the prop3D from the surface render -**/ -void wxMaracasSurfaceRenderingManager::setInteractor(vtkRenderWindowInteractor* interactor){ - _interactor = interactor; -} - - -/** -** Gets the renderer to manage the prop3D from the surface render -**/ -vtkRenderer* wxMaracasSurfaceRenderingManager::getRenderer(){ - return _renderer; -} - -/** -** Updates volume -**/ -void wxMaracasSurfaceRenderingManager::Update(int pid)throw(char*){ - wxMaracasSurfaceRenderingManagerData* data = this->getViewData(pid); - ((wxMaracasSurfaceRenderingManagerDataMhd*)data)->UpdateSurface(); - _renderer->Render(); -} - -/** -** Adds a prop3D to the manager and returns the identifier -**/ -int wxMaracasSurfaceRenderingManager::addProp3D(int idTP, vtkProp3D* prop3D, std::string dataname) throw(char*){ - checkInvariant(); - if(prop3D != NULL){ - wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerData(prop3D, dataname, _interactor); - prop3Dvect.push_back(data); - _renderer->AddActor(data->getProp3D()); - if(idTP == -1) - { - data->setId(_idCount); - _idCount++; - } - else - { - data->setId(idTP); - } - return data->getId(); - }else{ - throw "Check vtkProp3D file or input"; - } - return -1; -} -int wxMaracasSurfaceRenderingManager::addPropMHD(int idTP, vtkImageData* imagedata, std::string dataname) throw(char*){ - checkInvariant(); - if(imagedata != NULL){ - image = imagedata; - wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerDataMhd(imagedata, dataname, _interactor); - prop3Dvect.push_back(data); - _renderer->AddActor(data->getProp3D()); - if(idTP == -1) - { - data->setId(_idCount); - _idCount++; - } - else - { - data->setId(idTP); - } - printf("wxMaracasSurfaceRenderingManager::addPropMHD->idSurfaceRender: %i\n", data->getId()); - return data->getId(); - }else{ - throw "Check ImageData file or input"; - } - return -1; -} -/** -** adds or removes an actor depending of the bool value -**/ -void wxMaracasSurfaceRenderingManager::addRemoveActor(int propid, bool addremove) throw(char*){ - checkInvariant(); - - wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid); - if(data->getProp3D()!=NULL){ - if(addremove){ - _renderer->AddViewProp(data->getProp3D()); - }else{ - _renderer->RemoveViewProp(data->getProp3D()); - } - _renderer->Render(); - } -} -/** -** adds or removes the surface box depending of the bool value -**/ -void wxMaracasSurfaceRenderingManager::addRemoveSurfaceBox(int propid, bool addremove) throw(char*){ - checkInvariant(); - - wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid); - if(data->getProp3D()!=NULL){ - data->addRemoveSurfaceBox(addremove); - /*if(addremove){ - data-> - _renderer->AddViewProp(data->getProp3D()); - }else{ - _renderer->RemoveViewProp(data->getProp3D()); - } - _renderer->Render();*/ - } - -} - -/** -** Changes the opacity in a prop3D -**/ -void wxMaracasSurfaceRenderingManager::changeOpacity(int propid, int value) throw(char*){ - checkInvariant(); - - - this->getViewData(propid)->changeOpacity(value); - - _renderer->Render(); - -} - -/** -** changes the isovalue in a prop3D -**/ -void wxMaracasSurfaceRenderingManager::changeIsoValue(int propid, double value )throw(char*){ - checkInvariant(); - - wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid); - - //_renderer->RemoveActor(data->getProp3D()); - ((wxMaracasSurfaceRenderingManagerDataMhd*)data)->changeIsoValue(value); - //_renderer->AddActor(data->getProp3D()); - - _renderer->Render(); -} - -vtkProp3D* wxMaracasSurfaceRenderingManager:: getProp3D(std::string filename){ - if(filename.compare("")!= 0){ - vtkSTLReader *STLReader=vtkSTLReader::New(); - STLReader->SetFileName(filename.c_str()); - STLReader->Update(); - vtkPolyDataMapper* dataMapper = vtkPolyDataMapper::New(); - dataMapper->SetInput(STLReader->GetOutput()); - - vtkActor* dataActor = vtkActor::New(); - dataActor->SetMapper(dataMapper); - dataActor->GetProperty()->SetOpacity(1); - - return dataActor; - } - return NULL; -} - -vtkImageData* wxMaracasSurfaceRenderingManager::getImageData(std::string filename){ - if(filename.compare("")!= 0){ - - vtkMetaImageReader* reader = vtkMetaImageReader::New(); - reader->SetFileName(filename.c_str()); - reader->Update(); - vtkImageData* img = reader->GetOutput(); - //reader->Delete(); - return img; - } - return NULL; -} - -vtkImageData* wxMaracasSurfaceRenderingManager::getImageData(){ - return image; -} - -void wxMaracasSurfaceRenderingManager::checkInvariant() throw(char*){ - if(this->_renderer==NULL){ - throw "Renderer not set"; - } -} - -wxMaracasSurfaceRenderingManagerData* wxMaracasSurfaceRenderingManager::getViewData(int id) throw(char*){ - int i; - for(i = 0; i < (int)(prop3Dvect.size());i++){ - if(prop3Dvect[i]->getId() == id){ - return prop3Dvect[i]; - } - } - throw "id not found in the data"; - - return NULL; -} - -int wxMaracasSurfaceRenderingManager::getMaxIsoValue(int propid) throw(char*){ - - return ((wxMaracasSurfaceRenderingManagerDataMhd*)this->getViewData(propid))->getMaxGreyLevel(); - -} - -void wxMaracasSurfaceRenderingManager::changeColor(int propid, double red, double green, double blue) throw(char*){ - checkInvariant(); - this->getViewData(propid)->changeColor(red, green, blue); - - _renderer->Render(); -} - -void wxMaracasSurfaceRenderingManager::deleteActor(int propid) throw (char *){ - checkInvariant(); - - this->addRemoveActor(propid, false); - - int i,n; - bool exit = false; - for(i = 0; i < (int)(prop3Dvect.size())&&!exit;i++){ - if(prop3Dvect[i]->getId() == propid){ - n=i; - exit = true; - } - } - if(exit){ - wxMaracasSurfaceRenderingManagerData* data = prop3Dvect[n]; - int j; - for(j = i; j < (int)(prop3Dvect.size())-1;j++){ - prop3Dvect[j] = prop3Dvect[j+1]; - } - delete data; - prop3Dvect.pop_back(); - }else{ - - throw "id not found in the data"; - } -} - -void wxMaracasSurfaceRenderingManager::Transform(vtkMatrix4x4* tmatrix){ - -} - -bool wxMaracasSurfaceRenderingManager::interactorSet(){ - return _interactor? true:false; -} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManager.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManager.h deleted file mode 100644 index 916b785..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManager.h +++ /dev/null @@ -1,140 +0,0 @@ -/*========================================================================= - - Program: wxMaracas - Module: $RCSfile: wxMaracasSurfaceRenderingManager.h,v $ - Language: C++ - Date: $Date: 2010/01/21 13:54:15 $ - Version: $Revision: 1.5 $ - - 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 __wxMaracasSurfaceRenderingManagerH__ -#define __wxMaracasSurfaceRenderingManagerH__ - -#include -#include -#include - -#include "wxMaracasSurfaceRenderingManagerData.h" - - -class wxMaracasSurfaceRenderingManager { - -public: - wxMaracasSurfaceRenderingManager(); - ~wxMaracasSurfaceRenderingManager(); - - /** - ** Sets the renderer to manage the prop3D from the surface render - **/ - void setRenderer(vtkRenderer* renderer); - - /** - ** Gets the renderer which manages the prop3D from the surface render - **/ - vtkRenderer* getRenderer(); - - /** - ** Updates surface - **/ - void Update(int pid)throw(char*); - - /** - ** Adds a prop3D to the manager and returns the identifier - **/ - int addProp3D(int idTP, vtkProp3D* prop3D, std::string dataname) throw (char*); - /** - ** Adds a prop3D to the manager and returns the identifier - **/ - int addPropMHD(int idTP, vtkImageData* imagedata, std::string dataname) throw(char*); - /** - ** Changes the opacity in a prop3D - **/ - void changeOpacity(int propid, int value)throw(char*); - - /** - ** changes the isovalue in a prop3D - **/ - void changeIsoValue(int propid, double value)throw(char*); - - /** - ** loads a prop3D from a nSTL file - **/ - vtkProp3D* getProp3D(std::string filename); - - /** - ** loads a MHD file to convert it into an actor - **/ - vtkImageData* getImageData(std::string filename); - - /** - ** Gets image data asotiated with the rendering manager - **/ - vtkImageData* getImageData(); - - /** - ** adds or removes an actor depending of the bool value - **/ - void addRemoveActor(int propid, bool addremove)throw(char*); - /** - ** - **/ - void addRemoveSurfaceBox(int propid, bool addremove) throw(char*); - /** - ** Check if the variables are setted correctly - **/ - - void checkInvariant()throw(char*); - - /** - ** Given an id search the data in the vector - **/ - wxMaracasSurfaceRenderingManagerData* getViewData(int id)throw(char*); - - /** - ** - **/ - void setInteractor(vtkRenderWindowInteractor* interactor); - - /** - ** Given the id, return the max iso value from the imagedata - **/ - int getMaxIsoValue(int propid)throw(char*); - - - /** - ** Changes the color of the actor - **/ - void changeColor(int propid, double red, double green, double blue) throw(char*); - - void deleteActor(int propid)throw (char *); - - void Transform(vtkMatrix4x4* tmatrix); - - bool interactorSet(); - -private: - std::vector prop3Dvect; - - vtkRenderer* _renderer; - vtkRenderWindowInteractor* _interactor; - vtkImageData* image; - - int _idCount; - - - - -}; - -#endif diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerData.cxx deleted file mode 100644 index 75ef800..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerData.cxx +++ /dev/null @@ -1,108 +0,0 @@ - -#include "wxMaracasSurfaceRenderingManagerData.h" - -/******************************************************************************************** -** Start of data viewmanagerData -*********************************************************************************************/ - -wxMaracasSurfaceRenderingManagerData::wxMaracasSurfaceRenderingManagerData(vtkProp3D* prop3Dvect, std::string dataname, vtkRenderWindowInteractor* interactor){ - - _prop3D = prop3Dvect; - _dataname = dataname; - _boxWidgetS1=NULL; - - initializeBoxWidget(interactor); - - - - - /*_boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(0) ); - _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(1) ); - _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(2) ); - _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(3) );*/ -} - - -wxMaracasSurfaceRenderingManagerData::~wxMaracasSurfaceRenderingManagerData(){ - - _prop3D->Delete(); - if (_boxWidgetS1!=NULL) { _boxWidgetS1 -> Delete(); } -} - -void wxMaracasSurfaceRenderingManagerData::initializeBoxWidget(vtkRenderWindowInteractor* interactor){ - if(interactor!= NULL){ - - } -} - -/** -** Adds a prop3D to the world of the application -**/ -void wxMaracasSurfaceRenderingManagerData::setProp3D(vtkProp3D* prop3D){ - _prop3D = prop3D; -} - -void wxMaracasSurfaceRenderingManagerData::addRemoveSurfaceBox(bool visible) -{ - if(_boxWidgetS1){ - if (visible==true){ - _boxWidgetS1->On(); - } else { - _boxWidgetS1->Off(); - } - } -} -/** -** Changes the opacity in a prop3D -**/ -void wxMaracasSurfaceRenderingManagerData::changeOpacity(int value){ - std::cout<<"chage op"<_prop3D; - actor->GetProperty()->SetOpacity((double)value/100.0); - - - -} -void wxMaracasSurfaceRenderingManagerData::changeColor(double red, double green, double blue){ - std::cout<<"chage col"<_prop3D; - actor->GetProperty()->SetColor(red,green,blue); -} -/** -** Check if the variables are setted correctly -**/ -void wxMaracasSurfaceRenderingManagerData::checkInvariant(){ - -} -/** -** get the prop3D -**/ -vtkProp3D* wxMaracasSurfaceRenderingManagerData::getProp3D(){ - return this->_prop3D; -} -/** -** return the id from the daat -**/ -int wxMaracasSurfaceRenderingManagerData::getId(){ - return _id; -} -/** -** set data id -**/ -void wxMaracasSurfaceRenderingManagerData::setId(int propid){ - _id = propid; -} - -/** -** Get the filanme -**/ -std::string wxMaracasSurfaceRenderingManagerData::getDataname(){ - return _dataname; -} -/** -** Set the filanme -**/ -void wxMaracasSurfaceRenderingManagerData::setDataname(std::string dataname){ - _dataname = dataname; -} - diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerData.h deleted file mode 100644 index e0249ad..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerData.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef WXMARACASSURFACERENDERINGMANAGERDATA_H_ -#define WXMARACASSURFACERENDERINGMANAGERDATA_H_ - -#include "vtkProp3D.h" -#include "vtkRenderer.h" -#include "vtkSTLReader.h" -#include "vtkPolyDataMapper.h" -#include "vtkActor.h" -#include "vtkProperty.h" -#include "vtkBoxWidget.h" - - - -class wxMaracasSurfaceRenderingManagerData { - -public: - wxMaracasSurfaceRenderingManagerData(vtkProp3D* _prop3Dvect, std::string dataname="", vtkRenderWindowInteractor* interactor=NULL); - ~wxMaracasSurfaceRenderingManagerData(); - - /** - ** Adds a prop3D to the world of the application - **/ - void setProp3D(vtkProp3D* prop3D); - /** - ** Changes the opacity in a prop3D - **/ - void changeOpacity(int value); - /** - ** Check if the variables are setted correctly - **/ - void checkInvariant(); - /** - ** get the prop3D - **/ - vtkProp3D* getProp3D(); - /** - ** return the id from the daat - **/ - int getId(); - /** - ** set data id - **/ - void setId(int propid); - /** - ** Get the filanme - **/ - std::string getDataname(); - /** - ** Set the filanme - **/ - void setDataname(std::string dataname); - - /** - ** creates the image - **/ - void contourExtractor(int isovalue); - - /** - ** Changes the color of the actor - **/ - void changeColor(double red, double green, double blue); - - /** - ** adds or removes the surface box - **/ - void addRemoveSurfaceBox(bool visible); - - void initializeBoxWidget(vtkRenderWindowInteractor* interactor); -protected: - /** - * Prop 3D (data actor) - */ - vtkProp3D* _prop3D; - /** - * Dataname given by the user (ex. filename) - **/ - std::string _dataname; - - /** - ** - **/ - vtkBoxWidget* _boxWidgetS1; -private: - - /* - * id of the data - */ - int _id; - - - - -}; - -#endif /*WXMARACASSURFACERENDERINGMANAGERDATA_H_*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerDataMhd.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerDataMhd.cxx deleted file mode 100644 index eb991c0..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerDataMhd.cxx +++ /dev/null @@ -1,151 +0,0 @@ - -#include "wxMaracasSurfaceRenderingManagerDataMhd.h" - -#include "vtkStripper.h" - -wxMaracasSurfaceRenderingManagerDataMhd::wxMaracasSurfaceRenderingManagerDataMhd(vtkImageData* imagedata, std::string dataname, vtkRenderWindowInteractor* interactor) -: wxMaracasSurfaceRenderingManagerData(NULL, dataname) -{ - - this->setVtkImageData(imagedata); - _dataname = dataname; - - _maxgreylevel = getMaxLevel(imagedata); - _prop3D=NULL; - - _cubesFilter = vtkMarchingCubes::New(); - _cubesFilter->SetInput(this->_imagedata); - _cubesFilter->ComputeGradientsOn (); - _cubesFilter->ComputeScalarsOn (); - _cubesFilter->SetNumberOfContours( 1 ); - _cleanFilter = vtkCleanPolyData::New(); - _cleanFilter->SetInput ( _cubesFilter->GetOutput() ); - - _dataMapper = vtkPolyDataMapper::New( ); - _dataMapper->ScalarVisibilityOff( ); - _dataMapper->ImmediateModeRenderingOn(); - vtkActor* dataActor = vtkActor::New(); - - //if(_boxWidgetS1){ - if(interactor){ - - _boxWidgetS1 = vtkBoxWidget::New(); - _boxWidgetS1->SetInteractor( interactor ); - _boxWidgetS1->SetPlaceFactor(1.25); - - _boxWidgetS1->SetInput( this->_imagedata ); - _boxWidgetS1->PlaceWidget(); - boxSurfaceObserver* observer = boxSurfaceObserver::New(); - - vtkStripper* striper = vtkStripper::New(); - striper->SetInput( _cleanFilter->GetOutput() ); - //striper->SetInput( _cubesFilter->GetOutput() ); - - striper->Update(); - _boxWidgetS1->SetInput(striper->GetOutput()); - _boxWidgetS1->PlaceWidget(); - - _boxWidgetS1->HandlesOn (); - _boxWidgetS1->On(); - - _tissuePlanes = vtkPlanes::New(); - - int x1,x2,y1,y2,z1,z2; - this->_imagedata->GetExtent(x1,x2,y1,y2,z1,z2); - _tissuePlanes->SetBounds (x1,x2,y1,y2,z1,z2); - - - - _boxWidgetS1->GetPlanes( _tissuePlanes ); - - _tissueClipper = vtkClipPolyData::New(); - _tissueClipper->SetInput( striper->GetOutput() ); - _tissueClipper->SetClipFunction( _tissuePlanes ); - _tissueClipper->InsideOutOn( ); - _dataMapper->SetInput( _tissueClipper->GetOutput() ); - observer->SetPlanes( _tissuePlanes ); - observer->SetActor( dataActor ); - _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , observer ); - - - _boxWidgetS1->HandlesOn (); - _boxWidgetS1->On(); - }else{ - _dataMapper->SetInput(_cleanFilter->GetOutput()); - } - - dataActor->SetMapper(_dataMapper); - this->_prop3D = dataActor; - - - - - this->changeIsoValue(this->_maxgreylevel); - - -} - - -wxMaracasSurfaceRenderingManagerDataMhd::~wxMaracasSurfaceRenderingManagerDataMhd() -{ - _cubesFilter->Delete(); - _cleanFilter->Delete(); - _dataMapper->Delete(); -} - -void wxMaracasSurfaceRenderingManagerDataMhd::UpdateSurface() -{ - _cubesFilter->Update(); - _cleanFilter->Update(); - _dataMapper->Update(); -} -/** -** changes the isovalue in a prop3D -**/ -void wxMaracasSurfaceRenderingManagerDataMhd::changeIsoValue(double value){ - - - _cubesFilter->SetValue(0,value); - _cubesFilter->Update(); - _cleanFilter->Update(); - _dataMapper->Update(); - - - -} -int wxMaracasSurfaceRenderingManagerDataMhd::getMaxGreyLevel(){ - return _maxgreylevel; -} - -/** - ** Get's the max grey level of the image - **/ -int wxMaracasSurfaceRenderingManagerDataMhd::getMaxLevel(vtkImageData* img){ - - int ext[6], i, j, k,max=0; - img->GetExtent(ext); - - for(i = ext[0]; i < ext[1];i++){ - for(j = ext[2]; j < ext[3];j++){ - for(k = ext[4]; k < ext[5];k++){ - unsigned short* ptr = (unsigned short*)img->GetScalarPointer(i,j,k); - int temp = (int)*ptr; - if(temp > max){ - max = temp; - } - } - } - } - return max; - - -} - -/** -** Sets the VTK image data -**/ - -void wxMaracasSurfaceRenderingManagerDataMhd::setVtkImageData(vtkImageData* imagedata){ - _imagedata = imagedata; -} - diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerDataMhd.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerDataMhd.h deleted file mode 100644 index fd60ab7..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingManagerDataMhd.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef WXMARACASSURFACERENDERINGMANAGERDATAMHD_H_ -#define WXMARACASSURFACERENDERINGMANAGERDATAMHD_H_ - - -#include "wxMaracasSurfaceRenderingManagerData.h" -#include "boxSurfaceObserver.h" - -#include "vtkMetaImageReader.h" -#include "vtkMarchingCubes.h" -#include "vtkCleanPolyData.h" -#include "vtkImageData.h" -#include "vtkClipPolyData.h" -#include "vtkPlanes.h" - -class wxMaracasSurfaceRenderingManagerDataMhd : public wxMaracasSurfaceRenderingManagerData { - -public: - - wxMaracasSurfaceRenderingManagerDataMhd(vtkImageData* imagedata, std::string dataname="", vtkRenderWindowInteractor* interactor=0); - ~wxMaracasSurfaceRenderingManagerDataMhd(); - - - /** - ** Adds a prop3D to the world of the application - **/ - void setVtkImageData(vtkImageData* imagedata); - - /** - ** changes the isovalue in a prop3D - **/ - void changeIsoValue(double value); - /** - ** Check if the variables are setted correctly - **/ - void checkInvariant(); - - /** - ** Returns the grey max level of the image - **/ - - int getMaxGreyLevel(); - - /** - ** creates the image - **/ - void contourExtractor(int isovalue); - - /** - ** Updates surface - **/ - void UpdateSurface(); - -private: - - vtkImageData* _imagedata; - int _maxgreylevel; - - /** - ** to the image render - **/ - vtkMarchingCubes* _cubesFilter; - vtkCleanPolyData* _cleanFilter; - vtkPolyDataMapper* _dataMapper; - vtkClipPolyData* _tissueClipper; - vtkPlanes* _tissuePlanes; - - /** - ** Get's the max grey level of the image - **/ - int getMaxLevel(vtkImageData* img); - - - -}; - -#endif /*WXMARACASSURFACERENDERINGMANAGERDATAMHD_H_*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingPanel.h deleted file mode 100644 index 3c3209d..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingPanel.h +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef WXMARACASSURFACERENDERINGPANEL_H_ -#define WXMARACASSURFACERENDERINGPANEL_H_ - -#include "wx/wx.h" - -class wxMaracasSurfaceRenderingPanel : public wxPanel{ -public: - wxMaracasSurfaceRenderingPanel(wxWindow* parent, int propid, bool _isComplexBox, int _panID) - : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){ - createPanel(); - isComplexBox = _isComplexBox; - panID = _panID; - _propid = propid; - } - //virtual ~wxMaracasSurfaceRenderingPanel(); - virtual void createPanel(){ - show = false; - /*wxBoxSizer* sizerButtons = new wxBoxSizer(wxVERTICAL); - - wxButton* b = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, - wxDefaultValidator, wxString(_T("-"))); - Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingPanel::onActionButtonPressedHide); - wxButton* b1 = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, - wxDefaultValidator, wxString(_T("x"))); - Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingPanel::onActionButtonPressedEliminate); - - sizerButtons->Add(b, wxFIXED_MINSIZE); - sizerButtons->Add(b1, wxFIXED_MINSIZE);*/ - - sizercontrols = new wxBoxSizer(wxVERTICAL); - - wxBoxSizer* sizerpanel = new wxBoxSizer(wxHORIZONTAL); - - //sizerpanel->Add(sizerButtons,wxGROW); - sizerpanel->Add(sizercontrols,wxGROW); - - this->SetSizer(sizerpanel, true); - this->SetAutoLayout( true ); - } - - /** - ** Adds a new control to the panel (sizer, radiob, etc) - **/ - virtual void addControl(wxWindow* win){ - if(sizercontrols!=NULL){ - sizercontrols->Add(win, wxGROW); - } - } - - /** - ** Adds a new control to the panel (sizer, radiob, etc) - **/ - virtual void addControl(wxSizer* sizer){ - if(sizercontrols!=NULL){ - sizercontrols->Add(sizer, wxGROW); - } - } - - /** - ** Hides or show the controls in the panel - **/ - virtual void onActionButtonPressedHide( wxCommandEvent& event ){ - wxList list = sizercontrols->GetChildren(); - int i; - for(i=0; i<(int)list.size();i++){ - sizercontrols->Show(i,show); - } - show = !show; - sizercontrols->Layout(); - this->Layout(); - } - - /** - ** The user must implement this function to remove the panel from the - **/ - //virtual void onActionButtonPressedEliminate( wxCommandEvent& event )=0; - - /** - ** The user must implement this function to add the necessary controls to the panel - **/ - virtual void createControls( )=0; - - /** - ** returns the id of the panel - **/ - int getPropId(){ - return _propid; - } - - /** - ** Returns the papnel id - **/ - int getPanId(){ - return panID; - } - - /** - ** Tells if the panel is used for a complex box - **/ - bool isComplex(){ - return isComplexBox; - } - -private: - wxBoxSizer* sizercontrols; - bool show; -protected: - int _propid; - - //-- Atributes added for complex box --// - bool isComplexBox; - int panID; -}; - -#endif /*WXMARACASSURFACERENDERINGPANEL_H_*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3D.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3D.cxx deleted file mode 100644 index 8b8cf8b..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3D.cxx +++ /dev/null @@ -1,186 +0,0 @@ -#include "wxMaracasSurfaceRenderingProp3D.h" -#include "wxMaracasDialog_NViewers.h" - -#include -#include "wxMaracasSurfaceRendering.h" -#include "wxMaracasRendererView.h" - -#include "vtkImageData.h" - -#include -#include -#include "Color.xpm" - -/** -** Implementation of viewProp3D -**/ -wxMaracasSurfaceRenderingProp3D::wxMaracasSurfaceRenderingProp3D(wxWindow* parent, int propid, bool _isComplexBox, int _panID) -:wxMaracasSurfaceRenderingPanel(parent, propid, _isComplexBox, _panID){ - createControls(); -} - -/** -** Panel Destructor -**/ -wxMaracasSurfaceRenderingProp3D::~wxMaracasSurfaceRenderingProp3D(){ - //wxMaracasSurfaceRendering::getInstance()->addRemoveActor(_propid, false); - if(this->isComplex()) - { - //if(this->getPanId() == 1) - // ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->addRemoveActorSA(_propid, false); - //if(this->getPanId() == 2) - // ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->addRemoveActorSB(_propid, false); - //if(this->getPanId() == 3) - // ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->addRemoveActorSC(_propid, false); - } - //else - //wxMaracasSurfaceRendering::getInstance()->deleteActor(_propid); -} - -/** -** Constructs the panel. Elements inside may change depending on which tipe of panel construction if being requested -**/ -void wxMaracasSurfaceRenderingProp3D::createControls(){ - - wxFlexGridSizer* sizersurfprop = new wxFlexGridSizer(1); - - if(!isComplexBox) - { - //wxString choices[2]; - //choices[0] = wxString(_T("On")); - //choices[1] = wxString(_T("Off")); - wxFlexGridSizer* checkboxsizer = new wxFlexGridSizer(2); - - checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor"))); - Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onCheckBoxChange); - checkbox->SetValue(true); - checkboxsizer->Add(checkbox,1, wxGROW); - - - if(wxMaracasSurfaceRendering::getInstance()->interactorSet()){ - checkboxsurface = new wxCheckBox(this,-1,wxString(_T("Surface Box"))); - Connect(checkboxsurface->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onCheckBoxSurfaceChange); - checkboxsurface->SetValue(true); - checkboxsizer->Add(checkboxsurface,1, wxGROW); - } - - - sizersurfprop->Add(checkboxsizer,1, wxGROW); - } - - //this->addControl(checkbox); - wxFlexGridSizer* sizerbut = new wxFlexGridSizer(3); - - wxBitmap bitmap(Color_xpm); - _colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30)); - Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onColorChange); - sizerbut->Add(_colorchoose,1, wxGROW); - - /* - wxBitmap bitmap1(Add_xpm); - _viewimage = new wxBitmapButton(this, -1, bitmap1, wxDefaultPosition, wxSize(30,30)); - Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onViewImage); - sizerbut->Add(_viewimage,wxFIXED_MINSIZE); - */ - sizersurfprop->Add(sizerbut,1, wxGROW); - //sizercolor->Add(checkbox,wxFIXED_MINSIZE); - //sizercolor->Add(_colorchoose,wxFIXED_MINSIZE); - //this->addControl(sizercolor); - - wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity"))); - opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS); - Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onOpacityRelease); - wxFlexGridSizer* sizeropacity = new wxFlexGridSizer(1,1,1); - sizeropacity->Add(label,1, wxGROW); - sizeropacity->Add(opacity,1, wxGROW); - - sizersurfprop->Add(sizeropacity,1, wxGROW); - - this->addControl(sizersurfprop); - -} - -/** -** Method called by setting on or off the actor -**/ -void wxMaracasSurfaceRenderingProp3D::onCheckBoxChange(wxCommandEvent& event){ - //if(!isComplexBox) - wxMaracasSurfaceRendering::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue()); -} -void wxMaracasSurfaceRenderingProp3D::onCheckBoxSurfaceChange(wxCommandEvent& event){ - //if(!isComplexBox) - wxMaracasSurfaceRendering::getInstance()->addRemoveSurfaceBox(this->getPropId(), checkboxsurface->GetValue()); -} - -/** -** -**/ -void wxMaracasSurfaceRenderingProp3D::onColorChange(wxCommandEvent& event){ - wxColourDialog* colourdiag = new wxColourDialog(this); - if(colourdiag->ShowModal()==wxID_OK){ - wxColour colour = colourdiag->GetColourData().GetColour(); - _colorchoose->SetBackgroundColour(colour); - - double r = (double)(colour.Red())/255.0; - double g = (double)(colour.Green())/255.0; - double b = (double)(colour.Blue())/255.0; - - if(this->isComplex()){ - if(this->getPanId() == 1) - ( (wxMaracasRendererView::getInstance())->getTabbedPanel(getPropId()) )->changeColorA(this->getPropId(), r, g, b); - if(this->getPanId() == 2) - ( (wxMaracasRendererView::getInstance())->getTabbedPanel(getPropId()) )->changeColorB(this->getPropId(), r, g, b); - if(this->getPanId() == 3) - ( (wxMaracasRendererView::getInstance())->getTabbedPanel(getPropId()) )->changeColorC(this->getPropId(), r, g, b); - } - else - wxMaracasSurfaceRendering::getInstance()->changeColor(this->getPropId(),r,g,b); - } - delete colourdiag; -} -/*void wxMaracasSurfaceRenderingProp3D::onActionButtonPressedEliminate( wxCommandEvent& event ){ - -}*/ - -/** -** Changes the opacity of an actor -**/ -void wxMaracasSurfaceRenderingProp3D::onOpacityRelease(wxScrollEvent& event ){ - - if(this->isComplex()){ - if(this->getPanId() == 1) - ( (wxMaracasRendererView::getInstance())->getTabbedPanel(getPropId()) )->changeOpacityA(this->getPropId(),opacity->GetValue()); - if(this->getPanId() == 2) - ( (wxMaracasRendererView::getInstance())->getTabbedPanel(getPropId()) )->changeOpacityB(this->getPropId(),opacity->GetValue()); - if(this->getPanId() == 3) - ( (wxMaracasRendererView::getInstance())->getTabbedPanel(getPropId()) )->changeOpacityC(this->getPropId(),opacity->GetValue()); - } - else - wxMaracasSurfaceRendering::getInstance()->changeOpacity(this->getPropId(),opacity->GetValue()); - -} - -/**Carolina Perez: Method recently added. Not functionalit yet -** Loads the volume in a separate window -**/ -void wxMaracasSurfaceRenderingProp3D::onViewImage(wxCommandEvent& event){ - vtkImageData* img; - if(this->isComplexBox){ - if(this->getPanId() == 1) - img = (wxMaracasRendererView::getInstance())->getTabbedPanel(_propid)->getSurfAImage(); - if(this->getPanId() == 2) - img = (wxMaracasRendererView::getInstance())->getTabbedPanel(_propid)->getSurfBImage(); - if(this->getPanId() == 3) - img = (wxMaracasRendererView::getInstance())->getTabbedPanel(_propid)->getSurfCImage(); - - std::vector type; - type.push_back(6); - - wxMaracasDialog_NViewers* dialog1 = new wxMaracasDialog_NViewers(this, img, &type, wxString(_T("Volume Visualization") )); - dialog1->SetSize(730, 700); - dialog1->Show(); - } - else{ - //vtkImageData* img = wxMaracasMultipleVolumeRendererView::getInstance()->getVolImage(); - } -} \ No newline at end of file diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3D.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3D.h deleted file mode 100644 index 1ebdeea..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3D.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef WXMARACASSURFACERENDERINGPROP3D_H_ -#define WXMARACASSURFACERENDERINGPROP3D_H_ - -#include "wxMaracasSurfaceRenderingPanel.h" -//#include "wxMaracasRenderImageManagementPanel.h" - -class wxMaracasSurfaceRenderingProp3D : public wxMaracasSurfaceRenderingPanel{ -public: - wxMaracasSurfaceRenderingProp3D(wxWindow* parent, int propid, bool _isComplexBox, int _panID); - ~wxMaracasSurfaceRenderingProp3D(); - virtual void createControls(); - void onOpacityRelease(wxScrollEvent& event); - void onCheckBoxChange(wxCommandEvent& event); - void onCheckBoxSurfaceChange(wxCommandEvent& event); - void onColorChange(wxCommandEvent& event); - void onViewImage(wxCommandEvent& event); - - -private: - wxCheckBox* checkbox; - wxCheckBox* checkboxsurface; - wxSlider* opacity; - wxBitmapButton* _colorchoose; - wxBitmapButton* _viewimage; - //wxMaracasRenderImageManagementPanel* dialog; -}; - -#endif /*WXMARACASSURFACERENDERINGPROP3D_H_*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3DMHD.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3DMHD.cxx deleted file mode 100644 index a364a49..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3DMHD.cxx +++ /dev/null @@ -1,66 +0,0 @@ -#include "wxMaracasSurfaceRenderingProp3DMHD.h" - -#include "wxMaracasSurfaceRendering.h" -#include "wxMaracasRendererView.h" -#include -/** -** SurfaceRenderingProp3DMHD implementation -**/ -wxMaracasSurfaceRenderingProp3DMHD::wxMaracasSurfaceRenderingProp3DMHD(wxWindow* parent, int propid, bool _isComplexBox, int _panID) -: wxMaracasSurfaceRenderingProp3D(parent, propid, _isComplexBox, _panID){ - -} -wxMaracasSurfaceRenderingProp3DMHD::~wxMaracasSurfaceRenderingProp3DMHD(){ - //this->Show(false); - if(this->isComplex()) - { - //if(this->getPanId() == 1) - // ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->addRemoveActorSA(_propid, false); - //if(this->getPanId() == 2) - // ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->addRemoveActorSB(_propid, false); - //if(this->getPanId() == 3) - // ((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->addRemoveActorSC(_propid, false); - } - //else - //wxMaracasSurfaceRendering::getInstance()->addRemoveActor(_propid, false); -} -void wxMaracasSurfaceRenderingProp3DMHD::createControls(int maxisovalue){ - - wxFlexGridSizer* sizer = new wxFlexGridSizer(1,1,1); - - wxStaticText* label = new wxStaticText(this, -1, wxString(_T("IsoValue"))); - sizer->Add(label, 1, wxGROW); - //this->addControl(label); - isovalue = new wxSlider(this, -1,maxisovalue,0,maxisovalue,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS); - sizer->Add(isovalue, 1, wxGROW); - //this->addControl(isovalue); - - this->addControl(sizer); - Connect(isovalue->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3DMHD::onIsoValueRelease); - -} - -void wxMaracasSurfaceRenderingProp3DMHD::onIsoValueRelease(wxScrollEvent& event ) -{ - if(this->isComplex()) - { - if(this->getPanId() == 1) - ( (wxMaracasRendererView::getInstance())->getTabbedPanel(getPropId()) )->changeIsoValueA(this->getPropId(),isovalue->GetValue()/1.0); - if(this->getPanId() == 2) - ( (wxMaracasRendererView::getInstance())->getTabbedPanel(getPropId()) )->changeIsoValueB(this->getPropId(),isovalue->GetValue()/1.0); - if(this->getPanId() == 3) - ( (wxMaracasRendererView::getInstance())->getTabbedPanel(getPropId()) )->changeIsoValueC(this->getPropId(),isovalue->GetValue()/1.0); - } - else - wxMaracasSurfaceRendering::getInstance()->changeIsoValue(this->getPropId(), isovalue->GetValue()/1.0); - -} - -void wxMaracasSurfaceRenderingProp3DMHD::onViewImage(wxCommandEvent& event){ - - //if(mwxwidget->ShowModal()==wxID_OK){ - - // mwxwidget->Show(false); - //} -} - diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3DMHD.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3DMHD.h deleted file mode 100644 index 49a3d22..0000000 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSurfaceRenderingProp3DMHD.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef WXMARACASSURFACERENDERINGPROP3DMHD_H_ -#define WXMARACASSURFACERENDERINGPROP3DMHD_H_ - -#include "wxMaracasSurfaceRenderingProp3D.h" - -class wxMaracasSurfaceRenderingProp3DMHD : public wxMaracasSurfaceRenderingProp3D{ -public: - wxMaracasSurfaceRenderingProp3DMHD(wxWindow* parent, int propid, bool _isComplexBox, int _panID); - ~wxMaracasSurfaceRenderingProp3DMHD(); - void onIsoValueRelease(wxScrollEvent& event ); - void createControls(int maxisovalue); - void onViewImage(wxCommandEvent& event); - -private: - wxSlider* isovalue; - wxBitmapButton* _viewimage; - int _propid; - -}; - -#endif /*WXMARACASSURFACERENDERINGPROP3DMHD_H_*/