1 /*=========================================================================
4 Module: $RCSfile: gdcmDicomDir.h,v $
6 Date: $Date: 2004/06/19 23:51:03 $
7 Version: $Revision: 1.22 $
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.htm 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"
31 //-----------------------------------------------------------------------------
32 typedef std::list<gdcmDicomDirPatient *> ListDicomDirPatient;
33 typedef std::vector<gdcmDocument *> VectDocument;
35 typedef GDCM_EXPORT void(gdcmMethod)(void * = NULL);
36 //-----------------------------------------------------------------------------
39 * \ingroup gdcmDicomDir
40 * \brief gdcmDicomDir defines an object representing a DICOMDIR in memory.
43 class GDCM_EXPORT gdcmDicomDir: public gdcmDocument
46 // gdcmDicomDir(ListTag *l,
47 // bool exception_on_error = false);
48 gdcmDicomDir(const char *FileName,
49 bool parseDir = false,
50 bool exception_on_error = false);
51 gdcmDicomDir(bool exception_on_error = false);
56 * \ingroup gdcmDicomDir
57 * \brief Sets the print level for the Dicom Header
58 * \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
60 void SetPrintLevel(int level)
61 { printLevel = level; };
63 * \ingroup gdcmDicomDir
64 * \brief canonical Printer
67 virtual void Print(std::ostream &os = std::cout);
69 // Informations contained in the parser
70 virtual bool IsReadable(void);
72 /// \brief returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
73 inline gdcmDicomDirMeta *GetDicomDirMeta()
76 /// \brief returns the PATIENT chained List for this DICOMDIR.
77 inline ListDicomDirPatient &GetDicomDirPatients()
81 void ParseDirectory(void);
83 void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
84 void SetStartMethodArgDelete(gdcmMethod *);
85 void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
86 void SetProgressMethodArgDelete(gdcmMethod *);
87 void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
88 void SetEndMethodArgDelete(gdcmMethod *);
90 /// \brief GetProgress GetProgress
91 inline float GetProgress(void)
94 /// \brief AbortProgress AbortProgress
95 inline void AbortProgress(void)
98 /// \brief IsAborted IsAborted
99 inline bool IsAborted(void)
103 gdcmDicomDirMeta * NewMeta(void);
104 gdcmDicomDirPatient * NewPatient(void);
107 void WriteEntries(FILE *_fp);
108 bool Write(std::string fileName);
110 /// Types of the gdcmObject within the gdcmDicomDir
115 GDCM_DICOMDIR_PATIENT,
122 void CreateDicomDirChainedList(std::string path);
124 void CallStartMethod(void);
125 void CallProgressMethod(void);
126 void CallEndMethod(void);
129 void Initialize(void);
130 void CreateDicomDir(void);
131 // void AddObjectToEnd(gdcmDicomDirType type, gdcmSQItem *s);
132 void AddDicomDirMeta ();
133 void AddDicomDirPatientToEnd(gdcmSQItem *s);
134 void AddDicomDirStudyToEnd (gdcmSQItem *s);
135 void AddDicomDirSerieToEnd (gdcmSQItem *s);
136 void AddDicomDirImageToEnd (gdcmSQItem *s);
138 void SetElements(std::string &path, VectDocument &list);
139 void SetElement (std::string &path,gdcmDicomDirType type,
140 gdcmDocument *header);
142 void UpdateDirectoryRecordSequenceLength(void);
144 static bool HeaderLessThan(gdcmDocument *header1,gdcmDocument *header2);
148 /// \brief pointer on *the* gdcmObject 'DicomDirMeta Elements'
149 gdcmDicomDirMeta *metaElems;
151 /// \brief chained list of DicomDirPatient (to be exploited recursively)
152 ListDicomDirPatient patients;
154 /// pointer to the initialisation method for any progress bar
155 gdcmMethod *startMethod;
156 /// pointer to the incrementation method for any progress bar
157 gdcmMethod *progressMethod;
158 /// pointer to the tremination method for any progress bar
159 gdcmMethod *endMethod;
160 /// pointer to the ??? method for any progress bar
161 gdcmMethod *startMethodArgDelete;
162 /// pointer to the ??? method for any progress bar
163 gdcmMethod *progressMethodArgDelete;
164 /// pointer to the ??? method for any progress bar
165 gdcmMethod *endMethodArgDelete;
166 /// pointer to the ??? for any progress bar
168 /// pointer to the ??? for any progress bar
170 /// pointer to the ??? for any progress bar
172 /// value of the ??? for any progress bar
174 /// value of the ??? for any progress bar
178 //-----------------------------------------------------------------------------