1 //----------------------------------------------------------------------------------------------------------------
2 // Class definition include
3 //----------------------------------------------------------------------------------------------------------------
5 #include "wxContourGUIExample.h"
6 #include "wxContourMainFrame.h"
7 //#include "OutlineModelManager.h"
8 //#include "wxContourEventHandler.h"
10 //#include <creaImageIOWxGimmickDialog.h>
11 //#include <creaImageIOWxGimmickReaderDialog.h>
12 #include <creaImageIOWxSimpleDlg.h>
14 #include <creaImageIOSystem.h>
16 #include <creaVtkBasicSlicer.h>
17 //#include "wxContourMainPanel.h"
19 #include "vtkMetaImageReader.h"
21 #include "vtkImageData.h"
23 #include "wx/artprov.h"
24 #include <wx/filedlg.h>
28 //#include "OutlineModelBuilder.h"
29 //#include "ContourThing.h"
30 //#include "AxeThing.h"
31 //#include "ImageSourceThing.h"
32 //#include "ImageSectionThing.h"
33 //#include "SomeEnvironment.h"
34 //#include "ReaderEnvironment.h"
36 //#include "interfMainPanel.h"
38 #if defined(MACOSX) // assume this is OSX
39 # include <sys/param.h>
40 # include <mach-o/dyld.h> // _NSGetExecutablePath : must add -framework CoreFoundation to link line
43 # define PATH_MAX MAXPATHLEN
48 #ifndef PATH_MAX // If not defined yet : do it
49 # define PATH_MAX 2048
60 wxContourMainFrame* wxTheApplication::frame = 0;
62 //----------------------------------------------------------------------------------------------------------------
63 // This macro implements the entry point (main function) for the application
64 //----------------------------------------------------------------------------------------------------------------
71 //=========================================================================
72 //=========================================================================
73 IMPLEMENT_APP( wxTheApplication );
75 wxContourGUIExample :: wxContourGUIExample(const wxString& title, const wxPoint& pos, const wxSize& size)
76 : wxFrame((wxFrame *) NULL, -1, title, pos, size)
82 void wxAppConsole::OnAssert(char const *,int,char const *,char const *)
86 void wxAppConsole::OnAssertFailure(char const *,int,char const *,char const *,char const *)
91 bool wxTheApplication :: OnInit()
93 wxInitAllImageHandlers();
95 //EED01Juin2010 int min_image_type = GIMMICK_2D_IMAGE_SELECTION;
96 //EED01Juin2010 int max_image_type = GIMMICK_3D_IMAGE_SELECTION;
97 //EED01Juin2010 int output_dim = NATIVE;
98 //EED01Juin2010 int threads = 1;
102 creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
105 std::vector<vtkImageData*> images;
107 // creaImageIO::WxGimmickReaderDialog w(0,
109 // "creaContours_Descriptor.dscp",
110 // "creatisContours DB",
111 // _T("WxGimmickDialog test"),
112 // wxDefaultPosition,wxSize(1200,800)
121 //std::string datadir( crea::wx2std(GetExecutablePath()) );
122 std::string datadir( crea::System::GetExecutablePath() );
125 #ifdef LINUX /* assume this is OSX */
126 datadir=datadir+"/../share/creaContours";
129 #ifdef MACOSX /* assume this is OSX */
130 datadir=datadir+"/../../../../share/creaContours";
134 if(w.GetReturnCode() == wxID_OK)
136 std::vector<std::string> s;
137 //EED 01Juin2010 w.GetSelectedFiles(s);
140 //EED std::vector<std::string>::iterator i;
141 // for (i=s.begin();i!=s.end();++i)
143 // std::cout << *i << std::endl;
145 // std::cout << "$$$$ "<<std::endl;
146 //w.GetSelectedImages(images);
148 //EED31mai2010 w.GetSelectedImages(images,output_dim);
152 // std::vector<creaImageIO::OutStrGimmick> out;
153 // std::vector<std::string> attr;
154 //// attr.push_back("D0028_0010");
155 //// attr.push_back("D0008_0023");
156 //// attr.push_back("D0008_1070");
157 // w.getSelected(out, attr,true,"");
158 //// std::cout<<out.size()<<std::endl;
159 //// crea::VtkBasicSlicer(out.front().img);
160 // int size=out.size();
162 // for (ii=0;ii<size;ii++)
164 // images.push_back(out[ii].img);
168 printf("EED creaContours wxTheApplication :: OnInit %d\n", w.getImagesSelected().size() );
169 images=w.getImagesSelected();
170 printf("EED creaContours wxTheApplication :: OnInit %d\n", images.size() );
173 else if (w.GetReturnCode() == wxID_CANCEL)
175 vtkMetaImageReader *reader = vtkMetaImageReader::New();
176 std::string filename= datadir + "/data/hola.mhd";
177 reader->SetFileName( filename.c_str() );
179 images.push_back(reader->GetOutput());
187 wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("ROI Application - Evaluation version, 09 Feb 2009 "), wxPoint(400,50), wxSize(800, 600) );
189 //frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600), images );
190 frame = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(200,50), wxSize(800, 600), images, wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
191 frame1->CreateStatusBar();
193 frame->RefreshInterface();
198 int main(int argc, char* argv[])
200 return WinMain(::GetModuleHandle(NULL), NULL,
201 ::GetCommandLine(), SW_SHOWNORMAL);