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 void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
48 void SetStartMethodArgDelete(gdcmMethod *);
49 void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
50 void SetProgressMethodArgDelete(gdcmMethod *);
51 void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
52 void SetEndMethodArgDelete(gdcmMethod *);
54 inline float GetProgress(void) {return(progress);};
56 inline void AbortProgress(void) {abort=true;};
57 inline bool IsAborted(void) {return(abort);};
60 bool Write(std::string fileName);
74 void NewDicomDir(std::string path);
75 std::string GetPath(void);
77 void CallStartMethod(void);
78 void CallProgressMethod(void);
79 void CallEndMethod(void);
82 void CreateDicomDir(void);
83 void AddObjectToEnd(gdcmDicomDirType type,
84 ListTag::iterator begin,ListTag::iterator end);
85 void AddMetaToEnd (ListTag::iterator begin,ListTag::iterator end);
86 void AddPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
87 void AddStudyToEnd (ListTag::iterator begin,ListTag::iterator end);
88 void AddSerieToEnd (ListTag::iterator begin,ListTag::iterator end);
89 void AddImageToEnd (ListTag::iterator begin,ListTag::iterator end);
91 void SetElements(std::string &path,ListHeader &list);
92 void SetElement (std::string &path,gdcmDicomDirType type,gdcmHeader *header);
94 static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
99 gdcmMethod *startMethod;
100 gdcmMethod *progressMethod;
101 gdcmMethod *endMethod;
102 gdcmMethod *startMethodArgDelete;
103 gdcmMethod *progressMethodArgDelete;
104 gdcmMethod *endMethodArgDelete;
113 //-----------------------------------------------------------------------------