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()
94 wxInitAllImageHandlers();
96 //EED01Juin2010 int min_image_type = GIMMICK_2D_IMAGE_SELECTION;
97 //EED01Juin2010 int max_image_type = GIMMICK_3D_IMAGE_SELECTION;
98 //EED01Juin2010 int output_dim = NATIVE;
99 //EED01Juin2010 int threads = 1;
103 creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
106 std::vector<vtkImageData*> images;
108 // creaImageIO::WxGimmickReaderDialog w(0,
110 // "creaContours_Descriptor.dscp",
111 // "creatisContours DB",
112 // _T("WxGimmickDialog test"),
113 // wxDefaultPosition,wxSize(1200,800)
122 //std::string datadir( crea::wx2std(GetExecutablePath()) );
123 std::string datadir( crea::System::GetExecutablePath() );
126 #ifdef LINUX /* assume this is OSX */
127 datadir=datadir+"/../share/creaContours";
130 #ifdef MACOSX /* assume this is OSX */
131 datadir=datadir+"/../../../../share/creaContours";
135 if(w.GetReturnCode() == wxID_OK)
137 std::vector<std::string> s;
138 //EED 01Juin2010 w.GetSelectedFiles(s);
141 //EED std::vector<std::string>::iterator i;
142 // for (i=s.begin();i!=s.end();++i)
144 // std::cout << *i << std::endl;
146 // std::cout << "$$$$ "<<std::endl;
147 //w.GetSelectedImages(images);
149 //EED31mai2010 w.GetSelectedImages(images,output_dim);
153 // std::vector<creaImageIO::OutStrGimmick> out;
154 // std::vector<std::string> attr;
155 //// attr.push_back("D0028_0010");
156 //// attr.push_back("D0008_0023");
157 //// attr.push_back("D0008_1070");
158 // w.getSelected(out, attr,true,"");
159 //// std::cout<<out.size()<<std::endl;
160 //// crea::VtkBasicSlicer(out.front().img);
161 // int size=out.size();
163 // for (ii=0;ii<size;ii++)
165 // images.push_back(out[ii].img);
169 // printf("EED creaContours wxTheApplication :: OnInit %d\n", w.getImagesSelected().size() );
170 images = w.getImagesSelected();
171 infoImage = w.getInfoImage();
172 // printf("EED creaContours wxTheApplication :: OnInit %d\n", images.size() );
175 else if (w.GetReturnCode() == wxID_CANCEL)
177 vtkMetaImageReader *reader = vtkMetaImageReader::New();
178 std::string filename= datadir + "/data/hola.mhd";
179 infoImage=_T("DEFAULT-Image:")+crea::std2wx(filename);
180 reader->SetFileName( filename.c_str() );
182 images.push_back(reader->GetOutput());
190 wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("Creatis- ROI Application- Evaluation version,01 Agost 2010 ")+infoImage, wxPoint(400,50), wxSize(800, 600) );
192 //frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600), images );
193 frame = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(200,50), wxSize(800, 600), images, wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
194 frame1->CreateStatusBar();
196 frame->RefreshInterface();
201 int main(int argc, char* argv[])
203 return WinMain(::GetModuleHandle(NULL), NULL,
204 ::GetCommandLine(), SW_SHOWNORMAL);