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 <creaImageIOSystem.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>
26 //#include "OutlineModelBuilder.h"
27 //#include "ContourThing.h"
28 //#include "AxeThing.h"
29 //#include "ImageSourceThing.h"
30 //#include "ImageSectionThing.h"
31 //#include "SomeEnvironment.h"
32 //#include "ReaderEnvironment.h"
34 //#include "interfMainPanel.h"
36 #if defined(MACOSX) // assume this is OSX
37 # include <sys/param.h>
38 # include <mach-o/dyld.h> // _NSGetExecutablePath : must add -framework CoreFoundation to link line
41 # define PATH_MAX MAXPATHLEN
46 #ifndef PATH_MAX // If not defined yet : do it
47 # define PATH_MAX 2048
58 wxContourMainFrame* wxTheApplication::frame = 0;
60 //----------------------------------------------------------------------------------------------------------------
61 // This macro implements the entry point (main function) for the application
62 //----------------------------------------------------------------------------------------------------------------
69 //=========================================================================
70 //=========================================================================
71 IMPLEMENT_APP( wxTheApplication );
73 wxContourGUIExample :: wxContourGUIExample(const wxString& title, const wxPoint& pos, const wxSize& size)
74 : wxFrame((wxFrame *) NULL, -1, title, pos, size)
80 void wxAppConsole::OnAssert(char const *,int,char const *,char const *)
84 void wxAppConsole::OnAssertFailure(char const *,int,char const *,char const *,char const *)
89 bool wxTheApplication :: OnInit()
91 wxInitAllImageHandlers();
93 int min_image_type = GIMMICK_2D_IMAGE_SELECTION;
94 int max_image_type = GIMMICK_3D_IMAGE_SELECTION;
95 int output_dim = NATIVE;
98 std::vector<vtkImageData*> images;
99 creaImageIO::WxGimmickReaderDialog w(0,
101 "creaContours_Descriptor.dscp",
102 "creatisContours DB",
103 _T("WxGimmickDialog test"),
104 wxDefaultPosition,wxSize(1200,800)
114 //std::string datadir( crea::wx2std(GetExecutablePath()) );
115 std::string datadir( crea::System::GetExecutablePath() );
118 #ifdef LINUX /* assume this is OSX */
119 datadir=datadir+"/../share/creaContours";
122 #ifdef MACOSX /* assume this is OSX */
123 datadir=datadir+"/../../../../share/creaContours";
127 if(w.GetReturnCode() == wxID_OK)
129 std::vector<std::string> s;
130 w.GetSelectedFiles(s);
133 //EED std::vector<std::string>::iterator i;
134 // for (i=s.begin();i!=s.end();++i)
136 // std::cout << *i << std::endl;
138 // std::cout << "$$$$ "<<std::endl;
139 //w.GetSelectedImages(images);
141 //EED31mai2010 w.GetSelectedImages(images,output_dim);
143 std::vector<creaImageIO::OutStrGimmick> out;
144 std::vector<std::string> attr;
145 // attr.push_back("D0028_0010");
146 // attr.push_back("D0008_0023");
147 // attr.push_back("D0008_1070");
148 w.getSelected(out, attr,true,"");
149 // std::cout<<out.size()<<std::endl;
150 // crea::VtkBasicSlicer(out.front().img);
153 for (ii=0;ii<size;ii++)
155 images.push_back(out[ii].img);
160 else if (w.GetReturnCode() == wxID_CANCEL)
162 vtkMetaImageReader *reader = vtkMetaImageReader::New();
163 std::string filename= datadir + "/data/hola.mhd";
164 reader->SetFileName( filename.c_str() );
166 images.push_back(reader->GetOutput());
174 wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("ROI Application - Evaluation version, 09 Feb 2009 "), wxPoint(400,50), wxSize(800, 600) );
176 //frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600), images );
177 frame = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(200,50), wxSize(800, 600), images, wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
178 frame1->CreateStatusBar();
180 frame->RefreshInterface();
185 int main(int argc, char* argv[])
187 return WinMain(::GetModuleHandle(NULL), NULL,
188 ::GetCommandLine(), SW_SHOWNORMAL);