Mercurial > hg > orthanc
diff OrthancServer/ServerContext.cpp @ 3944:aae045f802f4 transcoding
preparing simplified interface for IDicomTranscoder
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 19 May 2020 10:17:06 +0200 |
parents | 771dbd9eb3bd |
children | 0b3256c3ee14 |
line wrap: on
line diff
--- a/OrthancServer/ServerContext.cpp Mon May 18 21:37:31 2020 +0200 +++ b/OrthancServer/ServerContext.cpp Tue May 19 10:17:06 2020 +0200 @@ -1413,4 +1413,48 @@ return NULL; } } + + + bool ServerContext::Transcode(DicomImage& target, + bool& hasSopInstanceUidChanged /* out */, + DicomImage& source /* in, "GetParsed()" possibly modified */, + const std::set<DicomTransferSyntax>& allowedSyntaxes, + bool allowNewSopInstanceUid) + { + if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_Before) + { + if (dcmtkTranscoder_->Transcode(target, hasSopInstanceUidChanged, source, + allowedSyntaxes, allowNewSopInstanceUid)) + { + return true; + } + } + +#if ORTHANC_ENABLE_PLUGINS == 1 + if (HasPlugins() && + GetPlugins().HasCustomTranscoder()) + { + if (GetPlugins().Transcode(target, hasSopInstanceUidChanged, source, + allowedSyntaxes, allowNewSopInstanceUid)) + { + return true; + } + else if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_After) + { + LOG(INFO) << "The installed transcoding plugins cannot handle an image, " + << "fallback to the built-in DCMTK transcoder"; + } + } +#endif + + if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_After) + { + return dcmtkTranscoder_->Transcode(target, hasSopInstanceUidChanged, source, + allowedSyntaxes, allowNewSopInstanceUid); + } + else + { + return false; + } + } }