]> 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    /*
28    creaImageIO::SetGimmickMessageLevel(9);
29    creaImageIO::SetGimmickDebugMessageLevel(9);
30    */
31
32    int image_type = GIMMICK_3D_IMAGE_SELECTION;
33    int threads = 1;
34
35    creaImageIO::WxGimmickReaderDialog w(0,
36                                         -1,
37                                         _T("Select image(s)        - Gimmick! (c) CREATIS-LRMN 2008"),
38                                         wxDefaultPosition,
39                                         wxSize(1200,800),
40                                         image_type,
41                                         threads);
42    w.ShowModal();
43    
44    if (w.GetReturnCode() == wxID_OK)
45      {
46        std::cout << "$$$$ main : user clicked 'OK' $$$$"<<std::endl;
47        std::cout << "$$$$ selected files : "<<std::endl;
48        std::vector<std::string> s;
49        w.GetSelectedFiles(s);
50        std::vector<std::string>::iterator i;
51        for (i=s.begin();i!=s.end();++i) 
52          {
53            std::cout << *i << std::endl;
54          }
55        std::cout << "$$$$ "<<std::endl;
56
57        std::vector<vtkImageData*> images;
58        w.GetSelectedImages(images);
59        crea::VtkBasicSlicer(images.front());
60        images.front()->Delete();
61
62      }
63    else if (w.GetReturnCode() == wxID_CANCEL)
64      {
65        std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<<std::endl;
66      }
67    else 
68      {
69         std::cout << "$$$$ main : dialog ended without return code ! $$$$"
70                   <<std::endl;
71       
72      }
73
74    //   std::cout << "$$$$ main : deleting dialog"<<std::endl;
75    //   delete w;
76    std::cout << "$$$$$$$$$$$$$$$$$$$$ main ended "<<std::endl;
77    return false;
78 }
79
80