Mercurial > hg > orthanc
diff Core/DicomNetworking/DicomStoreUserConnection.cpp @ 3958:596912ebab5f c-get
integration mainline->c-get
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 20 May 2020 17:03:24 +0200 |
parents | 5fe8c6d3212e |
children |
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomStoreUserConnection.cpp Wed May 20 16:38:33 2020 +0200 +++ b/Core/DicomNetworking/DicomStoreUserConnection.cpp Wed May 20 17:03:24 2020 +0200 @@ -491,40 +491,35 @@ uncompressedSyntaxes.insert(DicomTransferSyntax_BigEndianExplicit); } - std::unique_ptr<IDicomTranscoder::TranscodedDicom> transcoded( - transcoder.TranscodeToParsed(*dicom, buffer, size, uncompressedSyntaxes, false)); + IDicomTranscoder::DicomImage source; + source.AcquireParsed(dicom.release()); + source.SetExternalBuffer(buffer, size); - // WARNING: Below this point, "transcoded->GetDicom()" is possibly - // a reference to "*dicom", if the DCMTK transcoder was used + const std::string sourceUid = IDicomTranscoder::GetSopInstanceUid(source.GetParsed()); - if (transcoded.get() == NULL || - transcoded->GetDicom().getDataset() == NULL) + IDicomTranscoder::DicomImage transcoded; + if (transcoder.Transcode(transcoded, source, uncompressedSyntaxes, false)) { - throw OrthancException( - ErrorCode_NotImplemented, - "Cannot transcode from \"" + std::string(GetTransferSyntaxUid(inputSyntax)) + - "\" to an uncompressed syntax for modality: " + - GetParameters().GetRemoteModality().GetApplicationEntityTitle()); - } - else if (transcoded->HasSopInstanceUidChanged()) - { - throw OrthancException(ErrorCode_Plugin, "The transcoder has changed the SOP " - "instance UID while transcoding to an uncompressed transfer syntax"); - } - else - { - DicomTransferSyntax transcodedSyntax; - - // Sanity check - if (!FromDcmtkBridge::LookupOrthancTransferSyntax(transcodedSyntax, transcoded->GetDicom()) || - accepted.find(transcodedSyntax) == accepted.end()) + if (sourceUid != IDicomTranscoder::GetSopInstanceUid(transcoded.GetParsed())) { - throw OrthancException(ErrorCode_InternalError); + throw OrthancException(ErrorCode_Plugin, "The transcoder has changed the SOP " + "instance UID while transcoding to an uncompressed transfer syntax"); } else { - Store(sopClassUid, sopInstanceUid, transcoded->GetDicom(), - hasMoveOriginator, moveOriginatorAET, moveOriginatorID); + DicomTransferSyntax transcodedSyntax; + + // Sanity check + if (!FromDcmtkBridge::LookupOrthancTransferSyntax(transcodedSyntax, transcoded.GetParsed()) || + accepted.find(transcodedSyntax) == accepted.end()) + { + throw OrthancException(ErrorCode_InternalError); + } + else + { + Store(sopClassUid, sopInstanceUid, transcoded.GetParsed(), + hasMoveOriginator, moveOriginatorAET, moveOriginatorID); + } } } }