Mercurial > hg > orthanc
changeset 7195:abb0321e1aeb
modifying the SpecificCharacterSet now changes the encoding of all texts in the DICOM file
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Wed, 04 Nov 2026 15:39:25 +0100 |
| parents | d2109836f70d |
| children | 6331d240a7fc |
| files | NEWS OrthancFramework/Sources/DicomParsing/DicomModification.cpp |
| diffstat | 2 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Wed Nov 04 11:35:21 2026 +0100 +++ b/NEWS Wed Nov 04 15:39:25 2026 +0100 @@ -8,6 +8,9 @@ - Optimized some queries to access single resources. - Added/updated 2 indexes: the first startup with this version migth be slower to rebuild these indexes. +* It is now possible to change the encoding of all texts in a DICOM file by modifying its + SpecificCharacterSet when calling /modify. + (https://github.com/orthanc-server/orthanc-explorer-2/issues/123) Plugin SDK ----------
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Wed Nov 04 11:35:21 2026 +0100 +++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Wed Nov 04 15:39:25 2026 +0100 @@ -1084,7 +1084,21 @@ toModify->Remove(*it); } - // (5) Replace the tags + // (5.0) Change the encoding before replacing new values + if (IsReplaced(DICOM_TAG_SPECIFIC_CHARACTER_SET)) + { + std::string targetEncodingStr = GetReplacementAsString(DICOM_TAG_SPECIFIC_CHARACTER_SET); + Encoding targetEncoding; + + if (!GetDicomEncoding(targetEncoding, targetEncodingStr.c_str())) + { + throw OrthancException(ErrorCode_BadRequest, std::string("Unrecognized SpecificCharacterSet, unable to modify the encoding: ") + targetEncodingStr); + } + + toModify->ChangeEncoding(targetEncoding); + } + + // (5.1) Replace the tags for (Replacements::const_iterator it = replacements_.begin(); it != replacements_.end(); ++it) {
