Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
1854:4026a458349d | 1855:73a4bee08bb6 |
---|---|
1760 { | 1760 { |
1761 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | 1761 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
1762 } | 1762 } |
1763 else | 1763 else |
1764 { | 1764 { |
1765 if (GetViewport().windowingPresetCenters_.empty()) | |
1766 { | |
1767 // New in Stone Web viewer 2.2: Deal with Philips multiframe | |
1768 // (cf. mail from Tomas Kenda on 2021-08-17) | |
1769 double windowingCenter, windowingWidth; | |
1770 message.GetDicom().GetDefaultWindowing(windowingCenter, windowingWidth, frameNumber_); | |
1771 GetViewport().windowingPresetCenters_.push_back(windowingCenter); | |
1772 GetViewport().windowingPresetWidths_.push_back(windowingWidth); | |
1773 GetViewport().SetWindowingPreset(); | |
1774 } | |
1775 | |
1765 Apply(GetViewport(), message.GetDicom(), frame.release(), sopInstanceUid_, frameNumber_); | 1776 Apply(GetViewport(), message.GetDicom(), frame.release(), sopInstanceUid_, frameNumber_); |
1766 | 1777 |
1767 if (isPrefetch_) | 1778 if (isPrefetch_) |
1768 { | 1779 { |
1769 GetViewport().ScheduleNextPrefetch(); | 1780 GetViewport().ScheduleNextPrefetch(); |
1798 { | 1809 { |
1799 a = doseScaling; | 1810 a = doseScaling; |
1800 } | 1811 } |
1801 | 1812 |
1802 double rescaleIntercept, rescaleSlope; | 1813 double rescaleIntercept, rescaleSlope; |
1803 if (tags.ParseDouble(rescaleIntercept, Orthanc::DICOM_TAG_RESCALE_INTERCEPT) && | 1814 dicom.GetRescale(rescaleIntercept, rescaleSlope, frameNumber); |
1804 tags.ParseDouble(rescaleSlope, Orthanc::DICOM_TAG_RESCALE_SLOPE)) | 1815 a *= rescaleSlope; |
1805 { | 1816 b = rescaleIntercept; |
1806 a *= rescaleSlope; | |
1807 b = rescaleIntercept; | |
1808 } | |
1809 | 1817 |
1810 converted.reset(new Orthanc::Image(Orthanc::PixelFormat_Float32, frameProtection->GetWidth(), frameProtection->GetHeight(), false)); | 1818 converted.reset(new Orthanc::Image(Orthanc::PixelFormat_Float32, frameProtection->GetWidth(), frameProtection->GetHeight(), false)); |
1811 Orthanc::ImageProcessing::Convert(*converted, *frameProtection); | 1819 Orthanc::ImageProcessing::Convert(*converted, *frameProtection); |
1812 Orthanc::ImageProcessing::ShiftScale2(*converted, b, a, false); | 1820 Orthanc::ImageProcessing::ShiftScale2(*converted, b, a, false); |
1813 } | 1821 } |