Mercurial > hg > orthanc
changeset 6835:727365eb11a5 streaming
removed useless version of ServerContext::DecodeDicomFrame()
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Thu, 21 May 2026 11:45:33 +0200 |
| parents | 8dfbb91480cc |
| children | 9ae0a5b7772f |
| files | OrthancServer/Plugins/Engine/OrthancPlugins.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h OrthancServer/Sources/ServerTranscoder.cpp OrthancServer/Sources/ServerTranscoder.h |
| diffstat | 5 files changed, 25 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Thu May 21 11:17:23 2026 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Thu May 21 11:45:33 2026 +0200 @@ -4039,7 +4039,7 @@ std::unique_ptr<ImageAccessor> decoded; { PImpl::ServerContextReference lock(*pimpl_); - decoded.reset(lock.GetContext().DecodeDicomFrame(instance, p.frameIndex)); + decoded.reset(lock.GetContext().GetTranscoder()->DecodeFrame(instance, p.frameIndex)); } *(p.targetImage) = ReturnImage(decoded); @@ -4153,8 +4153,14 @@ case OrthancPluginImageFormat_Dicom: { - PImpl::ServerContextReference lock(*pimpl_); - image.reset(lock.GetContext().GetTranscoder()->DecodeFrame(p.data, p.size, 0 /* frame index */)); + std::unique_ptr<DicomInstanceToStore> instance(DicomInstanceToStore::CreateFromBuffer(p.data, p.size)); + + { + PImpl::ServerContextReference lock(*pimpl_); + image.reset(lock.GetContext().GetTranscoder()->DecodeFrame( + *instance, 0 /* frame index is not available in _OrthancPluginUncompressImage */)); + } + break; } @@ -4828,8 +4834,13 @@ case _OrthancPluginService_DecodeDicomImage: { - PImpl::ServerContextReference lock(*pimpl_); - result.reset(lock.GetContext().GetTranscoder()->DecodeFrame(p.constBuffer, p.bufferSize, p.frameIndex)); + std::unique_ptr<DicomInstanceToStore> instance(DicomInstanceToStore::CreateFromBuffer(p.constBuffer, p.bufferSize)); + + { + PImpl::ServerContextReference lock(*pimpl_); + result.reset(lock.GetContext().GetTranscoder()->DecodeFrame(*instance, p.frameIndex)); + } + break; }
--- a/OrthancServer/Sources/ServerContext.cpp Thu May 21 11:17:23 2026 +0200 +++ b/OrthancServer/Sources/ServerContext.cpp Thu May 21 11:45:33 2026 +0200 @@ -1847,17 +1847,6 @@ } - ImageAccessor* ServerContext::DecodeDicomFrame(const DicomInstanceToStore& dicom, - unsigned int frameIndex) - { - return GetTranscoder()->DecodeFrame(//dicom.GetParsedDicomFile(), - dicom.GetBufferData(), - dicom.GetBufferSize(), - frameIndex); - - } - - void ServerContext::PerformCStoreWithTranscoding(std::string& sopClassUid, std::string& sopInstanceUid, DicomStoreUserConnection& connection,
--- a/OrthancServer/Sources/ServerContext.h Thu May 21 11:17:23 2026 +0200 +++ b/OrthancServer/Sources/ServerContext.h Thu May 21 11:45:33 2026 +0200 @@ -541,10 +541,6 @@ ImageAccessor* DecodeDicomFrame(const std::string& publicId, unsigned int frameIndex); - // TODO-Streaming : To remove (or adapt) - ImageAccessor* DecodeDicomFrame(const DicomInstanceToStore& dicom, - unsigned int frameIndex); - void PerformCStoreWithTranscoding(std::string& sopClassUid, std::string& sopInstanceUid, DicomStoreUserConnection& connection,
--- a/OrthancServer/Sources/ServerTranscoder.cpp Thu May 21 11:17:23 2026 +0200 +++ b/OrthancServer/Sources/ServerTranscoder.cpp Thu May 21 11:45:33 2026 +0200 @@ -32,6 +32,7 @@ #include "../../OrthancFramework/Sources/Logging.h" #include "../../OrthancFramework/Sources/OrthancException.h" #include "../Plugins/Engine/OrthancPlugins.h" +#include "DicomInstanceToStore.h" #include "OrthancConfiguration.h" #include <boost/thread.hpp> @@ -282,28 +283,21 @@ } - ImageAccessor* ServerTranscoder::DecodeFrame(const void* buffer, - size_t size, + ImageAccessor* ServerTranscoder::DecodeFrame(const DicomInstanceToStore& image, unsigned int frameIndex) { - std::unique_ptr<ParsedDicomFile> dicom; std::unique_ptr<ImageAccessor> decoded; if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_Before) { - if (dicom.get() == NULL) - { - dicom.reset(new ParsedDicomFile(buffer, size)); - } - - decoded.reset(DecodeFrameBuiltin(*dicom, frameIndex)); + decoded.reset(DecodeFrameBuiltin(image.GetParsedDicomFile(), frameIndex)); if (decoded.get() != NULL) { return decoded.release(); } } - decoded.reset(DecodeFrameUsingPluginsDecoder(buffer, size, frameIndex)); + decoded.reset(DecodeFrameUsingPluginsDecoder(image.GetBufferData(), image.GetBufferSize(), frameIndex)); if (decoded.get() != NULL) { return decoded.release(); @@ -311,19 +305,14 @@ if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_After) { - if (dicom.get() == NULL) - { - dicom.reset(new ParsedDicomFile(buffer, size)); - } - - decoded.reset(DecodeFrameBuiltin(*dicom, frameIndex)); + decoded.reset(DecodeFrameBuiltin(image.GetParsedDicomFile(), frameIndex)); if (decoded.get() != NULL) { return decoded.release(); } } - decoded.reset(DecodeFrameUsingPluginsTranscoder(buffer, size, frameIndex)); + decoded.reset(DecodeFrameUsingPluginsTranscoder(image.GetBufferData(), image.GetBufferSize(), frameIndex)); if (decoded.get() != NULL) { return decoded.release();
--- a/OrthancServer/Sources/ServerTranscoder.h Thu May 21 11:17:23 2026 +0200 +++ b/OrthancServer/Sources/ServerTranscoder.h Thu May 21 11:45:33 2026 +0200 @@ -34,6 +34,7 @@ namespace Orthanc { class DataSourceReader; + class DicomInstanceToStore; #if ORTHANC_ENABLE_PLUGINS == 1 class OrthancPlugins; @@ -59,7 +60,6 @@ size_t size, unsigned int frameIndex); - // TODO-Streaming : remove ImageAccessor* DecodeFrameUsingPluginsTranscoder(const void* buffer, size_t size, unsigned int frameIndex); @@ -90,8 +90,8 @@ bool HasPluginsTranscoder() const; - ImageAccessor* DecodeFrame(const void* buffer, - size_t size, + // This version should only be used by plugins + ImageAccessor* DecodeFrame(const DicomInstanceToStore& image, unsigned int frameIndex); ImageAccessor* DecodeFrame(const boost::shared_ptr<DataSourceReader>& dicomReader, // For built-in decoding
