00001
00002
00003 #ifndef GDCMDICOMDIR_H
00004 #define GDCMDICOMDIR_H
00005
00006 #include "gdcmHeader.h"
00007 #include "gdcmCommon.h"
00008 #include "gdcmPatient.h"
00009 #include "gdcmDicomDirElement.h"
00010
00011 #include <list>
00012 #include <vector>
00013
00014
00015 typedef std::list<gdcmPatient *> ListPatient;
00016 typedef std::vector<gdcmHeader *> ListHeader;
00017
00018
00019
00020
00021
00022
00023
00024 class GDCM_EXPORT gdcmDicomDir: public gdcmParser
00025 {
00026 public:
00027
00028 gdcmDicomDir(const char *FileName, bool parseDir = false,
00029 bool exception_on_error = false);
00030
00031 ~gdcmDicomDir(void);
00032
00033 void SetPrintLevel(int level) { printLevel = level; };
00034 virtual void Print(std::ostream &os = std::cout);
00035
00036 inline ListPatient &GetPatients() {return patients;};
00037
00038
00039 bool Write(std::string fileName);
00040 void ParseDirectory(void);
00041
00042
00043 typedef enum
00044 {
00045 GDCM_NONE,
00046 GDCM_PATIENT,
00047 GDCM_STUDY,
00048 GDCM_SERIE,
00049 GDCM_IMAGE,
00050 } gdcmDicomDirType;
00051
00052 protected:
00053 void NewDicomDir(std::string path);
00054 std::string GetPath(void);
00055
00056 private:
00057 void CreateDicomDir(void);
00058 void AddObjectToEnd(gdcmDicomDirType type,ListTag::iterator begin,ListTag::iterator end);
00059 void AddPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
00060 void AddStudyToEnd(ListTag::iterator begin,ListTag::iterator end);
00061 void AddSerieToEnd(ListTag::iterator begin,ListTag::iterator end);
00062 void AddImageToEnd(ListTag::iterator begin,ListTag::iterator end);
00063
00064 void SetElements(std::string &path,ListHeader &list);
00065 void SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader *header);
00066
00067 static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
00068
00069 ListPatient patients;
00070 };
00071
00072
00073 #endif