# HG changeset patch # User Alain Mazy # Date 1736179809 -3600 # Node ID 81c78bbc9c97faa1b437664179760cd90385b724 # Parent 4563e98991367bb8f49646f570a9d4cc87ff8fe8 Housekeeper: allow transcoding to lossy transfer syntax diff -r 4563e9899136 -r 81c78bbc9c97 NEWS --- a/NEWS Mon Jan 06 17:07:27 2025 +0100 +++ b/NEWS Mon Jan 06 17:10:09 2025 +0100 @@ -8,6 +8,8 @@ operating system native CA store (if any). This is equivalent to the --ca-native curl option. * Housekeeper plugin: fixed the "Force" configuration that was ineffective. +* Housekeeper plugin: allow transcoding to lossy transfer syntax. Orthanc will keep + the SOPInstanceUID untouched in this case. Version 1.12.5 (2024-12-17) diff -r 4563e9899136 -r 81c78bbc9c97 OrthancServer/Sources/ServerContext.cpp --- a/OrthancServer/Sources/ServerContext.cpp Mon Jan 06 17:07:27 2025 +0100 +++ b/OrthancServer/Sources/ServerContext.cpp Mon Jan 06 17:10:09 2025 +0100 @@ -938,10 +938,20 @@ source.SetExternalBuffer(dicom->GetBufferData(), dicom->GetBufferSize()); IDicomTranscoder::DicomImage transcoded; + if (Transcode(transcoded, source, syntaxes, true /* allow new SOP instance UID */)) { std::unique_ptr tmp(transcoded.ReleaseAsParsedDicomFile()); + if (isReconstruct) + { + // when reconstructing, we always want to keep the DICOM IDs untouched even if the transcoding has generated a new SOPInstanceUID. + const Orthanc::ParsedDicomFile& sourceDicom = dicom->GetParsedDicomFile(); + std::string sopInstanceUid; + sourceDicom.GetTagValue(sopInstanceUid, DICOM_TAG_SOP_INSTANCE_UID); + tmp->ReplacePlainString(DICOM_TAG_SOP_INSTANCE_UID, sopInstanceUid); + } + std::unique_ptr toStore(DicomInstanceToStore::CreateFromParsedDicomFile(*tmp)); toStore->SetOrigin(dicom->GetOrigin()); toStore->CopyMetadata(dicom->GetMetadata());