Mercurial > hg > orthanc
changeset 5949:81c78bbc9c97
Housekeeper: allow transcoding to lossy transfer syntax
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Mon, 06 Jan 2025 17:10:09 +0100 |
parents | 4563e9899136 |
children | bfadfbcca13e |
files | NEWS OrthancServer/Sources/ServerContext.cpp |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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<ParsedDicomFile> 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<DicomInstanceToStore> toStore(DicomInstanceToStore::CreateFromParsedDicomFile(*tmp)); toStore->SetOrigin(dicom->GetOrigin()); toStore->CopyMetadata(dicom->GetMetadata());