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 gdcmDocument
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);
40 * \ingroup gdcmDicomDir
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; };
47 * \ingroup gdcmDicomDir
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 /// \brief returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
57 inline gdcmDicomDirMeta *GetDicomDirMeta()
60 /// \brief returns the PATIENT chained List for this DICOMDIR.
61 inline ListDicomDirPatient &GetDicomDirPatients()
65 void ParseDirectory(void);
67 void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
68 void SetStartMethodArgDelete(gdcmMethod *);
69 void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
70 void SetProgressMethodArgDelete(gdcmMethod *);
71 void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
72 void SetEndMethodArgDelete(gdcmMethod *);
74 /// \brief GetProgress GetProgress
75 inline float GetProgress(void)
78 /// \brief AbortProgress AbortProgress
79 inline void AbortProgress(void)
82 /// \brief IsAborted IsAborted
83 inline bool IsAborted(void)
87 gdcmDicomDirMeta * NewMeta(void);
88 gdcmDicomDirPatient * NewPatient(void);
91 void WriteEntries(FILE *_fp);
92 bool Write(std::string fileName);
94 /// Types of the gdcmObject within the gdcmDicomDir
99 GDCM_DICOMDIR_PATIENT,
106 void CreateDicomDirChainedList(std::string path);
108 void CallStartMethod(void);
109 void CallProgressMethod(void);
110 void CallEndMethod(void);
113 void CreateDicomDir(void);
114 // void AddObjectToEnd(gdcmDicomDirType type, gdcmSQItem *s);
115 void AddDicomDirMeta ();
116 void AddDicomDirPatientToEnd(gdcmSQItem *s);
117 void AddDicomDirStudyToEnd (gdcmSQItem *s);
118 void AddDicomDirSerieToEnd (gdcmSQItem *s);
119 void AddDicomDirImageToEnd (gdcmSQItem *s);
121 void SetElements(std::string &path,ListHeader &list);
122 void SetElement (std::string &path,gdcmDicomDirType type,gdcmHeader *header);
124 void UpdateDirectoryRecordSequenceLength(void);
126 static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
130 /// \brief pointer on *the* gdcmObject 'DicomDirMeta Elements'
131 gdcmDicomDirMeta *metaElems;
133 /// \brief chained list of DicomDirPatient (to be exploited recursively)
134 ListDicomDirPatient patients;
136 /// pointer to the initialisation method for any progress bar
137 gdcmMethod *startMethod;
138 /// pointer to the incrementation method for any progress bar
139 gdcmMethod *progressMethod;
140 /// pointer to the tremination method for any progress bar
141 gdcmMethod *endMethod;
142 /// pointer to the ??? method for any progress bar
143 gdcmMethod *startMethodArgDelete;
144 /// pointer to the ??? method for any progress bar
145 gdcmMethod *progressMethodArgDelete;
146 /// pointer to the ??? method for any progress bar
147 gdcmMethod *endMethodArgDelete;
148 /// pointer to the ??? for any progress bar
150 /// pointer to the ??? for any progress bar
152 /// pointer to the ??? for any progress bar
154 /// value of the ??? for any progress bar
156 /// value of the ??? for any progress bar
160 //-----------------------------------------------------------------------------