1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2004/11/09 13:10:44 $
7 Version: $Revision: 1.38 $
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 "gdcmCommon.h"
23 #include "gdcmDocument.h"
24 #include "gdcmDicomDirPatient.h"
25 #include "gdcmDicomDirMeta.h"
26 #include "gdcmDicomDirElement.h"
33 //-----------------------------------------------------------------------------
34 typedef std::list<DicomDirPatient*> ListDicomDirPatient;
35 typedef std::vector<Document*> VectDocument;
37 //-----------------------------------------------------------------------------
41 * \brief DicomDir defines an object representing a DICOMDIR in memory.
44 class GDCM_EXPORT DicomDir: public Document
47 typedef void(Method)(void*);
49 DicomDir( std::string const & filename, bool parseDir = false );
54 /// \brief canonical Printer
56 void Print(std::ostream &os = std::cout);
58 /// Informations contained in the parser
59 virtual bool IsReadable();
61 /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
62 DicomDirMeta* GetDicomDirMeta() { return MetaElems; };
64 /// Returns the PATIENT chained List for this DICOMDIR.
65 ListDicomDirPatient const & GetDicomDirPatients() const { return Patients; };
68 void ParseDirectory();
70 void SetStartMethod( DicomDir::Method*,
72 DicomDir::Method* = NULL );
73 void SetProgressMethod( DicomDir::Method*,
75 DicomDir::Method* = NULL );
76 void SetEndMethod( DicomDir::Method*,
78 DicomDir::Method* = NULL );
79 void SetStartMethodArgDelete( DicomDir::Method* );
80 void SetProgressMethodArgDelete( DicomDir::Method* );
81 void SetEndMethodArgDelete( DicomDir::Method* );
83 /// GetProgress GetProgress
84 float GetProgress() { return Progress; };
86 /// AbortProgress AbortProgress
87 void AbortProgress() { Abort = true; };
89 /// IsAborted IsAborted
90 bool IsAborted() { return Abort; };
93 DicomDirMeta* NewMeta();
94 DicomDirPatient* NewPatient();
97 bool WriteDicomDir(std::string const & fileName);
99 /// Types of the DicomDirObject within the DicomDir
104 GDCM_DICOMDIR_PATIENT,
111 void CreateDicomDirChainedList(std::string const & path);
112 void CallStartMethod();
113 void CallProgressMethod();
114 void CallEndMethod();
118 void CreateDicomDir();
119 void AddDicomDirMeta();
120 void AddDicomDirPatientToEnd(SQItem* s);
121 void AddDicomDirStudyToEnd (SQItem* s);
122 void AddDicomDirSerieToEnd (SQItem* s);
123 void AddDicomDirImageToEnd (SQItem* s);
125 void SetElements(std::string const & path, VectDocument const &list);
126 void SetElement (std::string const & path, DicomDirType type,
129 static bool HeaderLessThan(Document* header1, Document* header2);
133 /// Pointer on *the* DicomDirObject 'DicomDirMeta Elements'
134 DicomDirMeta* MetaElems;
136 /// Chained list of DicomDirPatient (to be exploited recursively)
137 ListDicomDirPatient Patients;
139 /// pointer to the initialisation method for any progress bar
141 /// pointer to the incrementation method for any progress bar
142 Method* ProgressMethod;
143 /// pointer to the termination method for any progress bar
145 /// pointer to the ??? method for any progress bar
146 Method* StartMethodArgDelete;
147 /// pointer to the ??? method for any progress bar
148 Method* ProgressMethodArgDelete;
149 /// pointer to the ??? method for any progress bar
150 Method* EndMethodArgDelete;
151 /// pointer to the ??? for any progress bar
153 /// pointer to the ??? for any progress bar
155 /// pointer to the ??? for any progress bar
157 /// value of the ??? for any progress bar
159 /// value of the ??? for any progress bar
162 } // end namespace gdcm
163 //-----------------------------------------------------------------------------