# HG changeset patch # User Sebastien Jodogne # Date 1762371895 -3600 # Node ID f4483be2364e3e6d2cffd604507db1236bf73d63 # Parent bdc8449b00cb0c9dccf54bf350afd8c79b4fe49f backward compatibility in the viewer if x/y are swapped diff -r bdc8449b00cb -r f4483be2364e Framework/Inputs/DicomPyramidInstance.cpp --- a/Framework/Inputs/DicomPyramidInstance.cpp Wed Nov 05 19:03:33 2025 +0100 +++ b/Framework/Inputs/DicomPyramidInstance.cpp Wed Nov 05 20:44:55 2025 +0100 @@ -301,11 +301,6 @@ hasImagedVolumeSize_ = ( reader.GetDoubleValue(imagedVolumeWidth_, Orthanc::DicomPath(DICOM_TAG_IMAGED_VOLUME_WIDTH)) && reader.GetDoubleValue(imagedVolumeHeight_, Orthanc::DicomPath(DICOM_TAG_IMAGED_VOLUME_HEIGHT))); - - if (hasImagedVolumeSize_) - { - // TODO - SWAP WIDTH/HEIGHT FOR OLD VERSIONS OF ORTHANC - } } diff -r bdc8449b00cb -r f4483be2364e ViewerPlugin/viewer.js --- a/ViewerPlugin/viewer.js Wed Nov 05 19:03:33 2025 +0100 +++ b/ViewerPlugin/viewer.js Wed Nov 05 20:44:55 2025 +0100 @@ -21,6 +21,12 @@ **/ +function IsNear(a, b) +{ + return Math.abs(a - b) <= 0.000000001; +} + + function InitializePyramid(pyramid, tilesBaseUrl) { $('#map').css('background', pyramid['BackgroundColor']); // New in WSI 2.1 @@ -36,10 +42,17 @@ imagedVolumeHeight !== undefined) { var metersPerUnitX = parseFloat(imagedVolumeWidth) / (1000.0 * parseFloat(width)); var metersPerUnitY = parseFloat(imagedVolumeHeight) / (1000.0 * parseFloat(height)); - if (Math.abs(metersPerUnitX - metersPerUnitY) <= 0.000000001) { + if (IsNear(metersPerUnitX, metersPerUnitY)) { metersPerUnit = metersPerUnitX; } else { - console.error('Inconsistency in the imaged volume size, not showing the scale'); + // Backward compatibility with OrthancWSIDicomizer <= 3.2, where X/Y were swapped + metersPerUnitX = parseFloat(imagedVolumeWidth) / (1000.0 * parseFloat(height)); + metersPerUnitY = parseFloat(imagedVolumeHeight) / (1000.0 * parseFloat(width)); + if (IsNear(metersPerUnitX, metersPerUnitY)) { + metersPerUnit = metersPerUnitX; + } else { + console.error('Inconsistency in the imaged volume size, not showing the scale'); + } } }