changeset 1855:73a4bee08bb6

Support detection of windowing and rescale in Philips multiframe images
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Aug 2021 13:00:01 +0200
parents 4026a458349d
children 0830db74be6b fae708b2d212 35ac2be493e2
files Applications/StoneWebViewer/NEWS Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/NEWS	Fri Aug 13 17:53:50 2021 +0200
+++ b/Applications/StoneWebViewer/NEWS	Mon Aug 30 13:00:01 2021 +0200
@@ -1,6 +1,7 @@
 Pending changes in the mainline
 ===============================
 
+* Support detection of windowing and rescale in Philips multiframe images
 * Fix values reported in "ww/wc" info panel (windowing width and center)
 
 
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Fri Aug 13 17:53:50 2021 +0200
+++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Mon Aug 30 13:00:01 2021 +0200
@@ -1762,6 +1762,17 @@
       }
       else
       {
+        if (GetViewport().windowingPresetCenters_.empty())
+        {
+          // New in Stone Web viewer 2.2: Deal with Philips multiframe
+          // (cf. mail from Tomas Kenda on 2021-08-17)
+          double windowingCenter, windowingWidth;
+          message.GetDicom().GetDefaultWindowing(windowingCenter, windowingWidth, frameNumber_);
+          GetViewport().windowingPresetCenters_.push_back(windowingCenter);
+          GetViewport().windowingPresetWidths_.push_back(windowingWidth);
+          GetViewport().SetWindowingPreset();
+        }
+
         Apply(GetViewport(), message.GetDicom(), frame.release(), sopInstanceUid_, frameNumber_);
 
         if (isPrefetch_)
@@ -1800,12 +1811,9 @@
         }
       
         double rescaleIntercept, rescaleSlope;
-        if (tags.ParseDouble(rescaleIntercept, Orthanc::DICOM_TAG_RESCALE_INTERCEPT) &&
-            tags.ParseDouble(rescaleSlope, Orthanc::DICOM_TAG_RESCALE_SLOPE))
-        {
-          a *= rescaleSlope;
-          b = rescaleIntercept;
-        }
+        dicom.GetRescale(rescaleIntercept, rescaleSlope, frameNumber);
+        a *= rescaleSlope;
+        b = rescaleIntercept;
 
         converted.reset(new Orthanc::Image(Orthanc::PixelFormat_Float32, frameProtection->GetWidth(), frameProtection->GetHeight(), false));
         Orthanc::ImageProcessing::Convert(*converted, *frameProtection);