3 #ifndef __creaImageIOWxAnySimpleDlg_h_INCLUDED__
4 #define __creaImageIOWxAnySimpleDlg_h_INCLUDED__
8 #include "creaImageIOSimpleView.h"
10 #include <itkImageFileReader.h>
11 #include <boost/any.hpp>
19 /// Simple Wxwidgets interface to select file(s) or directory or from creaImageIO database to display
20 //EED class __declspec(dllexport) WxAnySimpleDlg : public wxDialog
21 class CREAIMAGEIO_EXPORT WxAnySimpleDlg : public wxDialog
25 WxAnySimpleDlg( wxWindow *parent,
26 wxString i_title =_T(""),
27 const std::string i_namedescp = "localdatabase_Descriptor.dscp",
28 const std::string i_namedb = "Local Database"
33 void setExts(std::vector<std::string>);
34 /// Callback to read file(s)
35 void OnReadFile(wxCommandEvent& event);
37 /// Callback to read directory, no recursive
38 void OnReadDirectory(wxCommandEvent &event);
40 /// Callback to select from creaImageIO database
41 void OnReadGimmick(wxCommandEvent &event);
43 /// return a vtkImageData vector of selected images, if available
44 std::vector<vtkImageData*> getVtkImagesSelected() {return m_Vresults;}
46 wxString getInfoImage();
48 void set(bool i_dicom){m_dicom= i_dicom;}
49 std::vector <boost::any>& getImagesSelected(){ return m_AnyImages;}
51 // return the size of readed images
52 std::vector</*const*/ size_t> getDims(){ return m_AnyDims;} // comment out const // JPR
54 // return the type of readed images
55 std::vector</*const */std::type_info *> getTypes(){ return m_AnyType;} // comment out const // JPR
57 // get an Image on wanted type
59 // strange compile error, commented out on Fred's advice // JPR
60 template <typename TImage>
61 typename TImage::Pointer getImage(boost::any i_AnyImage)
63 typedef itk::Image<TImage> ImageOut;
64 typename ImageOut::Pointer img = ImageOut::New();
65 img = boost::any_cast< ImageOut::Pointer>(i_AnyImage);
70 // get the images on itk type defined by user
71 template <typename TImage>
72 std::vector<typename TImage::Pointer> getTemplatedImagesSelected()
74 std::vector<typename TImage::Pointer> imgs;
75 std::vector<boost::any>::iterator it = m_AnyImages.begin();
76 for(; it != m_AnyImages.end(); it++)
78 imgs.push_back(boost::any_cast<TImage*> (*it));
85 // strange compile error with gcc 4.5.1-4 //JPR
86 std::vector</*const*/ size_t> m_AnyDims; //comment out const JPR
87 std::vector</*const*/ std::type_info *> m_AnyType; //comment out const JPR
88 std::vector<boost::any> m_AnyImages; //comment out const JPR
89 std::vector<std::string> m_exts;
90 std::string namedescp;
94 template <class TImage>
95 void split3Din3Dvtk(TImage* i_Img);
97 template <typename TImage>
98 void split4Din3Dvtk(TImage* i_Img);
101 /// interface to read data
103 void readImg(const std::string &i_name);
104 void readDicomImg(const std::vector<std::string> &i_names);
105 std::vector <vtkImageData*> m_Vresults;
107 const size_t getNumberOfDimensions(const std::string &i_name);
108 const std::type_info & getType(const std::string &i_name);
114 #endif //__creaImageIOWxAnySimpleDlg_h_INCLUDED__