# HG changeset patch # User Alain Mazy # Date 1743005913 -3600 # Node ID e90ddb89c3ae76148a2ca7ccf36b9a011efde6f6 # Parent 115628b0651df3aae283cd8738c57fb2971d3ecf Fix loading of US images with a negative PhyiscalDeltaX value diff -r 115628b0651d -r e90ddb89c3ae Applications/StoneWebViewer/NEWS --- a/Applications/StoneWebViewer/NEWS Thu Jan 23 11:59:11 2025 +0100 +++ b/Applications/StoneWebViewer/NEWS Wed Mar 26 17:18:33 2025 +0100 @@ -9,6 +9,7 @@ * New configuration "ScreenshotTemplate" to define the filename of the "download as JPEG" function. New default value is: "{PatientID}-{PatientName}-{StudyDate}-{SeriesDescription}-{InstanceNumber}-{CurrentFrame}.jpg" +* Fix loading of US images with a negative PhyiscalDeltaX value. Version 2.6 (2024-08-31) diff -r 115628b0651d -r e90ddb89c3ae Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp --- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Thu Jan 23 11:59:11 2025 +0100 +++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp Wed Mar 26 17:18:33 2025 +0100 @@ -2461,6 +2461,17 @@ pixelSpacingY = centralPixelSpacingY_; } + // This hack has been introduced to fix an issue where the first US image of a series had negative PhysicalDeltaX value + // while the other images from the series had different geometries. layer->SetOrigin was failing later. + // At the end, it appears that the measures are corrects although we have set the pixelSpacing to 1m so the values are likely + // overwritten later on... + if (pixelSpacingX < 0 || pixelSpacingY < 0) + { + LOG(ERROR) << "Pixel spacings are invalid: " << pixelSpacingX << " " << pixelSpacingY << " setting dummy values to 1000, 1000 -> measures might be invalid !"; + pixelSpacingX = 1000; + pixelSpacingY = 1000; + } + if (FIX_LSD_479) { /** diff -r 115628b0651d -r e90ddb89c3ae OrthancStone/Sources/Messages/IObservable.cpp --- a/OrthancStone/Sources/Messages/IObservable.cpp Thu Jan 23 11:59:11 2025 +0100 +++ b/OrthancStone/Sources/Messages/IObservable.cpp Wed Mar 26 17:18:33 2025 +0100 @@ -80,15 +80,17 @@ { try { + // LOG(INFO) << "IN Handling message : " << message.GetIdentifier().AsString(); (*it)->Apply(message); + // LOG(INFO) << "OUT Handling message : " << message.GetIdentifier().AsString(); } catch (Orthanc::OrthancException& e) { - LOG(ERROR) << "Exception on callable: " << e.What(); + LOG(ERROR) << "OrthancException on callable: " << e.What() << " " << message.GetIdentifier().AsString(); } catch (StoneException& e) { - LOG(ERROR) << "Exception on callable: " << e.What(); + LOG(ERROR) << "StoneException on callable: " << e.What(); } catch (std::exception& e) { diff -r 115628b0651d -r e90ddb89c3ae OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp --- a/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp Thu Jan 23 11:59:11 2025 +0100 +++ b/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp Wed Mar 26 17:18:33 2025 +0100 @@ -256,7 +256,7 @@ if (!data_.hasPixelSpacing_ && dataset.GetSequenceSize(size, Orthanc::DicomPath(DICOM_TAG_SEQUENCE_OF_ULTRASOUND_REGIONS)) && - size == 1) + size >= 1) { int directionX, directionY; double deltaX, deltaY;