2 //-----------------------------------------------------------------------------
6 #include "gdcmHeader.h"
7 #include "gdcmCommon.h"
8 #include "gdcmDicomDirPatient.h"
9 #include "gdcmDicomDirMeta.h"
10 #include "gdcmDicomDirElement.h"
15 //-----------------------------------------------------------------------------
16 typedef std::list<gdcmDicomDirPatient *> ListDicomDirPatient;
17 typedef std::vector<gdcmHeader *> ListHeader;
19 typedef GDCM_EXPORT void(gdcmMethod)(void * = NULL);
20 //-----------------------------------------------------------------------------
23 * \ingroup gdcmDicomDir
24 * \brief gdcmDicomDir defines an object representing a DICOMDIR in memory.
28 class GDCM_EXPORT gdcmDicomDir: public gdcmParser
31 // gdcmDicomDir(ListTag *l,
32 // bool exception_on_error = false);
33 gdcmDicomDir(const char *FileName,
34 bool parseDir = false,
35 bool exception_on_error = false);
36 gdcmDicomDir(bool exception_on_error = false);
42 * \brief Sets the print level for the Dicom Header
43 * \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
45 void SetPrintLevel(int level)
46 { printLevel = level; };
49 * \brief canonical Printer
52 virtual void Print(std::ostream &os = std::cout);
54 // Informations contained in the parser
55 virtual bool IsReadable(void);
57 * \ingroup gdcmDicomDir
58 * \brief returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
60 inline gdcmDicomDirMeta *GetDicomDirMeta()
63 * \ingroup gdcmDicomDir
64 * \brief returns the PATIENT chained List for this DICOMDIR.
66 inline ListDicomDirPatient &GetDicomDirPatients()
70 void ParseDirectory(void);
71 void CheckBoundaries(void);
73 void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
74 void SetStartMethodArgDelete(gdcmMethod *);
75 void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
76 void SetProgressMethodArgDelete(gdcmMethod *);
77 void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
78 void SetEndMethodArgDelete(gdcmMethod *);
80 * \ingroup gdcmDicomDir
83 inline float GetProgress(void)
86 * \ingroup gdcmDicomDir
87 * \brief AbortProgress.
88 */ inline void AbortProgress(void)
91 * \ingroup gdcmDicomDir
93 */ inline bool IsAborted(void)
97 gdcmDicomDirPatient * NewPatient(void);
100 bool Write(std::string fileName);
102 /// Types of the gdcmObject within the gdcmDicomDir
107 GDCM_DICOMDIR_PATIENT,
114 void CreateDicomDirChainedList(std::string path);
116 void CallStartMethod(void);
117 void CallProgressMethod(void);
118 void CallEndMethod(void);
121 void CreateDicomDir(void);
122 void AddObjectToEnd(gdcmDicomDirType type,
123 ListTag::iterator begin,ListTag::iterator end);
124 void AddDicomDirMetaToEnd (ListTag::iterator begin,ListTag::iterator end);
125 void AddDicomDirPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
126 void AddDicomDirStudyToEnd (ListTag::iterator begin,ListTag::iterator end);
127 void AddDicomDirSerieToEnd (ListTag::iterator begin,ListTag::iterator end);
128 void AddDicomDirImageToEnd (ListTag::iterator begin,ListTag::iterator end);
130 void SetElements(std::string &path,ListHeader &list);
131 void SetElement (std::string &path,gdcmDicomDirType type,gdcmHeader *header);
133 void UpdateDirectoryRecordSequenceLength(void);
135 static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
136 void WriteDicomDirEntries(FILE *_fp);
140 * \brief pointer on *the* gdcmObject 'DicomDirMeta Elements'
142 gdcmDicomDirMeta *metaElems;
144 * \brief chained list of DicomDirPatient (to be exploited recursively)
146 ListDicomDirPatient patients;
148 /// pointer to the initialisation method for any progress bar
149 gdcmMethod *startMethod;
150 /// pointer to the incrementation method for any progress bar
151 gdcmMethod *progressMethod;
152 /// pointer to the tremination method for any progress bar
153 gdcmMethod *endMethod;
154 /// pointer to the ??? method for any progress bar
155 gdcmMethod *startMethodArgDelete;
156 /// pointer to the ??? method for any progress bar
157 gdcmMethod *progressMethodArgDelete;
158 /// pointer to the ??? method for any progress bar
159 gdcmMethod *endMethodArgDelete;
160 /// pointer to the ??? for any progress bar
162 /// pointer to the ??? for any progress bar
164 /// pointer to the ??? for any progress bar
166 /// value of the ??? for any progress bar
168 /// value of the ??? for any progress bar
172 //-----------------------------------------------------------------------------