diff Core/DicomFormat/DicomMap.cpp @ 1364:111e23bb4904 query-retrieve

integration mainline->query-retrieve
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 21 May 2015 16:58:30 +0200
parents c2c28dd17e87 0649c5aef34a
children 1412ec22ee0b
line wrap: on
line diff
--- a/Core/DicomFormat/DicomMap.cpp	Wed Jun 25 15:34:40 2014 +0200
+++ b/Core/DicomFormat/DicomMap.cpp	Thu May 21 16:58:30 2015 +0200
@@ -1,7 +1,7 @@
 /**
  * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
- * Belgium
+ * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
  *
  * This program is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -36,6 +36,7 @@
 #include <stdio.h>
 #include <memory>
 #include "DicomString.h"
+#include "DicomArray.h"
 #include "../OrthancException.h"
 
 
@@ -190,6 +191,17 @@
   }
 
 
+  void DicomMap::Assign(const DicomMap& other)
+  {
+    Clear();
+
+    for (Map::const_iterator it = other.map_.begin(); it != other.map_.end(); ++it)
+    {
+      map_.insert(std::make_pair(it->first, it->second->Clone()));
+    }
+  }
+
+
   const DicomValue& DicomMap::GetValue(const DicomTag& tag) const
   {
     const DicomValue* value = TestAndGetValue(tag);
@@ -389,30 +401,21 @@
   }
 
 
-  void DicomMap::ExtractMainDicomTagsForLevel(DicomMap& result,
-                                              ResourceType level) const
+  void DicomMap::Print(FILE* fp) const
   {
-    switch (level)
-    {
-      case ResourceType_Patient:
-        ExtractPatientInformation(result);
-        break;
+    DicomArray a(*this);
+    a.Print(fp);
+  }
+
 
-      case ResourceType_Study:
-        ExtractStudyInformation(result);
-        break;
+  void DicomMap::GetTags(std::set<DicomTag>& tags) const
+  {
+    tags.clear();
 
-      case ResourceType_Series:
-        ExtractSeriesInformation(result);
-        break;
-
-      case ResourceType_Instance:
-        ExtractInstanceInformation(result);
-        break;
-
-      default:
-        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    for (Map::const_iterator it = map_.begin();
+         it != map_.end(); ++it)
+    {
+      tags.insert(it->first);
     }
   }
-
 }