# HG changeset patch # User Sebastien Jodogne # Date 1764159281 -3600 # Node ID 7e8623928cbfe99655a8ceb0441229c17596fca0 # Parent 098fbdff9945e7649fdc4a75fddb56137c99635c fix interpretation of DS and IS value representations in dicomweb diff -r 098fbdff9945 -r 7e8623928cbf OrthancStone/Sources/Toolbox/OrthancDatasets/DicomWebDataset.cpp --- a/OrthancStone/Sources/Toolbox/OrthancDatasets/DicomWebDataset.cpp Wed Nov 26 12:39:22 2025 +0100 +++ b/OrthancStone/Sources/Toolbox/OrthancDatasets/DicomWebDataset.cpp Wed Nov 26 13:14:41 2025 +0100 @@ -24,6 +24,7 @@ #include "DicomWebDataset.h" #include +#include #include @@ -169,8 +170,7 @@ result = (*value) [0][ALPHABETIC].asString(); return true; } - else if ((vr == "DS" || - vr == "FD" || + else if ((vr == "FD" || vr == "FL") && (*value) [0].isDouble()) { @@ -185,8 +185,7 @@ result = boost::lexical_cast((*value) [0].asUInt64()); return true; } - else if ((vr == "IS" || - vr == "SL" || + else if ((vr == "SL" || vr == "SS" || vr == "SV") && (*value) [0].isInt64()) @@ -194,10 +193,40 @@ result = boost::lexical_cast((*value) [0].asInt64()); return true; } - else + else if (vr == "DS") { - throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, "Unsupported value representation: " + vr); + const Json::Value& a = (*value) [0]; + double b; + if (a.isString() && + Orthanc::SerializationToolbox::ParseDouble(b, a.asString())) + { + result = boost::lexical_cast(b); + return true; + } + else if (a.isDouble()) + { + result = boost::lexical_cast(a.asDouble()); + return true; + } } + else if (vr == "IS") + { + const Json::Value& a = (*value) [0]; + int64_t b; + if (a.isString() && + Orthanc::SerializationToolbox::ParseInteger64(b, a.asString())) + { + result = boost::lexical_cast(b); + return true; + } + else if (a.isInt64()) + { + result = boost::lexical_cast(a.asInt64()); + return true; + } + } + + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, "Unsupported value representation: " + vr); } else if (value->type() == Json::arrayValue && vr == "SQ")