]> Creatis software - gdcm.git/blob - src/gdcmDicomDir.h
* gdcmDirList : to parse a hard drive directory in recursive (or not)
[gdcm.git] / src / gdcmDicomDir.h
1 // gdcmDicomDir.h
2 //-----------------------------------------------------------------------------
3 #ifndef GDCMDICOMDIR_H
4 #define GDCMDICOMDIR_H
5
6 #include "gdcmHeader.h"
7 #include "gdcmCommon.h"
8 #include "gdcmPatient.h"
9
10 //-----------------------------------------------------------------------------
11 typedef std::list<gdcmPatient *> ListPatient;
12 typedef std::list<gdcmHeader *>  ListHeader;
13
14 //-----------------------------------------------------------------------------
15 /*
16  * \defgroup gdcmDicomDir
17  * \brief    gdcmDicomDir defines an object representing a DICOMDIR in memory.
18  *
19  */
20 class GDCM_EXPORT gdcmDicomDir: public gdcmParser
21 {
22 public:
23    gdcmDicomDir(ListTag *l,           bool exception_on_error = false);
24    gdcmDicomDir(const char *FileName,bool exception_on_error = false);
25    
26    ~gdcmDicomDir(void);
27
28    void SetPrintLevel(int level) { printLevel = level; };
29    virtual void Print(std::ostream &os = std::cout);
30
31    inline ListPatient &GetPatients() {return patients;};
32    bool   Write(std::string fileName);
33
34    typedef enum
35    {
36       GDCM_NONE,
37       GDCM_PATIENT,
38       GDCM_STUDY,
39       GDCM_SERIE,
40       GDCM_IMAGE,
41    } gdcmDicomDirType;
42    
43 protected:
44    void NewDicomDir(std::string path);
45
46 private:
47    void CreateDicomDir(void);
48    void AddObjectToEnd(gdcmDicomDirType type,ListTag::iterator begin,ListTag::iterator end);
49    void AddPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
50    void AddStudyToEnd(ListTag::iterator begin,ListTag::iterator end);
51    void AddSerieToEnd(ListTag::iterator begin,ListTag::iterator end);
52    void AddImageToEnd(ListTag::iterator begin,ListTag::iterator end);
53
54    void SetElements(std::string &path,ListHeader &list);
55    void SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader *header);
56
57    ListPatient patients;
58 };
59
60 //-----------------------------------------------------------------------------
61 #endif