Mercurial > hg > orthanc-stone
changeset 1159:acb399643945 broker
DicomInstanceParameters::ApplyRescale()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 18 Nov 2019 15:24:36 +0100 |
parents | e3eaadcb314a |
children | 59906485896f |
files | Framework/Toolbox/DicomInstanceParameters.cpp Framework/Toolbox/DicomInstanceParameters.h |
diffstat | 2 files changed, 25 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Toolbox/DicomInstanceParameters.cpp Sun Nov 17 11:37:47 2019 +0100 +++ b/Framework/Toolbox/DicomInstanceParameters.cpp Mon Nov 18 15:24:36 2019 +0100 @@ -265,7 +265,7 @@ void DicomInstanceParameters::Data::ApplyRescaleAndDoseScaling(Orthanc::ImageAccessor& image, - bool useDouble) const + bool useDouble) const { if (image.GetFormat() != Orthanc::PixelFormat_Float32) { @@ -455,4 +455,19 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); } } + + + double DicomInstanceParameters::Data::ApplyRescale(double value) const + { + double factor = doseGridScaling_; + double offset = 0.0; + + if (hasRescale_) + { + factor *= rescaleSlope_; + offset = rescaleIntercept_; + } + + return (value * factor + offset); + } }
--- a/Framework/Toolbox/DicomInstanceParameters.h Sun Nov 17 11:37:47 2019 +0100 +++ b/Framework/Toolbox/DicomInstanceParameters.h Mon Nov 18 15:24:36 2019 +0100 @@ -71,8 +71,10 @@ bool IsPlaneWithinSlice(unsigned int frame, const CoordinateSystem3D& plane) const; - void ApplyRescaleAndDoseScaling( - Orthanc::ImageAccessor& image, bool useDouble) const; + void ApplyRescaleAndDoseScaling(Orthanc::ImageAccessor& image, + bool useDouble) const; + + double ApplyRescale(double value) const; }; @@ -211,5 +213,10 @@ { return data_.doseGridScaling_; } + + double ApplyRescale(double value) const + { + return data_.ApplyRescale(value); + } }; }