2 //-----------------------------------------------------------------------------
6 #include "gdcmHeader.h"
7 #include "gdcmCommon.h"
8 #include "gdcmPatient.h"
10 #include "gdcmDicomDirElement.h"
15 //-----------------------------------------------------------------------------
16 typedef std::list<gdcmPatient *> ListPatient;
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, bool exception_on_error = false);
30 gdcmDicomDir(const char *FileName,
31 bool parseDir = false,
32 bool exception_on_error = false);
36 void SetPrintLevel(int level) { printLevel = level; };
37 virtual void Print(std::ostream &os = std::cout);
39 // Informations contained in the parser
40 virtual bool IsReadable(void);
41 inline gdcmMeta *GetMeta() {return metaElems;};
42 inline ListPatient &GetPatients() {return patients;};
45 void ParseDirectory(void);
47 inline void SetStartMethod(gdcmMethod *method,void *arg=NULL) {startMethod=method;startArg=arg;};
48 inline void SetProgressMethod(gdcmMethod *method,void *arg=NULL) {progressMethod=method;progressArg=arg;};
49 inline void SetEndMethod(gdcmMethod *method,void *arg=NULL) {endMethod=method;endArg=arg;};
51 inline float GetProgress(void) {return(progress);};
53 inline void AbortProgress(void) {abort=true;};
54 inline bool IsAborted(void) {return(abort);};
57 bool Write(std::string fileName);
71 void NewDicomDir(std::string path);
72 std::string GetPath(void);
74 void CallStartMethod(void);
75 void CallProgressMethod(void);
76 void CallEndMethod(void);
79 void CreateDicomDir(void);
80 void AddObjectToEnd(gdcmDicomDirType type,
81 ListTag::iterator begin,ListTag::iterator end);
82 void AddMetaToEnd (ListTag::iterator begin,ListTag::iterator end);
83 void AddPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
84 void AddStudyToEnd (ListTag::iterator begin,ListTag::iterator end);
85 void AddSerieToEnd (ListTag::iterator begin,ListTag::iterator end);
86 void AddImageToEnd (ListTag::iterator begin,ListTag::iterator end);
88 void SetElements(std::string &path,ListHeader &list);
89 void SetElement (std::string &path,gdcmDicomDirType type,gdcmHeader *header);
91 static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
96 gdcmMethod *startMethod;
97 gdcmMethod *progressMethod;
98 gdcmMethod *endMethod;
107 //-----------------------------------------------------------------------------