changeset 3381:a6c590cb8181

OrthancPlugins::DicomPath::SetPrefixIndex()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 28 May 2019 07:33:10 +0200
parents 0528a6c36f3d
children a2862d4484f5
files Plugins/Samples/Common/DicomPath.cpp Plugins/Samples/Common/DicomPath.h
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Samples/Common/DicomPath.cpp	Thu May 23 12:06:26 2019 +0200
+++ b/Plugins/Samples/Common/DicomPath.cpp	Tue May 28 07:33:10 2019 +0200
@@ -50,6 +50,19 @@
   }
 
 
+  DicomPath::Prefix& DicomPath::GetPrefixItem(size_t depth)
+  {
+    if (depth >= prefix_.size())
+    {
+      ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
+    }
+    else
+    {
+      return prefix_[depth];
+    }
+  }
+
+
   DicomPath::DicomPath(const DicomTag& sequence,
                        size_t index,
                        const DicomTag& tag) :
--- a/Plugins/Samples/Common/DicomPath.h	Thu May 23 12:06:26 2019 +0200
+++ b/Plugins/Samples/Common/DicomPath.h	Tue May 28 07:33:10 2019 +0200
@@ -50,6 +50,8 @@
 
     const Prefix& GetPrefixItem(size_t depth) const;
 
+    Prefix& GetPrefixItem(size_t depth);
+
   public:
     DicomPath(const DicomTag& finalTag) :
     finalTag_(finalTag)
@@ -94,6 +96,12 @@
     {
       return GetPrefixItem(depth).second;
     }
+
+    void SetPrefixIndex(size_t depth,
+                        size_t value)
+    {
+      GetPrefixItem(depth).second = value;
+    }
     
     const DicomTag& GetFinalTag() const
     {