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 //-----------------------------------------------------------------------------
22 * \defgroup gdcmDicomDir
23 * \brief gdcmDicomDir defines an object representing a DICOMDIR in memory.
26 class GDCM_EXPORT gdcmDicomDir: public gdcmParser
29 // gdcmDicomDir(ListTag *l,
30 // bool exception_on_error = false);
31 gdcmDicomDir(const char *FileName,
32 bool parseDir = false,
33 bool exception_on_error = false);
34 gdcmDicomDir(bool exception_on_error = false);
40 * \brief Sets the print level for the Dicom Header
41 * \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
43 void SetPrintLevel(int level)
44 { printLevel = level; };
47 * \brief canonical Printer
50 virtual void Print(std::ostream &os = std::cout);
52 // Informations contained in the parser
53 virtual bool IsReadable(void);
55 * \ingroup gdcmDicomDir
56 * \brief returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
58 inline gdcmDicomDirMeta *GetDicomDirMeta()
61 * \ingroup gdcmDicomDir
62 * \brief returns the PATIENT chained List for this DICOMDIR.
64 inline ListDicomDirPatient &GetDicomDirPatients()
68 void ParseDirectory(void);
69 void CheckBoundaries(void);
71 void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
72 void SetStartMethodArgDelete(gdcmMethod *);
73 void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
74 void SetProgressMethodArgDelete(gdcmMethod *);
75 void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
76 void SetEndMethodArgDelete(gdcmMethod *);
78 * \ingroup gdcmDicomDir
81 inline float GetProgress(void)
84 * \ingroup gdcmDicomDir
85 * \brief AbortProgress.
86 */ inline void AbortProgress(void)
89 * \ingroup gdcmDicomDir
91 */ inline bool IsAborted(void)
95 gdcmDicomDirPatient * NewPatient(void);
98 bool Write(std::string fileName);
105 GDCM_DICOMDIR_PATIENT,
112 void CreateDicomDirChainedList(std::string path);
114 void CallStartMethod(void);
115 void CallProgressMethod(void);
116 void CallEndMethod(void);
119 void CreateDicomDir(void);
120 void AddObjectToEnd(gdcmDicomDirType type,
121 ListTag::iterator begin,ListTag::iterator end);
122 void AddDicomDirMetaToEnd (ListTag::iterator begin,ListTag::iterator end);
123 void AddDicomDirPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
124 void AddDicomDirStudyToEnd (ListTag::iterator begin,ListTag::iterator end);
125 void AddDicomDirSerieToEnd (ListTag::iterator begin,ListTag::iterator end);
126 void AddDicomDirImageToEnd (ListTag::iterator begin,ListTag::iterator end);
128 void SetElements(std::string &path,ListHeader &list);
129 void SetElement (std::string &path,gdcmDicomDirType type,gdcmHeader *header);
131 void UpdateDirectoryRecordSequenceLength(void);
133 static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
134 void WriteDicomDirEntries(FILE *_fp);
138 * \brief pointer on *the* gdcmObject 'DicomDirMeta Elements'
140 gdcmDicomDirMeta *metaElems;
142 * \brief chained list of DicomDirPatient (to be exploited recursively)
144 ListDicomDirPatient patients;
146 /// pointer to the initialisation method for any progress bar
147 gdcmMethod *startMethod;
148 /// pointer to the incrementation method for any progress bar
149 gdcmMethod *progressMethod;
150 /// pointer to the tremination method for any progress bar
151 gdcmMethod *endMethod;
152 /// pointer to the ??? method for any progress bar
153 gdcmMethod *startMethodArgDelete;
154 /// pointer to the ??? method for any progress bar
155 gdcmMethod *progressMethodArgDelete;
156 /// pointer to the ??? method for any progress bar
157 gdcmMethod *endMethodArgDelete;
158 /// pointer to the ??? for any progress bar
160 /// pointer to the ??? for any progress bar
162 /// pointer to the ??? for any progress bar
164 /// value of the ??? for any progress bar
166 /// value of the ??? for any progress bar
170 //-----------------------------------------------------------------------------