2 #include "creaImageIOSimpleView.h"
4 #include <itkImageFileReader.h>
5 #include <boost/any.hpp>
12 /// Simple Wxwidgets interface to select file(s) or directory or from creaImageIO database to display
13 //EED class __declspec(dllexport) WxAnySimpleDlg : public wxDialog
14 class CREAIMAGEIO_EXPORT WxAnySimpleDlg : public wxDialog
18 WxAnySimpleDlg( wxWindow *parent,
19 wxString i_title =_T(""),
20 const std::string i_namedescp = "localdatabase_Descriptor.dscp",
21 const std::string i_namedb = "Local Database"
26 void setExts(std::vector<std::string>);
27 /// Callback to read file(s)
28 void OnReadFile(wxCommandEvent& event);
30 /// Callback to read directory, no recursive
31 void OnReadDirectory(wxCommandEvent &event);
33 /// Callback to select from creaImageIO database
34 void OnReadGimmick(wxCommandEvent &event);
36 /// return a vtkImageData vector of selected images, if available
37 std::vector<vtkImageData*> getVtkImagesSelected() {return m_Vresults;}
39 wxString getInfoImage();
42 void set(bool i_dicom){m_dicom= i_dicom;}
43 std::vector <boost::any>& getImagesSelected(){ return m_AnyImages;}
45 // return the size of readed images
46 std::vector<const size_t> getDims(){ return m_AnyDims;}
48 // return the type of readed images
49 std::vector<const std::type_info *> getTypes(){ return m_AnyType;}
51 // get an Image on wanted type
52 template <typename TImage>
53 typename TImage::Pointer getImage(boost::any i_AnyImage)
55 typedef itk::Image<TImage> ImageOut;
56 typename ImageOut::Pointer img = ImageOut::New();
57 img = boost::any_cast< ImageOut::Pointer>(i_AnyImage);
61 // get the images on itk type defined by user
62 template <typename TImage>
63 std::vector<typename TImage::Pointer> getTemplatedImagesSelected()
65 std::vector<typename TImage::Pointer> imgs;
66 std::vector<boost::any>::iterator it = m_AnyImages.begin();
67 for(; it != m_AnyImages.end(); it++)
69 imgs.push_back(boost::any_cast<TImage*> (*it));
77 std::vector<const size_t> m_AnyDims;
78 std::vector<const std::type_info *> m_AnyType;
79 std::vector<boost::any> m_AnyImages;
80 std::vector<std::string> m_exts;
81 std::string namedescp;
85 template <class TImage>
86 void split3Din3Dvtk(TImage* i_Img);
88 template <typename TImage>
89 void split4Din3Dvtk(TImage* i_Img);
92 /// interface to read data
94 void readImg(const std::string &i_name);
95 void readDicomImg(const std::vector<std::string> &i_names);
96 std::vector <vtkImageData*> m_Vresults;
98 const size_t getNumberOfDimensions(const std::string &i_name);
99 const std::type_info & getType(const std::string &i_name);