changeset 1644:4796fb60999e

removing methods from SortedFrames to simplify api
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Nov 2020 18:08:16 +0100
parents 882e2253a90e
children bc7bd8ee13f8
files Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp OrthancStone/Sources/Toolbox/SortedFrames.h UnitTestsSources/SortedFramesCreateTest.py UnitTestsSources/SortedFramesTests.cpp
diffstat 4 files changed, 113 insertions(+), 134 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Tue Nov 10 17:35:32 2020 +0100
+++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Tue Nov 10 18:08:16 2020 +0100
@@ -1330,7 +1330,7 @@
       bool isFull = prefetchQueue_.front().IsFull();
       prefetchQueue_.pop_front();
       
-      const std::string sopInstanceUid = frames_->GetFrameSopInstanceUid(index);
+      const std::string sopInstanceUid = frames_->GetInstanceOfFrame(index).GetSopInstanceUid();
       unsigned int frameNumber = frames_->GetFrameNumberInInstance(index);
 
       {
@@ -1372,7 +1372,7 @@
     {
       size_t index = cursor_->GetCurrentIndex();
 
-      if (frames_->GetFrameSopInstanceUid(index) == sopInstanceUid &&
+      if (frames_->GetInstanceOfFrame(index).GetSopInstanceUid() == sopInstanceUid &&
           frames_->GetFrameNumberInInstance(index) == frameNumber)
       {
         DisplayCurrentFrame();
@@ -1414,7 +1414,7 @@
         quality = DisplayedFrameQuality_High;
       }
 
-      currentFrameExtent_ = FrameExtent(frames_->GetFrameTags(index));
+      currentFrameExtent_ = FrameExtent(frames_->GetInstanceOfFrame(index).GetTags());
 
       {
         // Prepare prefetching
@@ -1473,8 +1473,17 @@
       layer.GetWindowing(windowingCenter_, windowingWidth_);
     }
   }
+
+
+  static bool IsFrameMonochrome1(const OrthancStone::SortedFrames& frames,
+                                 size_t frameIndex)
+  {
+    const OrthancStone::DicomInstanceParameters& instance = frames.GetInstanceOfFrame(frameIndex);
+    return (instance.GetImageInformation().GetPhotometricInterpretation() ==
+            Orthanc::PhotometricInterpretation_Monochrome1);
+  }
   
-
+  
   bool DisplayFrame(unsigned int& quality,
                     size_t index)
   {
@@ -1483,7 +1492,7 @@
       return false;
     }
 
-    const std::string sopInstanceUid = frames_->GetFrameSopInstanceUid(index);
+    const std::string sopInstanceUid = frames_->GetInstanceOfFrame(index).GetSopInstanceUid();
     size_t frameNumber = frames_->GetFrameNumberInInstance(index);
 
     FramesCache::Accessor accessor(*cache_, sopInstanceUid, frameNumber);
@@ -1506,7 +1515,7 @@
           std::unique_ptr<OrthancStone::FloatTextureSceneLayer> tmp(
             new OrthancStone::FloatTextureSceneLayer(accessor.GetImage()));
           tmp->SetCustomWindowing(windowingCenter_, windowingWidth_);
-          tmp->SetInverted(inverted_ ^ frames_->IsFrameMonochrome1(index));
+          tmp->SetInverted(inverted_ ^ IsFrameMonochrome1(*frames_, index));
           layer.reset(tmp.release());
           break;
         }
@@ -1521,7 +1530,7 @@
 
       double pixelSpacingX, pixelSpacingY;
       OrthancStone::GeometryToolbox::GetPixelSpacing(
-        pixelSpacingX, pixelSpacingY, frames_->GetFrameTags(index));
+        pixelSpacingX, pixelSpacingY, frames_->GetInstanceOfFrame(index).GetTags());
       layer->SetPixelSpacing(pixelSpacingX, pixelSpacingY);
 
 
@@ -1596,7 +1605,7 @@
   {
     if (frames_.get() != NULL)
     {
-      std::string sopInstanceUid = frames_->GetFrameSopInstanceUid(index);
+      std::string sopInstanceUid = frames_->GetInstanceOfFrame(index).GetSopInstanceUid();
       unsigned int frameNumber = frames_->GetFrameNumberInInstance(index);
       
       {
@@ -1621,9 +1630,9 @@
     }
     else if (frames_.get() != NULL)
     {
-      std::string sopInstanceUid = frames_->GetFrameSopInstanceUid(index);
+      std::string sopInstanceUid = frames_->GetInstanceOfFrame(index).GetSopInstanceUid();
       unsigned int frameNumber = frames_->GetFrameNumberInInstance(index);
-      bool isMonochrome1 = frames_->IsFrameMonochrome1(index);
+      bool isMonochrome1 = IsFrameMonochrome1(*frames_, index);
 
       const std::string uri = ("studies/" + frames_->GetStudyInstanceUid() +
                                "/series/" + frames_->GetSeriesInstanceUid() +
@@ -1857,7 +1866,7 @@
     
     if (frames_->GetFramesCount() != 0)
     {
-      const std::string& sopInstanceUid = frames_->GetFrameSopInstanceUid(cursor_->GetCurrentIndex());
+      const std::string& sopInstanceUid = frames_->GetInstanceOfFrame(cursor_->GetCurrentIndex()).GetSopInstanceUid();
 
       {
         // Fetch the default windowing for the central instance
--- a/OrthancStone/Sources/Toolbox/SortedFrames.h	Tue Nov 10 17:35:32 2020 +0100
+++ b/OrthancStone/Sources/Toolbox/SortedFrames.h	Tue Nov 10 18:08:16 2020 +0100
@@ -68,8 +68,6 @@
     InstancesIndex                         instancesIndex_;
     FramesIndex                            framesIndex_;
 
-    const DicomInstanceParameters& GetInstance(size_t instanceIndex) const;
-
     const Frame& GetFrame(size_t frameIndex) const;
 
     void AddFramesOfInstance(std::set<size_t>& remainingInstances,
@@ -112,20 +110,8 @@
       return instances_.size();
     }
 
-    const Orthanc::DicomMap& GetInstanceTags(size_t instanceIndex) const
-    {
-      return GetInstance(instanceIndex).GetTags();
-    }
-
-    const std::string& GetSopInstanceUid(size_t instanceIndex) const
-    {
-      return GetInstance(instanceIndex).GetSopInstanceUid();
-    }
-
-    const CoordinateSystem3D& GetInstanceGeometry(size_t instanceIndex) const
-    {
-      return GetInstance(instanceIndex).GetGeometry();
-    }
+    // TODO - REMOVE THIS DANGEROUS FUNCTION (might be taken for GetInstanceOfFrame())
+    const DicomInstanceParameters& GetInstance(size_t instanceIndex) const;
 
     bool LookupSopInstanceUid(size_t& instanceIndex,
                               const std::string& sopInstanceUid) const;
@@ -137,19 +123,9 @@
 
     size_t GetFramesCount() const;
 
-    const Orthanc::DicomMap& GetFrameTags(size_t frameIndex) const
-    {
-      return GetFrame(frameIndex).GetInstance().GetTags();
-    }
-
-    const std::string& GetFrameSopInstanceUid(size_t frameIndex) const
+    const DicomInstanceParameters& GetInstanceOfFrame(size_t frameIndex) const
     {
-      return GetFrame(frameIndex).GetInstance().GetSopInstanceUid();
-    }
-
-    unsigned int GetFrameSiblingsCount(size_t frameIndex) const
-    {
-      return GetFrame(frameIndex).GetInstance().GetNumberOfFrames();
+      return GetFrame(frameIndex).GetInstance();
     }
 
     unsigned int GetFrameNumberInInstance(size_t frameIndex) const
@@ -157,12 +133,6 @@
       return GetFrame(frameIndex).GetFrameNumberInInstance();
     }
 
-    bool IsFrameMonochrome1(size_t frameIndex) const  // TODO - REMOVE
-    {
-      return GetFrame(frameIndex).GetInstance().GetImageInformation().GetPhotometricInterpretation() ==
-        Orthanc::PhotometricInterpretation_Monochrome1;
-    }
-
     CoordinateSystem3D GetFrameGeometry(size_t frameIndex) const;
 
     bool LookupFrame(size_t& frameIndex,
--- a/UnitTestsSources/SortedFramesCreateTest.py	Tue Nov 10 17:35:32 2020 +0100
+++ b/UnitTestsSources/SortedFramesCreateTest.py	Tue Nov 10 18:08:16 2020 +0100
@@ -81,5 +81,5 @@
 print('  ASSERT_EQ(%du, f.GetFramesCount());' % len(slices))
 
 for i in range(len(slices)):
-    print('  ASSERT_EQ(f.GetFrameSopInstanceUid(%d), "%s");' % (i, slices[i][0]))
+    print('  ASSERT_EQ(f.GetInstanceOfFrame(%d).GetSopInstanceUid(), "%s");' % (i, slices[i][0]))
 
--- a/UnitTestsSources/SortedFramesTests.cpp	Tue Nov 10 17:35:32 2020 +0100
+++ b/UnitTestsSources/SortedFramesTests.cpp	Tue Nov 10 18:08:16 2020 +0100
@@ -32,13 +32,13 @@
   ASSERT_TRUE(f.GetStudyInstanceUid().empty());
   ASSERT_TRUE(f.GetSeriesInstanceUid().empty());
   ASSERT_EQ(0u, f.GetInstancesCount());
-  ASSERT_THROW(f.GetInstanceTags(0), Orthanc::OrthancException);
-  ASSERT_THROW(f.GetSopInstanceUid(0), Orthanc::OrthancException);
+  ASSERT_THROW(f.GetInstance(0).GetTags(), Orthanc::OrthancException);
+  ASSERT_THROW(f.GetInstance(0).GetSopInstanceUid(), Orthanc::OrthancException);
   ASSERT_TRUE(f.IsSorted());
   ASSERT_EQ(0u, f.GetFramesCount());
-  ASSERT_THROW(f.GetFrameTags(0), Orthanc::OrthancException);
-  ASSERT_THROW(f.GetFrameSopInstanceUid(0), Orthanc::OrthancException);
-  ASSERT_THROW(f.GetFrameSiblingsCount(0), Orthanc::OrthancException);
+  ASSERT_THROW(f.GetInstanceOfFrame(0).GetTags(), Orthanc::OrthancException);
+  ASSERT_THROW(f.GetInstanceOfFrame(0).GetSopInstanceUid(), Orthanc::OrthancException);
+  ASSERT_THROW(f.GetInstanceOfFrame(0).GetNumberOfFrames(), Orthanc::OrthancException);
   ASSERT_THROW(f.GetFrameNumberInInstance(0), Orthanc::OrthancException);
 
   Orthanc::DicomMap tags;
@@ -54,25 +54,25 @@
   ASSERT_EQ("series", f.GetSeriesInstanceUid());
   ASSERT_EQ(1u, f.GetInstancesCount());
   std::string s;
-  ASSERT_TRUE(f.GetInstanceTags(0).LookupStringValue(s, Orthanc::DICOM_TAG_SOP_INSTANCE_UID, false));
+  ASSERT_TRUE(f.GetInstance(0).GetTags().LookupStringValue(s, Orthanc::DICOM_TAG_SOP_INSTANCE_UID, false));
   ASSERT_EQ("sop", s);
-  ASSERT_EQ("sop", f.GetSopInstanceUid(0));
+  ASSERT_EQ("sop", f.GetInstance(0).GetSopInstanceUid());
   ASSERT_FALSE(f.IsSorted());
   ASSERT_THROW(f.GetFramesCount(), Orthanc::OrthancException);
-  ASSERT_THROW(f.GetFrameTags(0), Orthanc::OrthancException);
-  ASSERT_THROW(f.GetFrameSopInstanceUid(0), Orthanc::OrthancException);
-  ASSERT_THROW(f.GetFrameSiblingsCount(0), Orthanc::OrthancException);
+  ASSERT_THROW(f.GetInstanceOfFrame(0).GetTags(), Orthanc::OrthancException);
+  ASSERT_THROW(f.GetInstanceOfFrame(0).GetSopInstanceUid(), Orthanc::OrthancException);
+  ASSERT_THROW(f.GetInstanceOfFrame(0).GetNumberOfFrames(), Orthanc::OrthancException);
   ASSERT_THROW(f.GetFrameNumberInInstance(0), Orthanc::OrthancException);
 
   f.Sort();
   ASSERT_TRUE(f.IsSorted());
   ASSERT_EQ(1u, f.GetFramesCount());
-  ASSERT_TRUE(f.GetFrameTags(0).LookupStringValue(s, Orthanc::DICOM_TAG_SOP_INSTANCE_UID, false));
+  ASSERT_TRUE(f.GetInstanceOfFrame(0).GetTags().LookupStringValue(s, Orthanc::DICOM_TAG_SOP_INSTANCE_UID, false));
   ASSERT_EQ("sop", s);
-  ASSERT_EQ("sop", f.GetFrameSopInstanceUid(0));
-  ASSERT_EQ(1u, f.GetFrameSiblingsCount(0));
+  ASSERT_EQ("sop", f.GetInstanceOfFrame(0).GetSopInstanceUid());
+  ASSERT_EQ(1u, f.GetInstanceOfFrame(0).GetNumberOfFrames());
   ASSERT_EQ(0u, f.GetFrameNumberInInstance(0));
-  ASSERT_THROW(f.GetFrameTags(1), Orthanc::OrthancException);
+  ASSERT_THROW(f.GetInstanceOfFrame(1).GetTags(), Orthanc::OrthancException);
 }
 
 
@@ -103,16 +103,16 @@
   
   f.Sort();
   ASSERT_EQ(3u, f.GetInstancesCount());
-  ASSERT_EQ("sop3", f.GetSopInstanceUid(0));
-  ASSERT_EQ("sop1", f.GetSopInstanceUid(1));
-  ASSERT_EQ("sop2", f.GetSopInstanceUid(2));
+  ASSERT_EQ("sop3", f.GetInstance(0).GetSopInstanceUid());
+  ASSERT_EQ("sop1", f.GetInstance(1).GetSopInstanceUid());
+  ASSERT_EQ("sop2", f.GetInstance(2).GetSopInstanceUid());
   ASSERT_EQ(6u, f.GetFramesCount());
-  ASSERT_EQ("sop1", f.GetFrameSopInstanceUid(0));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(0));
-  ASSERT_EQ("sop1", f.GetFrameSopInstanceUid(1));  ASSERT_EQ(1u, f.GetFrameNumberInInstance(1));
-  ASSERT_EQ("sop1", f.GetFrameSopInstanceUid(2));  ASSERT_EQ(2u, f.GetFrameNumberInInstance(2));
-  ASSERT_EQ("sop2", f.GetFrameSopInstanceUid(3));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(3));
-  ASSERT_EQ("sop2", f.GetFrameSopInstanceUid(4));  ASSERT_EQ(1u, f.GetFrameNumberInInstance(4));
-  ASSERT_EQ("sop3", f.GetFrameSopInstanceUid(5));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(5));
+  ASSERT_EQ("sop1", f.GetInstanceOfFrame(0).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(0));
+  ASSERT_EQ("sop1", f.GetInstanceOfFrame(1).GetSopInstanceUid());  ASSERT_EQ(1u, f.GetFrameNumberInInstance(1));
+  ASSERT_EQ("sop1", f.GetInstanceOfFrame(2).GetSopInstanceUid());  ASSERT_EQ(2u, f.GetFrameNumberInInstance(2));
+  ASSERT_EQ("sop2", f.GetInstanceOfFrame(3).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(3));
+  ASSERT_EQ("sop2", f.GetInstanceOfFrame(4).GetSopInstanceUid());  ASSERT_EQ(1u, f.GetFrameNumberInInstance(4));
+  ASSERT_EQ("sop3", f.GetInstanceOfFrame(5).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(5));
 
   // The instances must not have been reordered, only the frames
   ASSERT_TRUE(f.LookupSopInstanceUid(i, "sop1"));  ASSERT_EQ(1u, i);
@@ -173,19 +173,19 @@
 
   f.Sort();
   ASSERT_EQ(6u, f.GetInstancesCount());
-  ASSERT_EQ("sop1", f.GetSopInstanceUid(0));
-  ASSERT_EQ("sop2", f.GetSopInstanceUid(1));
-  ASSERT_EQ("sop2a", f.GetSopInstanceUid(2));
-  ASSERT_EQ("sop4", f.GetSopInstanceUid(3));
-  ASSERT_EQ("sop3", f.GetSopInstanceUid(4));
-  ASSERT_EQ("sop5", f.GetSopInstanceUid(5));
+  ASSERT_EQ("sop1", f.GetInstance(0).GetSopInstanceUid());
+  ASSERT_EQ("sop2", f.GetInstance(1).GetSopInstanceUid());
+  ASSERT_EQ("sop2a", f.GetInstance(2).GetSopInstanceUid());
+  ASSERT_EQ("sop4", f.GetInstance(3).GetSopInstanceUid());
+  ASSERT_EQ("sop3", f.GetInstance(4).GetSopInstanceUid());
+  ASSERT_EQ("sop5", f.GetInstance(5).GetSopInstanceUid());
   ASSERT_EQ(6u, f.GetFramesCount());
-  ASSERT_EQ("sop2", f.GetFrameSopInstanceUid(0));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(0));
-  ASSERT_EQ("sop3", f.GetFrameSopInstanceUid(1));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(1));
-  ASSERT_EQ("sop4", f.GetFrameSopInstanceUid(2));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(2));
-  ASSERT_EQ("sop5", f.GetFrameSopInstanceUid(3));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(3));
-  ASSERT_EQ("sop1", f.GetFrameSopInstanceUid(4));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(4));
-  ASSERT_EQ("sop2a", f.GetFrameSopInstanceUid(5)); ASSERT_EQ(0u, f.GetFrameNumberInInstance(5));
+  ASSERT_EQ("sop2", f.GetInstanceOfFrame(0).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(0));
+  ASSERT_EQ("sop3", f.GetInstanceOfFrame(1).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(1));
+  ASSERT_EQ("sop4", f.GetInstanceOfFrame(2).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(2));
+  ASSERT_EQ("sop5", f.GetInstanceOfFrame(3).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(3));
+  ASSERT_EQ("sop1", f.GetInstanceOfFrame(4).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(4));
+  ASSERT_EQ("sop2a", f.GetInstanceOfFrame(5).GetSopInstanceUid()); ASSERT_EQ(0u, f.GetFrameNumberInInstance(5));
 
   // The instances must not have been reordered, only the frames
   ASSERT_TRUE(f.LookupSopInstanceUid(i, "sop1"));  ASSERT_EQ(0u, i);
@@ -232,16 +232,16 @@
 
   f.Sort();
   ASSERT_EQ(4u, f.GetInstancesCount());
-  ASSERT_EQ("sop1", f.GetSopInstanceUid(0));
-  ASSERT_EQ("sop2", f.GetSopInstanceUid(1));
-  ASSERT_EQ("sop3", f.GetSopInstanceUid(2));
-  ASSERT_EQ("sop4", f.GetSopInstanceUid(3));
+  ASSERT_EQ("sop1", f.GetInstance(0).GetSopInstanceUid());
+  ASSERT_EQ("sop2", f.GetInstance(1).GetSopInstanceUid());
+  ASSERT_EQ("sop3", f.GetInstance(2).GetSopInstanceUid());
+  ASSERT_EQ("sop4", f.GetInstance(3).GetSopInstanceUid());
   ASSERT_EQ(4u, f.GetFramesCount());
   // First instance number, then image index
-  ASSERT_EQ("sop1", f.GetFrameSopInstanceUid(0));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(0));
-  ASSERT_EQ("sop4", f.GetFrameSopInstanceUid(1));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(1));
-  ASSERT_EQ("sop2", f.GetFrameSopInstanceUid(2));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(2));
-  ASSERT_EQ("sop3", f.GetFrameSopInstanceUid(3));  ASSERT_EQ(0u, f.GetFrameNumberInInstance(3));
+  ASSERT_EQ("sop1", f.GetInstanceOfFrame(0).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(0));
+  ASSERT_EQ("sop4", f.GetInstanceOfFrame(1).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(1));
+  ASSERT_EQ("sop2", f.GetInstanceOfFrame(2).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(2));
+  ASSERT_EQ("sop3", f.GetInstanceOfFrame(3).GetSopInstanceUid());  ASSERT_EQ(0u, f.GetFrameNumberInInstance(3));
 }
 
 
@@ -405,28 +405,28 @@
   f.AddInstance(tags);
   f.Sort();
   ASSERT_EQ(22u, f.GetFramesCount());
-  ASSERT_EQ(f.GetFrameSopInstanceUid(0), "b9cf5158-06f8e713-7d5111aa-411fd75b-7be2c51e");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(1), "3e8f8ec1-b603f874-825552f1-6fcac7fa-72ca1aa5");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(2), "348efc0a-71ee4758-56bd51fa-9703cbff-9b51d4c9");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(3), "a0ca6802-56c697c3-0205bab8-42217cfc-84ff0de6");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(4), "eaa49a94-b9042041-7f45150b-e414f800-d7232874");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(5), "a8ee83f9-1cc26ad9-ebba3043-8afc47c2-bd784610");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(6), "c19fb4b6-ad1224f2-2c3a2b28-0ea233be-38eea0de");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(7), "e0d82343-9cef01e9-e21df50a-11886a94-1d0216ea");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(8), "efce9ff4-3fe07d83-745846f8-fefe5d64-bfea65e6");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(9), "67b44a5e-8997f88d-6e527bd6-df342483-dab1674c");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(10), "8bdecadd-e3477e28-bbbf0297-22b0b680-37b13a7c");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(11), "f5e889ac-c5afdc37-c5b62074-a8bdeef3-c58d9889");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(12), "b590cc95-55789755-ebd10b76-911e855e-f24e4fe7");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(13), "16606f69-83b48518-ab34304a-c8871b7f-a9298d74");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(14), "23d12f39-e9a4fc21-8da338c4-97feff30-48e95534");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(15), "7a7c0120-37f6dd58-c46312e6-2559975d-5af4616f");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(16), "fa56f961-d1ae8f6a-989c04f4-7a588e9e-b41b1a13");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(17), "63d595f3-327a306d-1709bb8b-2a72e11c-4f7221fe");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(18), "5faf886f-bd5517cf-1a6ba06e-ac0e6ddb-47bdd8b2");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(19), "6824db93-ed4e2740-07be953f-6d0a8fb3-af0a3a0b");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(20), "dc1576ee-25b0b1ef-e038df76-d296fcad-a1456169");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(21), "5a2acb03-063f5063-cac452d1-a55992f9-769900fb");
+  ASSERT_EQ(f.GetInstanceOfFrame(0).GetSopInstanceUid(), "b9cf5158-06f8e713-7d5111aa-411fd75b-7be2c51e");
+  ASSERT_EQ(f.GetInstanceOfFrame(1).GetSopInstanceUid(), "3e8f8ec1-b603f874-825552f1-6fcac7fa-72ca1aa5");
+  ASSERT_EQ(f.GetInstanceOfFrame(2).GetSopInstanceUid(), "348efc0a-71ee4758-56bd51fa-9703cbff-9b51d4c9");
+  ASSERT_EQ(f.GetInstanceOfFrame(3).GetSopInstanceUid(), "a0ca6802-56c697c3-0205bab8-42217cfc-84ff0de6");
+  ASSERT_EQ(f.GetInstanceOfFrame(4).GetSopInstanceUid(), "eaa49a94-b9042041-7f45150b-e414f800-d7232874");
+  ASSERT_EQ(f.GetInstanceOfFrame(5).GetSopInstanceUid(), "a8ee83f9-1cc26ad9-ebba3043-8afc47c2-bd784610");
+  ASSERT_EQ(f.GetInstanceOfFrame(6).GetSopInstanceUid(), "c19fb4b6-ad1224f2-2c3a2b28-0ea233be-38eea0de");
+  ASSERT_EQ(f.GetInstanceOfFrame(7).GetSopInstanceUid(), "e0d82343-9cef01e9-e21df50a-11886a94-1d0216ea");
+  ASSERT_EQ(f.GetInstanceOfFrame(8).GetSopInstanceUid(), "efce9ff4-3fe07d83-745846f8-fefe5d64-bfea65e6");
+  ASSERT_EQ(f.GetInstanceOfFrame(9).GetSopInstanceUid(), "67b44a5e-8997f88d-6e527bd6-df342483-dab1674c");
+  ASSERT_EQ(f.GetInstanceOfFrame(10).GetSopInstanceUid(), "8bdecadd-e3477e28-bbbf0297-22b0b680-37b13a7c");
+  ASSERT_EQ(f.GetInstanceOfFrame(11).GetSopInstanceUid(), "f5e889ac-c5afdc37-c5b62074-a8bdeef3-c58d9889");
+  ASSERT_EQ(f.GetInstanceOfFrame(12).GetSopInstanceUid(), "b590cc95-55789755-ebd10b76-911e855e-f24e4fe7");
+  ASSERT_EQ(f.GetInstanceOfFrame(13).GetSopInstanceUid(), "16606f69-83b48518-ab34304a-c8871b7f-a9298d74");
+  ASSERT_EQ(f.GetInstanceOfFrame(14).GetSopInstanceUid(), "23d12f39-e9a4fc21-8da338c4-97feff30-48e95534");
+  ASSERT_EQ(f.GetInstanceOfFrame(15).GetSopInstanceUid(), "7a7c0120-37f6dd58-c46312e6-2559975d-5af4616f");
+  ASSERT_EQ(f.GetInstanceOfFrame(16).GetSopInstanceUid(), "fa56f961-d1ae8f6a-989c04f4-7a588e9e-b41b1a13");
+  ASSERT_EQ(f.GetInstanceOfFrame(17).GetSopInstanceUid(), "63d595f3-327a306d-1709bb8b-2a72e11c-4f7221fe");
+  ASSERT_EQ(f.GetInstanceOfFrame(18).GetSopInstanceUid(), "5faf886f-bd5517cf-1a6ba06e-ac0e6ddb-47bdd8b2");
+  ASSERT_EQ(f.GetInstanceOfFrame(19).GetSopInstanceUid(), "6824db93-ed4e2740-07be953f-6d0a8fb3-af0a3a0b");
+  ASSERT_EQ(f.GetInstanceOfFrame(20).GetSopInstanceUid(), "dc1576ee-25b0b1ef-e038df76-d296fcad-a1456169");
+  ASSERT_EQ(f.GetInstanceOfFrame(21).GetSopInstanceUid(), "5a2acb03-063f5063-cac452d1-a55992f9-769900fb");
 }
 
 
@@ -554,27 +554,27 @@
   f.AddInstance(tags);
   f.Sort();
   ASSERT_EQ(23u, f.GetFramesCount());
-  ASSERT_EQ(f.GetFrameSopInstanceUid(0), "fda415d4-f1429b07-5d1cd9f0-675059ff-c0ce9e67");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(1), "f555ef96-6b01a90c-bdc2585a-dd17bb3a-75e89920");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(2), "8c7d1e4d-7936f799-c4b8b56b-32d0d9a6-2b492e98");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(3), "faec09f9-ca7fe0f0-2b25c370-bb1bfaef-8ccfa560");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(4), "6570b6c0-7d2f324d-db7cad50-843f62df-d0446352");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(5), "c9dfc022-7b377063-08bdc5e8-fedcc463-8de22ee6");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(6), "0be36fe7-6c7a762b-281cf109-fff9d8ea-42e16b7a");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(7), "ec282396-a8209d00-1c5091f3-f632bf3d-a1bcebba");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(8), "7906b806-47190031-72c5043c-d42704c1-688a3b23");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(9), "9e3b97ec-25b86a67-2cbb8f77-94e73268-4509d383");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(10), "efc9f411-9f4294e0-66d292a1-b8b6b421-897f1d80");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(11), "b348f629-11d59f98-fb22710b-4964b90a-f44436ff");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(12), "aac4f2ba-e863f124-6af96709-053258a7-3d39db26");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(13), "a468da62-a8a6e0b9-f66b86b0-b15fa30b-93077161");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(14), "d52d5f21-54f1ad99-4015a995-108f7210-ee157944");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(15), "8346a1db-0b08a22b-9045aaad-57098aac-5b2e9159");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(16), "20b42f52-6d5f784b-cdbc0fbe-4bfc6b0c-5a199c75");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(17), "caa62568-fdf894fe-08f830a2-5a468967-681d954b");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(18), "931d0c36-8fbb4101-70e6d756-edb15431-aaa9a31b");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(19), "8fefe14c-c4c34152-2c3d3514-04e75747-eb7f01f0");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(20), "1cf40ac9-e823e677-cbd5db4b-9e48b451-cccbf950");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(21), "e734c170-96b0a397-95e3b43e-d7a5ed74-025843c8");
-  ASSERT_EQ(f.GetFrameSopInstanceUid(22), "99c20bcc-115ae447-84d616f2-cb6c5576-9f67aa7a");
+  ASSERT_EQ(f.GetInstanceOfFrame(0).GetSopInstanceUid(), "fda415d4-f1429b07-5d1cd9f0-675059ff-c0ce9e67");
+  ASSERT_EQ(f.GetInstanceOfFrame(1).GetSopInstanceUid(), "f555ef96-6b01a90c-bdc2585a-dd17bb3a-75e89920");
+  ASSERT_EQ(f.GetInstanceOfFrame(2).GetSopInstanceUid(), "8c7d1e4d-7936f799-c4b8b56b-32d0d9a6-2b492e98");
+  ASSERT_EQ(f.GetInstanceOfFrame(3).GetSopInstanceUid(), "faec09f9-ca7fe0f0-2b25c370-bb1bfaef-8ccfa560");
+  ASSERT_EQ(f.GetInstanceOfFrame(4).GetSopInstanceUid(), "6570b6c0-7d2f324d-db7cad50-843f62df-d0446352");
+  ASSERT_EQ(f.GetInstanceOfFrame(5).GetSopInstanceUid(), "c9dfc022-7b377063-08bdc5e8-fedcc463-8de22ee6");
+  ASSERT_EQ(f.GetInstanceOfFrame(6).GetSopInstanceUid(), "0be36fe7-6c7a762b-281cf109-fff9d8ea-42e16b7a");
+  ASSERT_EQ(f.GetInstanceOfFrame(7).GetSopInstanceUid(), "ec282396-a8209d00-1c5091f3-f632bf3d-a1bcebba");
+  ASSERT_EQ(f.GetInstanceOfFrame(8).GetSopInstanceUid(), "7906b806-47190031-72c5043c-d42704c1-688a3b23");
+  ASSERT_EQ(f.GetInstanceOfFrame(9).GetSopInstanceUid(), "9e3b97ec-25b86a67-2cbb8f77-94e73268-4509d383");
+  ASSERT_EQ(f.GetInstanceOfFrame(10).GetSopInstanceUid(), "efc9f411-9f4294e0-66d292a1-b8b6b421-897f1d80");
+  ASSERT_EQ(f.GetInstanceOfFrame(11).GetSopInstanceUid(), "b348f629-11d59f98-fb22710b-4964b90a-f44436ff");
+  ASSERT_EQ(f.GetInstanceOfFrame(12).GetSopInstanceUid(), "aac4f2ba-e863f124-6af96709-053258a7-3d39db26");
+  ASSERT_EQ(f.GetInstanceOfFrame(13).GetSopInstanceUid(), "a468da62-a8a6e0b9-f66b86b0-b15fa30b-93077161");
+  ASSERT_EQ(f.GetInstanceOfFrame(14).GetSopInstanceUid(), "d52d5f21-54f1ad99-4015a995-108f7210-ee157944");
+  ASSERT_EQ(f.GetInstanceOfFrame(15).GetSopInstanceUid(), "8346a1db-0b08a22b-9045aaad-57098aac-5b2e9159");
+  ASSERT_EQ(f.GetInstanceOfFrame(16).GetSopInstanceUid(), "20b42f52-6d5f784b-cdbc0fbe-4bfc6b0c-5a199c75");
+  ASSERT_EQ(f.GetInstanceOfFrame(17).GetSopInstanceUid(), "caa62568-fdf894fe-08f830a2-5a468967-681d954b");
+  ASSERT_EQ(f.GetInstanceOfFrame(18).GetSopInstanceUid(), "931d0c36-8fbb4101-70e6d756-edb15431-aaa9a31b");
+  ASSERT_EQ(f.GetInstanceOfFrame(19).GetSopInstanceUid(), "8fefe14c-c4c34152-2c3d3514-04e75747-eb7f01f0");
+  ASSERT_EQ(f.GetInstanceOfFrame(20).GetSopInstanceUid(), "1cf40ac9-e823e677-cbd5db4b-9e48b451-cccbf950");
+  ASSERT_EQ(f.GetInstanceOfFrame(21).GetSopInstanceUid(), "e734c170-96b0a397-95e3b43e-d7a5ed74-025843c8");
+  ASSERT_EQ(f.GetInstanceOfFrame(22).GetSopInstanceUid(), "99c20bcc-115ae447-84d616f2-cb6c5576-9f67aa7a");
 }