1 //----------------------------------------------------------------------------------------------------------------
2 // Class definition include
3 //----------------------------------------------------------------------------------------------------------------
6 #include "wxContourGUIExample.h"
7 #include "wxContourMainFrame.h"
8 //#include "OutlineModelManager.h"
9 //#include "wxContourEventHandler.h"
12 #include <creaImageIOWxGimmickDialog.h>
14 #include <creaVtkBasicSlicer.h>
15 //#include "wxContourMainPanel.h"
17 #include "vtkMetaImageReader.h"
19 #include "vtkImageData.h"
21 #include "wx/artprov.h"
22 #include <wx/filedlg.h>
23 //#include "OutlineModelBuilder.h"
24 //#include "ContourThing.h"
25 //#include "AxeThing.h"
26 //#include "ImageSourceThing.h"
27 //#include "ImageSectionThing.h"
28 //#include "SomeEnvironment.h"
29 //#include "ReaderEnvironment.h"
34 //#include "interfMainPanel.h"
37 wxContourMainFrame* wxTheApplication::frame = 0;
38 //----------------------------------------------------------------------------------------------------------------
39 // This macro implements the entry point (main function) for the application
40 //----------------------------------------------------------------------------------------------------------------
44 // http://lists.wxwidgets.org/archive/wx-dev/msg30449.html
45 wxString getExecutablePath()
51 GetModuleFileName(NULL, buf, 511);
52 slash = strrchr(buf, '\\');
57 #elif defined(__LINUX__)
59 res = readlink("/proc/self/exe", buf, 512);
63 slash = strrchr(buf, '/');
72 return wxString(buf, wxConvUTF8 );
80 IMPLEMENT_APP( wxTheApplication );
83 wxContourGUIExample :: wxContourGUIExample(const wxString& title, const wxPoint& pos, const wxSize& size)
84 : wxFrame((wxFrame *) NULL, -1, title, pos, size)
91 void wxAppConsole::OnAssert(char const *,int,char const *,char const *)
95 void wxAppConsole::OnAssertFailure(char const *,int,char const *,char const *,char const *)
100 bool wxTheApplication :: OnInit()
103 wxInitAllImageHandlers();
105 int image_type = GIMMICK_3D_IMAGE_SELECTION;
108 creaImageIO::WxGimmickDialog w(0,
110 _T("WxGimmickDialog test"),
117 //vtkImageData* selectedimage=NULL;
118 std::vector<vtkImageData*> images;
119 if(w.GetReturnCode() == wxID_OK){
121 std::vector<std::string> s;
122 w.GetSelectedFiles(s);
123 std::vector<std::string>::iterator i;
124 for (i=s.begin();i!=s.end();++i){
125 std::cout << *i << std::endl;
128 std::cout << "$$$$ "<<std::endl;
129 w.GetSelectedImages(images);
130 //selectedimage = images[0];
131 //crea::VtkBasicSlicer(images.front());
132 //images.front()->Delete();
134 }else if (w.GetReturnCode() == wxID_CANCEL){
135 vtkMetaImageReader *reader = vtkMetaImageReader::New();
136 wxString filename= getExecutablePath()+ wxString( _T("/data/hola.mhd") , wxConvUTF8 );
137 reader->SetFileName( filename.c_str() );
139 images.push_back(reader->GetOutput());
145 wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("ROI Application - Evaluation version, 09 Feb 2009 "), wxPoint(400,50), wxSize(800, 600) );
147 //frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600), images );
148 frame = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(200,50), wxSize(800, 600), images, wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,(const char*)( getExecutablePath().mb_str() ) );
149 frame1->CreateStatusBar();
157 int main(int argc, char* argv[])
159 return WinMain(::GetModuleHandle(NULL), NULL,
160 ::GetCommandLine(), SW_SHOWNORMAL);