1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2004/11/09 10:25:27 $
7 Version: $Revision: 1.37 $
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 GDCM_EXPORT void(Method)(void*);
48 DicomDir( std::string const & filename, bool parseDir = false );
53 /// \brief canonical Printer
55 void Print(std::ostream &os = std::cout);
57 /// Informations contained in the parser
58 virtual bool IsReadable();
60 /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
61 DicomDirMeta* GetDicomDirMeta() { return MetaElems; };
63 /// Returns the PATIENT chained List for this DICOMDIR.
64 ListDicomDirPatient const & GetDicomDirPatients() const { return Patients; };
67 void ParseDirectory();
69 void SetStartMethod( DicomDir::Method*,
71 DicomDir::Method* = NULL );
72 void SetProgressMethod( DicomDir::Method*,
74 DicomDir::Method* = NULL );
75 void SetEndMethod( DicomDir::Method*,
77 DicomDir::Method* = NULL );
78 void SetStartMethodArgDelete( DicomDir::Method* );
79 void SetProgressMethodArgDelete( DicomDir::Method* );
80 void SetEndMethodArgDelete( DicomDir::Method* );
82 /// GetProgress GetProgress
83 float GetProgress() { return Progress; };
85 /// AbortProgress AbortProgress
86 void AbortProgress() { Abort = true; };
88 /// IsAborted IsAborted
89 bool IsAborted() { return Abort; };
92 DicomDirMeta* NewMeta();
93 DicomDirPatient* NewPatient();
96 bool WriteDicomDir(std::string const & fileName);
98 /// Types of the DicomDirObject within the DicomDir
103 GDCM_DICOMDIR_PATIENT,
110 void CreateDicomDirChainedList(std::string const & path);
111 void CallStartMethod();
112 void CallProgressMethod();
113 void CallEndMethod();
117 void CreateDicomDir();
118 void AddDicomDirMeta();
119 void AddDicomDirPatientToEnd(SQItem* s);
120 void AddDicomDirStudyToEnd (SQItem* s);
121 void AddDicomDirSerieToEnd (SQItem* s);
122 void AddDicomDirImageToEnd (SQItem* s);
124 void SetElements(std::string const & path, VectDocument const &list);
125 void SetElement (std::string const & path, DicomDirType type,
128 static bool HeaderLessThan(Document* header1, Document* header2);
132 /// Pointer on *the* DicomDirObject 'DicomDirMeta Elements'
133 DicomDirMeta* MetaElems;
135 /// Chained list of DicomDirPatient (to be exploited recursively)
136 ListDicomDirPatient Patients;
138 /// pointer to the initialisation method for any progress bar
140 /// pointer to the incrementation method for any progress bar
141 Method* ProgressMethod;
142 /// pointer to the termination method for any progress bar
144 /// pointer to the ??? method for any progress bar
145 Method* StartMethodArgDelete;
146 /// pointer to the ??? method for any progress bar
147 Method* ProgressMethodArgDelete;
148 /// pointer to the ??? method for any progress bar
149 Method* EndMethodArgDelete;
150 /// pointer to the ??? for any progress bar
152 /// pointer to the ??? for any progress bar
154 /// pointer to the ??? for any progress bar
156 /// value of the ??? for any progress bar
158 /// value of the ??? for any progress bar
161 } // end namespace gdcm
162 //-----------------------------------------------------------------------------