22#ifndef PACS_SERVICES_RETRIEVE_SCU_HPP
23#define PACS_SERVICES_RETRIEVE_SCU_HPP
64 default:
return "Unknown";
88 [[nodiscard]] uint16_t
total() const noexcept {
96 [[nodiscard]]
float percent() const noexcept {
98 if (t == 0)
return 0.0f;
106 [[nodiscard]] std::chrono::milliseconds
elapsed() const noexcept {
107 return std::chrono::duration_cast<std::chrono::milliseconds>(
108 std::chrono::steady_clock::now() -
start_time);
363 explicit retrieve_scu(std::shared_ptr<di::ILogger> logger =
nullptr);
372 std::shared_ptr<di::ILogger> logger =
nullptr);
402 std::string_view destination_ae,
442 std::string_view study_uid,
457 std::string_view series_uid,
472 std::string_view sop_instance_uid,
488 uint16_t message_id);
551 network::association& assoc,
552 const core::dicom_dataset& query_keys,
553 std::string_view destination_ae,
560 network::association& assoc,
561 const core::dicom_dataset& query_keys,
583 std::string_view study_uid) const;
589 std::string_view series_uid) const;
595 std::string_view sop_instance_uid) const;
DICOM Association management per PS3.8.
network::Result< retrieve_result > retrieve_instance(network::association &assoc, std::string_view sop_instance_uid, retrieve_progress_callback progress=nullptr)
Retrieve a single instance by SOP Instance UID.
network::Result< std::monostate > cancel(network::association &assoc, uint16_t message_id)
Send a C-CANCEL request to stop an ongoing retrieve.
std::atomic< size_t > instances_retrieved_
Statistics: total number of instances retrieved.
network::Result< retrieve_result > retrieve_series(network::association &assoc, std::string_view series_uid, retrieve_progress_callback progress=nullptr)
Retrieve a series by Series Instance UID.
retrieve_scu(const retrieve_scu &)=delete
retrieve_scu_config config_
Configuration.
retrieve_scu & operator=(retrieve_scu &&)=delete
network::Result< retrieve_result > perform_get(network::association &assoc, const core::dicom_dataset &query_keys, retrieve_progress_callback progress)
Internal C-GET implementation.
const retrieve_scu_config & config() const noexcept
Get the current configuration.
size_t retrieves_performed() const noexcept
Get the number of retrieves performed since construction.
core::dicom_dataset build_instance_query(std::string_view sop_instance_uid) const
Build query dataset for instance retrieval.
network::Result< retrieve_result > retrieve_study(network::association &assoc, std::string_view study_uid, retrieve_progress_callback progress=nullptr)
Retrieve a study by Study Instance UID.
void set_move_destination(std::string_view ae_title)
Set the move destination AE title.
network::Result< retrieve_result > get(network::association &assoc, const core::dicom_dataset &query_keys, retrieve_progress_callback progress=nullptr)
Perform a C-GET operation with raw dataset.
void reset_statistics() noexcept
Reset statistics counters to zero.
std::string_view get_get_sop_class_uid() const noexcept
Get GET SOP Class UID based on current configuration.
std::atomic< size_t > retrieves_performed_
Statistics: number of retrieves performed.
size_t instances_retrieved() const noexcept
Get the total number of instances retrieved since construction.
uint16_t next_message_id() noexcept
Get the next message ID for DIMSE operations.
std::atomic< uint16_t > message_id_counter_
Message ID counter.
std::atomic< size_t > bytes_retrieved_
Statistics: total bytes retrieved.
retrieve_scu & operator=(const retrieve_scu &)=delete
void set_config(const retrieve_scu_config &config)
Update the SCU configuration.
network::Result< retrieve_result > move(network::association &assoc, const core::dicom_dataset &query_keys, std::string_view destination_ae, retrieve_progress_callback progress=nullptr)
Perform a C-MOVE operation with raw dataset.
retrieve_scu(retrieve_scu &&)=delete
network::Result< retrieve_result > perform_move(network::association &assoc, const core::dicom_dataset &query_keys, std::string_view destination_ae, retrieve_progress_callback progress)
Internal C-MOVE implementation.
std::string_view get_move_sop_class_uid() const noexcept
Get MOVE SOP Class UID based on current configuration.
std::shared_ptr< di::ILogger > logger_
Logger instance for service logging.
size_t bytes_retrieved() const noexcept
Get the total bytes retrieved since construction (C-GET only)
core::dicom_dataset build_study_query(std::string_view study_uid) const
Build query dataset for study retrieval.
core::dicom_dataset build_series_query(std::string_view series_uid) const
Build query dataset for series retrieval.
retrieve_scu(std::shared_ptr< di::ILogger > logger=nullptr)
Construct a Retrieve SCU with default configuration.
DICOM Dataset - ordered collection of Data Elements.
DIMSE message encoding and decoding.
Logger interface for dependency injection.
retrieve_mode
DICOM Retrieve Mode (C-MOVE vs C-GET)
@ c_get
Receive directly from SCP on same association.
@ c_move
Request SCP to send to third party (requires move destination)
std::function< bool(const core::dicom_dataset &)> instance_receive_callback
Callback type for receiving instances during C-GET.
std::function< void(const retrieve_progress &)> retrieve_progress_callback
Callback type for retrieve progress updates.
auto to_string(mpps_status status) -> std::string_view
Convert mpps_status to DICOM string representation.
query_level
DICOM Query/Retrieve level enumeration.
@ study
Study level - query study information.
query_model
DICOM Query/Retrieve Information Model.
@ study_root
Study Root Query/Retrieve Information Model.
DICOM Query SCU service (C-FIND sender)
DICOM Retrieve SCP service (C-MOVE/C-GET handler)
Progress information for a retrieve operation.
uint16_t failed
Number of failed sub-operations.
uint16_t remaining
Number of remaining sub-operations.
uint16_t completed
Number of completed sub-operations.
uint16_t warning
Number of sub-operations with warnings.
uint16_t total() const noexcept
Get total number of sub-operations.
float percent() const noexcept
Get completion percentage.
std::chrono::milliseconds elapsed() const noexcept
Get elapsed time since start.
std::chrono::steady_clock::time_point start_time
Result of a retrieve operation (C-MOVE or C-GET)
uint16_t warning
Number of sub-operations with warnings.
uint16_t completed
Number of successfully completed sub-operations.
uint16_t failed
Number of failed sub-operations.
bool is_success() const noexcept
Check if the retrieve was fully successful.
bool has_failures() const noexcept
Check if any sub-operations failed.
bool has_warnings() const noexcept
Check if any sub-operations had warnings.
uint16_t final_status
Final DIMSE status code.
std::vector< core::dicom_dataset > received_instances
Received instances (for C-GET mode only)
std::chrono::milliseconds elapsed
Retrieve execution time.
bool is_cancelled() const noexcept
Check if the retrieve was cancelled.
Configuration for Retrieve SCU service.
std::chrono::milliseconds timeout
Timeout for receiving responses (milliseconds)
query_level level
Query level (Study, Series, or Image)
query_model model
Query information model (Patient Root or Study Root)
retrieve_mode mode
Retrieve mode (C-MOVE or C-GET)
uint16_t priority
Priority for DIMSE operations (0=medium, 1=high, 2=low)
std::string move_destination
Move destination AE title (required for C-MOVE mode)