Mercurial > hg > orthanc-stone
changeset 980:8e497a4e3d96
DicomInstanceParameters::GetIndexInSeries()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 03 Sep 2019 19:03:17 +0200 |
parents | 18d53a8b41b7 |
children | 3f6e5a38c88f |
files | .hgignore Framework/Toolbox/DicomInstanceParameters.cpp Framework/Toolbox/DicomInstanceParameters.h |
diffstat | 3 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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/
--- 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); + } + } }
--- 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; }; }