1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2005/03/09 19:29:38 $
7 Version: $Revision: 1.58 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #ifndef GDCMDICOMDIR_H
20 #define GDCMDICOMDIR_H
22 #include "gdcmDocument.h"
29 //-----------------------------------------------------------------------------
30 class DicomDirPatient;
32 class DicomDirElement;
38 typedef std::list<DicomDirPatient *> ListDicomDirPatient;
39 typedef std::vector<Document *> VectDocument;
41 //-----------------------------------------------------------------------------
43 * \brief DicomDir defines an object representing a DICOMDIR in memory
44 * as a tree-like structure DicomDirPatient
49 class GDCM_EXPORT DicomDir: public Document
52 typedef void Method(void*);
54 DicomDir( std::string const &filename, bool parseDir = false );
59 void Print(std::ostream &os = std::cout, std::string const &indent = "" );
61 // Informations contained in the parser
62 virtual bool IsReadable();
65 DicomDirMeta *NewMeta();
66 /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
67 DicomDirMeta *GetMeta() { return MetaElems; };
70 DicomDirPatient *NewPatient();
73 DicomDirPatient *GetFirstPatient();
74 DicomDirPatient *GetNextPatient();
77 void ParseDirectory();
79 // Note: the DicomDir:: namespace prefix is needed by Swig in the
80 // following method declarations. Refer to gdcmPython/gdcm.i
81 // for the reasons of this unnecessary notation at C++ level.
82 void SetStartMethod( DicomDir::Method *method,
84 DicomDir::Method *argDelete = NULL );
85 void SetProgressMethod( DicomDir::Method *method,
87 DicomDir::Method *argDelete = NULL );
88 void SetEndMethod( DicomDir::Method *method,
90 DicomDir::Method *argDelete = NULL );
91 void SetStartMethodArgDelete ( DicomDir::Method *m );
92 void SetProgressMethodArgDelete( DicomDir::Method *m );
93 void SetEndMethodArgDelete ( DicomDir::Method *m );
95 /// GetProgress GetProgress
96 float GetProgress() { return Progress; };
97 /// AbortProgress AbortProgress
98 void AbortProgress() { Abort = true; };
99 /// IsAborted IsAborted
100 bool IsAborted() { return Abort; };
103 bool WriteDicomDir(std::string const &fileName);
105 bool AnonymizeDicomDir();
107 /// Types of the DicomDirObject within the DicomDir
112 GDCM_DICOMDIR_PATIENT,
119 void CreateDicomDirChainedList(std::string const &path);
120 void CallStartMethod();
121 void CallProgressMethod();
122 void CallEndMethod();
126 void CreateDicomDir();
128 bool AddPatientToEnd(DicomDirPatient *dd);
129 bool AddStudyToEnd (DicomDirStudy *dd);
130 bool AddSerieToEnd (DicomDirSerie *dd);
131 bool AddImageToEnd (DicomDirImage *dd);
133 void SetElements(std::string const &path, VectDocument const &list);
134 void SetElement (std::string const &path, DicomDirType type,
136 void MoveSQItem(DocEntrySet *dst, DocEntrySet *src);
138 static bool HeaderLessThan(Document *header1, Document *header2);
142 /// Pointer on *the* DicomDirObject 'DicomDirMeta Elements'
143 DicomDirMeta *MetaElems;
145 /// Chained list of DicomDirPatient (to be exploited hierarchicaly)
146 ListDicomDirPatient Patients;
147 ListDicomDirPatient::iterator ItPatient;
149 /// pointer to the initialisation method for any progress bar
151 /// pointer to the incrementation method for any progress bar
152 Method *ProgressMethod;
153 /// pointer to the termination method for any progress bar
155 /// pointer to the ??? method for any progress bar
156 Method *StartMethodArgDelete;
157 /// pointer to the ??? method for any progress bar
158 Method* ProgressMethodArgDelete;
159 /// pointer to the ??? method for any progress bar
160 Method *EndMethodArgDelete;
161 /// pointer to the ??? for any progress bar
163 /// pointer to the ??? for any progress bar
165 /// pointer to the ??? for any progress bar
167 /// value of the ??? for any progress bar
169 /// value of the ??? for any progress bar
172 } // end namespace gdcm
173 //-----------------------------------------------------------------------------