Mercurial > hg > orthanc-wsi
changeset 379:1a01f3456ce0
added tolerance to imaged volume width/height by looking only at the finest level
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 05 Apr 2025 15:36:08 +0200 (3 weeks ago) |
parents | e5fb8f7ade59 |
children | c6928c98fef9 30959cb91e89 |
files | Framework/Inputs/DicomPyramid.cpp Framework/Inputs/DicomPyramidLevel.cpp Framework/Inputs/DicomPyramidLevel.h NEWS |
diffstat | 4 files changed, 40 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Inputs/DicomPyramid.cpp Sat Apr 05 14:58:21 2025 +0200 +++ b/Framework/Inputs/DicomPyramid.cpp Sat Apr 05 15:36:08 2025 +0200 @@ -24,7 +24,6 @@ #include "../PrecompiledHeadersWSI.h" #include "DicomPyramid.h" -#include "../ImageToolbox.h" #include "../DicomToolbox.h" #include <Compatibility.h> @@ -277,29 +276,7 @@ bool DicomPyramid::LookupImagedVolumeSize(double& width, double& height) const { - bool found = false; - - for (size_t i = 0; i < instances_.size(); i++) - { - assert(instances_[i] != NULL); - - if (instances_[i]->HasImagedVolumeSize()) - { - if (!found) - { - found = true; - width = instances_[i]->GetImagedVolumeWidth(); - height = instances_[i]->GetImagedVolumeHeight(); - } - else if (!ImageToolbox::IsNear(width, instances_[i]->GetImagedVolumeWidth()) || - !ImageToolbox::IsNear(height, instances_[i]->GetImagedVolumeHeight())) - { - LOG(WARNING) << "Inconsistency of imaged volume width/height in series: " << seriesId_; - return false; - } - } - } - - return found; + CheckLevel(0); + return levels_[0]->LookupImagedVolumeSize(width, height, seriesId_); } }
--- a/Framework/Inputs/DicomPyramidLevel.cpp Sat Apr 05 14:58:21 2025 +0200 +++ b/Framework/Inputs/DicomPyramidLevel.cpp Sat Apr 05 15:36:08 2025 +0200 @@ -24,6 +24,8 @@ #include "../PrecompiledHeadersWSI.h" #include "DicomPyramidLevel.h" +#include "../ImageToolbox.h" + #include <Logging.h> #include <OrthancException.h> @@ -147,4 +149,35 @@ return false; } } + + + bool DicomPyramidLevel::LookupImagedVolumeSize(double& width, + double& height, + const std::string& seriesId) const + { + bool found = false; + + for (size_t i = 0; i < tiles_.size(); i++) + { + assert(tiles_[i].instance_ != NULL); + + if (tiles_[i].instance_->HasImagedVolumeSize()) + { + if (!found) + { + found = true; + width = tiles_[i].instance_->GetImagedVolumeWidth(); + height = tiles_[i].instance_->GetImagedVolumeHeight(); + } + else if (!ImageToolbox::IsNear(width, tiles_[i].instance_->GetImagedVolumeWidth()) || + !ImageToolbox::IsNear(height, tiles_[i].instance_->GetImagedVolumeHeight())) + { + LOG(WARNING) << "Inconsistency of imaged volume width/height in series: " << seriesId; + return false; + } + } + } + + return found; + } }
--- a/Framework/Inputs/DicomPyramidLevel.h Sat Apr 05 14:58:21 2025 +0200 +++ b/Framework/Inputs/DicomPyramidLevel.h Sat Apr 05 15:36:08 2025 +0200 @@ -93,5 +93,9 @@ OrthancStone::IOrthancConnection& orthanc, unsigned int tileX, unsigned int tileY) const; + + bool LookupImagedVolumeSize(double& width, + double& height, + const std::string& seriesId) const; }; }
--- a/NEWS Sat Apr 05 14:58:21 2025 +0200 +++ b/NEWS Sat Apr 05 15:36:08 2025 +0200 @@ -2,6 +2,7 @@ =============================== * Support windowing when rendering grayscale images using on-the-fly deep zoom +* Added tolerance to imaged volume width/height by looking only at the finest level Version 3.1 (2025-03-17)