creaImageIO_lib
creaImageIO::WxGimmickView Class Reference

Concrete derivative of GimmickView which implements a wxWidgets-based view. More...

#include <creaImageIOWxGimmickView.h>

Inheritance diagram for creaImageIO::WxGimmickView:
Collaboration diagram for creaImageIO::WxGimmickView:

Public Types

typedef int EventType
 
typedef std::map< std::string,
TreeView * > 
TreeViewMapType
 
typedef boost::signal< void(bool)> ValidationSignalType
 
typedef
ValidationSignalType::slot_function_type 
ValidationCallbackType
 
typedef std::vector
< DicomDatabase * > 
DicomDatabaseListType
 Type of list of DicomDatabase. More...
 

Public Member Functions

 WxGimmickView (boost::shared_ptr< Gimmick >, wxWindow *parent, const wxWindowID id, const wxPoint &pos, const wxSize &size, int min_dim=2, int max_dim=3, int number_of_threads=0)
 Ctor. More...
 
virtual ~WxGimmickView ()
 Virtual destructor. More...
 
void GetSelectedFiles (std::vector< std::string > &s)
 
void getSelectedFiles (std::vector< OutStrGimmick > &outG, std::vector< std::string > out_infos, bool mult=false, const std::string out_model="")
 Returns the selected files in output structure. More...
 
void GetSelectedImages (std::vector< vtkImageData * > &s, int dim)
 
void GetSelectedImagesInVector (std::vector< vtkImageData * > &s, int dim)
 Adds the selected Images to the given vector. More...
 
void GetImages (int dim, const std::vector< std::string > &files, std::vector< vtkImageData * > &s)
 
void OnSelectionChange (const std::vector< tree::Node * > &s, bool isSelection, int selection, bool mProcess)
 Callback called when a selection from a TreeView has changed. More...
 
void StopPlayer ()
 Stops the player. More...
 
void AddIgnoreFile (tree::Node *toRemove)
 Adds a file to ignore. More...
 
void ClearSelection ()
 Resets the default image. More...
 
void CopyFiles (const std::vector< std::string > &filenames)
 Copies selected files. More...
 
void AddDir (std::string dirName)
 Add selected files to the Database. More...
 
void ReadImageThreaded (const std::vector< tree::Node * > &sel)
 Sends a request to read the currently selected node and the ones that surround it. More...
 
void OnSaveSettingsCallback (const std::string &copyPath, const std::string &dbPath, const std::string &syncEvent, const std::string &syncFreq)
 Saves the settings to the file. More...
 
void OnListenerCallback (const std::string &drive, bool addFiles, bool removeFiles)
 Changes listener state. More...
 
void OnDriveMount (bool mount)
 Acts upon a drive mount. More...
 
void StartListeningThread ()
 Starts the listening thread on the CD/DVD drive. More...
 
void StopListeningThread ()
 Stops the listening thread on the CD/DVD drive. More...
 
void OnFieldsEdited (tree::Node *node, const std::string &name, const std::string &key, const std::string &val)
 Called upon when a field has been edited. More...
 
void GetVisibleAttributes (std::vector< std::string > &shown, std::vector< std::string > &nShown, int level)
 Called upon to return the visible attributes of the current tab. More...
 
void OnAttributesChanged (const std::vector< std::string > &nShown, int level)
 Called when there has been a change in the visible attributes of a tree view. More...
 
virtual void Initialize ()
 
TreeViewMapTypeGetTreeViewMap ()
 Returns the TreeViewMap (ref) More...
 
const TreeViewMapTypeGetTreeViewMap () const
 Returns the TreeViewMap (const ref) More...
 
virtual void Finalize ()
 Finalize. More...
 
int GetMaximalPriority ()
 Returns the maximal priority. More...
 
virtual void GetSelectedImages (std::vector< vtkImageData * > &)
 Returns the vector of images corresponding to selection. More...
 
virtual void GetImages (int dim, std::vector< std::string > files, std::vector< vtkImageData * > &s)
 
void Anonymize (std::vector< std::string > i_filenames, int type)
 Anonymize or de-anonymize data. More...
 
virtual void SaveAs (const std::vector< std::string > &filenames)
 Copies selected files. More...
 
bool NoValidateSelected ()
 No selected image. More...
 
bool ValidateSelected (tree::Node *sel, int min_dim, int max_dim)
 Validates the dimension compliance of the images with the maximum and minimum given, and between their sizes. More...
 
void ReadImagesNotThreaded (std::vector< vtkImageData * > &s, std::vector< std::string > files, int dim)
 Reads the vector of images, builds it in the dimension required and returns them in the supplied vector. More...
 
void ReadImagesNotThreadedInVector (std::vector< vtkImageData * > &s, std::vector< std::string > files, int dim)
 Reads the vector of images, builds it in the dimension required and returns them in the supplied vector. More...
 
void RequestReading (tree::Node *n, int prio, int selection_index, boost::shared_ptr< ImagePointerHolder > p)
 current selection (-1 if not in selection) More...
 
std::string GetMessage ()
 Obtains the message of the state. More...
 
void SetMessage (std::string mess)
 Obtains the message of the state. More...
 
void ResetExtent ()
 Resets the data of the extent and begins a new selection. More...
 
void CreateTreeViews ()
 Create the tree views. More...
 
void CreateSingleTreeView (std::string &i_name)
 Create a tree view with a given name. More...
 
virtual void UpdateTreeViewLevel (const std::string &, int l)
 
void OnMultiThreadImageReaderEvent (const std::string &filename, MultiThreadImageReaderUser::EventType t, vtkImageData *image)
 
vtkImageData * GetDefaultImage ()
 
void ConnectValidationObserver (ValidationCallbackType callback)
 
void modifyValidationSignal (bool ivalid)
 
void readImages (std::vector< OutStrGimmick > &o_output, std::vector< std::string > im, OutputAttr i_attr, int i_dim, double i_zspc)
 
bool isSingle (const std::string i_file)
 
void stopReader ()
 
virtual int GetSelectionSize ()
 Returns the size of the current selection. More...
 
virtual bool IsSelectionValid ()
 Returns true if there is a valid selection. More...
 
virtual void GetSelectedDicomNodes (std::vector< DicomNode * > &)
 Returns the vector of DicomNode corresponding to selection. More...
 
virtual DicomNode * GetDicomNodeOfItem (const TreeItemId &i)
 Returns the DicomNode corresponding to the tree item. More...
 
virtual DicomDatabaseListTypeGetDicomDatabaseList ()
 Returns the list of DicomDatabase open. More...
 
virtual const
DicomDatabaseListType
GetDicomDatabaseList () const
 Returns the list of DicomDatabase open (const) More...
 
virtual void LoadOrCreateFavoritesDatabase ()
 Loads or creates a favorites database. More...
 
void MultiThreadImageReaderEventLock ()
 
void MultiThreadImageReaderEventLock ()
 
void MultiThreadImageReaderEventUnlock ()
 
void MultiThreadImageReaderEventUnlock ()
 
wxMutex & GetMultiThreadImageReaderUserMutex ()
 
QMutex * GetMultiThreadImageReaderUserMutex ()
 

Public Attributes

OutStrGimmick m_out
 

Protected Member Functions

void CreateToolBar ()
 Creates the tool bar. More...
 
void CreateTreeView (TreeHandler *)
 Create the tree view for TreeHandler provided. More...
 
virtual void OpenOrNewDatabase (bool open)
 Opens an existing database, or else, creates a local database. More...
 
virtual void ShowHelp ()
 Shows the help. More...
 
virtual void RebuildView ()
 
virtual void UpdateDicomDatabaseView (DicomDatabase *)
 
virtual void UpdateDicomNodeView (DicomNode *n, const TreeItemId &parent)
 

Private Member Functions

void CreateIconList ()
 
void OnAddFiles (wxCommandEvent &event)
 Callback for adding files. More...
 
void OnAddDir (wxCommandEvent &event)
 Callback for adding dir. More...
 
void OnRemove (wxCommandEvent &event)
 Callback for removing files. More...
 
void OnSynchronize (wxCommandEvent &event)
 Callback for synchronization. More...
 
void OnSettings (wxCommandEvent &event)
 Callback for settings edition. More...
 
void OnTools (wxCommandEvent &event)
 Callback for settings edition. More...
 
void OnImportExport (wxCommandEvent &event)
 Callback for Import/Export images. More...
 
void ImportImages ()
 
void ExportImages ()
 
void CreateSettingsDialog (wxNotebook *nb, wxDialog *dial)
 Creates the settings dialog (the pages inside and the information) More...
 
void DisplayAddSummary ()
 Display a message box with the last addition statistics. More...
 
bool isNeedRecursive (std::string i_name)
 Test a directory to know if contains sub-directory to analyze. More...
 
int NumberFilesToAdd (const std::string &dirpath, bool recursive)
 Determines number of files potentially to add to database. More...
 
void OnAddProgress (Gimmick::AddProgress &)
 AddProgress Gimmick callback. More...
 
void UpdateWindowUI (long flags=wxUPDATE_UI_NONE)
 
void OnAddDB (wxCommandEvent &event)
 callback to add a database More...
 
void OnCreateDB (wxCommandEvent &event)
 Create a DB from an Attributes Descriptor files. More...
 
std::string ExtractName (const std::string &i_name)
 
void CreateEditFieldsDialog (tree::Node *node, std::vector< std::string > names, std::vector< std::string > keys)
 Edits the fields of a given node. More...
 
void DumpTags (const std::string i_filename)
 Display all Dicom Tags. More...
 
void ExportToStorage (const std::vector< std::string > i_filenames)
 Export from Storage to Storage. More...
 
void killProgress ()
 

Private Attributes

wxBoxSizer * mbottom_sizer
 
wxBoxSizer * msizer
 
bool mConstructed
 
wxToolBar * mToolBar
 The ToolBar and the tools. More...
 
wxToolBarToolBase * mToolAddFile
 
wxToolBarToolBase * mToolAddDir
 
wxToolBarToolBase * mToolRemove
 
wxToolBarToolBase * mToolAddDatabase
 
wxToolBarToolBase * mToolHelp
 
wxToolBarToolBase * mToolSynchronize
 
wxToolBarToolBase * mToolSettings
 
wxToolBarToolBase * mToolTools
 
wxSplitterWindow * mSplitter
 
wxPanel * mBottomPanel
 
wxStaticText * mText
 
wxNotebook * mNotebook
 
wxImageList * mIcon
 The list of icons. More...
 
boost::shared_ptr< GimmickmGimmick
 
ListenermListener
 
time_t mstart
 
wxProgressDialog * mProgressDialog
 Progress dialog. More...
 
int mSelectionMaxDimension
 The selection's maximum dimension. More...
 
int mSelectionMinDimension
 The selection's minimum dimension. More...
 
WxViewermViewer
 Image previewer. More...
 
tree::NodemCurImageItemToShow
 Currently Displayed Node. More...
 
std::vector< boost::shared_ptr
< ImagePointerHolder > > 
pointers
 
wxString mCurrentDirectory
 

Detailed Description

Concrete derivative of GimmickView which implements a wxWidgets-based view.

Definition at line 59 of file creaImageIOWxGimmickView.h.

Member Typedef Documentation

typedef std::vector<DicomDatabase*> creaImageIO::GimmickView::DicomDatabaseListType
inherited

Type of list of DicomDatabase.

Definition at line 64 of file OldcreaImageIOGimmickView.h.

Definition at line 63 of file creaImageIOWxGimmickView.h.

typedef std::map<std::string, TreeView*> creaImageIO::GimmickView::TreeViewMapType
inherited

Type of map from View name to TreeView* (This map is equivalent for Views of the TreeHandlerMap of Gimmick)

Definition at line 96 of file creaImageIOGimmickView.h.

typedef ValidationSignalType::slot_function_type creaImageIO::GimmickView::ValidationCallbackType
inherited

Definition at line 206 of file creaImageIOGimmickView.h.

typedef boost::signal<void (bool)> creaImageIO::GimmickView::ValidationSignalType
inherited

Definition at line 205 of file creaImageIOGimmickView.h.

Constructor & Destructor Documentation

creaImageIO::WxGimmickView::WxGimmickView ( boost::shared_ptr< Gimmick gimmick,
wxWindow *  parent,
const wxWindowID  id,
const wxPoint &  pos,
const wxSize &  size,
int  min_dim = 2,
int  max_dim = 3,
int  number_of_threads = 0 
)

Ctor.

fix warning: unused variable hsize

Definition at line 128 of file creaImageIOWxGimmickView.cpp.

References CreateIconList(), CreateToolBar(), creaImageIO::GimmickView::CreateTreeViews(), creaImageIO::GimmickView::GetDefaultImage(), GimmickDebugMessage, mbottom_sizer, mBottomPanel, mConstructed, mCurrentDirectory, mGimmick, mNotebook, mProgressDialog, mSelectionMaxDimension, mSelectionMinDimension, msizer, mSplitter, mText, mToolBar, mViewer, OnAddProgress(), pointers, creaImageIO::WxViewer::SetImageVector(), and creaImageIO::WxViewer::StartPlayer().

136  : wxPanel(parent,id,pos,size),
137  GimmickView(gimmick, number_of_threads),
138  mProgressDialog(0),
139  mConstructed(false)
140  {
141  GimmickDebugMessage(1,"WxGimmickView::WxGimmickView"
142  <<std::endl);
143  // Sets the current directory to the home dir
144  mCurrentDirectory = std2wx(gimmick->GetHomeDirectory());
145 
146 
147  // Connect the AddProgress callback
148  gimmick->ConnectAddProgressObserver
149  ( boost::bind( &WxGimmickView::OnAddProgress , this, _1 ) );
150 
151  // Create the list of icons (mIcon)
152  CreateIconList();
153 
154  // Global sizer
155  msizer = new wxBoxSizer(wxVERTICAL);
156 
157  // Create the tool bar
158  CreateToolBar();
159  msizer->Add( mToolBar, 0, wxGROW, 0);
160 
161  // Split part below toolbar into notebook for views and panel
162  // for preview, messages...
163  mSplitter = new wxSplitterWindow( this , -1);
164 
165  // Notebook
166  mNotebook = new wxNotebook(mSplitter,
167  -1, wxDefaultPosition, wxDefaultSize, 0);
168 
169  //Gimmick
170  mGimmick=gimmick;
171 
172  mSelectionMaxDimension = max_dim;
173  mSelectionMinDimension = min_dim;
174 
175  // Create the views
176  CreateTreeViews();
177 
178  // Bottom panel
179  mBottomPanel = new wxPanel(mSplitter,-1);
180 
181  mbottom_sizer = new wxBoxSizer(wxVERTICAL); //HORIZONTAL);
182 
183 
184  // Previewer
185  mViewer = new WxViewer(mBottomPanel, wxID_ANY, wxT("Gimmick! Viewer"),wxDefaultPosition, wxDefaultSize );
186  //pointers.push_back(new ImagePointerHolder(GetDefaultImage())
187  pointers.push_back(boost::shared_ptr<creaImageIO::ImagePointerHolder>(new ImagePointerHolder(GetDefaultImage())));
188 
190  mViewer->StartPlayer();
191 
192 
193  mbottom_sizer->Add(mViewer,1,wxGROW,1);
194  // mViewer->Show();
195 
196  mText = new wxStaticText(mBottomPanel, wxID_ANY, wxT("Welcome to Gimmick!"));
197  mbottom_sizer->Add(mText,0,wxGROW,0);
198 
199 
200 
201  mBottomPanel->SetSizer(mbottom_sizer);
202 
203  // Splitting
205  int hsize = size.GetHeight();
206 
207  int top_minsize = 450;
208  int bottom_minsize = 50;
209 
210  mSplitter->SetMinimumPaneSize( bottom_minsize );
211  mSplitter->SplitHorizontally( mNotebook, mBottomPanel,
212  top_minsize);
213 
214  msizer->Add( mSplitter, 1, wxGROW, 0);
215 
216  mProgressDialog=0;
217  SetSizer( msizer );
218  SetAutoLayout(true);
219  Layout();
220  //mListener=new Listener();
221  //mListener->ConnectObserver(boost::bind( &WxGimmickView::OnDriveMount, this, _1 ) );
222  //mListener->Create();
223  // mListener->Run();
224  // mListener->Pause();
225 
226  mConstructed = true;
227  }

Here is the call graph for this function:

creaImageIO::WxGimmickView::~WxGimmickView ( )
virtual

Virtual destructor.

Destructor.

Definition at line 232 of file creaImageIOWxGimmickView.cpp.

References GimmickDebugMessage, mIcon, mViewer, and creaImageIO::WxViewer::StopPlayer().

233  {
234  // stop the viewer before application exit.
235  mViewer->StopPlayer();
236  GimmickDebugMessage(1,"WxGimmickView::~WxGimmickView"
237  <<std::endl);
238  delete mIcon;
239  delete mViewer;
240  //if(mListener->IsAlive()) { mListener->Delete(); }
241  }

Here is the call graph for this function:

Member Function Documentation

void creaImageIO::WxGimmickView::AddDir ( std::string  dirName)

Add selected files to the Database.

Definition at line 863 of file creaImageIOWxGimmickView.cpp.

References DisplayAddSummary(), killProgress(), mCurrentDirectory, mGimmick, mNotebook, mProgressDialog, and creaImageIO::GimmickView::UpdateTreeViewLevel().

Referenced by creaImageIO::WxGimmickPanel::AddImagesToDB().

864  {
865  mProgressDialog = new wxProgressDialog(_T("Adding directory"),_T(""),1000,
866 
867 //EED this,
868  NULL,
869 
870  wxPD_ELAPSED_TIME |wxPD_CAN_ABORT );
871  mCurrentDirectory = crea::std2wx(dirName);
872  mGimmick->AddDir(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),dirName,true);
873  mProgressDialog->Pulse(_T("Updating view..."));
874 
875  UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
876  killProgress();
878  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::AddIgnoreFile ( tree::Node toRemove)
virtual

Adds a file to ignore.

Reimplemented from creaImageIO::GimmickView.

Definition at line 849 of file creaImageIOWxGimmickView.cpp.

References mGimmick, and mNotebook.

850  {
851  mGimmick->RemoveFile(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),toRemove);
852  // GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->UpdateLevel(1);
853  }
void creaImageIO::GimmickView::Anonymize ( std::vector< std::string >  i_filenames,
int  type 
)
inherited

Anonymize or de-anonymize data.

Definition at line 875 of file creaImageIOGimmickView.cpp.

Referenced by creaImageIO::WxTreeView::OnAnonymizer().

876 {
877  bool res = true;
878  std::vector<GDCM_NAME_SPACE::FileHelper *> filesH;
879  std::vector<std::string> suid;
880  std::map<std::string, std::string> msuid;
881  std::string tempuid = GDCM_NAME_SPACE::Util::CreateUniqueUID();
882  int i = 1;
883  std::vector<std::string>::iterator it = i_filenames.begin();
884  for(; it != i_filenames.end(); it++)
885  {
886 
887  GDCM_NAME_SPACE::File *file;
888  file = GDCM_NAME_SPACE::File::New( );
889  file->SetLoadMode( GDCM_NAME_SPACE::LD_ALL );
890  file->SetFileName( (*it).c_str() );
891  res = file->Load();
892  if ( !res )
893  {
894  std::cerr << "Sorry, " << (*it).c_str() <<" not a gdcm-readable "
895  << "DICOM / ACR File" <<std::endl;
896  file ->Delete();
897  //return 0;
898  }
899  std::cout << " ... is readable " << std::endl;
900 
901  // We need a gdcm::FileHelper, since we want to load the pixels
902  GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(file);
903 
904  uint8_t *imageData = fh->GetImageData();
905 
906  // Institution name
907  file->AddAnonymizeElement(0x0008, 0x0080, "*");
908  // Patient's name
909  file->AddAnonymizeElement(0x0010, 0x0010, "*");
910  // Patient's ID
911  file->AddAnonymizeElement( 0x0010, 0x0020,"1515" );
912  // Study Instance UID
913  file->AddAnonymizeElement(0x0020, 0x000d, tempuid );
914  // Telephone
915  file->AddAnonymizeElement(0x0010, 0x2154, "3615" );
916 
917  // Aware user will add here more fields to anonymize here
918 
919  // The gdcm::File is modified in memory
920 
921  file->AnonymizeFile();
922 
923 
924  i++;
925  fh->SetContentType(GDCM_NAME_SPACE::UNMODIFIED_PIXELS_IMAGE);
926 
927  fh->WriteDcmExplVR(file->GetFileName() +".ano1" );
928  std::cout << i <<" End Anonymize" << std::cout;
929  file->ClearAnonymizeList();
930  file->Delete();
931  fh->Delete();
932  }
933 }

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::ClearSelection ( )
virtual

Resets the default image.

Reimplemented from creaImageIO::GimmickView.

Definition at line 822 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::GetDefaultImage(), mViewer, pointers, creaImageIO::WxViewer::RefreshIfNecessary(), creaImageIO::GimmickView::ResetExtent(), and creaImageIO::WxViewer::SetImageVector().

Referenced by OnRemove().

823  {
824  pointers.clear();
825  pointers.push_back(boost::shared_ptr<creaImageIO::ImagePointerHolder>(new ImagePointerHolder(GetDefaultImage())));
826  //pointers.push_back(new ImagePointerHolder(GetDefaultImage()));
829  ResetExtent();
830  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::GimmickView::ConnectValidationObserver ( ValidationCallbackType  callback)
inherited

Adds the function f to the list of functions to call when the addition progresses. f is of type ProgressCallbackType which is: void (*ProgressCallbackType)(Progress&) To pass a member function 'f' of an instance 'c' of a class 'C' as callback you have to 'bind' it, i.e. call: ConnectValidationObserver ( boost::bind( &C::f , c, _1 ) );

Definition at line 867 of file creaImageIOGimmickView.cpp.

References creaImageIO::GimmickView::mValidationSignal.

Referenced by creaImageIO::WxGimmickPanel::WxGimmickPanel(), and creaImageIO::WxGimmickReaderDialog::WxGimmickReaderDialog().

868  {
869  mValidationSignal.connect(callback);
870  }

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::CopyFiles ( const std::vector< std::string > &  filenames)
virtual

Copies selected files.

Reimplemented from creaImageIO::GimmickView.

Definition at line 856 of file creaImageIOWxGimmickView.cpp.

References mGimmick, and mNotebook.

857  {
858  mGimmick->CopyFiles(filenames, crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())));
859  wxMessageBox(std2wx("The selected files have been copied"),_T("Copy files"),wxOK,this);
860  }
void creaImageIO::WxGimmickView::CreateEditFieldsDialog ( tree::Node node,
std::vector< std::string >  names,
std::vector< std::string >  keys 
)
privatevirtual

Edits the fields of a given node.

Reimplemented from creaImageIO::GimmickView.

Definition at line 1177 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::tree::Node::GetLabel().

1178  {
1179  wxDialog* dial= new wxDialog (this,-1,crea::std2wx("Edit Fields for node "+node->GetLabel()),wxDefaultPosition, wxSize(350,155));
1180  wxBoxSizer *siz = new wxBoxSizer(wxVERTICAL);
1181  WxEditFieldsPanel* ef = new WxEditFieldsPanel(dial, dial, this, node, names, keys);
1182 
1183  siz->Add( ef,1,wxGROW ,0);
1184  dial->SetSizer(siz);
1185  dial->ShowModal();
1186  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::CreateIconList ( )
private

Definition at line 464 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::Icon_accept, creaImageIO::Icon_add, creaImageIO::Icon_create_database, creaImageIO::Icon_database_add, creaImageIO::Icon_folder_down, creaImageIO::Icon_help, creaImageIO::icon_number, creaImageIO::Icon_page_down, creaImageIO::Icon_remove, creaImageIO::Icon_settings, creaImageIO::Icon_synchronize, creaImageIO::Icon_tools, and mIcon.

Referenced by WxGimmickView().

465  {
466  // Size of the icons;
467  int size = 16;
468 
469  wxIcon icons[20];
470  // should correspond to Icon_xxx enum
471  icons[Icon_accept] = wxIcon(accept_xpm);
472  icons[Icon_add] = wxIcon(add_xpm);
473  icons[Icon_folder_down] = wxIcon(folder_down_xpm);
474  icons[Icon_page_down] = wxIcon(page_down_xpm);
475  icons[Icon_remove] = wxIcon(remove_xpm);
476  icons[Icon_database_add] = wxIcon(database_add_xpm);
477  icons[Icon_help] = wxIcon(help_xpm);
478  icons[Icon_synchronize] = wxIcon(synchronize_xpm);
479  icons[Icon_create_database] = wxIcon(create_database_xpm);
480  icons[Icon_settings] = wxIcon(settings_xpm);
481  icons[Icon_tools] = wxIcon(tools_xpm);
482 
483  // unsigned int NbIcons = 8;
484  // Make an image list containing small icons
485  mIcon = new wxImageList(size,size,true);
486 
487  // Make all icons the same size = size of the first one
488  int sizeOrig = icons[0].GetWidth();
489  for ( size_t i = 0; i < icon_number; i++ )
490  {
491  if ( size == sizeOrig )
492  {
493  mIcon->Add(icons[i]);
494  }
495  else
496  {
497  mIcon->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size)));
498  }
499  }
500  }

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::CreateSettingsDialog ( wxNotebook *  nb,
wxDialog *  dial 
)
private

Creates the settings dialog (the pages inside and the information)

Definition at line 1046 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::GetTreeViewMap(), mGimmick, mNotebook, SETTINGS_COPY_PATH, SETTINGS_DBPATH, SETTINGS_SYNC_EVENT, and SETTINGS_SYNC_FREQ.

Referenced by OnSettings().

1047  {
1048  //First page: Customization of configurations
1049  //Copy Path string
1050  std::string cp;
1051  mGimmick->GetSetting(SETTINGS_COPY_PATH,cp);
1052  //Database Path String
1053  std::string dp;
1054  mGimmick->GetSetting(SETTINGS_DBPATH,dp);
1055  //Syncronization Event String
1056  std::string se;
1057  mGimmick->GetSetting(SETTINGS_SYNC_EVENT,se);
1058  //Syncronization Frequency String
1059  std::string sf;
1060  mGimmick->GetSetting(SETTINGS_SYNC_FREQ,sf);
1061 
1062  WxCustomizeConfigPanel * customConfig=new WxCustomizeConfigPanel(nb,dial,this,cp,dp,se,sf);
1063 
1064  nb->AddPage( customConfig, crea::std2wx("Customize Configuration") );
1065 
1066  //Second page: Creation of Databases
1067  /*wxPanel* databaseCreation=new wxPanel(nb);
1068  nb->AddPage( databaseCreation, crea::std2wx("Create Database") );*/
1069 
1070  //Second page (temporary): Connection to PACS
1071  WxPACSConnectionPanel* pacs=new WxPACSConnectionPanel(nb,dial, this);
1072  nb->AddPage( pacs, crea::std2wx("Connect to PACS") );
1073 
1074  //Third page: CD/DVD Watch
1075  WxListenerPanel* cdWatch=new WxListenerPanel(nb,dial, this,true);//, mListener->IsPaused());
1076  nb->AddPage( cdWatch, crea::std2wx("CD/DVD") );
1077 
1078  //Fourth page: Selection of attributes to show
1079  std::vector<std::string> shown;
1080  std::vector<std::string> nShown;
1081  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetAttributes(shown,nShown,1);
1082  int nLev=GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetNumberOfLevels();
1083  WxAttributeSelectionPanel* attSelection=new WxAttributeSelectionPanel(nb,dial,this,shown,nShown,nLev);
1084  nb->AddPage( attSelection, crea::std2wx("Selection of Attributes") );
1085  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::GimmickView::CreateSingleTreeView ( std::string &  i_name)
inherited

Create a tree view with a given name.

Definition at line 162 of file creaImageIOGimmickView.cpp.

References creaImageIO::GimmickView::CreateTreeView(), and creaImageIO::GimmickView::mGimmick.

Referenced by OnAddDB(), and OnCreateDB().

163  {
164  this->CreateTreeView(mGimmick->GetTreeHandlerMap()[i_name]);
165 
166  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::CreateToolBar ( )
protected

Creates the tool bar.

Definition at line 246 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::Icon_create_database, creaImageIO::Icon_database_add, creaImageIO::Icon_folder_down, creaImageIO::Icon_help, creaImageIO::Icon_page_down, creaImageIO::Icon_remove, creaImageIO::Icon_settings, creaImageIO::Icon_synchronize, creaImageIO::Icon_tools, mIcon, mToolAddDatabase, mToolAddDir, mToolAddFile, mToolBar, mToolHelp, mToolRemove, mToolSettings, mToolSynchronize, mToolTools, creaImageIO::TOOL_ADDDATABASE_ID, creaImageIO::TOOL_ADDDIR_ID, creaImageIO::TOOL_ADDFILES_ID, creaImageIO::TOOL_CREATEDB_ID, creaImageIO::TOOL_HELP_ID, creaImageIO::TOOL_PACS_ID, creaImageIO::TOOL_REMOVE_ID, creaImageIO::TOOL_SETTINGS_ID, creaImageIO::TOOL_SYNCHRONIZE_ID, and creaImageIO::TOOL_TOOLS_ID.

Referenced by WxGimmickView().

247  {
248  long style = wxTB_HORIZONTAL | wxNO_BORDER | wxTB_TEXT;
249  mToolBar = new wxToolBar(this,-1,wxDefaultPosition,wxDefaultSize,
250  style);
251 
253  _T("Add file(s)"),
254  mIcon->GetBitmap(Icon_page_down),
255  _T("Add one or more file to database")
256  );
257  mToolAddDir = mToolBar->AddTool( TOOL_ADDDIR_ID,
258  _T("Add folder"),
259  mIcon->GetBitmap(Icon_folder_down),
260  _T("Add the content of a folder to database")
261  );
263  _T("Open database"),
264  mIcon->GetBitmap(Icon_database_add),
265  _T("Open a local or distant database")
266  );
267  mToolRemove = mToolBar->AddTool( TOOL_REMOVE_ID,
268  _T("Remove"),
269  mIcon->GetBitmap(Icon_remove),
270  _T("Remove selected items")
271  );
273  _T("Synchronize"),
274  mIcon->GetBitmap(Icon_synchronize),
275  _T("Synchronizes the database with disk")
276  );
277  mToolHelp = mToolBar->AddTool( TOOL_HELP_ID,
278  _T("Help"),
279  mIcon->GetBitmap(Icon_help),
280  _T("Open help window")
281  );
283  _T("System settings"),
284  mIcon->GetBitmap(Icon_settings),
285  _T("Allows the modification of various system settings")
286  );
287  mToolTools = mToolBar->AddTool( TOOL_TOOLS_ID,
288  _T("Tools"),
289  mIcon->GetBitmap(Icon_tools),
290  _T("Applies tools to images")
291  );
293  _T("Create database"),
294  mIcon->GetBitmap(Icon_create_database),
295  _T("Create DB from an Attributes Descriptor file")
296  );
297 #if defined(BUILD_PACS)
298  mToolAddFile = mToolBar->AddTool( TOOL_PACS_ID,
299  _T("PACS Connection,"),
300  mIcon->GetBitmap(Icon_create_database),
301  _T("Echo, Find and Get to a PACS")
302  );
303 #endif
304  //const wxBitmap& bitmap1, const wxString& shortHelpString = "", wxItemKind kind = wxITEM_NORMAL)
305 
306  mToolBar->Realize();
307  }

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::CreateTreeView ( TreeHandler h)
protectedvirtual

Create the tree view for TreeHandler provided.

Create the tree view for TreeHandler provided (overloaded from GimmickView)

Reimplemented from creaImageIO::GimmickView.

Definition at line 313 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::tree::Node::GetAttribute(), creaImageIO::TreeHandler::GetTree(), creaImageIO::GimmickView::GetTreeViewMap(), GimmickMessage, and mNotebook.

314  {
315  std::string name(h->GetTree().GetAttribute("Name"));
316  GimmickMessage(2,"Creating the tree view for '"<<
317  name<<"'"<<std::endl);
318  // Create the WxTreeView
319  WxTreeView* view = new WxTreeView(h, this, mNotebook, -1);
320 
321  // TO DO : TEST THAT A VIEW WITH SAME NAME IS NOT
322  // ALREADY IN THE MAP
323  GetTreeViewMap()[name] = view;
324 
325  // Add Notebook page
326  mNotebook->AddPage( view, crea::std2wx(name) );
327 
328  }

Here is the call graph for this function:

void creaImageIO::GimmickView::CreateTreeViews ( )
inherited

Create the tree views.

Definition at line 149 of file creaImageIOGimmickView.cpp.

References creaImageIO::GimmickView::CreateTreeView(), GimmickMessage, and creaImageIO::GimmickView::mGimmick.

Referenced by WxGimmickView().

150  {
151  GimmickMessage(2,"Creating the tree views"<<std::endl);
152  Gimmick::TreeHandlerMapType::const_iterator i;
153  for (i = mGimmick->GetTreeHandlerMap().begin();
154  i!= mGimmick->GetTreeHandlerMap().end();
155  ++i)
156  {
157  this->CreateTreeView(i->second);
158  }
159  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::DisplayAddSummary ( )
private

Display a message box with the last addition statistics.

Definition at line 1266 of file creaImageIOWxGimmickView.cpp.

References mGimmick, and mstart.

Referenced by AddDir(), ExportToStorage(), OnAddDir(), OnAddFiles(), OnDriveMount(), and OnTools().

1267  {
1268  std::stringstream mess(mGimmick->getSummary());
1269  time_t end;
1270  time(&end);
1271  mess << "time to scan :" << difftime(end,mstart) << "sec";
1272  wxMessageBox(std2wx(mess.str()),_T("Addition result"),wxOK,this);
1273  }

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::DumpTags ( const std::string  i_filename)
privatevirtual

Display all Dicom Tags.

Reimplemented from creaImageIO::GimmickView.

Definition at line 1191 of file creaImageIOWxGimmickView.cpp.

1192  {
1193  WxDumpPanel* pan= new WxDumpPanel (this,i_filename);
1194  pan->ShowModal();
1195  }
void creaImageIO::WxGimmickView::ExportImages ( )
private

Definition at line 945 of file creaImageIOWxGimmickView.cpp.

Referenced by OnImportExport().

946  {
947  //Archive selection: name, emplacement
948  //same process than copy local but to a zip
949  // if settings are yes "always ask for descriptor addition", ask
950  // if settings are yes, adding descriptor
951  }

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::ExportToStorage ( const std::vector< std::string >  i_filenames)
privatevirtual

Export from Storage to Storage.

Reimplemented from creaImageIO::GimmickView.

Definition at line 1198 of file creaImageIOWxGimmickView.cpp.

References DisplayAddSummary(), creaImageIO::WxExportDlg::GetStorage(), ID_EXPORT_OK, killProgress(), mGimmick, mProgressDialog, and creaImageIO::GimmickView::UpdateTreeViewLevel().

1199  {
1200  std::vector<std::string> storages;
1201  Gimmick::TreeHandlerMapType::iterator it = mGimmick->GetTreeHandlerMap().begin();
1202  for(;it != mGimmick->GetTreeHandlerMap().end(); it++)
1203  {
1204  storages.push_back(it->first);
1205  }
1206 
1207  WxExportDlg* exp= new WxExportDlg(this,storages);
1208  if ( exp->ShowModal() ==ID_EXPORT_OK)
1209  {
1210  std::string storage = exp->GetStorage();
1211  mProgressDialog =
1212  new wxProgressDialog(_T("Adding file(s)"),
1213  _T(""),
1214  1000,
1215 
1216 //EED this,
1217  NULL,
1218 
1219  wxPD_ELAPSED_TIME |
1220  // wxPD_ESTIMATED_TIME |
1221  // wxPD_REMAINING_TIME |
1222  wxPD_CAN_ABORT );
1223  mGimmick->AddFiles(storage,i_filenames);
1224  mProgressDialog->Pulse(_T("Updating view..."));
1225  UpdateTreeViewLevel(storage,1);
1226  killProgress();
1227  DisplayAddSummary();
1228  }
1229  }

Here is the call graph for this function:

std::string creaImageIO::WxGimmickView::ExtractName ( const std::string &  i_name)
private
void creaImageIO::GimmickView::Finalize ( )
virtualinherited

Finalize.

Definition at line 141 of file creaImageIOGimmickView.cpp.

142  {
143  }
vtkImageData* creaImageIO::GimmickView::GetDefaultImage ( )
inlineinherited

Definition at line 202 of file creaImageIOGimmickView.h.

References creaImageIO::MultiThreadImageReader::GetImage(), and creaImageIO::GimmickView::mReader.

Referenced by ClearSelection(), creaImageIO::GimmickView::OnMultiThreadImageReaderEvent(), ReadImageThreaded(), and WxGimmickView().

202 { return mReader.GetImage(""); }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual DicomDatabaseListType& creaImageIO::GimmickView::GetDicomDatabaseList ( )
inlinevirtualinherited

Returns the list of DicomDatabase open.

Definition at line 66 of file OldcreaImageIOGimmickView.h.

67  { return null; }
virtual const DicomDatabaseListType& creaImageIO::GimmickView::GetDicomDatabaseList ( ) const
inlinevirtualinherited

Returns the list of DicomDatabase open (const)

Definition at line 69 of file OldcreaImageIOGimmickView.h.

70  { return null; }
virtual DicomNode* creaImageIO::GimmickView::GetDicomNodeOfItem ( const TreeItemId &  i)
virtualinherited

Returns the DicomNode corresponding to the tree item.

void creaImageIO::WxGimmickView::GetImages ( int  dim,
const std::vector< std::string > &  files,
std::vector< vtkImageData * > &  s 
)

Returns the images indicated by the filenames in the vector so that they comply with the given parameter(dim)

Definition at line 454 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::ReadImagesNotThreaded().

457  {
458  ReadImagesNotThreaded(s,files,dim);
459  }

Here is the call graph for this function:

virtual void creaImageIO::GimmickView::GetImages ( int  dim,
std::vector< std::string >  files,
std::vector< vtkImageData * > &  s 
)
inlinevirtualinherited

Definition at line 121 of file creaImageIOGimmickView.h.

References GimmickError.

122  { GimmickError("INTERNAL ERROR : GetImages not implemented"); }
int creaImageIO::GimmickView::GetMaximalPriority ( )
inlineinherited

Returns the maximal priority.

Definition at line 108 of file creaImageIOGimmickView.h.

References creaImageIO::MultiThreadImageReader::GetMaximalPriority(), and creaImageIO::GimmickView::mReader.

Referenced by ReadImageThreaded().

108 {return mReader.GetMaximalPriority();}

Here is the call graph for this function:

Here is the caller graph for this function:

std::string creaImageIO::GimmickView::GetMessage ( )
inlineinherited

Obtains the message of the state.

Definition at line 175 of file creaImageIOGimmickView.h.

References creaImageIO::GimmickView::mMess.

Referenced by OnSelectionChange().

175 {return mMess;}

Here is the caller graph for this function:

wxMutex& creaImageIO::MultiThreadImageReaderUser::GetMultiThreadImageReaderUserMutex ( )
inlineinherited
QMutex* creaImageIO::MultiThreadImageReaderUser::GetMultiThreadImageReaderUserMutex ( )
inlineinherited

Definition at line 85 of file creaImageIOQMultiThreadImageReader.h.

virtual void creaImageIO::GimmickView::GetSelectedDicomNodes ( std::vector< DicomNode * > &  )
inlinevirtualinherited

Returns the vector of DicomNode corresponding to selection.

Definition at line 58 of file OldcreaImageIOGimmickView.h.

58 { return; }
void creaImageIO::WxGimmickView::GetSelectedFiles ( std::vector< std::string > &  s)
virtual

Returns the selected files (overloaded from GimmickView)

Reimplemented from creaImageIO::GimmickView.

Definition at line 447 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::GetTreeViewMap(), and mNotebook.

448  {
449  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetSelectedAsString(s);
450  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::getSelectedFiles ( std::vector< OutStrGimmick > &  outG,
std::vector< std::string >  i_attr,
bool  mult = false,
const std::string  out_model = "" 
)

Returns the selected files in output structure.

By default if out_infos is empty, we dont' provide informations, we return only vtkImageData if out_infos has only one entry "all" we provide all database informations

Definition at line 357 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::OutputAttr::db, creaImageIO::GimmickView::GetTreeViewMap(), creaImageIO::GimmickView::isSingle(), mGimmick, mNotebook, creaImageIO::OutputModel::orderFilesWithZspacing(), creaImageIO::GimmickView::readImages(), SETTINGS_OUTPUT_ASK, and SETTINGS_OUTPUT_DIM.

359  {
360  // First we select the files
361  std::vector<std::string> files;
362  std::string db_name = crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()));
363  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetSelectedAsString(files);
364 
365  std::string asking;
366  std::string dim;
367  bool bsingle = isSingle(files.front());
368  int i_dim_out;
369  mGimmick->GetSetting(SETTINGS_OUTPUT_ASK, asking);
370  mGimmick->GetSetting(SETTINGS_OUTPUT_DIM, dim);
371 
372  if (asking == "true")
373  {
374  // display the output dialog box
375  // get dim
376  int idim;
377  sscanf(dim.c_str(),"%d",&idim);
378  WxOutputDlg *dlg = new WxOutputDlg(this,files, idim -1, bsingle);
379  if (dlg->ShowModal() == wxID_OK)
380  {
381  dim = dlg->getDim();
382  mGimmick->UpdateSetting(SETTINGS_OUTPUT_ASK, dlg->getAsking());
383  mGimmick->UpdateSetting(SETTINGS_OUTPUT_DIM, dim);
384  }
385  else
386  {
387  return;
388  }
389  }
390  else
391  {
392  }
393  sscanf(dim.c_str(),"%d",&i_dim_out);
394 
395 
396  // Next we create the structure for dicom output infos
397  OutputAttr Oattr;
398  Oattr.db = crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()));
399  if(i_attr.empty())
400  {
401  // We don't send informations!
402  }
403  else if( i_attr.size() == 1 && i_attr.front() == "ALL")
404  {
405  // we send all database
406  Oattr.inside.push_back("ALL");
407  }
408  else if( (i_attr.size() == 1 && i_attr.front() != "ALL")
409  || (i_attr.size() >1) )
410  {
411  mGimmick->fillVectInfos(i_attr, Oattr);
412  }
413  else
414  {
415  // nothing
416  }
417 
418  // Next we create model and sort files
419  std::vector<std::string> sort_files(files);
420  double zspacing = 1;
421  if( !out_model.empty() )
422  {
423  /* OutputModel mod(out_model);
424  mGimmick->isAttributeExist(db_name, mod);
425  mod.sort(files, sort_files);
426  */}
427 
428  if ( sort_files.size() > 1 && ( (bsingle && i_dim_out == 1) || (!bsingle && i_dim_out ==3) ) )
429  {
430  OutputModel *mod = new OutputModel();
431  zspacing = mod->orderFilesWithZspacing(sort_files);
432  delete mod;
433  }
434  // Now we read and create the waiting output (vtkImageData * or OutGimmickData *)
435  readImages(outG, sort_files, Oattr, i_dim_out, zspacing);
436  }

Here is the call graph for this function:

virtual void creaImageIO::GimmickView::GetSelectedImages ( std::vector< vtkImageData * > &  )
inlinevirtualinherited

Returns the vector of images corresponding to selection.

Definition at line 56 of file OldcreaImageIOGimmickView.h.

56 { return; }
void creaImageIO::WxGimmickView::GetSelectedImages ( std::vector< vtkImageData * > &  s,
int  dim 
)
virtual

Returns the selected Images so that they comply with the given parameter(4D) (overloaded from GimmickView)

Reimplemented from creaImageIO::GimmickView.

Definition at line 331 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::GetTreeViewMap(), and mNotebook.

332  {
333  std::vector<std::string> files;
334  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetSelectedAsString(files);
335  //ReadImagesNotThreaded(s, files, dim);
336 
337 
338  std::string db_name = crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()));
339  // ReadImagesNotThreadedInfosInVector(db_name,output, files,dim,1);
340  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::GetSelectedImagesInVector ( std::vector< vtkImageData * > &  s,
int  dim 
)
virtual

Adds the selected Images to the given vector.

Reimplemented from creaImageIO::GimmickView.

Definition at line 345 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::GetTreeViewMap(), mNotebook, and creaImageIO::GimmickView::ReadImagesNotThreadedInVector().

346  {
347  std::vector<std::string> files;
348  std::string db_name = crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()));
349  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetSelectedAsString(files);
350 
351  ReadImagesNotThreadedInVector(s, files, dim);
352  }

Here is the call graph for this function:

virtual int creaImageIO::GimmickView::GetSelectionSize ( )
inlinevirtualinherited

Returns the size of the current selection.

Definition at line 50 of file OldcreaImageIOGimmickView.h.

50 { return 0; }
TreeViewMapType& creaImageIO::GimmickView::GetTreeViewMap ( )
inlineinherited
const TreeViewMapType& creaImageIO::GimmickView::GetTreeViewMap ( ) const
inlineinherited

Returns the TreeViewMap (const ref)

Definition at line 101 of file creaImageIOGimmickView.h.

References creaImageIO::GimmickView::mTreeViewMap.

102  { return mTreeViewMap; }
void creaImageIO::WxGimmickView::GetVisibleAttributes ( std::vector< std::string > &  shown,
std::vector< std::string > &  nShown,
int  level 
)

Called upon to return the visible attributes of the current tab.

Definition at line 1088 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::GetTreeViewMap(), and mNotebook.

Referenced by creaImageIO::WxAttributeSelectionPanel::OnComboChange().

1090  {
1091  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetAttributes(shown,nShown,level);
1092  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::ImportImages ( )
private

Definition at line 953 of file creaImageIOWxGimmickView.cpp.

Referenced by OnImportExport().

954  {
955  //Find the *.zip
956  //dezip
957  // Contain a descriptor.text
958  // create a new database, and add to database
959  // if not, add to current database
960  //
961  }

Here is the caller graph for this function:

void creaImageIO::GimmickView::Initialize ( )
virtualinherited

Initializes the view : Creates the TreeViews for all the TreeHandler of the Controller

Definition at line 133 of file creaImageIOGimmickView.cpp.

References creaImageIO::GimmickView::mReaderStarted.

Referenced by creaImageIO::WxGimmickFrame::WxGimmickFrame(), creaImageIO::WxGimmickPanel::WxGimmickPanel(), and creaImageIO::WxGimmickReaderDialog::WxGimmickReaderDialog().

134  {
135  mReaderStarted=false;
136  }

Here is the caller graph for this function:

bool creaImageIO::WxGimmickView::isNeedRecursive ( std::string  i_name)
private

Test a directory to know if contains sub-directory to analyze.

Definition at line 637 of file creaImageIOWxGimmickView.cpp.

Referenced by OnAddDir().

638  {
639  boost::filesystem::directory_iterator iter(i_name), end_iter;
640  //bool bfindir = false;
641  for(; iter != end_iter; ++iter)
642  {
643  if(boost::filesystem::is_directory(*iter))
644  {
645  return true;
646  }
647  }
648  return false;
649  }

Here is the caller graph for this function:

virtual bool creaImageIO::GimmickView::IsSelectionValid ( )
inlinevirtualinherited

Returns true if there is a valid selection.

Definition at line 52 of file OldcreaImageIOGimmickView.h.

52 { return false; }
bool creaImageIO::GimmickView::isSingle ( const std::string  i_file)
inherited

Definition at line 451 of file creaImageIOGimmickView.cpp.

References creaImageIO::MultiThreadImageReader::GetImage(), and creaImageIO::GimmickView::mReader.

Referenced by getSelectedFiles(), and creaImageIO::GimmickView::readImages().

452  {
453  bool bres = true;
454  vtkImageData* first = mReader.GetImage( i_file);
455  int dim[3];
456  first->GetDimensions(dim);
457  if (dim[2] > 1)
458  {
459  bres = false;
460  }
461  else
462  {
463  }
464  return bres;
465  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::killProgress ( )
private

Definition at line 1346 of file creaImageIOWxGimmickView.cpp.

References mProgressDialog.

Referenced by AddDir(), ExportToStorage(), OnAddDir(), OnAddFiles(), OnDriveMount(), and OnTools().

1347  {
1348  mProgressDialog->Resume();
1349  mProgressDialog->Destroy();
1350  mProgressDialog = 0;
1351  }

Here is the caller graph for this function:

virtual void creaImageIO::GimmickView::LoadOrCreateFavoritesDatabase ( )
inlinevirtualinherited

Loads or creates a favorites database.

Definition at line 101 of file OldcreaImageIOGimmickView.h.

101 { return; }
void creaImageIO::GimmickView::modifyValidationSignal ( bool  ivalid)
inherited

Definition at line 325 of file creaImageIOGimmickView.cpp.

References creaImageIO::GimmickView::mValidationSignal.

Referenced by creaImageIO::GimmickView::NoValidateSelected(), creaImageIO::WxTreeView::RemoveSelected(), and creaImageIO::GimmickView::ValidateSelected().

326  {
327 
328  mValidationSignal(ivalid);
329  }

Here is the caller graph for this function:

void creaImageIO::MultiThreadImageReaderUser::MultiThreadImageReaderEventLock ( )
inlineinherited

Definition at line 80 of file creaImageIOMultiThreadImageReader.h.

Referenced by creaImageIO::ThreadedImageReader::Entry().

Here is the caller graph for this function:

void creaImageIO::MultiThreadImageReaderUser::MultiThreadImageReaderEventLock ( )
inlineinherited

Definition at line 81 of file creaImageIOQMultiThreadImageReader.h.

void creaImageIO::MultiThreadImageReaderUser::MultiThreadImageReaderEventUnlock ( )
inlineinherited

Definition at line 82 of file creaImageIOMultiThreadImageReader.h.

Referenced by creaImageIO::ThreadedImageReader::Entry().

Here is the caller graph for this function:

void creaImageIO::MultiThreadImageReaderUser::MultiThreadImageReaderEventUnlock ( )
inlineinherited

Definition at line 83 of file creaImageIOQMultiThreadImageReader.h.

bool creaImageIO::GimmickView::NoValidateSelected ( )
inherited

No selected image.

Definition at line 227 of file creaImageIOGimmickView.cpp.

References GimmickDebugMessage, creaImageIO::GimmickView::modifyValidationSignal(), creaImageIO::GimmickView::SetMessage(), and creaImageIO::GimmickView::valid.

228  {
229  GimmickDebugMessage(2,"Validating selected"<<std::endl);
230  std::string mMessage;
231  mMessage="Cannot have 0 images selected!";
232  valid=false;
234  SetMessage(mMessage);
235  return valid;
236  }

Here is the call graph for this function:

int creaImageIO::WxGimmickView::NumberFilesToAdd ( const std::string &  dirpath,
bool  recursive 
)
private

Determines number of files potentially to add to database.

Definition at line 612 of file creaImageIOWxGimmickView.cpp.

Referenced by OnAddDir().

613  {
614  int nb = 0;
615  if ( !boost::filesystem::exists( dirpath ) ) return nb;
616  boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
617  for ( boost::filesystem::directory_iterator itr( dirpath ); itr != end_itr; ++itr )
618  {
619  // If is directory & recurse : do recurse
620  if ( boost::filesystem::is_directory(itr->status()) )
621  {
622  if (recursive)
623  {
624  nb += NumberFilesToAdd(itr->path().string(), recursive);
625  }
626  }
627  else
628  {
629  nb++;
630  }
631  }
632  return nb;
633  }

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::OnAddDB ( wxCommandEvent &  event)
private

callback to add a database

Definition at line 1280 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::CreateSingleTreeView(), and mGimmick.

1281  {
1282  //Select DB
1283  long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
1284  std::string wc("*.sqlite3*");
1285  wxFileDialog* FD = new wxFileDialog( 0,
1286  _T("Select file"),
1287  _T(""),
1288  _T(""),
1289  crea::std2wx(wc),
1290  style,
1291  wxDefaultPosition);
1292 
1293  if (FD->ShowModal()==wxID_OK)
1294  {
1295  wxBusyCursor busy;
1296  wxArrayString files;
1297  FD->GetPaths(files);
1298  std::stringstream st;
1299  for(int i = 0; i< files.size(); i++)
1300  {
1301  //get name of DB (file name)
1302  size_t pos = files[i].find_last_of(_T("\\"));
1303  std::string name = crea::wx2std(files[i].substr(pos+1));
1304  pos = name.find_last_of(".");
1305  name = name.substr(0,pos);
1306  //create TreeHandler
1307  mGimmick->addDB(name, crea::wx2std(files[i]));
1308  //create TreeView
1309  CreateSingleTreeView(name);
1310  }
1311  }
1312  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnAddDir ( wxCommandEvent &  event)
private

Callback for adding dir.

Definition at line 558 of file creaImageIOWxGimmickView.cpp.

References DisplayAddSummary(), isNeedRecursive(), killProgress(), mCurrentDirectory, mGimmick, mNotebook, mProgressDialog, mstart, mViewer, NumberFilesToAdd(), creaImageIO::WxViewer::StartPlayer(), creaImageIO::WxViewer::StopPlayer(), and creaImageIO::GimmickView::UpdateTreeViewLevel().

559  {
560  mViewer->StopPlayer();
561  std::string name = crea::wx2std(mNotebook->GetCurrentPage()->GetName());
562  long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
563  wxDirDialog* FD =
564  new wxDirDialog( 0,
565  _T("Select directory"),
567  style);
568 
569  if (FD->ShowModal()==wxID_OK)
570  {
571  time(&mstart);
572  std::string dirname = wx2std (FD->GetPath());
573  bool recurse = isNeedRecursive(dirname);
574  if (recurse)
575  {
576  recurse = wxMessageBox(_T("Recurse into sub-directories ?"), _T("Scan directory"), wxYES_NO,this ) == wxYES ? true : false;
577  }
578 
579  wxBusyCursor busy;
580  wxString title(_T("Adding directory"));
581  if (recurse)
582  title = _T("Adding directory (recursive)");
583  mProgressDialog =
584  new wxProgressDialog(_T("Adding directory"),
585  _T(""),
586  NumberFilesToAdd(dirname,recurse),
587 
588 //EED this,
589  NULL,
590 
591  wxPD_ELAPSED_TIME |
592  wxPD_SMOOTH |
593  // wxPD_ESTIMATED_TIME |
594  // wxPD_REMAINING_TIME |
595  wxPD_CAN_ABORT );
596 
597  mCurrentDirectory = FD->GetPath();
598  mGimmick->AddDir(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),dirname,recurse);
599  mProgressDialog->Pulse(_T("Updating view..."));
600 
601  UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
602  killProgress();
604  }
605  mViewer->StartPlayer();
606  delete FD;
607  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnAddFiles ( wxCommandEvent &  event)
private

Callback for adding files.

Definition at line 505 of file creaImageIOWxGimmickView.cpp.

References DisplayAddSummary(), GimmickMessage, killProgress(), mGimmick, mNotebook, mProgressDialog, mViewer, creaImageIO::WxViewer::StartPlayer(), creaImageIO::WxViewer::StopPlayer(), and creaImageIO::GimmickView::UpdateTreeViewLevel().

506  {
507  mViewer->StopPlayer();
508  long style = wxOPEN | wxFILE_MUST_EXIST | wxFD_MULTIPLE;
509  std::string wc("*");
510  wxFileDialog* FD = new wxFileDialog( 0,
511  _T("Select file"),
512  _T(""),
513  _T(""),
514  crea::std2wx(wc),
515  style,
516  wxDefaultPosition);
517 
518  if (FD->ShowModal()==wxID_OK)
519  {
520  wxBusyCursor busy;
521 
522  wxArrayString files;
523  FD->GetPaths(files);
524  unsigned int i;
525  std::vector<std::string> filenames;
526  for (i=0;i<files.GetCount();++i)
527  {
528  filenames.push_back(wx2std(files[i]));
529  GimmickMessage(2,"Adding File "<<files[i]<<"."<<std::endl);
530  }
531 
532  mProgressDialog =
533  new wxProgressDialog(_T("Adding file(s)"),
534  _T(""),
535  1000,
536 // this,
537  NULL,
538  wxPD_ELAPSED_TIME |
539  // wxPD_ESTIMATED_TIME |
540  // wxPD_REMAINING_TIME |
541  wxPD_CAN_ABORT );
542 
543  // TO DO : select the current tree handler
544  mGimmick->AddFiles(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),filenames);
545 
546  mProgressDialog->Pulse(_T("Updating view..."));
547 
548  UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
549  killProgress();
551 
552  }
553  mViewer->StartPlayer();
554  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnAddProgress ( Gimmick::AddProgress p)
private

AddProgress Gimmick callback.

Definition at line 1242 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::TreeHandlerImageAdder::Progress::GetNumberAddedFiles(), creaImageIO::TreeHandlerImageAdder::Progress::GetNumberHandledFiles(), creaImageIO::TreeHandlerImageAdder::Progress::GetNumberScannedDirs(), creaImageIO::TreeHandlerImageAdder::Progress::GetNumberScannedFiles(), mProgressDialog, and creaImageIO::TreeHandlerImageAdder::Progress::SetStop().

Referenced by WxGimmickView().

1243  {
1244  char mess[200];
1245  sprintf(mess,"%i dirs : %i files :\n %i handled - %i added",
1246  p.GetNumberScannedDirs(),
1247  p.GetNumberScannedFiles(),
1248  p.GetNumberHandledFiles(),
1249  p.GetNumberAddedFiles());
1250  // std::cout << "OnAddProgress "<<mess<<std::endl;
1251  wxString s(wxString::From8BitData(mess));
1252  // std::cout << "Pulse"<<std::endl;
1253 
1254  if(mProgressDialog != 0)
1255  {
1256  if (!mProgressDialog->Pulse(s))
1257  {
1258  p.SetStop();
1259  }
1260  }
1261  // std::cout << "OnAddProgress ok"<<std::endl;
1262  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::OnAttributesChanged ( const std::vector< std::string > &  nShown,
int  level 
)

Called when there has been a change in the visible attributes of a tree view.

Definition at line 1095 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::GetTreeViewMap(), and mNotebook.

Referenced by creaImageIO::WxAttributeSelectionPanel::OnSaveConfig().

1096  {
1097  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->SetNonVisibleAttributes(nShown,level);
1098  std::vector<std::string> n=nShown;
1099  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->CreateCtrl(n,level);
1100  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::OnCreateDB ( wxCommandEvent &  event)
private

Create a DB from an Attributes Descriptor files.

Definition at line 1318 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::CreateSingleTreeView(), creaImageIO::WxDescriptorPanel::GetDescriptor(), ID_DSCP_APPLY, and mGimmick.

1319  {
1320  // PACSConnection("");
1321  WxDescriptorPanel * DescriptorPan = new WxDescriptorPanel(this, mGimmick->GetHomeDirectory());
1322  DescriptorPan->Layout();
1323  if ( DescriptorPan->ShowModal() == ID_DSCP_APPLY)
1324  {
1325  wxBusyCursor busy;
1326  std::string file(DescriptorPan->GetDescriptor());
1327  if (!file.empty())
1328  {
1329  size_t pos = file.find_last_of("\\");
1330  std::string name = file.substr(pos+1);
1331  std::string directory = file.substr(0,pos);
1332  pos = name.find_last_of(".");
1333  name = name.substr(0,pos);
1334  //get directory to store DB
1335  directory += "\\" + name + ".sqlite3";
1336  //create createDB
1337  mGimmick->createDB(name, file,directory);
1338  //create TreeHandler
1339  mGimmick->addDB(name, directory);
1340  //create TreeView
1341  CreateSingleTreeView(name);
1342  }
1343  }
1344  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnDriveMount ( bool  mount)

Acts upon a drive mount.

Definition at line 1123 of file creaImageIOWxGimmickView.cpp.

References DisplayAddSummary(), creaImageIO::Listener::GetMonitoredDrive(), GimmickMessage, killProgress(), mCurrentDirectory, mGimmick, mListener, mNotebook, mProgressDialog, mViewer, creaImageIO::WxViewer::StartPlayer(), creaImageIO::WxViewer::StopPlayer(), and creaImageIO::GimmickView::UpdateTreeViewLevel().

1124  {
1125  GimmickMessage(1, "Gimmick::OnDriveMount"<<std::endl);
1126  std::string drive;
1127  mListener->GetMonitoredDrive(drive);
1128 
1129  if(mount)
1130  {
1131  mViewer->StopPlayer();
1132  wxBusyCursor busy;
1133  wxString title(_T("Adding drive"));
1134  mProgressDialog =
1135  new wxProgressDialog(_T("Adding drive"),
1136  _T(""),
1137  1000,
1138 
1139 //EED this,
1140  NULL,
1141 
1142  wxPD_ELAPSED_TIME |
1143  // wxPD_ESTIMATED_TIME |
1144  // wxPD_REMAINING_TIME |
1145  wxPD_CAN_ABORT );
1146  mCurrentDirectory = crea::std2wx(drive);
1147  mGimmick->AddDir(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),drive,true);
1148  mProgressDialog->Pulse(_T("Updating view..."));
1149 
1150  UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
1151  killProgress();
1153  mViewer->StartPlayer();
1154  }
1155  else
1156  {
1157  mGimmick->DeleteDrive(drive);
1158  UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
1159  }
1160  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnFieldsEdited ( tree::Node node,
const std::string &  name,
const std::string &  key,
const std::string &  val 
)

Called upon when a field has been edited.

Definition at line 1234 of file creaImageIOWxGimmickView.cpp.

References mGimmick, mNotebook, and creaImageIO::GimmickView::UpdateTreeViewLevel().

Referenced by creaImageIO::WxEditFieldsPanel::OnEdit().

1235  {
1236  mGimmick->EditField(node, crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())), name, key, val);
1237  UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
1238  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::OnImportExport ( wxCommandEvent &  event)
private

Callback for Import/Export images.

Definition at line 930 of file creaImageIOWxGimmickView.cpp.

References ExportImages(), creaImageIO::GimmickView::GetTreeViewMap(), ImportImages(), and mNotebook.

931  {
932  wxBusyCursor busy;
933  // Test if one image is selected => export
934  // if not =>import
935  if (GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))])
936  {
937  ExportImages();
938  }
939  else
940  {
941  ImportImages();
942  }
943  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnListenerCallback ( const std::string &  drive,
bool  addFiles,
bool  removeFiles 
)

Changes listener state.

Definition at line 1114 of file creaImageIOWxGimmickView.cpp.

References mListener, creaImageIO::Listener::SetAddFilesState(), creaImageIO::Listener::SetMonitoredDrive(), and creaImageIO::Listener::SetRemoveFilesState().

Referenced by creaImageIO::WxListenerPanel::OnChangeListenState().

1115  {
1116  mListener->SetMonitoredDrive(drive);
1117  mListener->SetAddFilesState(addFiles);
1118  mListener->SetRemoveFilesState(removeFiles);
1119  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::GimmickView::OnMultiThreadImageReaderEvent ( const std::string &  filename,
MultiThreadImageReaderUser::EventType  type,
vtkImageData *  image 
)
virtualinherited

The virtual method to overload by MultiThreadImageReader users It is called when an image has been loaded or unloaded Provides :

  • The image file name which was requested
  • The type of event
  • If type==ImageLoaded the image pointer, else NULL pointer

Reimplemented from creaImageIO::MultiThreadImageReaderUser.

Definition at line 795 of file creaImageIOGimmickView.cpp.

References creaImageIO::MultiThreadImageReaderUser::Error, creaImageIO::GimmickView::GetDefaultImage(), GimmickDebugMessage, GimmickMessage, creaImageIO::GimmickView::ImageEventType::image, creaImageIO::MultiThreadImageReaderUser::ImageLoaded, creaImageIO::MultiThreadImageReaderUser::ImageUnloaded, creaImageIO::GimmickView::mImageEventMap, and creaImageIO::GimmickView::ImageEventType::pointerHolder.

798  {
800  "MultiThreadImageReader event : "<<e<<std::endl);
801  if (e==ImageLoaded)
802  {
803  if (filename.size()==0)
804  {
805  //What to do in this case?
806  /*
807  GimmickDebugMessage(5,
808  "Pushing unknown image in queue"
809  <<std::endl);
810  mImageEventQueue.push_back(ImageEventType(image));*/
811  return;
812  }
813  ImageEventTypeMap::iterator i;
814 //JCP 22-06-2009, test mImageEventMap.size() > 0
815  if(mImageEventMap.size()>0){
816  i = mImageEventMap.find(filename);
817  if (i!=mImageEventMap.end())
818  {
820  "Putting image of file '"<<filename<<"' on pointer"
821  <<std::endl);
822  ImageEventType ie(i->second);
823  ie.image = image;
824  ie.pointerHolder->Set(ie.image);
825  //mImageEventMap.erase(i);
826  }
827  }
828  }
829  else if (e==Error)
830  {
831  std::string mess="ERROR: MultiThreadImageReader: Cannot read image in file ";
832  mess+=filename;
833  mess+="\n";
834  GimmickMessage(1,mess);
835  ImageEventTypeMap::iterator i;
836  i = mImageEventMap.find(filename);
837  if (i!=mImageEventMap.end())
838  {
839  ImageEventType ie(i->second);
840  ie.image = image;
841  ie.pointerHolder->Set(GetDefaultImage());
842  //mImageEventMap.erase(i);
843  }
844  }
845 
846  else if (e==ImageUnloaded)
847  {
848  std::string mess="Unloaded image in file ";
849  mess+=filename;
850  mess+="\n";
851  GimmickMessage(1,mess);
852  ImageEventTypeMap::iterator i;
853  i = mImageEventMap.find(filename);
854  if (i!=mImageEventMap.end())
855  {
856  ImageEventType ie(i->second);
857  ie.image = image;
858  ie.pointerHolder->Set(GetDefaultImage());
859  //mImageEventMap.erase(i);
860  }
861  }
862  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnRemove ( wxCommandEvent &  event)
private

Callback for removing files.

Definition at line 835 of file creaImageIOWxGimmickView.cpp.

References ClearSelection(), creaImageIO::GimmickView::GetTreeViewMap(), mGimmick, mNotebook, and SETTINGS_REMOVE_PATIENT_DISPLAY.

836  {
837  //TODO Select current tree handler
838  wxBusyCursor busy;
839  std::string remove;
840  mGimmick->GetSetting(SETTINGS_REMOVE_PATIENT_DISPLAY,remove);
841  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->RemoveSelected(remove);
842  mGimmick->UpdateSetting(SETTINGS_REMOVE_PATIENT_DISPLAY,remove);
843  ClearSelection();
844  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnSaveSettingsCallback ( const std::string &  copyPath,
const std::string &  dbPath,
const std::string &  syncEvent,
const std::string &  syncFreq 
)

Saves the settings to the file.

Definition at line 1102 of file creaImageIOWxGimmickView.cpp.

References mGimmick, SETTINGS_COPY_PATH, SETTINGS_DBPATH, SETTINGS_SYNC_EVENT, and SETTINGS_SYNC_FREQ.

Referenced by creaImageIO::WxCustomizeConfigPanel::OnSaveConfig().

1106  {
1107  mGimmick->UpdateSetting(SETTINGS_COPY_PATH,copyPath);
1108  mGimmick->UpdateSetting(SETTINGS_DBPATH,dbPath);
1109  mGimmick->UpdateSetting(SETTINGS_SYNC_EVENT,syncEvent);
1110  mGimmick->UpdateSetting(SETTINGS_SYNC_FREQ,syncFreq);
1111  }

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::OnSelectionChange ( const std::vector< tree::Node * > &  s,
bool  isSelection,
int  selection,
bool  mProcess 
)
virtual

Callback called when a selection from a TreeView has changed.

Reimplemented from creaImageIO::GimmickView.

Definition at line 653 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::GetMessage(), GimmickDebugMessage, mSelectionMaxDimension, mSelectionMinDimension, mText, ReadImageThreaded(), creaImageIO::GimmickView::ResetExtent(), creaImageIO::GimmickView::valid, and creaImageIO::GimmickView::ValidateSelected().

654  {
656  "WxGimmickView::OnSelectionChange"
657  <<std::endl);
658  wxBusyCursor busy;
659  bool valid=true;
660 
661  if(sel.size()==0)
662  {
663  valid= ValidateSelected(NULL,
666  }
667  else if(needProcess)
668  {
669  ResetExtent();
670  std::vector<tree::Node*>::const_iterator i;
671  for(i=sel.begin();i!=sel.end()&&valid;++i)
672  {
673  valid= ValidateSelected((*i),
676  }
677  }
678  else if(isSelection)
679  {
680  valid= ValidateSelected(sel.front(),
683  }
684  else
685  {
686  ResetExtent();
687  std::vector<tree::Node*>::const_iterator i;
688  for(i=sel.begin();i!=sel.end()&&valid;++i)
689  {
690  valid= ValidateSelected((*i),
693  }
694  }
695  mText->SetLabel(crea::std2wx(GetMessage()));
696  /*if(valid)
697  {
698  ReadImageThreaded(sel);
699  }
700  else
701  {
702  ClearSelection();
703  }*/
704  ReadImageThreaded(sel);
705  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnSettings ( wxCommandEvent &  event)
private

Callback for settings edition.

Definition at line 916 of file creaImageIOWxGimmickView.cpp.

References CreateSettingsDialog().

917  {
918  wxDialog* dial= new wxDialog (this,-1,_T("System Settings"),wxDefaultPosition, wxSize(450,220));
919  wxBoxSizer *siz = new wxBoxSizer(wxVERTICAL);
920  // Notebook
921  wxNotebook* nb= new wxNotebook(dial, -1, wxDefaultPosition, wxDefaultSize, 0);
922 
923  siz->Add( nb,1,wxGROW ,0);
924  CreateSettingsDialog(nb,dial);
925  dial->SetSizer(siz);
926  dial->ShowModal();
927  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnSynchronize ( wxCommandEvent &  event)
private

Callback for synchronization.

Definition at line 881 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::GetTreeViewMap(), mGimmick, and mNotebook.

882  {
883  wxBusyCursor busy;
884  const wxString choices[] = { _T("Check database for files deletion and addition and give a report."),
885  _T("Check database for files deletion, addition and attributes change. Then give a report."),
886  _T("Repair database (remove deleted files and add new files)."),
887  _T("Repair database (remove deleted files, add new files and reset changed attributes).") } ;
888 
889  wxSingleChoiceDialog dialog(this,
890  _T("Select one of the following synchronization actions:\n")
891  _T("Please note that, due to the heavy amount of operations required, this action might take a while."),
892  _T("Synchronization Settings"),
893  WXSIZEOF(choices), choices);
894 
895  //dialog.SetSelection(0);
896 
897  if (dialog.ShowModal() == wxID_OK)
898  {
899  wxBusyCursor busy;
900  int sel=dialog.GetSelection();
901  bool repair=false;
902  bool checkAttributes=false;
903  if(sel==2 || sel==3){repair=true;}
904  if(sel==1 || sel==3){checkAttributes=true;}
905  std::string mess=mGimmick->Synchronize(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),repair, checkAttributes);
906  wxMessageBox(std2wx(mess),_T("Synchronization result"),wxOK,this);
907  if(sel==2 || sel==3){
908  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->UpdateLevel(1);
909  }
910 
911  }
912  }

Here is the call graph for this function:

void creaImageIO::WxGimmickView::OnTools ( wxCommandEvent &  event)
private

Callback for settings edition.

Definition at line 965 of file creaImageIOWxGimmickView.cpp.

References DisplayAddSummary(), creaImageIO::WxGimmickTools::getAddToDBCheckBoxValue(), creaImageIO::WxGimmickTools::getInputDir(), creaImageIO::WxGimmickTools::getOutputDir(), killProgress(), mCurrentDirectory, mGimmick, mNotebook, mProgressDialog, mViewer, creaImageIO::WxViewer::StartPlayer(), creaImageIO::WxViewer::StopPlayer(), and creaImageIO::GimmickView::UpdateTreeViewLevel().

966  {
967  mViewer->StopPlayer();
968 
969  wxDialog* dial = new wxDialog (this,-1,_T("Tools"),wxDefaultPosition, wxSize(550,350));
970 
971  wxSizer* buttonsSizer = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
972  wxNotebook* nb= new wxNotebook(dial, -1, wxDefaultPosition, wxDefaultSize, 0);
973  wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL);
974  dialSizer->Add(nb,1,wxGROW,0);
975  dialSizer->Add(buttonsSizer,0,wxGROW);
976 
977 #if defined(BUILD_BRUKER)
978  //First page: Bruker Image Reader
979  WxGimmickTools * gimmickTools = new WxGimmickTools(nb, mCurrentDirectory);
980  nb->AddPage( gimmickTools, _T("Bruker Image Reader") );
981 #endif
982 
983  dial->SetSizer(dialSizer, true);
984  dial->Layout();
985  dial->ShowModal();
986 
987  if (dial->GetReturnCode() == wxID_OK)
988  {
989 #if defined(BUILD_BRUKER)
990  if (nb->GetSelection()==0)//Selection: Bruker Image Reader
991  {
992  std::string inputDir = crea::wx2std(gimmickTools->getInputDir());
993  std::string outputDir = crea::wx2std(gimmickTools->getOutputDir());
994 
995  bool addToDB = gimmickTools->getAddToDBCheckBoxValue();
996 
997  if (inputDir.compare("")!=0 && outputDir.compare("")!=0)
998  {
999  if ( wxMessageBox(_T("Depending on the amount of Data the process can take several minutes. Do you want to continue?"),
1000  _T("Please confirm"), wxICON_QUESTION | wxYES_NO) == wxYES )
1001  {
1002  Bruker2Dicom b2d;
1003  b2d.SetInputDirectory(inputDir);
1004  b2d.SetOutputDirectory(outputDir);
1005  b2d.SetConvertModeToDicom();
1006  b2d.verbose=false;
1007  b2d.Execute();
1008  if (addToDB)
1009  {
1010  std::cout <<"after addToDB" << std::endl;
1011  mProgressDialog = new wxProgressDialog(_T("Adding directory"),_T(""),1000,
1012 
1013 //EED this,
1014  NULL,
1015 
1016  wxPD_ELAPSED_TIME |wxPD_CAN_ABORT );
1017  std::cout <<"after new wxProgressDialog" << std::endl;
1018  mCurrentDirectory = gimmickTools->getOutputDir();
1019  std::cout <<"after gimmickTools->getOutputDir[" <<mCurrentDirectory << std::endl;
1020  mGimmick->AddDir(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),outputDir,true);
1021  std::cout <<"after mGimmick->AddDir" << std::endl;
1022  mProgressDialog->Pulse(_T("Updating view..."));
1023  std::cout <<"after mProgressDialog->Pulse" << std::endl;
1024  UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
1025  std::cout <<"after UpdateTreeViewLevel" << std::endl;
1026  killProgress();
1027  std::cout <<"after delete mProgressDialog" << std::endl;
1029  std::cout <<"after dDisplayAddSummary" << std::endl;
1030  }
1031  }
1032  }
1033  else
1034  {
1035  wxMessageBox(_T("One or both of the directory fields are empty"),_T("Empty Fields"),wxOK,this);
1036  }
1037  }
1038  delete gimmickTools;
1039 #endif
1040  }
1041  mViewer->StartPlayer();
1042  }

Here is the call graph for this function:

virtual void creaImageIO::GimmickView::OpenOrNewDatabase ( bool  open)
inlineprotectedvirtualinherited

Opens an existing database, or else, creates a local database.

Definition at line 74 of file OldcreaImageIOGimmickView.h.

74 { return; }
void creaImageIO::GimmickView::readImages ( std::vector< OutStrGimmick > &  o_output,
std::vector< std::string >  im,
OutputAttr  i_attr,
int  i_dim,
double  i_zspc 
)
inherited

Definition at line 661 of file creaImageIOGimmickView.cpp.

References creaImageIO::GimmickView::isSingle(), creaImageIO::GimmickView::readImages1(), creaImageIO::GimmickView::readImages2(), creaImageIO::GimmickView::readImages3(), and creaImageIO::GimmickView::readImages4().

Referenced by getSelectedFiles().

663  {
664  int size = (int)im.size();
665  if ( size == 0)
666  {
667  return;
668  }
669  else if (size == 1)
670  {
671  // Simplest case
672  // Only one image : give it
673  // But take in count multiframe possibility
674  if ( isSingle(im.front()) || i_dim != 1)
675  {
676  readImages1(o_output,im, i_attr);
677  }
678  else
679  {
680  readImages2(o_output,im, i_attr,i_zspc);
681  }
682 
683  }
684  else
685  {
686  // multiple or single frame
687  if ( isSingle(im.front()) )
688  {
689  //we deal with 2D images
690  if(i_dim == 1)
691  {
692  // 2D to 3D
693  readImages3(o_output,im, i_attr,i_zspc);
694  }
695  else
696  {
697  readImages1(o_output,im, i_attr);
698  }
699  }
700  else
701  {
702  // we deal with multiple frames n x (2D x T)
703  // Differents outputs are avaialable
704  if(i_dim == 1)
705  {
706  // put all in one output
707  readImages3(o_output,im, i_attr,i_zspc);
708 
709  }
710  else if( i_dim == 2)
711  {
712  // put in a vector of n x T (2D)
713  readImages2(o_output,im, i_attr,i_zspc);
714  }
715  else if( i_dim == 3)
716  {
717  // put in a vector of n (2D x T)
718  // No transformations.
719  readImages1(o_output,im, i_attr);
720  }
721  else
722  {
723  // put in a vector of T (2D x n)
724  readImages4(o_output,im, i_attr);
725  }
726  }
727  }
728  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::GimmickView::ReadImagesNotThreaded ( std::vector< vtkImageData * > &  s,
std::vector< std::string >  files,
int  dim 
)
inherited

Reads the vector of images, builds it in the dimension required and returns them in the supplied vector.

Reads Images (Non Threaded)

Definition at line 338 of file creaImageIOGimmickView.cpp.

References creaImageIO::MultiThreadImageReader::GetImage(), creaImageIO::GimmickView::mReader, and creaImageIO::GimmickView::stopReader().

Referenced by GetImages().

339 {
340  stopReader();
341 /* remember!
342 
343 #define GIMMICK_NO_IMAGE_SELECTION 0
344 #define GIMMICK_2D_IMAGE_SELECTION 2
345 #define GIMMICK_3D_IMAGE_SELECTION 3
346 #define GIMMICK_4D_IMAGE_SELECTION 4
347 
348 #define NATIVE 0
349 #define _2D 2
350 #define _3D 3
351 
352 */
353  // Create the output data
354  if (im.size()==1)
355  {
356  vtkImageData * out=vtkImageData::New();
357  out->ShallowCopy(mReader.GetImage(im.front()));
358  s.push_back(out);
359  }
360  else if (im.size()>1) // Test inutile ? JPR
361  {
362  vtkImageData* first = mReader.GetImage( im.front());
363  if (dimension == 2)
364  {
365  // n3D
366  std::vector<std::string>::iterator it;
367  for (it=im.begin(); it!=im.end(); ++it)
368  {
369  vtkImageData* out = vtkImageData::New();
370  out->ShallowCopy(mReader.GetImage(*it));
371  s.push_back(out);
372  }
373  }
374  else
375  {
376  // n*2D to 3D
377  vtkImageData* out = vtkImageData::New();
378 // out->CopyStructure(first);
379  out->SetScalarType(first->GetScalarType());
380  out->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents());
381  int ext[6];
382  //first->GetExtent(ext); // JPR
383  first->GetWholeExtent(ext); // renvoie egalement 0,0 en Z // JPR
384 
385  if(ext[5] == 0)
386  {
387  ext[5] = (int)im.size()-1;
388  }
389  else
390  {
391  ext[5] = ext[5] * (int)im.size()-1; // to deal with multiframes - JPR
392  }
393  out->SetExtent(ext);
394 
395  // LG : TODO : Z Spacing ?
396 
397  int dim[3];
398  first->GetDimensions(dim);
399 
400  out->SetDimensions(dim[0], dim[1], (int)im.size() );
401  out->AllocateScalars();
402  out->Update();
403 
404  unsigned long imsize = dim[0] * dim[1];
405  imsize = imsize * dim[2] ; // deal with multiframes // JPR
406 
407 
408 //EED 03-11-2009
409  // differents formats char , short, etc...
410  // differents components 1..3 ex. jpg ->RGB 3
411  imsize = imsize * first->GetScalarSize() * first->GetNumberOfScalarComponents();
412 
413 
414  // Order the file name vector
415 
416  double spc[3];
417  first->GetSpacing(spc);
418 
419  // OrderTheFileNameVector is not here anymore.
420  // Try orderFilesWithZSpacing from OutputModel FCY
421  // spc[2]=OrderTheFileNameVector(im);
422  spc[2] =1;
423 
424  out->SetSpacing(spc);
425 
426  int slice = 0;
427  std::vector<std::string>::iterator it;
428 
429  for (it=im.begin(); it!=im.end(); ++it)
430  {
431  vtkImageData* cur = mReader.GetImage( (*it) );
432  memcpy(out->GetScalarPointer(0,0,slice), cur->GetScalarPointer(0,0,0), imsize);
433  slice++;
434  }
435  s.push_back(out);
436 
437  } // dimension == 3
438 
439  } // size >1
440 
441 }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::GimmickView::ReadImagesNotThreadedInVector ( std::vector< vtkImageData * > &  s,
std::vector< std::string >  files,
int  dim 
)
inherited

Reads the vector of images, builds it in the dimension required and returns them in the supplied vector.

fix unused variable 'first'

Definition at line 732 of file creaImageIOGimmickView.cpp.

References creaImageIO::MultiThreadImageReader::GetImage(), GimmickDebugMessage, and creaImageIO::GimmickView::mReader.

Referenced by GetSelectedImagesInVector().

733 {
734  // Create the output data
735  if (im.size()==1)
736  {
737  // Only one image : give it
738  vtkImageData* out = vtkImageData::New();
739  GimmickDebugMessage(3, "State Check: Full Filename: "
740  <<im.front()
741  <<std::endl);
742  out->ShallowCopy(mReader.GetImage(im.front()));
743  s.push_back( out );
744  }
745  else if (im.size()>1) // Test inutile ? JPR
746  {
748  vtkImageData* first = mReader.GetImage( im.front());
749  if (dimension == 2)
750  {
751  // n3D
752  std::vector<std::string>::iterator it;
753  for (it=im.begin(); it!=im.end(); ++it)
754  {
755  vtkImageData* out = vtkImageData::New();
756  out->ShallowCopy(mReader.GetImage(*it));
757  s.push_back(out);
758  }
759  }
760  else
761  {
762  // n2D to 3D // NO!
763  // n *2D + T in a vector :
764 
765  std::vector<std::string>::iterator it;
766  for (it=im.begin(); it!=im.end(); ++it)
767  {
768  vtkImageData* out = mReader.GetImage( (*it));
769  s.push_back(out);
770  }
771  }
772  }
773 }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::ReadImageThreaded ( const std::vector< tree::Node * > &  sel)

Sends a request to read the currently selected node and the ones that surround it.

Reads Images (Threaded)

Definition at line 711 of file creaImageIOWxGimmickView.cpp.

References creaImageIO::GimmickView::GetDefaultImage(), creaImageIO::GimmickView::GetMaximalPriority(), creaImageIO::GimmickView::GetTreeViewMap(), GimmickDebugMessage, mCurImageItemToShow, mNotebook, mViewer, pointers, creaImageIO::GimmickView::RequestReading(), and creaImageIO::WxViewer::SetImageVector().

Referenced by OnSelectionChange().

712  {
714  "ReadImageThreaded"
715  <<std::endl);
716  int maxprio = GetMaximalPriority();
717  int prio = maxprio + 2000;
718 
719  if(sel.size()>0)
720  {
721  //First load the selected images
722  mCurImageItemToShow = sel.front();
723  pointers.clear();
724  int index = 0;
725  std::vector<tree::Node*>::const_iterator selected;
726  for(selected=sel.begin();selected!=sel.end();++selected)
727  {
729  "Requesting image from selected "
730  <<(*selected)->GetAttribute("FullFileName")
731  <<std::endl);
732  //ImagePointerHolder* ph=new ImagePointerHolder(GetDefaultImage());
733  boost::shared_ptr<ImagePointerHolder> ph(new ImagePointerHolder(GetDefaultImage()));
734  pointers.push_back(ph);
735  RequestReading(*selected,prio,index,ph);
736  // AddEntryToMap(*selected);
737  prio--;
738  index++;
739  }
741  //Going up
742  prio = maxprio + 20;
743  std::vector<tree::Node*> up;
744  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetNodes(up,true);
745  std::vector<tree::Node*>::iterator iterUp;
746  for(iterUp=up.begin();iterUp!=up.end();++iterUp)
747  {
749  "Requesting image from neighbors up "
750  <<(*iterUp)->GetAttribute("FullFileName")
751  <<std::endl);
752 // ImagePointerHolder* ph=new ImagePointerHolder(GetDefaultImage());
753  boost::shared_ptr<ImagePointerHolder> ph(new ImagePointerHolder(GetDefaultImage()));
754  RequestReading(*iterUp,prio,-1,ph);
755  // AddEntryToMap(*iterUp);
756  prio--;
757  if (prio == maxprio) break;
758  }
759 
760  //Going down
761  prio = maxprio + 19;
762  std::vector<tree::Node*> down;
763  GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetNodes(down,false);
764  std::vector<tree::Node*>::iterator iterDown;
765  for(iterDown=down.begin();iterDown!=down.end();++iterDown)
766  {
768  "Requesting image from neighbors down "
769  <<(*iterDown)->GetAttribute("FullFileName")
770  <<std::endl);
771  //ImagePointerHolder* ph=new ImagePointerHolder(GetDefaultImage());
772  boost::shared_ptr<ImagePointerHolder> ph(new ImagePointerHolder(GetDefaultImage()));
773  RequestReading(*iterDown,prio,-1,ph);
774  // AddEntryToMap(*iterDown);
775  prio--;
776  if (prio == maxprio) break;
777  }
778  }
779  else
780  {
781  pointers.clear();
782  //ImagePointerHolder* ph=new ImagePointerHolder(GetDefaultImage());
783  boost::shared_ptr<ImagePointerHolder> ph(new ImagePointerHolder(GetDefaultImage()));
784  pointers.push_back(ph);
786  }
787  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void creaImageIO::GimmickView::RebuildView ( )
inlineprotectedvirtualinherited

Completely rebuilds the view with current DicomDatabaseList

Definition at line 124 of file OldcreaImageIOGimmickView.h.

124 { return; }
void creaImageIO::GimmickView::RequestReading ( tree::Node n,
int  prio,
int  selection_index,
boost::shared_ptr< ImagePointerHolder p 
)
inherited

current selection (-1 if not in selection)

Requests the reading of an image.

Requests the reading of an image with priority and index in the

Definition at line 778 of file creaImageIOGimmickView.cpp.

References creaImageIO::tree::Node::GetAttribute(), creaImageIO::GimmickView::mImageEventMap, creaImageIO::GimmickView::mReader, creaImageIO::GimmickView::mReaderStarted, creaImageIO::GimmickView::ImageEventType::pointerHolder, creaImageIO::MultiThreadImageReader::Request(), and creaImageIO::MultiThreadImageReader::Start().

Referenced by ReadImageThreaded().

780  {
781  if(!mReaderStarted)
782  {
783  mReader.Start();
784  mReaderStarted=true;
785  }
786  ImageEventType t(n,selection_index);
787  t.pointerHolder = p;
788  mImageEventMap[n->GetAttribute("FullFileName")] = t;
789  mReader.Request(this,n->GetAttribute("FullFileName"),prio);
790  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::GimmickView::ResetExtent ( )
inherited

Resets the data of the extent and begins a new selection.

Clears the status and begins a new selection process.

Definition at line 188 of file creaImageIOGimmickView.cpp.

References creaImageIO::GimmickView::mImageExtent, and creaImageIO::GimmickView::valid.

Referenced by ClearSelection(), and OnSelectionChange().

189  {
190  if(mImageExtent!=0)
191  {
192  mImageExtent.reset();
193  }
194  valid=true;
195  }

Here is the caller graph for this function:

virtual void creaImageIO::GimmickView::SaveAs ( const std::vector< std::string > &  filenames)
inlinevirtualinherited

Copies selected files.

Definition at line 154 of file creaImageIOGimmickView.h.

References GimmickError.

155  { GimmickError("INTERNAL ERROR : SaveAs not implemented"); }
void creaImageIO::GimmickView::SetMessage ( std::string  mess)
inlineinherited

Obtains the message of the state.

Definition at line 178 of file creaImageIOGimmickView.h.

References creaImageIO::GimmickView::mMess.

Referenced by creaImageIO::GimmickView::NoValidateSelected(), and creaImageIO::GimmickView::ValidateSelected().

178 {mMess=mess;}

Here is the caller graph for this function:

virtual void creaImageIO::GimmickView::ShowHelp ( )
protectedvirtualinherited

Shows the help.

void creaImageIO::WxGimmickView::StartListeningThread ( )

Starts the listening thread on the CD/DVD drive.

Definition at line 1164 of file creaImageIOWxGimmickView.cpp.

References mListener.

Referenced by creaImageIO::WxListenerPanel::OnChangeThreadState().

1165  {
1166  mListener->Resume();
1167  }

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::StopListeningThread ( )

Stops the listening thread on the CD/DVD drive.

Definition at line 1171 of file creaImageIOWxGimmickView.cpp.

References mListener.

Referenced by creaImageIO::WxListenerPanel::OnChangeThreadState().

1172  {
1173  mListener->Pause();
1174  }

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::StopPlayer ( )
inline

Stops the player.

Definition at line 101 of file creaImageIOWxGimmickView.h.

References mViewer, and creaImageIO::WxViewer::StopPlayer().

101 {mViewer->StopPlayer();}

Here is the call graph for this function:

void creaImageIO::GimmickView::stopReader ( )
inherited

Definition at line 331 of file creaImageIOGimmickView.cpp.

References creaImageIO::GimmickView::mReader, and creaImageIO::MultiThreadImageReader::Stop().

Referenced by creaImageIO::GimmickView::ReadImagesNotThreaded().

332  {
333  mReader.Stop();
334  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void creaImageIO::GimmickView::UpdateDicomDatabaseView ( DicomDatabase *  )
inlineprotectedvirtualinherited

Recursively updates the part of the view corresponding to the DicomDatabase passed i.e. creates items for the DicomNode which do not have deletes obsolete items (whose DicomNode has been deleted)

Definition at line 129 of file OldcreaImageIOGimmickView.h.

129 { return; }
virtual void creaImageIO::GimmickView::UpdateDicomNodeView ( DicomNode *  n,
const TreeItemId &  parent 
)
inlineprotectedvirtualinherited

Recursively updates the part of the view corresponding to the DicomNode provided. parent is its parent in the tree (where to insert / remove it)

Definition at line 133 of file OldcreaImageIOGimmickView.h.

133 { return; }
void creaImageIO::GimmickView::UpdateTreeViewLevel ( const std::string &  t,
int  l 
)
virtualinherited

Updates the TreeView of given name from level l to bottom (calls the virtual method TreeView::UpdateLevel(l))

Updates the TreeView of given name from level l to bottom (calls the virtual method TreeView::Update())

Definition at line 174 of file creaImageIOGimmickView.cpp.

References creaImageIO::GimmickView::GetTreeViewMap(), and GimmickError.

Referenced by AddDir(), ExportToStorage(), OnAddDir(), OnAddFiles(), OnDriveMount(), OnFieldsEdited(), and OnTools().

175  {
176  TreeViewMapType::iterator i;
177  i = GetTreeViewMap().find(t);
178  if ( i == GetTreeViewMap().end() )
179  {
180  GimmickError("INTERNAL ERROR : GimmickView::UpdateTreeView : '"
181  <<t<<"' is not in TreeViewMap");
182  }
183  i->second->UpdateLevel(l);
184  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxGimmickView::UpdateWindowUI ( long  flags = wxUPDATE_UI_NONE)
private

Definition at line 811 of file creaImageIOWxGimmickView.cpp.

References mViewer, and creaImageIO::WxViewer::RefreshIfNecessary().

812  {
813  if(mViewer)
814  {
816  }
817  }

Here is the call graph for this function:

bool creaImageIO::GimmickView::ValidateSelected ( tree::Node sel,
int  min_dim,
int  max_dim 
)
inherited

Validates the dimension compliance of the images with the maximum and minimum given, and between their sizes.

Validates the dimension compliance of the images with the maximum and minimum given, and between their sizes

Definition at line 241 of file creaImageIOGimmickView.cpp.

References GimmickDebugMessage, creaImageIO::GimmickView::mImageExtent, creaImageIO::GimmickView::modifyValidationSignal(), creaImageIO::GimmickView::SetMessage(), and creaImageIO::GimmickView::valid.

Referenced by OnSelectionChange().

242  {
243  GimmickDebugMessage(2,"Validating selected"<<std::endl);
244  std::string mMessage;
245 
246  if(sel==0)
247  {
248  mMessage="Cannot have 0 images selected!";
249  valid=false;
250  }
251  else
252  {
253  boost::shared_ptr<ImageExtent> ie=boost::shared_ptr<ImageExtent>(new ImageExtent((*sel).GetAttribute("D0028_0010"),
254  (*sel).GetAttribute("D0028_0011"),
255  (*sel).GetAttribute("D0028_0012"),
256  ""));
257 
258  if(mImageExtent==0)
259  {
260  mImageExtent=ie;
261  if((mImageExtent->Get(min_dim-1)<2)||(mImageExtent->Get(max_dim)>1))
262  {
263  valid=false;
264  }
265  else
266  {
267  std::stringstream out;
268  out << mImageExtent->GetDimension() << "D image " << mImageExtent->Get(0) << "x"<< mImageExtent->Get(1) << "x"<< mImageExtent->Get(2) <<" selected";
269  mMessage = out.str();
270  mImageExtent->SetDimension(2);
271  valid=true;
272  }
273  }
274  else
275  {
276  if(mImageExtent->IsCompatible(*ie))
277  {
278  if(mImageExtent->GetDimension()==max_dim && mImageExtent->Get(max_dim)>2)
279  {
280  std::stringstream out;
281  out<<"Cannot add this image to selection : would result in a "<<mImageExtent->GetDimension()+1<<"D image!";
282  mMessage=out.str();
283  valid=false;
284  }
285  else if(max_dim<3)
286  {
287  std::stringstream out;
288  out<<"Selecting "<<mImageExtent->GetDimension()<<"D images is not allowed !";
289  mMessage=out.str();
290  valid=false;
291  }
292  else if(min_dim==3 && (ie->Get(2)+mImageExtent->Get(2))<2)
293  {
294  std::stringstream out;
295  out << "Cannot build the selection as it would result in a ";
296  out << mImageExtent->GetDimension();
297  out << "D image, and the minimum is ";
298  out << min_dim;
299  out << "D!";
300  mMessage=out.str();
301  valid=false;
302  }
303  else
304  {
305  mImageExtent->Add(*ie);
306  std::stringstream out;
307  out << mImageExtent->GetDimension() << "D image " << mImageExtent->Get(0) << "x"<< mImageExtent->Get(1) << "x"<< mImageExtent->Get(2) <<" selected";
308  mMessage = out.str();
309  }
310  }
311  else
312  {
313  mMessage="The selected images are not compatible.";
314  valid=false;
315  }
316  }
317  }
318 
320  SetMessage(mMessage);
321  return valid;
322  }

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

OutStrGimmick creaImageIO::WxGimmickView::m_out

Definition at line 64 of file creaImageIOWxGimmickView.h.

wxBoxSizer* creaImageIO::WxGimmickView::mbottom_sizer
private

Definition at line 153 of file creaImageIOWxGimmickView.h.

Referenced by WxGimmickView().

wxPanel* creaImageIO::WxGimmickView::mBottomPanel
private

Definition at line 171 of file creaImageIOWxGimmickView.h.

Referenced by WxGimmickView().

bool creaImageIO::WxGimmickView::mConstructed
private

Is set to true at the end of constructor (in order to lock callbacks from threaded objects or event before everything is ok)

Definition at line 158 of file creaImageIOWxGimmickView.h.

Referenced by WxGimmickView().

tree::Node* creaImageIO::WxGimmickView::mCurImageItemToShow
private

Currently Displayed Node.

Definition at line 262 of file creaImageIOWxGimmickView.h.

Referenced by ReadImageThreaded().

wxString creaImageIO::WxGimmickView::mCurrentDirectory
private

Definition at line 270 of file creaImageIOWxGimmickView.h.

Referenced by AddDir(), OnAddDir(), OnDriveMount(), OnTools(), and WxGimmickView().

wxImageList* creaImageIO::WxGimmickView::mIcon
private

The list of icons.

Definition at line 176 of file creaImageIOWxGimmickView.h.

Referenced by CreateIconList(), CreateToolBar(), and ~WxGimmickView().

Listener* creaImageIO::WxGimmickView::mListener
private
wxProgressDialog* creaImageIO::WxGimmickView::mProgressDialog
private
int creaImageIO::WxGimmickView::mSelectionMaxDimension
private

The selection's maximum dimension.

Definition at line 253 of file creaImageIOWxGimmickView.h.

Referenced by OnSelectionChange(), and WxGimmickView().

int creaImageIO::WxGimmickView::mSelectionMinDimension
private

The selection's minimum dimension.

Definition at line 256 of file creaImageIOWxGimmickView.h.

Referenced by OnSelectionChange(), and WxGimmickView().

wxBoxSizer* creaImageIO::WxGimmickView::msizer
private

Definition at line 154 of file creaImageIOWxGimmickView.h.

Referenced by WxGimmickView().

wxSplitterWindow* creaImageIO::WxGimmickView::mSplitter
private

Definition at line 170 of file creaImageIOWxGimmickView.h.

Referenced by WxGimmickView().

time_t creaImageIO::WxGimmickView::mstart
private

Definition at line 215 of file creaImageIOWxGimmickView.h.

Referenced by DisplayAddSummary(), and OnAddDir().

wxStaticText* creaImageIO::WxGimmickView::mText
private

Definition at line 172 of file creaImageIOWxGimmickView.h.

Referenced by OnSelectionChange(), and WxGimmickView().

wxToolBarToolBase* creaImageIO::WxGimmickView::mToolAddDatabase
private

Definition at line 164 of file creaImageIOWxGimmickView.h.

Referenced by CreateToolBar().

wxToolBarToolBase* creaImageIO::WxGimmickView::mToolAddDir
private

Definition at line 162 of file creaImageIOWxGimmickView.h.

Referenced by CreateToolBar().

wxToolBarToolBase* creaImageIO::WxGimmickView::mToolAddFile
private

Definition at line 161 of file creaImageIOWxGimmickView.h.

Referenced by CreateToolBar().

wxToolBar* creaImageIO::WxGimmickView::mToolBar
private

The ToolBar and the tools.

Definition at line 160 of file creaImageIOWxGimmickView.h.

Referenced by CreateToolBar(), and WxGimmickView().

wxToolBarToolBase* creaImageIO::WxGimmickView::mToolHelp
private

Definition at line 165 of file creaImageIOWxGimmickView.h.

Referenced by CreateToolBar().

wxToolBarToolBase* creaImageIO::WxGimmickView::mToolRemove
private

Definition at line 163 of file creaImageIOWxGimmickView.h.

Referenced by CreateToolBar().

wxToolBarToolBase* creaImageIO::WxGimmickView::mToolSettings
private

Definition at line 167 of file creaImageIOWxGimmickView.h.

Referenced by CreateToolBar().

wxToolBarToolBase* creaImageIO::WxGimmickView::mToolSynchronize
private

Definition at line 166 of file creaImageIOWxGimmickView.h.

Referenced by CreateToolBar().

wxToolBarToolBase* creaImageIO::WxGimmickView::mToolTools
private

Definition at line 168 of file creaImageIOWxGimmickView.h.

Referenced by CreateToolBar().

WxViewer* creaImageIO::WxGimmickView::mViewer
private
std::vector< boost::shared_ptr<ImagePointerHolder> > creaImageIO::WxGimmickView::pointers
private

Definition at line 265 of file creaImageIOWxGimmickView.h.

Referenced by ClearSelection(), ReadImageThreaded(), and WxGimmickView().


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