]> Creatis software - creaImageIO.git/blob - src/creaImageIOExternalGimmick.cpp
42e07e2fe7fc8605cd92980cc3f55f1116706ed9
[creaImageIO.git] / src / creaImageIOExternalGimmick.cpp
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Santé)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and 
11 #  abiding by the rules of distribution of free software. You can  use, 
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
13 #  license as circulated by CEA, CNRS and INRIA at the following URL 
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability. 
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
26 */
27
28
29 #include <creaImageIOExternalGimmick.h>
30 #include <creaImageIOWxSimpleDlg.h>
31
32 //EED Borrame
33 //#include <creaImageIOExternalGimmick.h>
34
35
36 vtkImageData* getImageDataDialog()
37 {
38     wxString infoImage;
39     std::vector<vtkImageData*> images;
40     creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
41     w.ShowModal();
42     if(w.GetReturnCode() == wxID_OK)
43     {
44         std::vector<std::string> s;
45         images    = w.getImagesSelected();
46         infoImage = w.getInfoImage();
47     } // if
48
49     vtkImageData *result=NULL;
50     if (images.size()>0)
51     {
52         result=images[0];
53     }
54
55     return result;
56 }
57
58
59
60 std::vector<creaImageIO::OutStrGimmick> getImagesInfoDialog()
61 {
62     wxString infoImage;
63     std::vector<creaImageIO::OutStrGimmick> s;
64     creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
65         w.setInfo(true);
66     w.ShowModal();
67     if(w.GetReturnCode() == wxID_OK)
68     {
69            s      = w.getMapInfos();
70     } 
71
72     return s;
73 }
74
75
76 /*EED Borrame
77 vtkImageData* getImageDataDialog() {
78         //      wxApp::OnInit();
79         #ifdef __WXGTK__
80           //See http://www.wxwindows.org/faqgtk.htm#locale
81           setlocale(LC_NUMERIC, "C");
82         #endif
83            wxInitAllImageHandlers();
84
85            creaImageIO::SetGimmickMessageLevel(5);
86            creaImageIO::SetGimmickDebugMessageLevel(0);
87
88            int min_dim = GIMMICK_2D_IMAGE_SELECTION;
89            int max_dim = GIMMICK_3D_IMAGE_SELECTION;
90            int output_dim = NATIVE;
91            int threads = 1;
92
93            creaImageIO::WxGimmickReaderDialog w(
94                                                 0,
95                                            -1,
96                                            "localdatabase_Descriptor.dscp",
97                                            "Local Database",
98                                            _T("Select image(s)        - Gimmick! (c) CREATIS-LRMN 2008"),
99                                            wxDefaultPosition,
100                                            wxSize(1200,800),
101                                            min_dim,
102                                            max_dim,
103                                            output_dim,
104                                            threads);
105            w.ShowModal();
106
107            if (w.GetReturnCode() == wxID_OK)
108                  {
109                    std::cout << "$$$$ main : user clicked 'OK' $$$$"<<std::endl;
110                    std::cout << "$$$$ selected files : "<<std::endl;
111                    //Puts filenames
112                    std::vector<std::string> s;
113                    w.GetSelectedFiles(s);
114                    std::vector<std::string>::iterator i;
115                    for (i=s.begin();i!=s.end();++i)
116                          {
117                            std::cout << *i << std::endl;
118                          }
119                    std::cout << "$$$$ "<<std::endl;
120
121                    //Puts images
122                    std::vector<vtkImageData*> images;
123                    w.GetSelectedImages(images,output_dim);
124                    std::cout<<images.size()<<std::endl;
125
126                    w.OnExit();
127                    return images[0];
128
129                    //crea::VtkBasicSlicer(images.front());
130                    //images.front()->Delete();
131
132
133                  }
134            else if (w.GetReturnCode() == wxID_CANCEL)
135                  {
136                    w.OnExit();
137                    std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<<std::endl;
138                  }
139            else
140                  {
141                    w.OnExit();
142                    std::cout << "$$$$ main : dialog ended without return code ! $$$$"
143                                          <<std::endl;
144                  }
145
146            //   std::cout << "$$$$ main : deleting dialog"<<std::endl;
147            //   delete w;
148            std::cout << "$$$$$$$$$$$$$$$$$$$$ main ended "<<std::endl;
149            return NULL;
150         }
151
152
153 */