]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDir.h
*** empty log message ***
[gdcm.git] / src / gdcmDicomDir.h
index 1426b6317bdb915469b32e4652275dfc4f0be409..e54995e3445a1d927dfbfd382e7d40bd13853e2e 100644 (file)
@@ -1,4 +1,4 @@
-// gdcmDICOMDIR.h
+// gdcmDicomDir.h
 //-----------------------------------------------------------------------------
 #ifndef GDCMDICOMDIR_H
 #define GDCMDICOMDIR_H
@@ -6,10 +6,15 @@
 #include "gdcmHeader.h"
 #include "gdcmCommon.h"
 #include "gdcmPatient.h"
+#include "gdcmMeta.h"
+#include "gdcmDicomDirElement.h"
 
-//-----------------------------------------------------------------------------
+#include <list>
+#include <vector>
 
-typedef std::list<gdcmPatient *> lPatient;
+//-----------------------------------------------------------------------------
+typedef std::list<gdcmPatient *>   ListPatient;
+typedef std::vector<gdcmHeader *>  ListHeader;
 
 //-----------------------------------------------------------------------------
 /*
@@ -17,18 +22,58 @@ typedef std::list<gdcmPatient *> lPatient;
  * \brief    gdcmDicomDir defines an object representing a DICOMDIR in memory.
  *
  */
-class GDCM_EXPORT gdcmDicomDir: public gdcmParser {
+class GDCM_EXPORT gdcmDicomDir: public gdcmParser
+{
 public:
+//   gdcmDicomDir(ListTag *l,         bool exception_on_error = false);
+   gdcmDicomDir(const char *FileName, 
+                bool parseDir = false,
+                bool exception_on_error = false);
+   
+   ~gdcmDicomDir(void);
+
+   void SetPrintLevel(int level) { printLevel = level; };
+   virtual void Print(std::ostream &os = std::cout);
 
-   gdcmDicomDir(std::string &FileName,bool exception_on_error = false );
-   ~gdcmDicomDir();
+   inline gdcmMeta   *GetMeta()      {return metaElems;};
+   inline ListPatient &GetPatients() {return patients;};
 
-   inline lPatient &GetPatients() {return patients;};
-   inline void AddPatient(gdcmPatient *patient) {patients.push_back(patient);};
+// Write
+   bool Write(std::string fileName);
+   void ParseDirectory(void);
+
+// Types
+   typedef enum
+   {
+      GDCM_NONE,
+      GDCM_META,
+      GDCM_PATIENT,
+      GDCM_STUDY,
+      GDCM_SERIE,
+      GDCM_IMAGE,
+   } gdcmDicomDirType;
    
+protected:
+   void NewDicomDir(std::string path);
+   std::string GetPath(void);
+
 private:
-   lPatient patients;
+   void CreateDicomDir(void);
+   void AddObjectToEnd(gdcmDicomDirType type,
+                        ListTag::iterator begin,ListTag::iterator end);
+   void AddMetaToEnd   (ListTag::iterator begin,ListTag::iterator end);
+   void AddPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
+   void AddStudyToEnd  (ListTag::iterator begin,ListTag::iterator end);
+   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);
 
+   gdcmMeta *metaElems;
+   ListPatient patients;
 };
 
 //-----------------------------------------------------------------------------