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