Mercurial > hg > orthanc
changeset 6992:625d798dfcfa
added support for SV and UV in FromDcmtkBridge::ApplyVisitorToLeaf()
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Mon, 06 Jul 2026 09:14:54 +0200 |
| parents | 8274f812ed78 |
| children | f4b6e9a6ab2a |
| files | OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp |
| diffstat | 2 files changed, 68 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Mon Jul 06 09:04:53 2026 +0200 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Mon Jul 06 09:14:54 2026 +0200 @@ -3841,6 +3841,63 @@ } #endif +#if DCMTK_VERSION_NUMBER >= 365 + case EVR_SV: // signed very long + { + DcmSigned64bitVeryLong& content = dynamic_cast<DcmSigned64bitVeryLong&>(element); + + std::vector<int64_t> values; + values.reserve(content.getVM()); + + for (unsigned long i = 0; i < content.getVM(); i++) + { + Sint64 f; + if (content.getSint64(f, i).good()) + { + values.push_back(f); + } + } + + action = visitor.VisitIntegers(parentTags, parentIndexes, tag, vr, values); + break; + } +#endif + +#if DCMTK_VERSION_NUMBER >= 365 + case EVR_UV: // unsigned very long + { + DcmUnsigned64bitVeryLong& content = dynamic_cast<DcmUnsigned64bitVeryLong&>(element); + + bool truncated = false; + + std::vector<int64_t> values; + values.reserve(content.getVM()); + + for (unsigned long i = 0; i < content.getVM(); i++) + { + Uint64 f; + if (content.getUint64(f, i).good()) + { + values.push_back(f); + + if (static_cast<Uint64>(values.back()) != f) + { + truncated = true; + values.back() = std::numeric_limits<int64_t>::max(); + } + } + } + + if (truncated) + { + LOG(WARNING) << "An UV element contains a value that is too large and was truncated"; + } + + action = visitor.VisitIntegers(parentTags, parentIndexes, tag, vr, values); + break; + } +#endif + /** * Attribute tag.
--- a/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp Mon Jul 06 09:04:53 2026 +0200 +++ b/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp Mon Jul 06 09:14:54 2026 +0200 @@ -2013,6 +2013,8 @@ #if DCMTK_VERSION_NUMBER >= 365 FromDcmtkBridge::RegisterDictionaryTag(DicomTag(0x7056, 0x1000), ValueRepresentation_OtherVeryLong, "Tag1", 1, 1, ""); + FromDcmtkBridge::RegisterDictionaryTag(DicomTag(0x7056, 0x1001), ValueRepresentation_SignedVeryLong, "Tag2", 1, 1, ""); + FromDcmtkBridge::RegisterDictionaryTag(DicomTag(0x7056, 0x1002), ValueRepresentation_UnsignedVeryLong, "Tag3", 1, 1, ""); #endif ParsedDicomFile dicom(false); @@ -2050,6 +2052,8 @@ #if DCMTK_VERSION_NUMBER >= 365 dicom.ReplacePlainString(DicomTag(0x7056, 0x1000), "-17"); // OV + dicom.ReplacePlainString(DicomTag(0x7056, 0x1001), "-18"); // SV + dicom.ReplacePlainString(DicomTag(0x7056, 0x1002), "19"); // UV #endif DicomWebJsonVisitor visitor; @@ -2181,6 +2185,10 @@ #if DCMTK_VERSION_NUMBER >= 365 ASSERT_EQ("OV", visitor.GetResult() ["70561000"]["vr"].asString()); ASSERT_EQ(-17, visitor.GetResult() ["70561000"]["Value"][0].asInt()); + ASSERT_EQ("SV", visitor.GetResult() ["70561001"]["vr"].asString()); + ASSERT_EQ(-18, visitor.GetResult() ["70561001"]["Value"][0].asInt()); + ASSERT_EQ("UV", visitor.GetResult() ["70561002"]["vr"].asString()); + ASSERT_EQ(19, visitor.GetResult() ["70561002"]["Value"][0].asInt()); #endif std::string xml; @@ -2191,7 +2199,7 @@ m.FromDicomWeb(visitor.GetResult()); #if DCMTK_VERSION_NUMBER >= 365 - ASSERT_EQ(32u, m.GetSize()); + ASSERT_EQ(34u, m.GetSize()); #else ASSERT_EQ(31u, m.GetSize()); #endif @@ -2248,6 +2256,8 @@ #if DCMTK_VERSION_NUMBER >= 365 ASSERT_TRUE(m.LookupStringValue(s, DicomTag(0x7056, 0x1000), true)); ASSERT_EQ("-17", s); // OV + ASSERT_TRUE(m.LookupStringValue(s, DicomTag(0x7056, 0x1001), true)); ASSERT_EQ("-18", s); // SV + ASSERT_TRUE(m.LookupStringValue(s, DicomTag(0x7056, 0x1002), true)); ASSERT_EQ("19", s); // UV #endif } }
