#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 |
wxToolBar * | _toolb |
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, _toolb, 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 this->_toolb = new ToolBar(this,iconsdir); 00047 wxAuiPaneInfo paneinfo; 00048 wxauimanager->AddPane(_toolb,paneinfo.ToolbarPane().Top()); 00049 00050 wxauimanager->Update(); 00051 createFileChooser(); 00052 00053 00054 }
wxMaracasIRMView::~wxMaracasIRMView | ( | ) |
Definition at line 55 of file wxMaracasIRMView.cxx.
References _toolb.
00055 { 00056 00057 delete _toolb; 00058 00059 }
wxMaracasIRMView * wxMaracasIRMView::getInstance | ( | wxWindow * | parent, | |
std::string | path = "" | |||
) | [static] |
Definition at line 71 of file wxMaracasIRMView.cxx.
References instance, and wxMaracasIRMView().
00071 { 00072 if(instance==NULL){ 00073 instance = new wxMaracasIRMView(parent,path); 00074 } 00075 return instance; 00076 }
wxMaracasIRMView * wxMaracasIRMView::getInstance | ( | ) | [static] |
Definition at line 78 of file wxMaracasIRMView.cxx.
References instance.
Referenced by wxMaracasIRMViewProp3D::onCheckBoxChange(), wxMaracasIRMViewProp3D::onColorChange(), wxMaracasIRMViewProp3DMHD::onIsoValueRelease(), ToolBarEventHandler::onLoadImageFile(), wxMaracasIRMViewProp3D::onOpacityRelease(), and wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D().
00078 { 00079 return instance; 00080 }
void wxMaracasIRMView::setRenderer | ( | vtkRenderer * | renderer | ) |
Definition at line 82 of file wxMaracasIRMView.cxx.
References irmmanager, and wxMaracasIRMViewManager::setRenderer().
00082 { 00083 irmmanager->setRenderer(renderer); 00084 }
void wxMaracasIRMView::changeOpacity | ( | int | propid, | |
int | value | |||
) |
Definition at line 90 of file wxMaracasIRMView.cxx.
References wxMaracasIRMViewManager::changeOpacity(), and irmmanager.
Referenced by wxMaracasIRMViewProp3D::onOpacityRelease().
00090 { 00091 irmmanager->changeOpacity(_propid,value); 00092 }
void wxMaracasIRMView::changeIsoValue | ( | int | propid, | |
double | value | |||
) |
Definition at line 94 of file wxMaracasIRMView.cxx.
References wxMaracasIRMViewManager::changeIsoValue(), and irmmanager.
Referenced by wxMaracasIRMViewProp3DMHD::onIsoValueRelease().
00094 { 00095 irmmanager->changeIsoValue(propid, value); 00096 }
void wxMaracasIRMView::addRemoveActor | ( | int | propid, | |
bool | addremove | |||
) |
Definition at line 86 of file wxMaracasIRMView.cxx.
References wxMaracasIRMViewManager::addRemoveActor(), and irmmanager.
Referenced by wxMaracasIRMViewProp3D::onCheckBoxChange().
00086 { 00087 irmmanager->addRemoveActor(propid, addremove); 00088 }
void wxMaracasIRMView::changeColor | ( | int | propid, | |
double | red, | |||
double | green, | |||
double | blue | |||
) |
Definition at line 98 of file wxMaracasIRMView.cxx.
References wxMaracasIRMViewManager::changeColor(), and irmmanager.
Referenced by wxMaracasIRMViewProp3D::onColorChange().
00098 { 00099 try{ 00100 irmmanager->changeColor(propid, red, green, blue); 00101 00102 }catch(char* str){ 00103 00104 wxString s( str,wxConvUTF8 ); 00105 wxMessageDialog* diag = new wxMessageDialog(this, s, s, wxICON_ERROR); 00106 diag->ShowModal(); 00107 delete diag; 00108 00109 } 00110 }
void wxMaracasIRMView::addProp3D | ( | vtkProp3D * | prop3D, | |
std::string | dataname = "" | |||
) |
Definition at line 181 of file wxMaracasIRMView.cxx.
References addIRMViewPanel(), wxMaracasIRMViewManager::addProp3D(), and irmmanager.
Referenced by loadProp3D().
00181 { 00182 try{ 00183 int id = irmmanager->addProp3D(prop3D,dataname); 00184 if(id!=-1){ 00185 wxMaracasIRMViewPanel* controlpan = new wxMaracasIRMViewProp3D(this, id); 00186 addIRMViewPanel(controlpan, dataname); 00187 } 00188 }catch(char* str){ 00189 std::cout << "Exception : " << str << '\n'; 00190 wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR); 00191 diag->ShowModal(); 00192 } 00193 00194 }
void wxMaracasIRMView::addPropMHD | ( | vtkImageData * | imgdata, | |
std::string | dataname = "" | |||
) |
Definition at line 147 of file wxMaracasIRMView.cxx.
References addIRMViewPanel(), wxMaracasIRMViewManager::addPropMHD(), wxMaracasIRMViewManager::getMaxIsoValue(), and irmmanager.
Referenced by loadPropMHD().
00147 { 00148 try{ 00149 int id = irmmanager->addPropMHD(imgdata,dataname); 00150 if(id!=-1){ 00151 00152 wxMaracasIRMViewPanel* controlpan = new wxMaracasIRMViewProp3DMHD(this, id); 00153 int maxiso = irmmanager->getMaxIsoValue(id); 00154 ((wxMaracasIRMViewProp3DMHD*)controlpan)->createControls(maxiso); 00155 addIRMViewPanel(controlpan, dataname); 00156 } 00157 00158 }catch(char* str){ 00159 00160 std::cout << "Exception : " << str << '\n'; 00161 wxMessageDialog* diag = new wxMessageDialog(this, wxString( str,wxConvUTF8 ), wxString( str,wxConvUTF8 ), wxICON_ERROR); 00162 diag->ShowModal(); 00163 00164 } 00165 }
void wxMaracasIRMView::loadProp3D | ( | wxString | filename, | |
wxString | dataname | |||
) |
Definition at line 167 of file wxMaracasIRMView.cxx.
References addProp3D(), wxMaracasIRMViewManager::getProp3D(), and irmmanager.
Referenced by onLoadImageFile().
00167 { 00168 std::string s = std::string(filename.mb_str()); 00169 vtkProp3D* prop3D = irmmanager->getProp3D(s); 00170 if(prop3D != NULL){ 00171 s = std::string(dataname.mb_str() ); 00172 this->addProp3D(prop3D,s); 00173 }else{ 00174 //TODO msj to the user indicating error in file 00175 } 00176 00177 00178 00179 }
void wxMaracasIRMView::loadPropMHD | ( | wxString | filename, | |
wxString | dataname | |||
) |
Definition at line 134 of file wxMaracasIRMView.cxx.
References addPropMHD(), wxMaracasIRMViewManager::getImageData(), and irmmanager.
Referenced by onLoadImageFile().
00134 { 00135 00136 std::string s = std::string(filename.mb_str()); 00137 vtkImageData* img = irmmanager->getImageData(s); 00138 if(img!=NULL){ 00139 s = std::string(dataname.mb_str()); 00140 addPropMHD(img, s); 00141 } 00142 00143 00144 00145 }
void wxMaracasIRMView::onLoadImageFile | ( | ) |
Definition at line 112 of file wxMaracasIRMView.cxx.
References loadProp3D(), and loadPropMHD().
Referenced by ToolBarEventHandler::onLoadImageFile().
00112 { 00113 00114 wxString mhd(_T("mhd")); 00115 wxString stl(_T("stl")); 00116 00117 wxFileDialog* fildial = new wxFileDialog(this, wxString(_T("Select a STL file")),wxString(_T("")), 00118 wxString(_T("")),wxString(_T("STL files (*.stl)|*.stl|MHD files (*.mhd)|*.mhd")) ); 00119 00120 if(fildial->ShowModal()==wxID_OK){ 00121 wxString filename = fildial->GetFilename(); 00122 wxString pathfile(fildial->GetDirectory() + _T("/") + filename); 00123 00124 00125 if(filename.EndsWith(mhd)){ 00126 loadPropMHD(pathfile,filename); 00127 }else if(filename.EndsWith(stl)){ 00128 loadProp3D(pathfile,filename); 00129 } 00130 } 00131 delete fildial; 00132 00133 }
void wxMaracasIRMView::addIRMViewPanel | ( | wxMaracasIRMViewPanel * | irmview, | |
std::string | dataname = "" | |||
) |
Definition at line 195 of file wxMaracasIRMView.cxx.
References wxauimanager.
Referenced by addProp3D(), and addPropMHD().
00195 { 00196 00197 wxString s(dataname.c_str(),wxConvUTF8 ); 00198 wxAuiPaneInfo paneinfo; 00199 wxauimanager->AddPane(irmview, paneinfo.DefaultPane().Centre().DestroyOnClose().Caption(s)); 00200 wxauimanager->Update(); 00201 00202 00203 }
std::string wxMaracasIRMView::getPath | ( | ) |
Definition at line 61 of file wxMaracasIRMView.cxx.
References _path.
00061 { 00062 return _path; 00063 }
void wxMaracasIRMView::deleteActor | ( | int | propid | ) |
Definition at line 205 of file wxMaracasIRMView.cxx.
References wxMaracasIRMViewManager::deleteActor(), and irmmanager.
Referenced by wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D().
00205 { 00206 try{ 00207 irmmanager->deleteActor(propid); 00208 }catch(char* e){ 00209 00210 } 00211 }
void wxMaracasIRMView::createFileChooser | ( | ) | [private] |
Definition at line 67 of file wxMaracasIRMView.cxx.
Referenced by wxMaracasIRMView().
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().
std::string wxMaracasIRMView::_path [private] |
wxToolBar* wxMaracasIRMView::_toolb [private] |
Definition at line 80 of file wxMaracasIRMView.h.
Referenced by wxMaracasIRMView(), and ~wxMaracasIRMView().