creaImageIO_lib
creaImageIO::WxSimpleDlg Class Reference

Simple Wxwidgets interface to select file(s) or directory or from creaImageIO database to display. More...

#include <creaImageIOWxSimpleDlg.h>

Inheritance diagram for creaImageIO::WxSimpleDlg:
Collaboration diagram for creaImageIO::WxSimpleDlg:

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. More...
 
 ~WxSimpleDlg ()
 Dtor. More...
 
void OnReadFile (wxCommandEvent &event)
 Callback to read file(s) More...
 
void OnReadDirectory (wxCommandEvent &event)
 Callback to read directory, no recursive. More...
 
void OnReadGimmick (wxCommandEvent &event)
 Callback to select from creaImageIO database. More...
 
std::vector< vtkImageData * > getImagesSelected ()
 return a vtkImageData vector of selected images, if available More...
 
wxString getInfoImage ()
 
void setInfo (bool i_val)
 
std::vector
< creaImageIO::OutStrGimmick
getMapInfos ()
 

Private Attributes

bool bInfo
 
std::string namedescp
 
std::string namedb
 
wxString infoimage
 
SimpleView m_view
 interface to read data More...
 
std::vector< vtkImageData * > m_results
 vtkImageData vector More...
 
std::vector
< creaImageIO::OutStrGimmick
m_resultsInfo
 

Detailed Description

Simple Wxwidgets interface to select file(s) or directory or from creaImageIO database to display.

Definition at line 38 of file creaImageIOWxSimpleDlg.h.

Constructor & Destructor Documentation

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 36 of file creaImageIOWxSimpleDlg.cpp.

References bInfo, namedb, namedescp, OnReadDirectory(), OnReadFile(), and OnReadGimmick().

40  : wxDialog(parent, -1,_T("SELECT IMAGE(S)"), wxDefaultPosition, wxSize(230,150))
41  {
42  namedescp = i_namedescp;
43  namedb = i_namedb;
44 
45  if(!i_title.empty())
46  {
47  this->SetTitle(i_title);
48  }
49  // Button to select file(s)
50  wxButton *fileBut = new wxButton(this, -1,_T("Select a single file"), wxPoint(10,7) );
51  Connect( fileBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadFile );
52 
53  // Button to select directory
54  wxButton *directoryBut = new wxButton(this, -1,_T("Select all the files in a directory"), wxPoint(10,40) );
55  Connect( directoryBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadDirectory );
56 
57  // button to select creaImageIO
58  wxButton *gimmickBut = new wxButton(this, -1,_T("Select thru Dicom browser"), wxPoint(10,70) );
59  Connect( gimmickBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadGimmick );
60 
62  bInfo = false;
63  Layout();
64 
65  }

Here is the call graph for this function:

creaImageIO::WxSimpleDlg::~WxSimpleDlg ( )
inline

Dtor.

Definition at line 48 of file creaImageIOWxSimpleDlg.h.

48 {};

Member Function Documentation

std::vector< vtkImageData * > creaImageIO::WxSimpleDlg::getImagesSelected ( )

return a vtkImageData vector of selected images, if available

Definition at line 187 of file creaImageIOWxSimpleDlg.cpp.

References m_results.

Referenced by getImageDataDialog().

188  {
189  return m_results;
190  }

Here is the caller graph for this function:

wxString creaImageIO::WxSimpleDlg::getInfoImage ( )

Definition at line 179 of file creaImageIOWxSimpleDlg.cpp.

References infoimage.

Referenced by getImageDataDialog().

180  {
181  return infoimage;
182  }

Here is the caller graph for this function:

std::vector<creaImageIO::OutStrGimmick> creaImageIO::WxSimpleDlg::getMapInfos ( )
inline

Definition at line 69 of file creaImageIOWxSimpleDlg.h.

Referenced by getImagesInfoDialog().

69 {return m_resultsInfo;}

Here is the caller graph for this function:

void creaImageIO::WxSimpleDlg::OnReadDirectory ( wxCommandEvent &  event)

Callback to read directory, no recursive.

Definition at line 110 of file creaImageIOWxSimpleDlg.cpp.

References infoimage, m_results, m_view, and creaImageIO::SimpleView::readDirectory().

Referenced by WxSimpleDlg().

111  {
112  int resultShowModal;
113  long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
114  wxDirDialog* dirDlg = new wxDirDialog( 0, _T("Select the directory to display"), _T(""), style);
115 
116  resultShowModal = dirDlg->ShowModal();
117  if ( resultShowModal==wxID_OK )
118  {
119  m_results.clear();
120  infoimage=_T("DIRECTORY:")+dirDlg->GetPath();
121  if(! m_view.readDirectory(crea::wx2std(dirDlg->GetPath()),m_results))
122  {
123  //TO DO WARNING MESSAGE;
124  }
125  }
126  SetReturnCode( resultShowModal );
127 // Close();
128  EndModal( resultShowModal );
129  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxSimpleDlg::OnReadFile ( wxCommandEvent &  event)

Callback to read file(s)

Definition at line 69 of file creaImageIOWxSimpleDlg.cpp.

References infoimage, m_results, m_view, and creaImageIO::SimpleView::readFile().

Referenced by WxSimpleDlg().

70  {
71  int resultShowModal;
72  wxFileDialog* fileDlg = new wxFileDialog( 0, _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxOPEN |wxFD_MULTIPLE, wxDefaultPosition);
73 
74 printf("EED WxSimpleDlg::OnReadFile 1 \n");
75  resultShowModal = fileDlg->ShowModal();
76  if ( resultShowModal==wxID_OK )
77  {
78 printf("EED WxSimpleDlg::OnReadFile 2 \n");
79  wxArrayString wxArray;
80  fileDlg->GetPaths(wxArray);
81  if(wxArray.size() >0)
82  {
83 printf("EED WxSimpleDlg::OnReadFile 3 \n");
84  m_results.clear();
85  infoimage=_T("FILE(s):")+wxArray[0];
86  std::vector<std::string> files;
87  for( int i = 0; i < wxArray.GetCount(); i++)
88  {
89 printf("EED WxSimpleDlg::OnReadFile 4 \n");
90  files.push_back( crea::wx2std(wxArray[i]));
91  }
92  if(!m_view.readFile(files,m_results))
93  {
94  //TO DO WARNING MESSAGE;
95  }
96  } else {
97 printf("EED WxSimpleDlg::OnReadFile 5 \n");
98  // TO DO WARNING MESSAGES
99  }
100  }
101  SetReturnCode( resultShowModal );
102 // Close();
103  EndModal( resultShowModal );
104  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxSimpleDlg::OnReadGimmick ( wxCommandEvent &  event)

Callback to select from creaImageIO database.

Definition at line 135 of file creaImageIOWxSimpleDlg.cpp.

References _3D, bInfo, creaImageIO::WxGimmickReaderDialog::getSelected(), GIMMICK_2D_IMAGE_SELECTION, GIMMICK_3D_IMAGE_SELECTION, m_results, m_resultsInfo, namedb, namedescp, creaImageIO::WxGimmickReaderDialog::OnExit(), and creaImageIO::WxGimmickReaderDialog::stopReading().

Referenced by WxSimpleDlg().

136  {
137  // Run Gimmick
138  WxGimmickReaderDialog dlg(0,-1,
139  namedescp,
140  namedb,
141  _T("Select image(s) - Gimmick! (c) CREATIS-LRMN 2008"),
142  wxDefaultPosition,
143  wxSize(810,750),
146  _3D,
147  1);
148  dlg.ShowModal();
149  if (dlg.GetReturnCode() == wxID_OK)
150  {
151  std::vector<creaImageIO::OutStrGimmick> out;
152  std::vector<std::string> attr;
153  dlg.stopReading();
154  dlg.getSelected(out, attr,true,"");
155  m_results.clear();
156  int size=(int)out.size();
157 printf("EED WxSimpleDlg::OnReadGimmick size=%d \n");
158  int ii;
159  if(!bInfo)
160  {
161  for (ii=0;ii<size;ii++)
162  {
163  m_results.push_back(out[ii].img);
164  }
165  }
166  else
167  {
168  for (ii=0;ii<size;ii++)
169  {
170  m_resultsInfo.push_back(out[ii]);
171  }
172  }
173  dlg.OnExit();
174  }
175  SetReturnCode( dlg.GetReturnCode() );
176  EndModal( dlg.GetReturnCode() );
177  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxSimpleDlg::setInfo ( bool  i_val)
inline

Definition at line 64 of file creaImageIOWxSimpleDlg.h.

Referenced by getImagesInfoDialog().

64 {bInfo = i_val;}

Here is the caller graph for this function:

Member Data Documentation

bool creaImageIO::WxSimpleDlg::bInfo
private

Definition at line 72 of file creaImageIOWxSimpleDlg.h.

Referenced by OnReadGimmick(), and WxSimpleDlg().

wxString creaImageIO::WxSimpleDlg::infoimage
private

Definition at line 75 of file creaImageIOWxSimpleDlg.h.

Referenced by getInfoImage(), OnReadDirectory(), and OnReadFile().

std::vector<vtkImageData*> creaImageIO::WxSimpleDlg::m_results
private

vtkImageData vector

Definition at line 81 of file creaImageIOWxSimpleDlg.h.

Referenced by getImagesSelected(), OnReadDirectory(), OnReadFile(), and OnReadGimmick().

std::vector<creaImageIO::OutStrGimmick> creaImageIO::WxSimpleDlg::m_resultsInfo
private

Definition at line 83 of file creaImageIOWxSimpleDlg.h.

Referenced by OnReadGimmick().

SimpleView creaImageIO::WxSimpleDlg::m_view
private

interface to read data

Definition at line 78 of file creaImageIOWxSimpleDlg.h.

Referenced by OnReadDirectory(), and OnReadFile().

std::string creaImageIO::WxSimpleDlg::namedb
private

Definition at line 74 of file creaImageIOWxSimpleDlg.h.

Referenced by OnReadGimmick(), and WxSimpleDlg().

std::string creaImageIO::WxSimpleDlg::namedescp
private

Definition at line 73 of file creaImageIOWxSimpleDlg.h.

Referenced by OnReadGimmick(), and WxSimpleDlg().


The documentation for this class was generated from the following files: