Mercurial > hg > orthanc
changeset 6883:c4bb6a003f76 streaming
removed class TranscodingCallable
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Mon, 01 Jun 2026 15:33:18 +0200 |
| parents | 7f1d9c7f33f0 |
| children | 12125996722c |
| files | OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake OrthancFramework/Sources/DicomParsing/TranscodingCallable.cpp OrthancFramework/Sources/DicomParsing/TranscodingCallable.h OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h |
| diffstat | 5 files changed, 0 insertions(+), 194 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Mon Jun 01 15:30:37 2026 +0200 +++ b/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Mon Jun 01 15:33:18 2026 +0200 @@ -685,7 +685,6 @@ ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DataSource/DicomDataSource.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DataSource/DicomSequentialReader.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DataSource/TranscoderDataSource.cpp - ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/TranscodingCallable.cpp ) endif()
--- a/OrthancFramework/Sources/DicomParsing/TranscodingCallable.cpp Mon Jun 01 15:30:37 2026 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/** - * Orthanc - A Lightweight, RESTful DICOM Store - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2023 Osimis S.A., Belgium - * Copyright (C) 2024-2026 Orthanc Team SRL, Belgium - * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/>. - **/ - - -#include "../PrecompiledHeaders.h" -#include "TranscodingCallable.h" - -#include "../OrthancException.h" - -#include <dcmtk/dcmdata/dcfilefo.h> - - -namespace Orthanc -{ - TranscodingCallable::TranscodingCallable() : - mode_(TranscodingSopInstanceUidMode_AllowNew), - hasLossyQuality_(false), - lossyQuality_(0) - { - } - - - void TranscodingCallable::SetTranscoder(const boost::shared_ptr<IDicomTranscoder>& transcoder) - { - if (transcoder_.get() == NULL) - { - transcoder_ = transcoder; - } - else - { - throw OrthancException(ErrorCode_BadSequenceOfCalls); - } - } - - - void TranscodingCallable::SetLossyQuality(unsigned int quality) - { - hasLossyQuality_ = true; - lossyQuality_ = quality; - } - - - IDynamicObject* TranscodingCallable::Call() - { - if (transcoder_.get() == NULL) - { - throw OrthancException(ErrorCode_BadSequenceOfCalls); - } - - std::unique_ptr<IDicomTranscoder::DicomImage> transcoded(new IDicomTranscoder::DicomImage); - bool success; - - if (hasLossyQuality_) - { - success = transcoder_->Transcode(*transcoded, source_, allowedSyntaxes_, mode_, lossyQuality_); - } - else - { - success = transcoder_->Transcode(*transcoded, source_, allowedSyntaxes_, mode_); - } - - if (success) - { - return transcoded.release(); - } - else - { - if (allowedSyntaxes_.size() == 1) - { - DicomTransferSyntax syntax = *allowedSyntaxes_.begin(); - throw OrthancException(ErrorCode_InternalError, - "Cannot transcode to transfer syntax: " + - std::string(GetTransferSyntaxUid(syntax))); - } - else - { - throw OrthancException(ErrorCode_NotImplemented, "Cannot transcode DICOM image"); - } - } - } -}
--- a/OrthancFramework/Sources/DicomParsing/TranscodingCallable.h Mon Jun 01 15:30:37 2026 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/** - * Orthanc - A Lightweight, RESTful DICOM Store - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2023 Osimis S.A., Belgium - * Copyright (C) 2024-2026 Orthanc Team SRL, Belgium - * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/>. - **/ - - -#pragma once - -#include "IDicomTranscoder.h" -#include "../MultiThreading/ICallable.h" - -#include <boost/shared_ptr.hpp> - - -namespace Orthanc -{ - class TranscodingCallable : public ICallable - { - private: - boost::shared_ptr<IDicomTranscoder> transcoder_; - IDicomTranscoder::DicomImage source_; - std::set<DicomTransferSyntax> allowedSyntaxes_; - TranscodingSopInstanceUidMode mode_; - bool hasLossyQuality_; - unsigned int lossyQuality_; - - public: - // By default, allow new SOP instance UID - TranscodingCallable(); - - void AcquireParsed(ParsedDicomFile& parsed /* will be invalidated */) - { - source_.AcquireParsed(parsed); - } - - void AcquireBuffer(std::string& buffer /* will be swapped */) - { - source_.AcquireBuffer(buffer); - } - - void SetTranscoder(const boost::shared_ptr<IDicomTranscoder>& transcoder); - - void SetMode(TranscodingSopInstanceUidMode mode) - { - mode_ = mode; - } - - void AddTransferSyntax(DicomTransferSyntax syntax) - { - allowedSyntaxes_.insert(syntax); - } - - void SetLossyQuality(unsigned int quality); - - virtual IDynamicObject* Call() ORTHANC_OVERRIDE; - }; -}
--- a/OrthancServer/Sources/ServerContext.cpp Mon Jun 01 15:30:37 2026 +0200 +++ b/OrthancServer/Sources/ServerContext.cpp Mon Jun 01 15:33:18 2026 +0200 @@ -34,7 +34,6 @@ #include "../../OrthancFramework/Sources/DicomNetworking/DicomStoreUserConnection.h" #include "../../OrthancFramework/Sources/DicomParsing/DicomModification.h" #include "../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h" -#include "../../OrthancFramework/Sources/DicomParsing/TranscodingCallable.h" #include "../../OrthancFramework/Sources/FileStorage/StorageAccessor.h" #include "../../OrthancFramework/Sources/HttpServer/FilesystemHttpSender.h" #include "../../OrthancFramework/Sources/HttpServer/HttpStreamTranscoder.h" @@ -2181,19 +2180,6 @@ } - Future* ServerContext::SubmitTranscodingRequest(TranscodingCallable* callable) - { - if (callable == NULL) - { - throw OrthancException(ErrorCode_NullPointer); - } - - callable->SetTranscoder(transcoder_); - - return transcoderThreadPool_->Submit(callable); - } - - DicomSequentialReader::Factory& ServerContext::GetDicomSequentialReaderFactory() { return *dicomSequentialReaderFactory_;
--- a/OrthancServer/Sources/ServerContext.h Mon Jun 01 15:30:37 2026 +0200 +++ b/OrthancServer/Sources/ServerContext.h Mon Jun 01 15:33:18 2026 +0200 @@ -50,7 +50,6 @@ class SharedArchive; class StorageCommitmentReports; class ThreadPool; - class TranscodingCallable; /** @@ -599,8 +598,6 @@ const boost::shared_ptr<ServerTranscoder>& GetTranscoder() const; - Future* SubmitTranscodingRequest(TranscodingCallable* callable); - DicomSequentialReader::Factory& GetDicomSequentialReaderFactory(); }; }
