]> Creatis software - creaImageIO.git/blob - src/creaImageIOWxIsimpleDlg.h
#3185 creaImageIO Feature New Normal - Clean code
[creaImageIO.git] / src / creaImageIOWxIsimpleDlg.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 __creaImageIOWxIsimpleDlg_h_INCLUDED__
30 #define __creaImageIOWxIsimpleDlg_h_INCLUDED__
31
32
33 #include "creaImageIOSimpleView.h"
34 #include "itkImageToVTKImageFilter.h"
35 #include <creaWx.h>
36 #include <itkImageFileReader.h>
37 #include <boost/any.hpp>
38 namespace creaImageIO
39 {
40  /**
41    * \ingroup View
42    */
43
44         /// Simple Wxwidgets interface to select file(s) or directory or from creaImageIO database to display
45         template <typename TImage> 
46         class  __declspec(dllexport) WxISimpleDlg : public wxDialog
47         {
48         public:
49                  /// Ctor
50                   WxISimpleDlg( wxWindow *parent,  
51                           wxString i_title =_T(""),
52                           const std::string i_namedescp = "localdatabase_Descriptor.dscp",   
53                           const std::string i_namedb   = "Local Database"     
54                           );
55
56                   ~WxISimpleDlg(){};
57
58                   void setExts(std::vector<std::string>);
59                   /// Callback to read file(s)
60                   void OnReadFile(wxCommandEvent& event);
61
62                   /// Callback to read directory, no recursive
63                    void OnReadDirectory(wxCommandEvent &event);
64               
65                   /// Callback to select from creaImageIO database
66                    void OnReadGimmick(wxCommandEvent &event);
67
68                    /// return a vtkImageData vector of selected images, if available
69                    std::vector<vtkImageData*> getVtkImagesSelected() {return m_Vresults;}
70
71                         /// return a itkImage vector of selected images, if available
72                         std::vector<typename TImage::Pointer> getImagesSelected();
73                 
74
75                    wxString getInfoImage();
76
77                    void split4Din3Dvtk(const std::string &i_dir);
78                    void split3Din3Dvtk( );
79                    void set(bool i_dicom){m_dicom= i_dicom;}
80                    std::vector <boost::any>& getAnyImages(){ return m_AnyImages;}
81         private:
82
83                 std::vector<boost::any> m_AnyImages;
84                 std::vector<std::string> m_exts;
85                 std::string namedescp; 
86                 std::string namedb;
87                 wxString infoimage;
88                 bool m_dicom;
89                 /// interface to read data
90                 SimpleView m_view;
91                  void readImg(const std::string &i_name);
92                  void readDicomImg(const std::vector<std::string> &i_names);
93
94                  std::vector <typename TImage::Pointer> m_Iresults;
95
96                  std::vector <vtkImageData*> m_Vresults;
97
98         };
99
100
101 }
102
103
104 #endif //__creaImageIOWxIsimpleDlg_h_INCLUDED__