]> Creatis software - creaImageIO.git/blob - src/creaImageIOWxGimmickPanel.h
77e5aa0cc874ebb77a08ade5ce2cb3c6b977e5e9
[creaImageIO.git] / src / creaImageIOWxGimmickPanel.h
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 #ifndef __creaImageIOWxGimmickPanel_h_INCLUDED__
30 #define __creaImageIOWxGimmickPanel_h_INCLUDED__
31
32 #ifdef USE_WXWIDGETS
33
34 // Signal/slot mechanism for progress events
35 #include <boost/signal.hpp>
36 #include <boost/bind.hpp>
37
38 #include <creaImageIOWxGimmickView.h>
39 #include <creaWx.h>
40
41 namespace creaImageIO
42 {
43   /**
44    * \ingroup GUI
45    */
46   //=====================================================================
47  //=====================================================================
48   class  CREAIMAGEIO_EXPORT WxGimmickPanel : public wxPanel
49   {
50   public:
51     WxGimmickPanel();    
52     WxGimmickPanel(wxWindow *parent, 
53                    const wxWindowID id,
54                    const wxPoint& pos, 
55                    const wxSize& size,
56                    const std::string i_namedescp , 
57                    const std::string i_namedb = "Local Database",
58                    int threads = 0);
59     
60     ~WxGimmickPanel();
61
62       //=============================================
63       typedef boost::signal<void (bool)> SendImageSignalType;
64       typedef SendImageSignalType::slot_function_type SendImageCallbackType;
65       //=============================================
66
67      //==================================================================
68       /// Adds the function f to the list of functions to call 
69       /// when the addition progresses.
70       /// f is of type ProgressCallbackType which is:
71       /// void (*ProgressCallbackType)(Progress&)
72       /// To pass a member function 'f' of an instance 'c' of a class 'C' 
73       /// as callback you have to 'bind' it, i.e. call:
74       /// ConnectSendImageObserver ( boost::bind( &C::f , c, _1 ) );
75       void ConnectSendImageObserver(SendImageCallbackType callback);
76      //==================================================================
77
78         //===============================================================================================
79         //Image Selection
80         //===============================================================================================
81
82     void GetSelectedImages(std::vector<vtkImageData*>& s, int dim)
83     { 
84         mView->GetSelectedImages(s, dim); 
85     }
86
87 //EED 28mai2010      Use new mechanism getSelected
88 //    void GetSelectedImagesInVector(std::vector<vtkImageData*>& s, int dim)
89 //    { 
90 //      mView->GetSelectedImagesInVector(s, dim); 
91 //    }
92
93
94         // ----get selected files in an Output structure-------
95         // out: vector structure output  < <img, info>, ... >
96         // i_attr: list of dicom tags to extract 
97         // mult: information of one file or multiple files
98         // outmodel: xml-filename that specifies images order..(todo) 
99         void getSelected(std::vector<OutStrGimmick> &outG,std::vector< std::string> i_attr, bool mult, const std::string outmodel)
100         {
101                 mView->getSelectedFiles(outG, i_attr, mult, outmodel);
102         }
103
104     void OnSelectedImage(bool t);
105
106     void AddImagesToDB(std::string dir);
107
108     //    DECLARE_EVENT_TABLE();
109   private :
110     
111         boost::shared_ptr<Gimmick>       mGimmick;
112     WxGimmickView* mView;
113
114         ///The sendImage signal
115     SendImageSignalType mSendImageSignal;
116
117   }; // class WxGimmickPanel
118   //=====================================================================
119
120   
121 } // EO namespace creaImageIO
122
123
124 #endif // USE_WIDGETS
125 // EOF
126 #endif