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.
27 class GDCM_EXPORT gdcmDicomDir: public gdcmParser
30 // gdcmDicomDir(ListTag *l,
31 // bool exception_on_error = false);
32 gdcmDicomDir(const char *FileName,
33 bool parseDir = false,
34 bool exception_on_error = false);
35 gdcmDicomDir(bool exception_on_error = false);
41 * \brief Sets the print level for the Dicom Header
42 * \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
44 void SetPrintLevel(int level)
45 { printLevel = level; };
48 * \brief canonical Printer
51 virtual void Print(std::ostream &os = std::cout);
53 // Informations contained in the parser
54 virtual bool IsReadable(void);
56 * \ingroup gdcmDicomDir
57 * \brief returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
59 inline gdcmDicomDirMeta *GetDicomDirMeta()
62 * \ingroup gdcmDicomDir
63 * \brief returns the PATIENT chained List for this DICOMDIR.
65 inline ListDicomDirPatient &GetDicomDirPatients()
69 void ParseDirectory(void);
70 void CheckBoundaries(void);
72 void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
73 void SetStartMethodArgDelete(gdcmMethod *);
74 void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
75 void SetProgressMethodArgDelete(gdcmMethod *);
76 void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
77 void SetEndMethodArgDelete(gdcmMethod *);
79 * \ingroup gdcmDicomDir
82 inline float GetProgress(void)
85 * \ingroup gdcmDicomDir
86 * \brief AbortProgress.
87 */ inline void AbortProgress(void)
90 * \ingroup gdcmDicomDir
92 */ inline bool IsAborted(void)
96 gdcmDicomDirPatient * NewPatient(void);
99 void WriteEntries(FILE *_fp);
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);
139 * \brief pointer on *the* gdcmObject 'DicomDirMeta Elements'
141 gdcmDicomDirMeta *metaElems;
143 * \brief chained list of DicomDirPatient (to be exploited recursively)
145 ListDicomDirPatient patients;
147 /// pointer to the initialisation method for any progress bar
148 gdcmMethod *startMethod;
149 /// pointer to the incrementation method for any progress bar
150 gdcmMethod *progressMethod;
151 /// pointer to the tremination method for any progress bar
152 gdcmMethod *endMethod;
153 /// pointer to the ??? method for any progress bar
154 gdcmMethod *startMethodArgDelete;
155 /// pointer to the ??? method for any progress bar
156 gdcmMethod *progressMethodArgDelete;
157 /// pointer to the ??? method for any progress bar
158 gdcmMethod *endMethodArgDelete;
159 /// pointer to the ??? for any progress bar
161 /// pointer to the ??? for any progress bar
163 /// pointer to the ??? for any progress bar
165 /// value of the ??? for any progress bar
167 /// value of the ??? for any progress bar
171 //-----------------------------------------------------------------------------