# HG changeset patch # User Sebastien Jodogne # Date 1567530197 -7200 # Node ID 8e497a4e3d965fec070f53ac6b47f8d482650685 # Parent 18d53a8b41b79775e3dae5a9d9765cc553c835c8 DicomInstanceParameters::GetIndexInSeries() diff -r 18d53a8b41b7 -r 8e497a4e3d96 .hgignore --- a/.hgignore Tue Sep 03 17:52:28 2019 +0200 +++ b/.hgignore Tue Sep 03 19:03:17 2019 +0200 @@ -38,3 +38,5 @@ Samples/WebAssembly/build/ Samples/WebAssembly/ThirdPartyDownloads/ Samples/WebAssembly/installDir/ + +node_modules/ diff -r 18d53a8b41b7 -r 8e497a4e3d96 Framework/Toolbox/DicomInstanceParameters.cpp --- a/Framework/Toolbox/DicomInstanceParameters.cpp Tue Sep 03 17:52:28 2019 +0200 +++ b/Framework/Toolbox/DicomInstanceParameters.cpp Tue Sep 03 19:03:17 2019 +0200 @@ -176,6 +176,12 @@ { expectedPixelFormat_ = Orthanc::PixelFormat_Grayscale16; } + + // This computes the "IndexInSeries" metadata from Orthanc (check + // out "Orthanc::ServerIndex::Store()") + hasIndexInSeries_ = ( + dicom.ParseUnsignedInteger32(indexInSeries_, Orthanc::DICOM_TAG_INSTANCE_NUMBER) || + dicom.ParseUnsignedInteger32(indexInSeries_, Orthanc::DICOM_TAG_IMAGE_INDEX)); } @@ -398,4 +404,18 @@ return new LookupTableTextureSceneLayer(*converted); } } + + + unsigned int DicomInstanceParameters::GetIndexInSeries() const + { + if (data_.hasIndexInSeries_) + { + return data_.indexInSeries_; + } + else + { + LOG(ERROR) << "DicomInstanceParameters::GetIndexInSeries(): !data_.hasIndexInSeries_"; + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); + } + } } diff -r 18d53a8b41b7 -r 8e497a4e3d96 Framework/Toolbox/DicomInstanceParameters.h --- a/Framework/Toolbox/DicomInstanceParameters.h Tue Sep 03 17:52:28 2019 +0200 +++ b/Framework/Toolbox/DicomInstanceParameters.h Tue Sep 03 19:03:17 2019 +0200 @@ -57,6 +57,8 @@ float defaultWindowingCenter_; float defaultWindowingWidth_; Orthanc::PixelFormat expectedPixelFormat_; + bool hasIndexInSeries_; + unsigned int indexInSeries_; void ComputeDoseOffsets(const Orthanc::DicomMap& dicom); @@ -191,5 +193,12 @@ TextureBaseSceneLayer* CreateTexture(const Orthanc::ImageAccessor& pixelData) const; LookupTableTextureSceneLayer* CreateLookupTableTexture(const Orthanc::ImageAccessor& pixelData) const; + + bool HasIndexInSeries() const + { + return data_.hasIndexInSeries_; + } + + unsigned int GetIndexInSeries() const; }; }