1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 //----------------------------------------------------------------------------------------------------------------
27 // Class definition include
28 //----------------------------------------------------------------------------------------------------------------
30 #include "wxContourGUIExample.h"
31 #include "wxContourMainFrame.h"
32 //#include "OutlineModelManager.h"
33 //#include "wxContourEventHandler.h"
35 //#include <creaImageIOWxGimmickDialog.h>
36 //#include <creaImageIOWxGimmickReaderDialog.h>
37 #include <creaImageIOWxSimpleDlg.h>
39 #include <creaImageIOSystem.h>
41 #include <creaVtkBasicSlicer.h>
42 //#include "wxContourMainPanel.h"
44 #include "vtkMetaImageReader.h"
46 #include "vtkImageData.h"
48 #include "wx/artprov.h"
49 #include <wx/filedlg.h>
53 //#include "OutlineModelBuilder.h"
54 //#include "ContourThing.h"
55 //#include "AxeThing.h"
56 //#include "ImageSourceThing.h"
57 //#include "ImageSectionThing.h"
58 //#include "SomeEnvironment.h"
59 //#include "ReaderEnvironment.h"
61 //#include "interfMainPanel.h"
63 #if defined(MACOSX) // assume this is OSX
64 # include <sys/param.h>
65 # include <mach-o/dyld.h> // _NSGetExecutablePath : must add -framework CoreFoundation to link line
68 # define PATH_MAX MAXPATHLEN
73 #ifndef PATH_MAX // If not defined yet : do it
74 # define PATH_MAX 2048
85 wxContourMainFrame* wxTheApplication::frame = 0;
87 //----------------------------------------------------------------------------------------------------------------
88 // This macro implements the entry point (main function) for the application
89 //----------------------------------------------------------------------------------------------------------------
96 //=========================================================================
97 //=========================================================================
98 IMPLEMENT_APP( wxTheApplication );
100 wxContourGUIExample :: wxContourGUIExample(const wxString& title, const wxPoint& pos, const wxSize& size)
101 : wxFrame((wxFrame *) NULL, -1, title, pos, size)
107 void wxAppConsole::OnAssert(char const *,int,char const *,char const *)
111 void wxAppConsole::OnAssertFailure(char const *,int,char const *,char const *,char const *)
116 bool wxTheApplication :: OnInit()
119 wxInitAllImageHandlers();
121 //EED01Juin2010 int min_image_type = GIMMICK_2D_IMAGE_SELECTION;
122 //EED01Juin2010 int max_image_type = GIMMICK_3D_IMAGE_SELECTION;
123 //EED01Juin2010 int output_dim = NATIVE;
124 //EED01Juin2010 int threads = 1;
128 creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
131 std::vector<vtkImageData*> images;
133 // creaImageIO::WxGimmickReaderDialog w(0,
135 // "creaContours_Descriptor.dscp",
136 // "creatisContours DB",
137 // _T("WxGimmickDialog test"),
138 // wxDefaultPosition,wxSize(1200,800)
147 //std::string datadir( crea::wx2std(GetExecutablePath()) );
148 std::string datadir( crea::System::GetExecutablePath() );
151 #ifdef LINUX /* assume this is OSX */
152 datadir=datadir+"/../share/creaContours";
155 #ifdef MACOSX /* assume this is OSX */
156 datadir=datadir+"/../../../../share/creaContours";
160 if(w.GetReturnCode() == wxID_OK)
162 std::vector<std::string> s;
163 //EED 01Juin2010 w.GetSelectedFiles(s);
166 //EED std::vector<std::string>::iterator i;
167 // for (i=s.begin();i!=s.end();++i)
169 // std::cout << *i << std::endl;
171 // std::cout << "$$$$ "<<std::endl;
172 //w.GetSelectedImages(images);
174 //EED31mai2010 w.GetSelectedImages(images,output_dim);
178 // std::vector<creaImageIO::OutStrGimmick> out;
179 // std::vector<std::string> attr;
180 //// attr.push_back("D0028_0010");
181 //// attr.push_back("D0008_0023");
182 //// attr.push_back("D0008_1070");
183 // w.getSelected(out, attr,true,"");
184 //// std::cout<<out.size()<<std::endl;
185 //// crea::VtkBasicSlicer(out.front().img);
186 // int size=out.size();
188 // for (ii=0;ii<size;ii++)
190 // images.push_back(out[ii].img);
194 // printf("EED creaContours wxTheApplication :: OnInit %d\n", w.getImagesSelected().size() );
195 images = w.getImagesSelected();
196 infoImage = w.getInfoImage();
197 // printf("EED creaContours wxTheApplication :: OnInit %d\n", images.size() );
200 else if (w.GetReturnCode() == wxID_CANCEL)
202 vtkMetaImageReader *reader = vtkMetaImageReader::New();
203 std::string filename= datadir + "/data/hola.mhd";
204 infoImage=_T("DEFAULT-Image:")+crea::std2wx(filename);
205 reader->SetFileName( filename.c_str() );
207 images.push_back(reader->GetOutput());
215 wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("Creatis- ROI Application- Evaluation version,01 Agost 2010 ")+infoImage, wxPoint(400,50), wxSize(800, 600) );
217 //frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600), images );
218 frame = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(200,50), wxSize(800, 600), images, wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
219 frame1->CreateStatusBar();
221 frame->RefreshInterface();
226 int main(int argc, char* argv[])
228 return WinMain(::GetModuleHandle(NULL), NULL,
229 ::GetCommandLine(), SW_SHOWNORMAL);