comparison Framework/Toolbox/DicomInstanceParameters.cpp @ 1159:acb399643945 broker

DicomInstanceParameters::ApplyRescale()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 18 Nov 2019 15:24:36 +0100
parents 7681f3943748
children 19b1c8caade4
comparison
equal deleted inserted replaced
1158:e3eaadcb314a 1159:acb399643945
263 distance <= thickness_ / 2.0); 263 distance <= thickness_ / 2.0);
264 } 264 }
265 265
266 266
267 void DicomInstanceParameters::Data::ApplyRescaleAndDoseScaling(Orthanc::ImageAccessor& image, 267 void DicomInstanceParameters::Data::ApplyRescaleAndDoseScaling(Orthanc::ImageAccessor& image,
268 bool useDouble) const 268 bool useDouble) const
269 { 269 {
270 if (image.GetFormat() != Orthanc::PixelFormat_Float32) 270 if (image.GetFormat() != Orthanc::PixelFormat_Float32)
271 { 271 {
272 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); 272 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat);
273 } 273 }
453 { 453 {
454 LOG(ERROR) << "DicomInstanceParameters::GetIndexInSeries(): !data_.hasIndexInSeries_"; 454 LOG(ERROR) << "DicomInstanceParameters::GetIndexInSeries(): !data_.hasIndexInSeries_";
455 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); 455 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
456 } 456 }
457 } 457 }
458
459
460 double DicomInstanceParameters::Data::ApplyRescale(double value) const
461 {
462 double factor = doseGridScaling_;
463 double offset = 0.0;
464
465 if (hasRescale_)
466 {
467 factor *= rescaleSlope_;
468 offset = rescaleIntercept_;
469 }
470
471 return (value * factor + offset);
472 }
458 } 473 }