--- /dev/null
+#include "creaImageIOWxSimpleDlg.h"
+#include "creaImageIOWxGimmickReaderDialog.h"
+
+
+namespace creaImageIO
+{
+
+ ///Ctor
+ WxSimpleDlg::WxSimpleDlg(wxWindow *parent, wxString i_title)
+ : wxDialog(parent, -1,_T("DISPLAY IMAGES"), wxDefaultPosition, wxSize(230,150))
+ {
+ if(!i_title.empty())
+ {
+ this->SetTitle(i_title);
+ }
+ // Button to select file(s)
+ wxButton *fileBut = new wxButton(this, -1,_T("Select a file to display"), wxPoint(10,7) );
+ Connect( fileBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadFile );
+
+ // Button to select directory
+ wxButton *directoryBut = new wxButton(this, -1,_T("Select a directory to display"), wxPoint(10,40) );
+ Connect( directoryBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadDirectory );
+
+ // button to select creaImageIO
+ wxButton *gimmickBut = new wxButton(this, -1,_T("Select Gimmick"), wxPoint(10,70) );
+ Connect( gimmickBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadGimmick );
+
+ //TO DO Button to select Bruker directory
+
+ Layout();
+
+ }
+//////////////////////////////////////////////////////////////////////
+// //
+//////////////////////////////////////////////////////////////////////
+ void WxSimpleDlg::OnReadFile(wxCommandEvent& event)
+ {
+ wxFileDialog* FD = new wxFileDialog( 0, _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxOPEN |wxFD_MULTIPLE, wxDefaultPosition);
+
+ if (FD->ShowModal()==wxID_OK)
+ {
+ wxArrayString wxArray;
+ FD->GetPaths(wxArray);
+ if(wxArray.size() >0)
+ {
+ std::vector<std::string> files;
+ for( int i = 0; i < wxArray.GetCount(); i++)
+ {
+ files.push_back( crea::wx2std(wxArray[i]));
+ }
+ if(!m_view.readFile(files,m_results))
+ {
+ //TO DO WARNING MESSAGE;
+ }
+ }
+ else
+ {
+ // TO DO WARNING MESSAGES
+ }
+ }
+ Close();
+ }
+
+ //////////////////////////////////////////////////////////////////////
+// //
+//////////////////////////////////////////////////////////////////////
+
+ void WxSimpleDlg::OnReadDirectory(wxCommandEvent &event)
+ {
+ long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
+ wxDirDialog* FD = new wxDirDialog( 0, _T("Select the directory to display"), "", style);
+
+ if (FD->ShowModal()==wxID_OK)
+ {
+ if(! m_view.readDirectory(crea::wx2std(FD->GetPath()),m_results))
+ {
+ //TO DO WARNING MESSAGE;
+ }
+ }
+ Close();
+ }
+
+ //////////////////////////////////////////////////////////////////////
+// //
+//////////////////////////////////////////////////////////////////////
+
+ void WxSimpleDlg::OnReadGimmick(wxCommandEvent &event)
+ {
+ // Run Gimmick
+ WxGimmickReaderDialog dlg(0,-1, "localdatabase_Descriptor.dscp",
+ "Local Database", _T("Select image(s) - Gimmick! (c) CREATIS-LRMN 2008"),
+ wxDefaultPosition,
+ wxSize(810,750),
+ GIMMICK_2D_IMAGE_SELECTION,
+ GIMMICK_3D_IMAGE_SELECTION,
+ _3D,
+ 1);
+ dlg.ShowModal();
+ if (dlg.GetReturnCode() == wxID_OK)
+ {
+ dlg.GetSelectedImages(m_results,3);
+ dlg.OnExit();
+ }
+ Close();
+ }
+
+
+ //////////////////////////////////////////////////////////////////////
+// Return the results vector //
+//////////////////////////////////////////////////////////////////////
+ std::vector<vtkImageData*> WxSimpleDlg::getImagesSelected()
+ {
+ return m_results;
+ }
+}
+