Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp @ 3945:0b3256c3ee14 transcoding
simplified IDicomTranscoder
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 19 May 2020 11:24:00 +0200 |
parents | b26d25d3c1c7 |
children | 5fe8c6d3212e |
comparison
equal
deleted
inserted
replaced
3944:aae045f802f4 | 3945:0b3256c3ee14 |
---|---|
128 | 128 |
129 modification.Apply(*modified); | 129 modification.Apply(*modified); |
130 | 130 |
131 if (transcode) | 131 if (transcode) |
132 { | 132 { |
133 std::string transcoded; | 133 IDicomTranscoder::DicomImage source; |
134 source.AcquireParsed(*modified); // "modified" is invalid below this point | |
135 | |
136 IDicomTranscoder::DicomImage transcoded; | |
134 bool hasSopInstanceUidChanged; | 137 bool hasSopInstanceUidChanged; |
135 | 138 |
136 if (context.TranscodeParsedToBuffer(transcoded, hasSopInstanceUidChanged, | 139 std::set<DicomTransferSyntax> s; |
137 modified->GetDcmtkObject(), targetSyntax, true)) | 140 s.insert(targetSyntax); |
141 | |
142 if (context.Transcode(transcoded, hasSopInstanceUidChanged, source, s, true)) | |
138 { | 143 { |
139 call.GetOutput().AnswerBuffer(transcoded, MimeType_Dicom); | 144 call.GetOutput().AnswerBuffer(transcoded.GetBufferData(), |
145 transcoded.GetBufferSize(), MimeType_Dicom); | |
140 } | 146 } |
141 else | 147 else |
142 { | 148 { |
143 throw OrthancException(ErrorCode_InternalError, | 149 throw OrthancException(ErrorCode_InternalError, |
144 "Cannot transcode to transfer syntax: " + | 150 "Cannot transcode to transfer syntax: " + |