Simple Wxwidgets interface to select file(s) or directory or from creaImageIO database to display. More...
#include <creaImageIOWxSimpleDlg.h>
Public Member Functions | |
WxSimpleDlg (wxWindow *parent, wxString i_title=_T(""), const std::string i_namedescp="localdatabase_Descriptor.dscp", const std::string i_namedb="Local Database") | |
Ctor. | |
~WxSimpleDlg () | |
Dtor. | |
void | OnReadFile (wxCommandEvent &event) |
Callback to read file(s). | |
void | OnReadDirectory (wxCommandEvent &event) |
Callback to read directory, no recursive. | |
void | OnReadGimmick (wxCommandEvent &event) |
Callback to select from creaImageIO database. | |
std::vector< vtkImageData * > | getImagesSelected () |
return a vtkImageData vector of selected images, if available | |
wxString | getInfoImage () |
Private Attributes | |
std::string | namedescp |
std::string | namedb |
wxString | infoimage |
SimpleView | m_view |
interface to read data | |
std::vector< vtkImageData * > | m_results |
vtkImageData vector |
Simple Wxwidgets interface to select file(s) or directory or from creaImageIO database to display.
Definition at line 11 of file creaImageIOWxSimpleDlg.h.
creaImageIO::WxSimpleDlg::WxSimpleDlg | ( | wxWindow * | parent, | |
wxString | i_title = _T("") , |
|||
const std::string | i_namedescp = "localdatabase_Descriptor.dscp" , |
|||
const std::string | i_namedb = "Local Database" | |||
) |
Ctor.
Button to select Bruker directory
Definition at line 6 of file creaImageIOWxSimpleDlg.cpp.
References OnReadDirectory(), OnReadFile(), and OnReadGimmick().
{ WxSimpleDlg::WxSimpleDlg(wxWindow *parent, wxString i_title, const std::string i_namedescp , const std::string i_namedb) : wxDialog(parent, -1,_T("SELECT IMAGE(S)"), wxDefaultPosition, wxSize(230,150)) { namedescp = i_namedescp; namedb = i_namedb; if(!i_title.empty()) { this->SetTitle(i_title); } // Button to select file(s) wxButton *fileBut = new wxButton(this, -1,_T("Select a single file"), 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 all the files in a directory"), 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 thru Dicom browser"), wxPoint(10,70) ); Connect( gimmickBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadGimmick );
creaImageIO::WxSimpleDlg::~WxSimpleDlg | ( | ) | [inline] |
std::vector< vtkImageData * > creaImageIO::WxSimpleDlg::getImagesSelected | ( | ) |
return a vtkImageData vector of selected images, if available
Definition at line 150 of file creaImageIOWxSimpleDlg.cpp.
Referenced by getImageDataDialog().
wxString creaImageIO::WxSimpleDlg::getInfoImage | ( | ) |
Definition at line 142 of file creaImageIOWxSimpleDlg.cpp.
Referenced by getImageDataDialog().
void creaImageIO::WxSimpleDlg::OnReadDirectory | ( | wxCommandEvent & | event | ) |
Callback to read directory, no recursive.
Definition at line 77 of file creaImageIOWxSimpleDlg.cpp.
Referenced by WxSimpleDlg().
{ int resultShowModal; long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST; wxDirDialog* dirDlg = new wxDirDialog( 0, _T("Select the directory to display"), _T(""), style); resultShowModal = dirDlg->ShowModal(); if ( resultShowModal==wxID_OK ) { infoimage=_T("DIRECTORY:")+dirDlg->GetPath(); if(! m_view.readDirectory(crea::wx2std(dirDlg->GetPath()),m_results)) { //TO DO WARNING MESSAGE;
void creaImageIO::WxSimpleDlg::OnReadFile | ( | wxCommandEvent & | event | ) |
Callback to read file(s).
Definition at line 39 of file creaImageIOWxSimpleDlg.cpp.
Referenced by WxSimpleDlg().
{ int resultShowModal; wxFileDialog* fileDlg = new wxFileDialog( 0, _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxOPEN |wxFD_MULTIPLE, wxDefaultPosition); resultShowModal = fileDlg->ShowModal(); if ( resultShowModal==wxID_OK ) { wxArrayString wxArray; fileDlg->GetPaths(wxArray); if(wxArray.size() >0) { /* typedef itk::Image< float, 4 > ImageType; ReadImage<ImageType>(crea::wx2std(wxArray[0]).c_str());*/ infoimage=_T("FILE(s):")+wxArray[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
void creaImageIO::WxSimpleDlg::OnReadGimmick | ( | wxCommandEvent & | event | ) |
Callback to select from creaImageIO database.
Definition at line 101 of file creaImageIOWxSimpleDlg.cpp.
Referenced by WxSimpleDlg().
{ // Run Gimmick WxGimmickReaderDialog dlg(0,-1, namedescp, namedb, _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) { // infoimage=_T("DICOM: ???_EED_???"); //EED 07JUIN2010 dlg.GetSelectedImages(m_results,3); std::vector<creaImageIO::OutStrGimmick> out; std::vector<std::string> attr; // attr.push_back("D0028_0010"); // attr.push_back("D0008_0023"); // attr.push_back("D0008_1070"); dlg.stopReading(); dlg.getSelected(out, attr,true,""); // crea::VtkBasicSlicer(out.front().img); m_results.clear(); int size=out.size(); int ii; for (ii=0;ii<size;ii++) { m_results.push_back(out[ii].img); }
wxString creaImageIO::WxSimpleDlg::infoimage [private] |
Definition at line 41 of file creaImageIOWxSimpleDlg.h.
std::vector<vtkImageData*> creaImageIO::WxSimpleDlg::m_results [private] |
vtkImageData vector
Definition at line 47 of file creaImageIOWxSimpleDlg.h.
SimpleView creaImageIO::WxSimpleDlg::m_view [private] |
interface to read data
Definition at line 44 of file creaImageIOWxSimpleDlg.h.
std::string creaImageIO::WxSimpleDlg::namedb [private] |
Definition at line 40 of file creaImageIOWxSimpleDlg.h.
std::string creaImageIO::WxSimpleDlg::namedescp [private] |
Definition at line 39 of file creaImageIOWxSimpleDlg.h.