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 inline float GetProgress(void) {return(progress);};
79 inline void AbortProgress(void){abort=true; };
80 inline bool IsAborted(void) {return(abort); };
83 gdcmDicomDirPatient * NewPatient(void);
86 bool Write(std::string fileName);
93 GDCM_DICOMDIR_PATIENT,
100 void CreateDicomDirChainedList(std::string path);
102 void CallStartMethod(void);
103 void CallProgressMethod(void);
104 void CallEndMethod(void);
107 void CreateDicomDir(void);
108 void AddObjectToEnd(gdcmDicomDirType type,
109 ListTag::iterator begin,ListTag::iterator end);
110 void AddDicomDirMetaToEnd (ListTag::iterator begin,ListTag::iterator end);
111 void AddDicomDirPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
112 void AddDicomDirStudyToEnd (ListTag::iterator begin,ListTag::iterator end);
113 void AddDicomDirSerieToEnd (ListTag::iterator begin,ListTag::iterator end);
114 void AddDicomDirImageToEnd (ListTag::iterator begin,ListTag::iterator end);
116 void SetElements(std::string &path,ListHeader &list);
117 void SetElement (std::string &path,gdcmDicomDirType type,gdcmHeader *header);
119 void UpdateDirectoryRecordSequenceLength(void);
121 static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
122 void WriteDicomDirEntries(FILE *_fp);
126 * \brief pointer on *the* gdcmObject 'DicomDirMeta Elements'
128 gdcmDicomDirMeta *metaElems;
130 * \brief chained list of DicomDirPatient (to be exploited recursively)
132 ListDicomDirPatient patients;
134 gdcmMethod *startMethod;
135 gdcmMethod *progressMethod;
136 gdcmMethod *endMethod;
137 gdcmMethod *startMethodArgDelete;
138 gdcmMethod *progressMethodArgDelete;
139 gdcmMethod *endMethodArgDelete;
148 //-----------------------------------------------------------------------------