changeset 1846:2789b4b0e0a8

DicomInstanceParameters::HasNumberOfFrames() and DicomInstanceParameters::GetInstanceNumber()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Jun 2021 09:57:32 +0200
parents ca85b6d60bca
children b2ae1465d568
files OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp OrthancStone/Sources/Toolbox/DicomInstanceParameters.h
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp	Thu Jun 24 16:46:22 2021 +0200
+++ b/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp	Fri Jun 25 09:57:32 2021 +0200
@@ -91,10 +91,12 @@
     uint32_t n;
     if (dicom.ParseUnsignedInteger32(n, Orthanc::DICOM_TAG_NUMBER_OF_FRAMES))
     {
+      hasNumberOfFrames_ = true;
       numberOfFrames_ = n;
     }
     else
     {
+      hasNumberOfFrames_ = false;
       numberOfFrames_ = 1;
     }
 
@@ -262,6 +264,12 @@
     {
       frameOfReferenceUid_.clear();
     }
+
+    if (!dicom.HasTag(Orthanc::DICOM_TAG_INSTANCE_NUMBER) ||
+        !dicom.GetValue(Orthanc::DICOM_TAG_INSTANCE_NUMBER).ParseInteger32(instanceNumber_))
+    {
+      instanceNumber_ = 0;
+    }
   }
 
 
--- a/OrthancStone/Sources/Toolbox/DicomInstanceParameters.h	Thu Jun 24 16:46:22 2021 +0200
+++ b/OrthancStone/Sources/Toolbox/DicomInstanceParameters.h	Fri Jun 25 09:57:32 2021 +0200
@@ -63,6 +63,8 @@
       double              doseGridScaling_;
       std::string         frameOfReferenceUid_;
       bool                hasPixelSpacing_;
+      bool                hasNumberOfFrames_;
+      int32_t             instanceNumber_;
 
       explicit Data(const Orthanc::DicomMap& dicom);
     };
@@ -240,5 +242,15 @@
                          double pixelSpacingY);
 
     void EnrichUsingDicomWeb(const Json::Value& dicomweb);
+
+    bool HasNumberOfFrames() const
+    {
+      return data_.hasNumberOfFrames_;
+    }
+
+    int32_t GetInstanceNumber() const
+    {
+      return data_.instanceNumber_;
+    }
   };
 }