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