1 #include "creaImageIOWxSimpleDlg.h"
2 #include "creaImageIOWxGimmickReaderDialog.h"
8 WxSimpleDlg::WxSimpleDlg(wxWindow *parent,
10 const std::string i_namedescp ,
11 const std::string i_namedb)
12 : wxDialog(parent, -1,_T("DISPLAY IMAGES"), wxDefaultPosition, wxSize(230,150))
14 namedescp = i_namedescp;
19 this->SetTitle(i_title);
21 // Button to select file(s)
22 wxButton *fileBut = new wxButton(this, -1,_T("Select a file to display"), wxPoint(10,7) );
23 Connect( fileBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadFile );
25 // Button to select directory
26 wxButton *directoryBut = new wxButton(this, -1,_T("Select a directory to display"), wxPoint(10,40) );
27 Connect( directoryBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadDirectory );
29 // button to select creaImageIO
30 wxButton *gimmickBut = new wxButton(this, -1,_T("Select Gimmick"), wxPoint(10,70) );
31 Connect( gimmickBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadGimmick );
33 /// \TODO Button to select Bruker directory
38 //////////////////////////////////////////////////////////////////////
40 //////////////////////////////////////////////////////////////////////
41 void WxSimpleDlg::OnReadFile(wxCommandEvent& event)
44 wxFileDialog* fileDlg = new wxFileDialog( 0, _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxOPEN |wxFD_MULTIPLE, wxDefaultPosition);
46 resultShowModal = fileDlg->ShowModal();
47 if ( resultShowModal==wxID_OK )
49 wxArrayString wxArray;
50 fileDlg->GetPaths(wxArray);
53 infoimage=_T("FILE(s):")+wxArray[0];
54 std::vector<std::string> files;
55 for( int i = 0; i < wxArray.GetCount(); i++)
57 files.push_back( crea::wx2std(wxArray[i]));
59 if(!m_view.readFile(files,m_results))
61 //TO DO WARNING MESSAGE;
64 // TO DO WARNING MESSAGES
67 SetReturnCode( resultShowModal );
69 EndModal( resultShowModal );
72 //////////////////////////////////////////////////////////////////////
74 //////////////////////////////////////////////////////////////////////
76 void WxSimpleDlg::OnReadDirectory(wxCommandEvent &event)
79 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
80 wxDirDialog* dirDlg = new wxDirDialog( 0, _T("Select the directory to display"), _T(""), style);
82 resultShowModal = dirDlg->ShowModal();
83 if ( resultShowModal==wxID_OK )
85 infoimage=_T("DIRECTORY:")+dirDlg->GetPath();
86 if(! m_view.readDirectory(crea::wx2std(dirDlg->GetPath()),m_results))
88 //TO DO WARNING MESSAGE;
91 SetReturnCode( resultShowModal );
93 EndModal( resultShowModal );
96 //////////////////////////////////////////////////////////////////////
98 //////////////////////////////////////////////////////////////////////
100 void WxSimpleDlg::OnReadGimmick(wxCommandEvent &event)
103 WxGimmickReaderDialog dlg(0,-1,
106 _T("Select image(s) - Gimmick! (c) CREATIS-LRMN 2008"),
109 GIMMICK_2D_IMAGE_SELECTION,
110 GIMMICK_3D_IMAGE_SELECTION,
114 if (dlg.GetReturnCode() == wxID_OK)
116 // infoimage=_T("DICOM: ???_EED_???");
117 //EED 07JUIN2010 dlg.GetSelectedImages(m_results,3);
118 std::vector<creaImageIO::OutStrGimmick> out;
119 std::vector<std::string> attr;
120 // attr.push_back("D0028_0010");
121 // attr.push_back("D0008_0023");
122 // attr.push_back("D0008_1070");
124 dlg.getSelected(out, attr,true,"");
125 // crea::VtkBasicSlicer(out.front().img);
129 for (ii=0;ii<size;ii++)
131 m_results.push_back(out[ii].img);
136 SetReturnCode( dlg.GetReturnCode() );
138 EndModal( dlg.GetReturnCode() );
141 wxString WxSimpleDlg::getInfoImage()
146 //////////////////////////////////////////////////////////////////////
147 // Return the results vector //
148 //////////////////////////////////////////////////////////////////////
149 std::vector<vtkImageData*> WxSimpleDlg::getImagesSelected()