creaImageIO_lib
creaImageIO::GimmickView Class Reference

Abstract class that handles views, attributes and previews (GUI) for Gimmick. More...

#include <creaImageIOGimmickView.h>

Inheritance diagram for creaImageIO::GimmickView:
Collaboration diagram for creaImageIO::GimmickView:

Classes

struct  ImageEventType
 

Public Types

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...
 
enum  EventType {
  ThreadedReaderStarted, ThreadedReaderStopped, ImageLoaded, ImageUnloaded,
  Error, ThreadedReaderStarted, ThreadedReaderStopped, ImageLoaded,
  ImageUnloaded, Error
}
 
enum  EventType {
  ThreadedReaderStarted, ThreadedReaderStopped, ImageLoaded, ImageUnloaded,
  Error, ThreadedReaderStarted, ThreadedReaderStopped, ImageLoaded,
  ImageUnloaded, Error
}
 

Public Member Functions

 GimmickView (boost::shared_ptr< Gimmick >, int number_of_threads=0)
 Ctor. More...
 
virtual ~GimmickView ()
 Virtual destructor. 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 GetSelectedImagesInVector (std::vector< vtkImageData * > &s, int dim)
 Adds the selected Images to the given vector. More...
 
virtual void GetSelectedImages (std::vector< vtkImageData * > &s, int dim)
 Adds the selected Images to the given vector and validates to see if they comply with the given parameter (4D) More...
 
virtual void GetSelectedFiles (std::vector< std::string > &s)
 
virtual void GetImages (int dim, std::vector< std::string > files, std::vector< vtkImageData * > &s)
 
virtual void OnSelectionChange (const std::vector< tree::Node * > &s, bool isSelection, int selection, bool mProcess)
 
virtual void ClearSelection ()
 
virtual void AddIgnoreFile (tree::Node *toRemove)
 Adds a file to ignore. More...
 
virtual void CopyFiles (const std::vector< std::string > &filenames)
 Copies selected files. More...
 
virtual void CreateEditFieldsDialog (tree::Node *node, std::vector< std::string > names, std::vector< std::string > keys)
 Edits the fields of a given node. More...
 
void Anonymize (std::vector< std::string > i_filenames, int type)
 Anonymize or de-anonymize data. More...
 
virtual void DumpTags (const std::string filename)
 Display all Dicom Tags. More...
 
virtual void ExportToStorage (const std::vector< std::string > keys)
 Edits the fields of a given node. 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 CreateTreeView (TreeHandler *)
 Create the tree view for TreeHandler provided. 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 ()
 
 GimmickView ()
 Ctor. More...
 
virtual ~GimmickView ()
 Virtual destructor. More...
 
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 GetSelectedFiles (std::vector< std::string > &)
 Returns the vector of full filenames of selected images. More...
 
virtual void GetSelectedImages (std::vector< vtkImageData * > &)
 Returns the vector of images corresponding to 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 ()
 

Protected Member Functions

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 Types

typedef void(* readXD )(std::vector< OutStrGimmick > &, std::vector< std::string >, OutputAttr, double)
 
typedef std::map< std::string,
ImageEventType
ImageEventTypeMap
 
typedef std::deque
< ImageEventType
ImageEventQueueType
 
typedef WxGimmickTreeItemData TreeItemData
 Type definition of the data regarding the tree. More...
 
typedef WxGimmickDicomNodeData NodeData
 Type definition of the data insid a node of the tree. More...
 

Private Member Functions

void getAttributes (const std::string i_file, std::map< std::string, std::string > &o_infos, OutputAttr i_attr)
 
virtual void readImages2 (std::vector< OutStrGimmick > &o_output, std::vector< std::string > im, OutputAttr i_attr, double i_zspc)
 
virtual void readImages3 (std::vector< OutStrGimmick > &o_output, std::vector< std::string > im, OutputAttr i_attr, double i_zspc)
 
virtual void readImages4 (std::vector< OutStrGimmick > &o_output, std::vector< std::string > im, OutputAttr i_attr)
 
virtual void readImages1 (std::vector< OutStrGimmick > &o_output, std::vector< std::string > im, OutputAttr i_attr)
 
const std::string & GetDatabaseExtension ()
 Gets the extension of the database. More...
 
virtual void SetDatabaseExtension (const std::string &ext)
 Sets the extension of the database. More...
 
virtual void ShowImage (vtkImageData *image)
 Shows the image sent as a parameter. More...
 
void CreateUserSettingsDirectory ()
 Creates the user settings directory. More...
 
const std::string & GetUserSettingsDirectory ()
 Obtains the user settings directory. More...
 
virtual void ShowInformation (DicomNode *)
 Shows the Information regarding the node sent as a parameter. More...
 
TreeItemDataGetItemData (const TreeItemId &id)
 Gets the item data of the tree item passed as a parameter. More...
 

Private Attributes

boost::shared_ptr< GimmickmGimmick
 Controller which manages the interaction with the model. More...
 
TreeViewMapType mTreeViewMap
 The views. More...
 
std::string mMess
 The message that results from the validation. More...
 
MultiThreadImageReader mReader
 Multi-thread image reader. More...
 
ImageEventTypeMap mImageEventMap
 
boost::shared_ptr< ImageExtentmImageExtent
 The current image extent. More...
 
ValidationSignalType mValidationSignal
 The validation signal. More...
 
bool valid
 Boolean that determines if the selection is valid. More...
 
bool mReaderStarted
 Boolean that determines if the reader has been started. More...
 
int mSelectionType
 
int mSelectionMaxImageDimension
 
int mCurrentSelectionImageSize [4]
 
DicomDatabaseListType mDicomDatabaseList
 Existent Database List. More...
 
DicomDatabase * mFavoriteDatabase
 Favorites database. More...
 
std::string mDatabaseListFile
 Path to the database list file. More...
 
std::string mDatabaseExtension
 Extension of the database. More...
 
bool mJustStarted
 
int mFirstDicomDatabaseIconIndex
 
vtkImageViewer2 * mViewer
 
int mx1
 
int mx2
 
int my1
 
int my2
 
int mz1
 
int mz2
 
double mspx
 
double mspy
 
double mspz
 
std::map< std::string,
DicomNode * > 
mImageFileNameToNode
 
Gimmickcontroller
 

Detailed Description

Abstract class that handles views, attributes and previews (GUI) for Gimmick.

Definition at line 82 of file creaImageIOGimmickView.h.

Member Typedef Documentation

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

Type of list of DicomDatabase.

Definition at line 64 of file OldcreaImageIOGimmickView.h.

Definition at line 282 of file creaImageIOGimmickView.h.

typedef std::map<std::string,ImageEventType> creaImageIO::GimmickView::ImageEventTypeMap
private

Definition at line 276 of file creaImageIOGimmickView.h.

typedef WxGimmickDicomNodeData creaImageIO::GimmickView::NodeData
private

Type definition of the data insid a node of the tree.

Definition at line 141 of file OldcreaImageIOGimmickView.h.

typedef void(* creaImageIO::GimmickView::readXD)(std::vector< OutStrGimmick > &, std::vector< std::string >, OutputAttr, double)
private

Definition at line 231 of file creaImageIOGimmickView.h.

typedef WxGimmickTreeItemData creaImageIO::GimmickView::TreeItemData
private

Type definition of the data regarding the tree.

Definition at line 137 of file OldcreaImageIOGimmickView.h.

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

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

Definition at line 206 of file creaImageIOGimmickView.h.

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

Definition at line 205 of file creaImageIOGimmickView.h.

Member Enumeration Documentation

Enumerator
ThreadedReaderStarted 
ThreadedReaderStopped 
ImageLoaded 
ImageUnloaded 
Error 
ThreadedReaderStarted 
ThreadedReaderStopped 
ImageLoaded 
ImageUnloaded 
Error 

Definition at line 61 of file creaImageIOMultiThreadImageReader.h.

62  {
67  Error
68  }
Enumerator
ThreadedReaderStarted 
ThreadedReaderStopped 
ImageLoaded 
ImageUnloaded 
Error 
ThreadedReaderStarted 
ThreadedReaderStopped 
ImageLoaded 
ImageUnloaded 
Error 

Definition at line 62 of file creaImageIOQMultiThreadImageReader.h.

63  {
68  Error
69  }

Constructor & Destructor Documentation

creaImageIO::GimmickView::GimmickView ( boost::shared_ptr< Gimmick gimmick,
int  number_of_threads = 0 
)

Ctor.

Definition at line 107 of file creaImageIOGimmickView.cpp.

References GimmickDebugMessage.

108  : mGimmick(gimmick),
109  mReader(threads)
110  {
111  GimmickDebugMessage(1,"GimmickView::GimmickView"
112  <<std::endl);
113  // Anciently started the threads ...
114  // Threads now automatically start at first image request
115  //mReader.Start();
116 
117  }
creaImageIO::GimmickView::~GimmickView ( )
virtual

Virtual destructor.

Destructor.

Definition at line 122 of file creaImageIOGimmickView.cpp.

References GimmickDebugMessage.

123  {
124  GimmickDebugMessage(1,"GimmickView::~GimmickView"
125  <<std::endl);
126  }
creaImageIO::GimmickView::GimmickView ( )

Ctor.

virtual creaImageIO::GimmickView::~GimmickView ( )
virtual

Virtual destructor.

Member Function Documentation

virtual void creaImageIO::GimmickView::AddIgnoreFile ( tree::Node toRemove)
inlinevirtual

Adds a file to ignore.

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 131 of file creaImageIOGimmickView.h.

References GimmickError.

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

132  { GimmickError("INTERNAL ERROR : AddIgnoreFile not implemented"); }

Here is the caller graph for this function:

void creaImageIO::GimmickView::Anonymize ( std::vector< std::string >  i_filenames,
int  type 
)

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:

virtual void creaImageIO::GimmickView::ClearSelection ( )
inlinevirtual

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 127 of file creaImageIOGimmickView.h.

References GimmickError.

Referenced by creaImageIO::WxTreeView::OnItemSelected(), creaImageIO::WxTreeView::OnKeyDown(), and creaImageIO::WxTreeView::OnPopupFilter().

128  { GimmickError("INTERNAL ERROR : ClearSelection not implemented"); }

Here is the caller graph for this function:

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

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 mValidationSignal.

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

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

Here is the caller graph for this function:

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

Copies selected files.

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 135 of file creaImageIOGimmickView.h.

References GimmickError.

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

136  { GimmickError("INTERNAL ERROR : CopyFiles not implemented"); }

Here is the caller graph for this function:

virtual void creaImageIO::GimmickView::CreateEditFieldsDialog ( tree::Node node,
std::vector< std::string >  names,
std::vector< std::string >  keys 
)
inlinevirtual

Edits the fields of a given node.

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 139 of file creaImageIOGimmickView.h.

References GimmickError.

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

140  { GimmickError("INTERNAL ERROR : EditFields not implemented"); }

Here is the caller graph for this function:

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

Create a tree view with a given name.

Definition at line 162 of file creaImageIOGimmickView.cpp.

References CreateTreeView(), and mGimmick.

Referenced by creaImageIO::WxGimmickView::OnAddDB(), and creaImageIO::WxGimmickView::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:

virtual void creaImageIO::GimmickView::CreateTreeView ( TreeHandler )
inlinevirtual

Create the tree view for TreeHandler provided.

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 190 of file creaImageIOGimmickView.h.

References GimmickError.

Referenced by CreateSingleTreeView(), and CreateTreeViews().

191  { GimmickError("INTERNAL ERROR : CreateTreeView not implemented"); }

Here is the caller graph for this function:

void creaImageIO::GimmickView::CreateTreeViews ( )

Create the tree views.

Definition at line 149 of file creaImageIOGimmickView.cpp.

References CreateTreeView(), GimmickMessage, and mGimmick.

Referenced by creaImageIO::WxGimmickView::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::GimmickView::CreateUserSettingsDirectory ( )
inlineprivate

Creates the user settings directory.

Definition at line 104 of file OldcreaImageIOGimmickView.h.

104 { return; }
virtual void creaImageIO::GimmickView::DumpTags ( const std::string  filename)
inlinevirtual

Display all Dicom Tags.

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 146 of file creaImageIOGimmickView.h.

References GimmickError.

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

147  {GimmickError("INTERNAL ERROR : DumpTags not implemented"); }

Here is the caller graph for this function:

virtual void creaImageIO::GimmickView::ExportToStorage ( const std::vector< std::string >  keys)
inlinevirtual

Edits the fields of a given node.

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 150 of file creaImageIOGimmickView.h.

References GimmickError.

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

151  { GimmickError("INTERNAL ERROR : ExportToStorage not implemented"); }

Here is the caller graph for this function:

void creaImageIO::GimmickView::Finalize ( )
virtual

Finalize.

Definition at line 141 of file creaImageIOGimmickView.cpp.

142  {
143  }
void creaImageIO::GimmickView::getAttributes ( const std::string  i_file,
std::map< std::string, std::string > &  o_infos,
OutputAttr  i_attr 
)
private

Definition at line 471 of file creaImageIOGimmickView.cpp.

References creaImageIO::MultiThreadImageReader::getAttributes(), creaImageIO::OutputAttr::inside, mGimmick, mReader, and creaImageIO::OutputAttr::outside.

Referenced by readImages1(), readImages2(), readImages3(), and readImages4().

472  {
473  if(i_attr.inside.size() >0)
474  {
475  mGimmick->GetAttributes(i_file,o_infos,i_attr);
476  }
477  if(i_attr.outside.size()>0)
478  {
479  mReader.getAttributes(i_file,o_infos, i_attr.outside);
480  }
481  }

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string& creaImageIO::GimmickView::GetDatabaseExtension ( )
inlineprivate

Gets the extension of the database.

Definition at line 80 of file OldcreaImageIOGimmickView.h.

80 { return null; }
vtkImageData* creaImageIO::GimmickView::GetDefaultImage ( )
inline

Definition at line 202 of file creaImageIOGimmickView.h.

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

Referenced by creaImageIO::WxGimmickView::ClearSelection(), OnMultiThreadImageReaderEvent(), creaImageIO::WxGimmickView::ReadImageThreaded(), and creaImageIO::WxGimmickView::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 ( )
inlinevirtual

Returns the list of DicomDatabase open.

Definition at line 66 of file OldcreaImageIOGimmickView.h.

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

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)
virtual

Returns the DicomNode corresponding to the tree item.

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

Definition at line 121 of file creaImageIOGimmickView.h.

References GimmickError.

122  { GimmickError("INTERNAL ERROR : GetImages not implemented"); }
TreeItemData* creaImageIO::GimmickView::GetItemData ( const TreeItemId &  id)
inlineprivate

Gets the item data of the tree item passed as a parameter.

Definition at line 139 of file OldcreaImageIOGimmickView.h.

139 { return null; }
int creaImageIO::GimmickView::GetMaximalPriority ( )
inline

Returns the maximal priority.

Definition at line 108 of file creaImageIOGimmickView.h.

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

Referenced by creaImageIO::WxGimmickView::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 ( )
inline

Obtains the message of the state.

Definition at line 175 of file creaImageIOGimmickView.h.

References mMess.

Referenced by creaImageIO::WxGimmickView::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 * > &  )
inlinevirtual

Returns the vector of DicomNode corresponding to selection.

Definition at line 58 of file OldcreaImageIOGimmickView.h.

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

Returns the vector of full filenames of selected images.

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 54 of file OldcreaImageIOGimmickView.h.

54 { return; }
virtual void creaImageIO::GimmickView::GetSelectedFiles ( std::vector< std::string > &  s)
inlinevirtual

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 118 of file creaImageIOGimmickView.h.

References GimmickError.

119  { GimmickError("INTERNAL ERROR : GetSelectedFiles not implemented"); }
virtual void creaImageIO::GimmickView::GetSelectedImages ( std::vector< vtkImageData * > &  )
inlinevirtual

Returns the vector of images corresponding to selection.

Definition at line 56 of file OldcreaImageIOGimmickView.h.

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

Adds the selected Images to the given vector and validates to see if they comply with the given parameter (4D)

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 115 of file creaImageIOGimmickView.h.

References GimmickError.

116  { GimmickError("INTERNAL ERROR : GetSelectedImages not implemented"); }
virtual void creaImageIO::GimmickView::GetSelectedImagesInVector ( std::vector< vtkImageData * > &  s,
int  dim 
)
inlinevirtual

Adds the selected Images to the given vector.

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 111 of file creaImageIOGimmickView.h.

References GimmickError.

112  { GimmickError("INTERNAL ERROR : GetSelectedImagesInVector not implemented"); }
virtual int creaImageIO::GimmickView::GetSelectionSize ( )
inlinevirtual

Returns the size of the current selection.

Definition at line 50 of file OldcreaImageIOGimmickView.h.

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

Returns the TreeViewMap (const ref)

Definition at line 101 of file creaImageIOGimmickView.h.

References mTreeViewMap.

102  { return mTreeViewMap; }
const std::string& creaImageIO::GimmickView::GetUserSettingsDirectory ( )
inlineprivate

Obtains the user settings directory.

Definition at line 106 of file OldcreaImageIOGimmickView.h.

106 { return null; }
void creaImageIO::GimmickView::Initialize ( )
virtual

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

Definition at line 133 of file creaImageIOGimmickView.cpp.

References 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:

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

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)

Definition at line 451 of file creaImageIOGimmickView.cpp.

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

Referenced by creaImageIO::WxGimmickView::getSelectedFiles(), and 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:

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

Loads or creates a favorites database.

Definition at line 101 of file OldcreaImageIOGimmickView.h.

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

Definition at line 325 of file creaImageIOGimmickView.cpp.

References mValidationSignal.

Referenced by NoValidateSelected(), creaImageIO::WxTreeView::RemoveSelected(), and 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 ( )

No selected image.

Definition at line 227 of file creaImageIOGimmickView.cpp.

References GimmickDebugMessage, modifyValidationSignal(), SetMessage(), and 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:

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

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, GetDefaultImage(), GimmickDebugMessage, GimmickMessage, creaImageIO::GimmickView::ImageEventType::image, creaImageIO::MultiThreadImageReaderUser::ImageLoaded, creaImageIO::MultiThreadImageReaderUser::ImageUnloaded, 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:

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

Reimplemented in creaImageIO::WxGimmickView.

Definition at line 124 of file creaImageIOGimmickView.h.

References GimmickError.

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

125  { GimmickError("INTERNAL ERROR : OnSelectionChange not implemented"); }

Here is the caller graph for this function:

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

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 
)

Definition at line 661 of file creaImageIOGimmickView.cpp.

References isSingle(), readImages1(), readImages2(), readImages3(), and readImages4().

Referenced by creaImageIO::WxGimmickView::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::readImages1 ( std::vector< OutStrGimmick > &  o_output,
std::vector< std::string >  im,
OutputAttr  i_attr 
)
privatevirtual

Definition at line 486 of file creaImageIOGimmickView.cpp.

References getAttributes(), creaImageIO::MultiThreadImageReader::GetImage(), creaImageIO::OutStrGimmick::img, creaImageIO::OutStrGimmick::infos, mReader, and creaImageIO::OutputAttr::mult.

Referenced by readImages().

488  {
489  std::vector<std::string>::iterator it;
490  for (it=im.begin(); it!=im.end(); ++it)
491  {
492  OutStrGimmick out;
493  out.img = vtkImageData::New();
494  out.img->ShallowCopy(mReader.GetImage(*it));
495  if(i_attr.mult)
496  getAttributes((*it),out.infos,i_attr);
497  o_output.push_back(out);
498  }
499  // If we want only one output information structure, we set it outside the loop
500  if(!i_attr.mult)
501  {
502  getAttributes(im.front(), o_output.front().infos, i_attr);
503  }
504 
505  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::GimmickView::readImages2 ( std::vector< OutStrGimmick > &  o_output,
std::vector< std::string >  im,
OutputAttr  i_attr,
double  i_zspc 
)
privatevirtual

Definition at line 561 of file creaImageIOGimmickView.cpp.

References getAttributes(), creaImageIO::MultiThreadImageReader::GetImage(), creaImageIO::OutStrGimmick::img, mReader, and creaImageIO::OutputAttr::mult.

Referenced by readImages().

563  {
564  vtkImageData* first = mReader.GetImage( im.front());
565  int dim[3];
566  double spac[3];
567  first->GetDimensions(dim);
568  first->GetSpacing(spac);
569  // differents formats char , short, etc...
570  // differents components 1..3 ex. jpg ->RGB 3
571  unsigned long imsize = dim[0] * dim[1];
572  imsize = imsize * first->GetScalarSize() * first->GetNumberOfScalarComponents();
573 
574  // Order the file name vector already did with the OutputModel!!!
575  std::vector<std::string>::iterator it;
576  std::vector<OutStrGimmick>::iterator it_out = o_output.begin();
577 
578  for (it=im.begin(); it!=im.end(); ++it)//, it_out ++)
579  {
580  vtkImageData* cur = mReader.GetImage( (*it) );
581  for (int slice= 0 ; slice <dim[2]; slice++)
582  {
583  OutStrGimmick out;
584  out.img = vtkImageData::New();
585  out.img->SetScalarType(first->GetScalarType());
586  out.img->SetSpacing(spac);
587  out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents());
588  int ext[6];
589  first->GetWholeExtent(ext); // send also 0,0 in Z
590  ext[5] = 0;
591  out.img->SetExtent(ext);
592 
593  out.img->SetDimensions(dim[0], dim[1], 1 );
594  out.img->AllocateScalars();
595  out.img->Update();
596  memcpy(out.img->GetScalarPointer(0,0,0), cur->GetScalarPointer(0,0,slice), imsize);
597  o_output.push_back(out);
598  }
599  // if(i_attr.mult)
600  // getAttributes((*it),(*it_out).infos,i_attr);
601  }
602  if(!i_attr.mult)
603  {
604  getAttributes(im.front(), o_output.front().infos,i_attr);
605  }
606 
607  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::GimmickView::readImages3 ( std::vector< OutStrGimmick > &  o_output,
std::vector< std::string >  im,
OutputAttr  i_attr,
double  i_zspc 
)
privatevirtual

!!!out.img->SetSpacing(i_zspc);

Definition at line 510 of file creaImageIOGimmickView.cpp.

References getAttributes(), creaImageIO::MultiThreadImageReader::GetImage(), creaImageIO::OutStrGimmick::img, creaImageIO::OutStrGimmick::infos, and mReader.

Referenced by readImages().

512  {
513  OutStrGimmick out;
514  vtkImageData* first = mReader.GetImage( im.front());
515  out.img = vtkImageData::New();
516  out.img->SetScalarType(first->GetScalarType());
517  out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents());
518  int ext[6];
519  first->GetWholeExtent(ext); // send also 0,0 in Z
520  if(ext[5] == 0)
521  {
522  ext[5] = (int)im.size()-1;
523  }
524  else
525  {
526  ext[5] = ext[5] * (int)im.size()-1; // to deal with multiframes
527  }
528  out.img->SetExtent(ext);
529  int dim[3];
530  double spac[3];
531  first->GetDimensions(dim);
532  first->GetSpacing(spac);
533  out.img->SetSpacing(spac);
534  out.img->SetDimensions(dim[0], dim[1], (int)im.size() );
535  out.img->AllocateScalars();
536  out.img->Update();
537  unsigned long imsize = dim[0] * dim[1];
538  imsize = imsize * dim[2] ; // deal with multiframes here
539  // differents formats char , short, etc...
540  // differents components 1..3 ex. jpg ->RGB 3
541  imsize = imsize * first->GetScalarSize() * first->GetNumberOfScalarComponents();
542  // Order the file name vector already did with the OutputModel!!!
544  int slice = 0;
545  std::vector<std::string>::iterator it;
546  for (it=im.begin(); it!=im.end(); ++it)
547  {
548  vtkImageData* cur = mReader.GetImage( (*it) );
549  memcpy(out.img->GetScalarPointer(0,0,slice), cur->GetScalarPointer(0,0,0), imsize);
550  slice++;
551  }
552  getAttributes(im.front(),out.infos, i_attr);
553  o_output.push_back(out);
554  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::GimmickView::readImages4 ( std::vector< OutStrGimmick > &  o_output,
std::vector< std::string >  im,
OutputAttr  i_attr 
)
privatevirtual

Definition at line 612 of file creaImageIOGimmickView.cpp.

References getAttributes(), creaImageIO::MultiThreadImageReader::GetImage(), creaImageIO::OutStrGimmick::img, mReader, and creaImageIO::OutputAttr::mult.

Referenced by readImages().

614  {
615  std::vector<std::string>::iterator it;
616  std::vector<OutStrGimmick>::iterator it_out = o_output.begin();
617  vtkImageData* first = mReader.GetImage( im.front());
618  int dim[3];
619  first->GetDimensions(dim);
620 
621  for (int slice= 0 ; slice <dim[2]; slice++)
622  {
623  OutStrGimmick out;
624  out.img = vtkImageData::New();
625  out.img->SetScalarType(first->GetScalarType());
626  out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents());
627 
628  int ext[6];
629  double spac[6];
630  first->GetWholeExtent(ext); // send also 0,0 in Z
631  ext[5] = 0;
632  out.img->SetExtent(ext);
633  first->GetSpacing(spac);
634  out.img->SetSpacing(spac);
635  out.img->SetDimensions(dim[0], dim[1], (int)im.size() );
636  out.img->AllocateScalars();
637  out.img->Update();
638  unsigned long imsize = dim[0] * dim[1];
639  imsize = imsize * first->GetScalarSize() * first->GetNumberOfScalarComponents();
640  int index = 0;
641 
642  for (it=im.begin(); it!=im.end(); ++it, index ++)
643  {
644  vtkImageData* cur = mReader.GetImage( (*it) );
645  memcpy(out.img->GetScalarPointer(0,0,index), cur->GetScalarPointer(0,0,slice), imsize);
646  o_output.push_back(out);
647  }
648  }
649  if(!i_attr.mult) // No sense to take informations in all images
650  {
651  getAttributes(im.front(), o_output.front().infos,i_attr);
652  }
653 
654  }

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 
)

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(), mReader, and stopReader().

Referenced by creaImageIO::WxGimmickView::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 
)

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 mReader.

Referenced by creaImageIO::WxGimmickView::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:

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

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 
)

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(), mImageEventMap, mReader, mReaderStarted, creaImageIO::GimmickView::ImageEventType::pointerHolder, creaImageIO::MultiThreadImageReader::Request(), and creaImageIO::MultiThreadImageReader::Start().

Referenced by creaImageIO::WxGimmickView::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 ( )

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 mImageExtent, and valid.

Referenced by creaImageIO::WxGimmickView::ClearSelection(), and creaImageIO::WxGimmickView::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)
inlinevirtual

Copies selected files.

Definition at line 154 of file creaImageIOGimmickView.h.

References GimmickError.

155  { GimmickError("INTERNAL ERROR : SaveAs not implemented"); }
virtual void creaImageIO::GimmickView::SetDatabaseExtension ( const std::string &  ext)
inlineprivatevirtual

Sets the extension of the database.

Definition at line 82 of file OldcreaImageIOGimmickView.h.

82 { return; }
void creaImageIO::GimmickView::SetMessage ( std::string  mess)
inline

Obtains the message of the state.

Definition at line 178 of file creaImageIOGimmickView.h.

References mMess.

Referenced by NoValidateSelected(), and ValidateSelected().

178 {mMess=mess;}

Here is the caller graph for this function:

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

Shows the help.

virtual void creaImageIO::GimmickView::ShowImage ( vtkImageData *  image)
inlineprivatevirtual

Shows the image sent as a parameter.

Definition at line 92 of file OldcreaImageIOGimmickView.h.

92 { return; }
virtual void creaImageIO::GimmickView::ShowInformation ( DicomNode *  )
inlineprivatevirtual

Shows the Information regarding the node sent as a parameter.

Definition at line 115 of file OldcreaImageIOGimmickView.h.

115 { return; }
void creaImageIO::GimmickView::stopReader ( )

Definition at line 331 of file creaImageIOGimmickView.cpp.

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

Referenced by 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 *  )
inlineprotectedvirtual

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 
)
inlineprotectedvirtual

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 
)
virtual

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 GetTreeViewMap(), and GimmickError.

Referenced by creaImageIO::WxGimmickView::AddDir(), creaImageIO::WxGimmickView::ExportToStorage(), creaImageIO::WxGimmickView::OnAddDir(), creaImageIO::WxGimmickView::OnAddFiles(), creaImageIO::WxGimmickView::OnDriveMount(), creaImageIO::WxGimmickView::OnFieldsEdited(), and creaImageIO::WxGimmickView::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:

bool creaImageIO::GimmickView::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.

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, mImageExtent, modifyValidationSignal(), SetMessage(), and valid.

Referenced by creaImageIO::WxGimmickView::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

Gimmick* creaImageIO::GimmickView::controller
private

Definition at line 180 of file OldcreaImageIOGimmickView.h.

int creaImageIO::GimmickView::mCurrentSelectionImageSize[4]
private

Definition at line 151 of file OldcreaImageIOGimmickView.h.

std::string creaImageIO::GimmickView::mDatabaseExtension
private

Extension of the database.

Definition at line 161 of file OldcreaImageIOGimmickView.h.

std::string creaImageIO::GimmickView::mDatabaseListFile
private

Path to the database list file.

Definition at line 159 of file OldcreaImageIOGimmickView.h.

DicomDatabaseListType creaImageIO::GimmickView::mDicomDatabaseList
private

Existent Database List.

Definition at line 154 of file OldcreaImageIOGimmickView.h.

DicomDatabase* creaImageIO::GimmickView::mFavoriteDatabase
private

Favorites database.

Definition at line 156 of file OldcreaImageIOGimmickView.h.

int creaImageIO::GimmickView::mFirstDicomDatabaseIconIndex
private

Definition at line 165 of file OldcreaImageIOGimmickView.h.

boost::shared_ptr< Gimmick> creaImageIO::GimmickView::mGimmick
private

Controller which manages the interaction with the model.

Definition at line 249 of file creaImageIOGimmickView.h.

Referenced by CreateSingleTreeView(), CreateTreeViews(), and getAttributes().

ImageEventTypeMap creaImageIO::GimmickView::mImageEventMap
private

Map of images' names to ImageEventType Used to associated a filename to a the data of a request

Definition at line 279 of file creaImageIOGimmickView.h.

Referenced by OnMultiThreadImageReaderEvent(), and RequestReading().

boost::shared_ptr<ImageExtent> creaImageIO::GimmickView::mImageExtent
private

The current image extent.

Definition at line 287 of file creaImageIOGimmickView.h.

Referenced by ResetExtent(), and ValidateSelected().

std::map<std::string,DicomNode*> creaImageIO::GimmickView::mImageFileNameToNode
private

Definition at line 177 of file OldcreaImageIOGimmickView.h.

bool creaImageIO::GimmickView::mJustStarted
private

Definition at line 163 of file OldcreaImageIOGimmickView.h.

std::string creaImageIO::GimmickView::mMess
private

The message that results from the validation.

Definition at line 255 of file creaImageIOGimmickView.h.

Referenced by GetMessage(), and SetMessage().

bool creaImageIO::GimmickView::mReaderStarted
private

Boolean that determines if the reader has been started.

Definition at line 296 of file creaImageIOGimmickView.h.

Referenced by Initialize(), and RequestReading().

int creaImageIO::GimmickView::mSelectionMaxImageDimension
private

Definition at line 150 of file OldcreaImageIOGimmickView.h.

int creaImageIO::GimmickView::mSelectionType
private

Definition at line 149 of file OldcreaImageIOGimmickView.h.

double creaImageIO::GimmickView::mspx
private

Definition at line 171 of file OldcreaImageIOGimmickView.h.

double creaImageIO::GimmickView::mspy
private

Definition at line 171 of file OldcreaImageIOGimmickView.h.

double creaImageIO::GimmickView::mspz
private

Definition at line 171 of file OldcreaImageIOGimmickView.h.

TreeViewMapType creaImageIO::GimmickView::mTreeViewMap
private

The views.

Definition at line 252 of file creaImageIOGimmickView.h.

Referenced by GetTreeViewMap().

ValidationSignalType creaImageIO::GimmickView::mValidationSignal
private

The validation signal.

Definition at line 290 of file creaImageIOGimmickView.h.

Referenced by ConnectValidationObserver(), and modifyValidationSignal().

vtkImageViewer2* creaImageIO::GimmickView::mViewer
private

Definition at line 168 of file OldcreaImageIOGimmickView.h.

int creaImageIO::GimmickView::mx1
private

Definition at line 170 of file OldcreaImageIOGimmickView.h.

int creaImageIO::GimmickView::mx2
private

Definition at line 170 of file OldcreaImageIOGimmickView.h.

int creaImageIO::GimmickView::my1
private

Definition at line 170 of file OldcreaImageIOGimmickView.h.

int creaImageIO::GimmickView::my2
private

Definition at line 170 of file OldcreaImageIOGimmickView.h.

int creaImageIO::GimmickView::mz1
private

Definition at line 170 of file OldcreaImageIOGimmickView.h.

int creaImageIO::GimmickView::mz2
private

Definition at line 170 of file OldcreaImageIOGimmickView.h.

bool creaImageIO::GimmickView::valid
private

Boolean that determines if the selection is valid.

Definition at line 293 of file creaImageIOGimmickView.h.

Referenced by NoValidateSelected(), creaImageIO::WxGimmickView::OnSelectionChange(), ResetExtent(), and ValidateSelected().


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