]> Creatis software - creaImageIO.git/blob - appli/TestWxGimmickReaderDialog/main.cxx
*** empty log message ***
[creaImageIO.git] / appli / TestWxGimmickReaderDialog / main.cxx
1 #include <creaImageIOSystem.h>
2 #include <creaWx.h>
3 #include <creaImageIOWxGimmickReaderDialog.h>
4
5 #include <creaVtkBasicSlicer.h>
6
7 class myApp : public wxApp
8 {
9 public:
10   bool OnInit( );
11   int  OnExit() { return true; }
12 };
13
14 IMPLEMENT_APP(myApp);
15
16 CREA_WXMAIN_WITH_CONSOLE
17
18 bool myApp::OnInit( )
19 {        
20   wxApp::OnInit();
21 #ifdef __WXGTK__
22   //See http://www.wxwindows.org/faqgtk.htm#locale
23   setlocale(LC_NUMERIC, "C");
24 #endif
25    wxInitAllImageHandlers();
26
27    creaImageIO::SetGimmickMessageLevel(9);
28    creaImageIO::SetGimmickDebugMessageLevel(9);
29
30    int image_type = GIMMICK_3D_IMAGE_SELECTION;
31    int threads = 1;
32
33    creaImageIO::WxGimmickReaderDialog w(0,
34                                         -1,
35                                         _T("Select image(s)        - Gimmick! (c) CREATIS-LRMN 2008"),
36                                         wxDefaultPosition,
37                                         wxSize(1200,800),
38                                         image_type,
39                                         threads);
40    w.ShowModal();
41    
42    if (w.GetReturnCode() == wxID_OK)
43      {
44        std::cout << "$$$$ main : user clicked 'OK' $$$$"<<std::endl;
45        std::cout << "$$$$ selected files : "<<std::endl;
46        std::vector<std::string> s;
47        w.GetSelectedFiles(s);
48        std::vector<std::string>::iterator i;
49        for (i=s.begin();i!=s.end();++i) 
50          {
51            std::cout << *i << std::endl;
52          }
53        std::cout << "$$$$ "<<std::endl;
54
55        std::vector<vtkImageData*> images;
56        w.GetSelectedImages(images);
57        crea::VtkBasicSlicer(images.front());
58        images.front()->Delete();
59
60      }
61    else if (w.GetReturnCode() == wxID_CANCEL)
62      {
63        std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<<std::endl;
64      }
65    else 
66      {
67         std::cout << "$$$$ main : dialog ended without return code ! $$$$"
68                   <<std::endl;
69       
70      }
71
72    //   std::cout << "$$$$ main : deleting dialog"<<std::endl;
73    //   delete w;
74    std::cout << "$$$$$$$$$$$$$$$$$$$$ main ended "<<std::endl;
75    return false;
76 }
77
78