]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDir.h
* ENH : add methods in gdcmObject to get the hash table or the list of
[gdcm.git] / src / gdcmDicomDir.h
index ed91ea9658282cab962a1eb682c6784b635a797e..3604104e0ea059aef8a8858eac64db13b3ce8f01 100644 (file)
@@ -1,4 +1,4 @@
-// gdcmDICOMDIR.h
+// gdcmDicomDir.h
 //-----------------------------------------------------------------------------
 #ifndef GDCMDICOMDIR_H
 #define GDCMDICOMDIR_H
@@ -6,9 +6,14 @@
 #include "gdcmHeader.h"
 #include "gdcmCommon.h"
 #include "gdcmPatient.h"
+#include "gdcmDicomDirElement.h"
+
+#include <list>
+#include <vector>
 
 //-----------------------------------------------------------------------------
 typedef std::list<gdcmPatient *> ListPatient;
+typedef std::vector<gdcmHeader *>  ListHeader;
 
 //-----------------------------------------------------------------------------
 /*
@@ -16,11 +21,12 @@ typedef std::list<gdcmPatient *> ListPatient;
  * \brief    gdcmDicomDir defines an object representing a DICOMDIR in memory.
  *
  */
-class GDCM_EXPORT gdcmDicomDir: public gdcmParser 
+class GDCM_EXPORT gdcmDicomDir: public gdcmParser
 {
 public:
-   gdcmDicomDir(bool exception_on_error = false);
-   gdcmDicomDir(std::string &FileName,bool exception_on_error = false );
+//   gdcmDicomDir(ListTag *l,          bool exception_on_error = false);
+   gdcmDicomDir(const char *FileName, bool parseDir = false,
+                bool exception_on_error = false);
    
    ~gdcmDicomDir(void);
 
@@ -29,6 +35,11 @@ public:
 
    inline ListPatient &GetPatients() {return patients;};
 
+// Write
+   bool Write(std::string fileName);
+   void ParseDirectory(void);
+
+// Types
    typedef enum
    {
       GDCM_NONE,
@@ -38,6 +49,10 @@ public:
       GDCM_IMAGE,
    } gdcmDicomDirType;
    
+protected:
+   void NewDicomDir(std::string path);
+   std::string GetPath(void);
+
 private:
    void CreateDicomDir(void);
    void AddObjectToEnd(gdcmDicomDirType type,ListTag::iterator begin,ListTag::iterator end);
@@ -46,6 +61,11 @@ private:
    void AddSerieToEnd(ListTag::iterator begin,ListTag::iterator end);
    void AddImageToEnd(ListTag::iterator begin,ListTag::iterator end);
 
+   void SetElements(std::string &path,ListHeader &list);
+   void SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader *header);
+
+   static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
+
    ListPatient patients;
 };