#include <wxMaracasIRMView.h>
Public Member Functions | |
wxMaracasIRMView (wxWindow *parent, std::string path) | |
~wxMaracasIRMView () | |
void | setRenderer (vtkRenderer *renderer) |
void | changeOpacity (int propid, int value) |
void | changeIsoValue (int propid, double value) |
void | addRemoveActor (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 | addIRMViewPanel (wxMaracasIRMViewPanel *irmview, std::string dataname="") |
std::string | getPath () |
void | deleteActor (int propid) |
Static Public Member Functions | |
static wxMaracasIRMView * | getInstance (wxWindow *parent, std::string path="") |
static wxMaracasIRMView * | getInstance () |
Private Member Functions | |
void | createFileChooser () |
Private Attributes | |
wxMaracasIRMViewManager * | irmmanager |
wxAuiManager * | wxauimanager |
std::string | _path |
Static Private Attributes | |
static wxMaracasIRMView * | instance = NULL |
Definition at line 33 of file wxMaracasIRMView.h.
wxMaracasIRMView::wxMaracasIRMView | ( | wxWindow * | parent, | |
std::string | path | |||
) |
Definition at line 35 of file wxMaracasIRMView.cxx.
References _path, createFileChooser(), irmmanager, and wxauimanager.
Referenced by getInstance().
00036 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){ 00037 00038 irmmanager = new wxMaracasIRMViewManager(); 00039 00040 wxauimanager = new wxAuiManager(this); 00041 00042 _path = path; 00043 00044 std::string iconsdir = path; 00045 iconsdir+="/data/Icons"; 00046 wxToolBar* toolbar = new ToolBar(this,iconsdir); 00047 wxAuiPaneInfo paneinfo; 00048 wxauimanager->AddPane(toolbar,paneinfo.ToolbarPane().Top()); 00049 00050 wxauimanager->Update(); 00051 createFileChooser(); 00052 00053 00054 }
wxMaracasIRMView::~wxMaracasIRMView | ( | ) |
void wxMaracasIRMView::addIRMViewPanel | ( | wxMaracasIRMViewPanel * | irmview, | |
std::string | dataname = "" | |||
) |
Definition at line 194 of file wxMaracasIRMView.cxx.
References wxauimanager.
Referenced by addProp3D(), and addPropMHD().
00194 { 00195 00196 wxString s(dataname.c_str(),wxConvUTF8 ); 00197 wxAuiPaneInfo paneinfo; 00198 wxauimanager->AddPane(irmview, paneinfo.DefaultPane().Centre().DestroyOnClose().Caption(s)); 00199 wxauimanager->Update(); 00200 00201 00202 }
void wxMaracasIRMView::addProp3D | ( | vtkProp3D * | prop3D, | |
std::string | dataname = "" | |||
) |
Definition at line 180 of file wxMaracasIRMView.cxx.
References addIRMViewPanel(), wxMaracasIRMViewManager::addProp3D(), and irmmanager.
Referenced by loadProp3D().
00180 { 00181 try{ 00182 int id = irmmanager->addProp3D(prop3D,dataname); 00183 if(id!=-1){ 00184 wxMaracasIRMViewPanel* controlpan = new wxMaracasIRMViewProp3D(this, id); 00185 addIRMViewPanel(controlpan, dataname); 00186 } 00187 }catch(char* str){ 00188 std::cout << "Exception : " << str << '\n'; 00189 wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR); 00190 diag->ShowModal(); 00191 } 00192 00193 }
void wxMaracasIRMView::addPropMHD | ( | vtkImageData * | imgdata, | |
std::string | dataname = "" | |||
) |
Definition at line 146 of file wxMaracasIRMView.cxx.
References addIRMViewPanel(), wxMaracasIRMViewManager::addPropMHD(), wxMaracasIRMViewManager::getMaxIsoValue(), and irmmanager.
Referenced by loadPropMHD().
00146 { 00147 try{ 00148 int id = irmmanager->addPropMHD(imgdata,dataname); 00149 if(id!=-1){ 00150 00151 wxMaracasIRMViewPanel* controlpan = new wxMaracasIRMViewProp3DMHD(this, id); 00152 int maxiso = irmmanager->getMaxIsoValue(id); 00153 ((wxMaracasIRMViewProp3DMHD*)controlpan)->createControls(maxiso); 00154 addIRMViewPanel(controlpan, dataname); 00155 } 00156 00157 }catch(char* str){ 00158 00159 std::cout << "Exception : " << str << '\n'; 00160 wxMessageDialog* diag = new wxMessageDialog(this, wxString( str,wxConvUTF8 ), wxString( str,wxConvUTF8 ), wxICON_ERROR); 00161 diag->ShowModal(); 00162 00163 } 00164 }
void wxMaracasIRMView::addRemoveActor | ( | int | propid, | |
bool | addremove | |||
) |
Definition at line 85 of file wxMaracasIRMView.cxx.
References wxMaracasIRMViewManager::addRemoveActor(), and irmmanager.
Referenced by wxMaracasIRMViewProp3D::onCheckBoxChange().
00085 { 00086 irmmanager->addRemoveActor(propid, addremove); 00087 }
void wxMaracasIRMView::changeColor | ( | int | propid, | |
double | red, | |||
double | green, | |||
double | blue | |||
) |
Definition at line 97 of file wxMaracasIRMView.cxx.
References wxMaracasIRMViewManager::changeColor(), and irmmanager.
Referenced by wxMaracasIRMViewProp3D::onColorChange().
00097 { 00098 try{ 00099 irmmanager->changeColor(propid, red, green, blue); 00100 00101 }catch(char* str){ 00102 00103 wxString s( str,wxConvUTF8 ); 00104 wxMessageDialog* diag = new wxMessageDialog(this, s, s, wxICON_ERROR); 00105 diag->ShowModal(); 00106 delete diag; 00107 00108 } 00109 }
void wxMaracasIRMView::changeIsoValue | ( | int | propid, | |
double | value | |||
) |
Definition at line 93 of file wxMaracasIRMView.cxx.
References wxMaracasIRMViewManager::changeIsoValue(), and irmmanager.
Referenced by wxMaracasIRMViewProp3DMHD::onIsoValueRelease().
00093 { 00094 irmmanager->changeIsoValue(propid, value); 00095 }
void wxMaracasIRMView::changeOpacity | ( | int | propid, | |
int | value | |||
) |
Definition at line 89 of file wxMaracasIRMView.cxx.
References wxMaracasIRMViewManager::changeOpacity(), and irmmanager.
Referenced by wxMaracasIRMViewProp3D::onOpacityRelease().
00089 { 00090 irmmanager->changeOpacity(_propid,value); 00091 }
void wxMaracasIRMView::createFileChooser | ( | ) | [private] |
Definition at line 66 of file wxMaracasIRMView.cxx.
Referenced by wxMaracasIRMView().
void wxMaracasIRMView::deleteActor | ( | int | propid | ) |
Definition at line 204 of file wxMaracasIRMView.cxx.
References wxMaracasIRMViewManager::deleteActor(), and irmmanager.
Referenced by wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D().
00204 { 00205 try{ 00206 irmmanager->deleteActor(propid); 00207 }catch(char* e){ 00208 00209 } 00210 }
wxMaracasIRMView * wxMaracasIRMView::getInstance | ( | ) | [static] |
Definition at line 77 of file wxMaracasIRMView.cxx.
References instance.
Referenced by wxMaracasIRMViewProp3D::onCheckBoxChange(), wxMaracasIRMViewProp3D::onColorChange(), wxMaracasIRMViewProp3DMHD::onIsoValueRelease(), ToolBar::onLoadImageFile(), wxMaracasIRMViewProp3D::onOpacityRelease(), and wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D().
00077 { 00078 return instance; 00079 }
wxMaracasIRMView * wxMaracasIRMView::getInstance | ( | wxWindow * | parent, | |
std::string | path = "" | |||
) | [static] |
Definition at line 70 of file wxMaracasIRMView.cxx.
References instance, and wxMaracasIRMView().
00070 { 00071 if(instance==NULL){ 00072 instance = new wxMaracasIRMView(parent,path); 00073 } 00074 return instance; 00075 }
std::string wxMaracasIRMView::getPath | ( | ) |
Definition at line 60 of file wxMaracasIRMView.cxx.
References _path.
00060 { 00061 return _path; 00062 }
void wxMaracasIRMView::loadProp3D | ( | wxString | filename, | |
wxString | dataname | |||
) |
Definition at line 166 of file wxMaracasIRMView.cxx.
References addProp3D(), wxMaracasIRMViewManager::getProp3D(), and irmmanager.
Referenced by onLoadImageFile().
00166 { 00167 std::string s = std::string(filename.mb_str()); 00168 vtkProp3D* prop3D = irmmanager->getProp3D(s); 00169 if(prop3D != NULL){ 00170 s = std::string(dataname.mb_str() ); 00171 this->addProp3D(prop3D,s); 00172 }else{ 00173 //TODO msj to the user indicating error in file 00174 } 00175 00176 00177 00178 }
void wxMaracasIRMView::loadPropMHD | ( | wxString | filename, | |
wxString | dataname | |||
) |
Definition at line 133 of file wxMaracasIRMView.cxx.
References addPropMHD(), wxMaracasIRMViewManager::getImageData(), and irmmanager.
Referenced by onLoadImageFile().
00133 { 00134 00135 std::string s = std::string(filename.mb_str()); 00136 vtkImageData* img = irmmanager->getImageData(s); 00137 if(img!=NULL){ 00138 s = std::string(dataname.mb_str()); 00139 addPropMHD(img, s); 00140 } 00141 00142 00143 00144 }
void wxMaracasIRMView::onLoadImageFile | ( | ) |
Definition at line 111 of file wxMaracasIRMView.cxx.
References loadProp3D(), and loadPropMHD().
Referenced by ToolBar::onLoadImageFile().
00111 { 00112 00113 wxString mhd(_T("mhd")); 00114 wxString stl(_T("stl")); 00115 00116 wxFileDialog* fildial = new wxFileDialog(this, wxString(_T("Select a STL file")),wxString(_T("")), 00117 wxString(_T("")),wxString(_T("STL files (*.stl)|*.stl|MHD files (*.mhd)|*.mhd")) ); 00118 00119 if(fildial->ShowModal()==wxID_OK){ 00120 wxString filename = fildial->GetFilename(); 00121 wxString pathfile(fildial->GetDirectory() + _T("/") + filename); 00122 00123 00124 if(filename.EndsWith(mhd)){ 00125 loadPropMHD(pathfile,filename); 00126 }else if(filename.EndsWith(stl)){ 00127 loadProp3D(pathfile,filename); 00128 } 00129 } 00130 delete fildial; 00131 00132 }
void wxMaracasIRMView::setRenderer | ( | vtkRenderer * | renderer | ) |
Definition at line 81 of file wxMaracasIRMView.cxx.
References irmmanager, and wxMaracasIRMViewManager::setRenderer().
00081 { 00082 irmmanager->setRenderer(renderer); 00083 }
std::string wxMaracasIRMView::_path [private] |
wxMaracasIRMView * wxMaracasIRMView::instance = NULL [static, private] |
Definition at line 72 of file wxMaracasIRMView.h.
Referenced by addProp3D(), addPropMHD(), addRemoveActor(), changeColor(), changeIsoValue(), changeOpacity(), deleteActor(), loadProp3D(), loadPropMHD(), setRenderer(), and wxMaracasIRMView().
wxAuiManager* wxMaracasIRMView::wxauimanager [private] |
Definition at line 74 of file wxMaracasIRMView.h.
Referenced by addIRMViewPanel(), and wxMaracasIRMView().