1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2005/02/01 10:29:54 $
7 Version: $Revision: 1.51 $
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 //-----------------------------------------------------------------------------
44 * \brief DicomDir defines an object representing a DICOMDIR in memory
45 * as a tree-like structure DicomDirPatient -> DicomDirStudy -> DicomDirSerie
49 class GDCM_EXPORT DicomDir: public Document
52 typedef void(Method)(void*);
54 DicomDir( std::string const &filename, bool parseDir = false );
59 /// \brief canonical Printer
60 void Print(std::ostream &os = std::cout, std::string const & indent = "" );
63 /// Informations contained in the parser
64 virtual bool IsReadable();
67 void ParseDirectory();
69 // Note: the DicomDir:: namespace prefix is needed by Swig in the
70 // following method declarations. Refer to gdcmPython/gdcm.i
71 // for the reasons of this unecessary notation at C++ level.
72 void SetStartMethod( DicomDir::Method *method,
74 DicomDir::Method *argDelete = NULL );
75 void SetProgressMethod( DicomDir::Method *method,
77 DicomDir::Method *argDelete = NULL );
78 void SetEndMethod( DicomDir::Method *method,
80 DicomDir::Method *argDelete = NULL );
81 void SetStartMethodArgDelete( DicomDir::Method *m );
82 void SetProgressMethodArgDelete( DicomDir::Method *m );
83 void SetEndMethodArgDelete( DicomDir::Method *m );
84 /// GetProgress GetProgress
85 float GetProgress() { return Progress; };
86 /// AbortProgress AbortProgress
87 void AbortProgress() { Abort = true; };
88 /// IsAborted IsAborted
89 bool IsAborted() { return Abort; };
91 /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
92 DicomDirMeta* GetMeta() { return MetaElems; };
94 // should avoid exposing internal mechanism
95 DicomDirPatient *GetFirstPatient();
96 DicomDirPatient *GetNextPatient();
99 DicomDirMeta *NewMeta();
100 DicomDirPatient *NewPatient();
106 bool WriteDicomDir(std::string const &fileName);
108 /// Types of the DicomDirObject within the DicomDir
113 GDCM_DICOMDIR_PATIENT,
120 void CreateDicomDirChainedList(std::string const &path);
121 void CallStartMethod();
122 void CallProgressMethod();
123 void CallEndMethod();
127 void CreateDicomDir();
129 bool AddPatientToEnd(DicomDirPatient *dd);
130 bool AddStudyToEnd (DicomDirStudy *dd);
131 bool AddSerieToEnd (DicomDirSerie *dd);
132 bool AddImageToEnd (DicomDirImage *dd);
134 void SetElements(std::string const &path, VectDocument const &list);
135 void SetElement (std::string const &path, DicomDirType type,
137 void MoveSQItem(DocEntrySet *dst,DocEntrySet *src);
139 static bool HeaderLessThan(Document *header1, Document *header2);
143 /// Pointer on *the* DicomDirObject 'DicomDirMeta Elements'
144 DicomDirMeta* MetaElems;
146 /// Chained list of DicomDirPatient (to be exploited recursively)
147 ListDicomDirPatient Patients;
148 ListDicomDirPatient::iterator ItPatient;
150 /// pointer to the initialisation method for any progress bar
152 /// pointer to the incrementation method for any progress bar
153 Method* ProgressMethod;
154 /// pointer to the termination method for any progress bar
156 /// pointer to the ??? method for any progress bar
157 Method* StartMethodArgDelete;
158 /// pointer to the ??? method for any progress bar
159 Method* ProgressMethodArgDelete;
160 /// pointer to the ??? method for any progress bar
161 Method* EndMethodArgDelete;
162 /// pointer to the ??? for any progress bar
164 /// pointer to the ??? for any progress bar
166 /// pointer to the ??? for any progress bar
168 /// value of the ??? for any progress bar
170 /// value of the ??? for any progress bar
173 } // end namespace gdcm
174 //-----------------------------------------------------------------------------