diff Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 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 932dc2265baa
children 58681a5c727b
line wrap: on
line diff
--- 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);