# HG changeset patch # User Sebastien Jodogne # Date 1745831120 -7200 # Node ID 0045d4f23ebac622b05c07ad94ea4c01b9145713 # Parent 14303bf258b0bf6f772fe1bbee1584dd2c3f96fe fix diff -r 14303bf258b0 -r 0045d4f23eba Framework/ImageToolbox.cpp --- a/Framework/ImageToolbox.cpp Sun Apr 27 20:27:54 2025 +0200 +++ b/Framework/ImageToolbox.cpp Mon Apr 28 11:05:20 2025 +0200 @@ -48,7 +48,15 @@ bool IsNear(double a, double b) { - return std::abs(a - b) < 100.0 * std::numeric_limits::epsilon(); + return IsNear(a, b, 10.0 * std::numeric_limits::epsilon()); + } + + + bool IsNear(double a, + double b, + double threshold) + { + return std::abs(a - b) < threshold; } diff -r 14303bf258b0 -r 0045d4f23eba Framework/ImageToolbox.h --- a/Framework/ImageToolbox.h Sun Apr 27 20:27:54 2025 +0200 +++ b/Framework/ImageToolbox.h Mon Apr 28 11:05:20 2025 +0200 @@ -36,6 +36,10 @@ bool IsNear(double a, double b); + bool IsNear(double a, + double b, + double threshold); + Orthanc::ImageAccessor* Allocate(Orthanc::PixelFormat format, unsigned int width, unsigned int height); diff -r 14303bf258b0 -r 0045d4f23eba ViewerPlugin/Plugin.cpp --- a/ViewerPlugin/Plugin.cpp Sun Apr 27 20:27:54 2025 +0200 +++ b/ViewerPlugin/Plugin.cpp Mon Apr 28 11:05:20 2025 +0200 @@ -472,17 +472,17 @@ OrthancWSI::LABColor lab; if (!OrthancWSI::LABColor::DecodeDicomRecommendedAbsentPixelCIELab(lab, "65535\\0\\0") || - !OrthancWSI::ImageToolbox::IsNear(lab.GetL(), 100.0) || - !OrthancWSI::ImageToolbox::IsNear(lab.GetA(), -128.0) || - !OrthancWSI::ImageToolbox::IsNear(lab.GetB(), -128.0)) + !OrthancWSI::ImageToolbox::IsNear(lab.GetL(), 100.0, 0.001) || + !OrthancWSI::ImageToolbox::IsNear(lab.GetA(), -128.0, 0.001) || + !OrthancWSI::ImageToolbox::IsNear(lab.GetB(), -128.0, 0.001)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } if (!OrthancWSI::LABColor::DecodeDicomRecommendedAbsentPixelCIELab(lab, "0\\32896\\65535") || - !OrthancWSI::ImageToolbox::IsNear(lab.GetL(), 0.0) || - !OrthancWSI::ImageToolbox::IsNear(lab.GetA(), 0.0) || - !OrthancWSI::ImageToolbox::IsNear(lab.GetB(), 127.0)) + !OrthancWSI::ImageToolbox::IsNear(lab.GetL(), 0.0, 0.001) || + !OrthancWSI::ImageToolbox::IsNear(lab.GetA(), 0.0, 0.001) || + !OrthancWSI::ImageToolbox::IsNear(lab.GetB(), 127.0, 0.001)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); }