# HG changeset patch # User Sebastien Jodogne # Date 1779441636 -7200 # Node ID 96731e8733c2d36abd83dfec0a5946d32aaba38e # Parent 8d118becf2467021b3fcde90873227172ed4f8e9 renamed DicomDataSource::MultipleReader as MultipleDicomReader diff -r 8d118becf246 -r 96731e8733c2 OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake --- a/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Fri May 22 10:57:51 2026 +0200 +++ b/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Fri May 22 11:20:36 2026 +0200 @@ -681,6 +681,7 @@ if (ENABLE_DCMTK) list(APPEND ORTHANC_CORE_SOURCES_INTERNAL ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DataSource/DicomDataSource.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DataSource/MultipleDicomReader.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DataSource/TranscoderDataSource.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/TranscodingCallable.cpp ) diff -r 8d118becf246 -r 96731e8733c2 OrthancFramework/Sources/DataSource/DicomDataSource.cpp --- a/OrthancFramework/Sources/DataSource/DicomDataSource.cpp Fri May 22 10:57:51 2026 +0200 +++ b/OrthancFramework/Sources/DataSource/DicomDataSource.cpp Fri May 22 11:20:36 2026 +0200 @@ -205,6 +205,12 @@ } + IDataIdentifier* DicomDataSource::CreateWholeIdentifier(const FileInfo& attachment) + { + return new WholeIdentifier(attachment); + } + + DicomDataSource::Dicom* DicomDataSource::ReadWhole(DataSourceReader& reader, const FileInfo& attachment) { @@ -232,69 +238,4 @@ boost::shared_ptr value = reader.ReadSingle(id.release()); return new Dicom(value); } - - - class DicomDataSource::MultipleReader::PImpl : public boost::noncopyable - { - private: - boost::shared_ptr reader_; - std::unique_ptr request_; - boost::shared_ptr answer_; - - public: - PImpl(const boost::shared_ptr& reader) : - reader_(reader), - request_(new DataSourceRequest) - { - } - - void Enqueue(const FileInfo& attachment) - { - if (request_.get() == NULL) - { - throw OrthancException(ErrorCode_BadSequenceOfCalls); - } - else - { - request_->Enqueue(new WholeIdentifier(attachment)); - } - } - - Dicom* Dequeue() - { - if (answer_.get() == NULL) - { - assert(request_.get() != NULL); - answer_ = reader_->Submit(request_.release()); - } - - std::unique_ptr item(answer_->Dequeue()); - return new Dicom(item->GetValue()); - } - }; - - - DicomDataSource::MultipleReader::MultipleReader(const boost::shared_ptr& reader) : - pimpl_(new PImpl(reader)) - { - } - - - DicomDataSource::MultipleReader::~MultipleReader() - { - assert(pimpl_ != NULL); - delete pimpl_; - } - - - void DicomDataSource::MultipleReader::Enqueue(const FileInfo& attachment) - { - pimpl_->Enqueue(attachment); - } - - - DicomDataSource::Dicom* DicomDataSource::MultipleReader::Dequeue() - { - return pimpl_->Dequeue(); - } } diff -r 8d118becf246 -r 96731e8733c2 OrthancFramework/Sources/DataSource/DicomDataSource.h --- a/OrthancFramework/Sources/DataSource/DicomDataSource.h Fri May 22 10:57:51 2026 +0200 +++ b/OrthancFramework/Sources/DataSource/DicomDataSource.h Fri May 22 11:20:36 2026 +0200 @@ -96,27 +96,13 @@ }; }; + static IDataIdentifier* CreateWholeIdentifier(const FileInfo& attachment); + static Dicom* ReadWhole(DataSourceReader& reader, const FileInfo& attachment); static Dicom* ReadUntilPixelData(DataSourceReader& reader, const FileInfo& attachment, uint64_t pixelDataOffset); - - class MultipleReader : public boost::noncopyable - { - private: - class PImpl; - PImpl* pimpl_; - - public: - MultipleReader(const boost::shared_ptr& reader); - - ~MultipleReader(); - - void Enqueue(const FileInfo& item); - - Dicom* Dequeue(); - }; }; } diff -r 8d118becf246 -r 96731e8733c2 OrthancFramework/Sources/DataSource/MultipleDicomReader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancFramework/Sources/DataSource/MultipleDicomReader.cpp Fri May 22 11:20:36 2026 +0200 @@ -0,0 +1,99 @@ +/** + * 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 + * . + **/ + + +#include "../PrecompiledHeaders.h" +#include "MultipleDicomReader.h" + +#include "../OrthancException.h" +#include "DataSourceAnswer.h" +#include "DataSourceReader.h" +#include "DataSourceRequest.h" + + +namespace Orthanc +{ + class MultipleDicomReader::PImpl : public boost::noncopyable + { + private: + boost::shared_ptr reader_; + std::unique_ptr request_; + boost::shared_ptr answer_; + + public: + PImpl(const boost::shared_ptr& reader) : + reader_(reader), + request_(new DataSourceRequest) + { + } + + void Enqueue(const FileInfo& attachment) + { + if (request_.get() == NULL) + { + throw OrthancException(ErrorCode_BadSequenceOfCalls); + } + else + { + request_->Enqueue(DicomDataSource::CreateWholeIdentifier(attachment)); + } + } + + DicomDataSource::Dicom* Dequeue() + { + if (answer_.get() == NULL) + { + assert(request_.get() != NULL); + answer_ = reader_->Submit(request_.release()); + } + + std::unique_ptr item(answer_->Dequeue()); + return new DicomDataSource::Dicom(item->GetValue()); + } + }; + + + MultipleDicomReader::MultipleDicomReader(const boost::shared_ptr& reader) : + pimpl_(new PImpl(reader)) + { + } + + + MultipleDicomReader::~MultipleDicomReader() + { + assert(pimpl_ != NULL); + delete pimpl_; + } + + + void MultipleDicomReader::Enqueue(const FileInfo& attachment) + { + pimpl_->Enqueue(attachment); + } + + + DicomDataSource::Dicom* MultipleDicomReader::Dequeue() + { + return pimpl_->Dequeue(); + } +} diff -r 8d118becf246 -r 96731e8733c2 OrthancFramework/Sources/DataSource/MultipleDicomReader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancFramework/Sources/DataSource/MultipleDicomReader.h Fri May 22 11:20:36 2026 +0200 @@ -0,0 +1,59 @@ +/** + * 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 + * . + **/ + + +#pragma once + +#if !defined(ORTHANC_ENABLE_DCMTK) +# error The macro ORTHANC_ENABLE_DCMTK must be defined +#endif + +#if ORTHANC_ENABLE_DCMTK != 1 +# error The macro ORTHANC_ENABLE_DCMTK must be set to 1 to use this file +#endif + +#include "DicomDataSource.h" + +#include + + +namespace Orthanc +{ + class DataSourceReader; + + class MultipleDicomReader : public boost::noncopyable + { + private: + class PImpl; + PImpl* pimpl_; + + public: + MultipleDicomReader(const boost::shared_ptr& reader); + + ~MultipleDicomReader(); + + void Enqueue(const FileInfo& item); + + DicomDataSource::Dicom* Dequeue(); + }; +} diff -r 8d118becf246 -r 96731e8733c2 OrthancServer/Sources/OrthancGetRequestHandler.h --- a/OrthancServer/Sources/OrthancGetRequestHandler.h Fri May 22 10:57:51 2026 +0200 +++ b/OrthancServer/Sources/OrthancGetRequestHandler.h Fri May 22 11:20:36 2026 +0200 @@ -23,7 +23,7 @@ #pragma once #include "../../OrthancFramework/Sources/Compatibility.h" // For ORTHANC_OVERRIDE -#include "../../OrthancFramework/Sources/DataSource/DicomDataSource.h" +#include "../../OrthancFramework/Sources/DataSource/MultipleDicomReader.h" #include "../../OrthancFramework/Sources/DicomNetworking/IGetRequestHandler.h" #include "../../OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.h" @@ -45,7 +45,7 @@ std::vector instancesIds_; size_t position_; std::string originatorAet_; - std::unique_ptr instancesLoader_; + std::unique_ptr instancesLoader_; unsigned int completedCount_; unsigned int warningCount_; diff -r 8d118becf246 -r 96731e8733c2 OrthancServer/Sources/ServerContext.cpp --- a/OrthancServer/Sources/ServerContext.cpp Fri May 22 10:57:51 2026 +0200 +++ b/OrthancServer/Sources/ServerContext.cpp Fri May 22 11:20:36 2026 +0200 @@ -2144,8 +2144,8 @@ } - DicomDataSource::MultipleReader* ServerContext::CreateMultipleDicomReader() const + MultipleDicomReader* ServerContext::CreateMultipleDicomReader() const { - return new DicomDataSource::MultipleReader(dicomReader_); + return new MultipleDicomReader(dicomReader_); } } diff -r 8d118becf246 -r 96731e8733c2 OrthancServer/Sources/ServerContext.h --- a/OrthancServer/Sources/ServerContext.h Fri May 22 10:57:51 2026 +0200 +++ b/OrthancServer/Sources/ServerContext.h Fri May 22 11:20:36 2026 +0200 @@ -30,6 +30,7 @@ #include "ServerJobs/IStorageCommitmentFactory.h" #include "../../OrthancFramework/Sources/DataSource/DicomDataSource.h" +#include "../../OrthancFramework/Sources/DataSource/MultipleDicomReader.h" #include "../../OrthancFramework/Sources/DataSource/StorageAreaDataSource.h" #include "../../OrthancFramework/Sources/DicomParsing/DicomModification.h" #include "../../OrthancFramework/Sources/JobsEngine/JobsEngine.h" @@ -592,6 +593,6 @@ StorageAreaDataSource::MultipleReader* CreateMultipleStorageAreaReader() const; - DicomDataSource::MultipleReader* CreateMultipleDicomReader() const; + MultipleDicomReader* CreateMultipleDicomReader() const; }; }