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);
70 void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
71 void SetStartMethodArgDelete(gdcmMethod *);
72 void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
73 void SetProgressMethodArgDelete(gdcmMethod *);
74 void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
75 void SetEndMethodArgDelete(gdcmMethod *);
77 inline float GetProgress(void) {return(progress);};
78 inline void AbortProgress(void){abort=true; };
79 inline bool IsAborted(void) {return(abort); };
82 gdcmDicomDirPatient * NewPatient(void);
85 bool Write(std::string fileName);
92 GDCM_DICOMDIR_PATIENT,
99 void CreateDicomDirChainedList(std::string path);
101 void CallStartMethod(void);
102 void CallProgressMethod(void);
103 void CallEndMethod(void);
106 void CreateDicomDir(void);
107 void AddObjectToEnd(gdcmDicomDirType type,
108 ListTag::iterator begin,ListTag::iterator end);
109 void AddDicomDirMetaToEnd (ListTag::iterator begin,ListTag::iterator end);
110 void AddDicomDirPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
111 void AddDicomDirStudyToEnd (ListTag::iterator begin,ListTag::iterator end);
112 void AddDicomDirSerieToEnd (ListTag::iterator begin,ListTag::iterator end);
113 void AddDicomDirImageToEnd (ListTag::iterator begin,ListTag::iterator end);
115 void SetElements(std::string &path,ListHeader &list);
116 void SetElement (std::string &path,gdcmDicomDirType type,gdcmHeader *header);
118 void UpdateDirectoryRecordSequenceLength(void);
120 static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
121 void WriteDicomDirEntries(FILE *_fp);
125 * \brief pointer on *the* gdcmObject 'DicomDirMeta Elements'
127 gdcmDicomDirMeta *metaElems;
129 * \brief chained list of DicomDirPatient (to be exploited recursively)
131 ListDicomDirPatient patients;
133 gdcmMethod *startMethod;
134 gdcmMethod *progressMethod;
135 gdcmMethod *endMethod;
136 gdcmMethod *startMethodArgDelete;
137 gdcmMethod *progressMethodArgDelete;
138 gdcmMethod *endMethodArgDelete;
147 //-----------------------------------------------------------------------------