|
PACS System 0.1.0
PACS DICOM system library
|
#include <query_scu.h>

Public Member Functions | |
| query_scu (std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct a Query SCU with default configuration. | |
| query_scu (const query_scu_config &config, std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct a Query SCU with custom configuration. | |
| ~query_scu ()=default | |
| query_scu (const query_scu &)=delete | |
| query_scu & | operator= (const query_scu &)=delete |
| query_scu (query_scu &&)=delete | |
| query_scu & | operator= (query_scu &&)=delete |
| network::Result< query_result > | find (network::association &assoc, const core::dicom_dataset &query_keys) |
| Perform a C-FIND query with raw dataset. | |
| network::Result< size_t > | find_streaming (network::association &assoc, const core::dicom_dataset &query_keys, query_streaming_callback callback) |
| Perform a streaming C-FIND query for large result sets. | |
| network::Result< query_result > | find_patients (network::association &assoc, const patient_query_keys &keys) |
| Query for patients. | |
| network::Result< query_result > | find_studies (network::association &assoc, const study_query_keys &keys) |
| Query for studies. | |
| network::Result< query_result > | find_series (network::association &assoc, const series_query_keys &keys) |
| Query for series within a study. | |
| network::Result< query_result > | find_instances (network::association &assoc, const instance_query_keys &keys) |
| Query for instances within a series. | |
| network::Result< std::monostate > | cancel (network::association &assoc, uint16_t message_id) |
| Send a C-CANCEL request to stop an ongoing query. | |
| void | set_config (const query_scu_config &config) |
| Update the SCU configuration. | |
| const query_scu_config & | config () const noexcept |
| Get the current configuration. | |
| size_t | queries_performed () const noexcept |
| Get the number of queries performed since construction. | |
| size_t | total_matches () const noexcept |
| Get the total number of matches received since construction. | |
| void | reset_statistics () noexcept |
| Reset statistics counters to zero. | |
Private Member Functions | |
| network::Result< query_result > | find_impl (network::association &assoc, const core::dicom_dataset &query_keys, uint16_t message_id) |
| Internal query implementation. | |
| uint16_t | next_message_id () noexcept |
| Get the next message ID for DIMSE operations. | |
| core::dicom_dataset | build_query_dataset (const patient_query_keys &keys) const |
| Build query dataset from patient keys. | |
| core::dicom_dataset | build_query_dataset (const study_query_keys &keys) const |
| Build query dataset from study keys. | |
| core::dicom_dataset | build_query_dataset (const series_query_keys &keys) const |
| Build query dataset from series keys. | |
| core::dicom_dataset | build_query_dataset (const instance_query_keys &keys) const |
| Build query dataset from instance keys. | |
| std::string_view | get_sop_class_uid () const noexcept |
| Get SOP Class UID based on current configuration. | |
Private Attributes | |
| std::shared_ptr< di::ILogger > | logger_ |
| Logger instance for service logging. | |
| query_scu_config | config_ |
| Configuration. | |
| std::atomic< uint16_t > | message_id_counter_ {1} |
| Message ID counter. | |
| std::atomic< size_t > | queries_performed_ {0} |
| Statistics: number of queries performed. | |
| std::atomic< size_t > | total_matches_ {0} |
| Statistics: total number of matches received. | |
Definition at line 294 of file query_scu.h.
|
explicit |
Construct a Query SCU with default configuration.
| logger | Logger instance for service logging (nullptr uses null_logger) |
Definition at line 25 of file query_scu.cpp.
|
explicit |
Construct a Query SCU with custom configuration.
| config | Configuration options |
| logger | Logger instance for service logging (nullptr uses null_logger) |
Definition at line 28 of file query_scu.cpp.
|
default |
|
delete |
|
delete |
|
nodiscardprivate |
Build query dataset from instance keys.
Definition at line 485 of file query_scu.cpp.
References kcenon::pacs::core::tags::instance_number, kcenon::pacs::services::instance_query_keys::instance_number, kcenon::pacs::core::tags::query_retrieve_level, kcenon::pacs::core::tags::series_instance_uid, kcenon::pacs::services::instance_query_keys::series_uid, kcenon::pacs::core::tags::sop_class_uid, kcenon::pacs::core::tags::sop_instance_uid, and kcenon::pacs::services::instance_query_keys::sop_instance_uid.
|
nodiscardprivate |
Build query dataset from patient keys.
Definition at line 403 of file query_scu.cpp.
References kcenon::pacs::services::patient_query_keys::birth_date, kcenon::pacs::core::tags::number_of_patient_related_instances, kcenon::pacs::core::tags::number_of_patient_related_series, kcenon::pacs::core::tags::number_of_patient_related_studies, kcenon::pacs::core::tags::patient_birth_date, kcenon::pacs::core::tags::patient_id, kcenon::pacs::services::patient_query_keys::patient_id, kcenon::pacs::core::tags::patient_name, kcenon::pacs::services::patient_query_keys::patient_name, kcenon::pacs::core::tags::patient_sex, kcenon::pacs::core::tags::query_retrieve_level, and kcenon::pacs::services::patient_query_keys::sex.
Referenced by find_instances(), find_patients(), find_series(), and find_studies().

|
nodiscardprivate |
Build query dataset from series keys.
Definition at line 459 of file query_scu.cpp.
References kcenon::pacs::core::tags::modality, kcenon::pacs::services::series_query_keys::modality, kcenon::pacs::core::tags::number_of_series_related_instances, kcenon::pacs::core::tags::query_retrieve_level, kcenon::pacs::core::tags::series_description, kcenon::pacs::core::tags::series_instance_uid, kcenon::pacs::core::tags::series_number, kcenon::pacs::services::series_query_keys::series_number, kcenon::pacs::services::series_query_keys::series_uid, kcenon::pacs::core::tags::study_instance_uid, and kcenon::pacs::services::series_query_keys::study_uid.
|
nodiscardprivate |
Build query dataset from study keys.
Definition at line 428 of file query_scu.cpp.
References kcenon::pacs::core::tags::accession_number, kcenon::pacs::services::study_query_keys::accession_number, kcenon::pacs::core::tags::modalities_in_study, kcenon::pacs::services::study_query_keys::modality, kcenon::pacs::core::tags::number_of_study_related_instances, kcenon::pacs::core::tags::number_of_study_related_series, kcenon::pacs::core::tags::patient_id, kcenon::pacs::services::study_query_keys::patient_id, kcenon::pacs::core::tags::patient_name, kcenon::pacs::core::tags::query_retrieve_level, kcenon::pacs::core::tags::study_date, kcenon::pacs::services::study_query_keys::study_date, kcenon::pacs::core::tags::study_description, kcenon::pacs::services::study_query_keys::study_description, kcenon::pacs::core::tags::study_id, kcenon::pacs::core::tags::study_instance_uid, kcenon::pacs::core::tags::study_time, and kcenon::pacs::services::study_query_keys::study_uid.
|
nodiscard |
Send a C-CANCEL request to stop an ongoing query.
| assoc | The association on which the query is running |
| message_id | The message ID of the query to cancel |
Definition at line 341 of file query_scu.cpp.
References kcenon::pacs::network::association::accepted_context_id(), get_sop_class_uid(), kcenon::pacs::error_codes::no_acceptable_context, kcenon::pacs::pacs_error(), and kcenon::pacs::network::association::send_dimse().
Referenced by find_impl(), and find_streaming().


|
nodiscardnoexcept |
Get the current configuration.
Definition at line 369 of file query_scu.cpp.
References config_.
Referenced by set_config().

|
nodiscard |
Perform a C-FIND query with raw dataset.
Sends a C-FIND request with the provided query keys and collects all matching datasets from the SCP.
| assoc | The established association to use |
| query_keys | The DICOM dataset containing query keys |
Definition at line 36 of file query_scu.cpp.
References find_impl(), and next_message_id().
Referenced by kcenon::pacs::client::job_manager::impl::execute_query_job(), find_instances(), find_patients(), find_series(), find_studies(), and kcenon::pacs::client::sync_manager::impl::query_remote_studies().


|
nodiscardprivate |
Internal query implementation.
Definition at line 43 of file query_scu.cpp.
References kcenon::pacs::network::association::accepted_context_id(), kcenon::pacs::error_codes::association_not_established, cancel(), kcenon::pacs::services::query_scu_config::cancel_on_max, config_, kcenon::pacs::services::query_result::elapsed, kcenon::pacs::error_codes::find_unexpected_command, get_sop_class_uid(), kcenon::pacs::network::association::is_established(), logger_, kcenon::pacs::services::query_result::matches, kcenon::pacs::services::query_scu_config::max_results, kcenon::pacs::error_codes::no_acceptable_context, kcenon::pacs::pacs_error(), queries_performed_, kcenon::pacs::network::association::receive_dimse(), kcenon::pacs::network::association::send_dimse(), kcenon::pacs::services::query_result::status, kcenon::pacs::services::query_scu_config::timeout, kcenon::pacs::services::to_string(), total_matches_, and kcenon::pacs::services::query_result::total_pending.
Referenced by find().


|
nodiscard |
Query for instances within a series.
| assoc | The established association to use |
| keys | Instance-level query keys (series_uid required) |
Definition at line 323 of file query_scu.cpp.
References build_query_dataset(), config_, find(), kcenon::pacs::services::image, and kcenon::pacs::services::query_scu_config::level.
Referenced by kcenon::pacs::web::endpoints::register_remote_nodes_endpoints_impl().


|
nodiscard |
Query for patients.
| assoc | The established association to use |
| keys | Patient-level query keys |
Definition at line 281 of file query_scu.cpp.
References build_query_dataset(), config_, find(), kcenon::pacs::services::query_scu_config::level, and kcenon::pacs::services::patient.
Referenced by kcenon::pacs::web::endpoints::register_remote_nodes_endpoints_impl().


|
nodiscard |
Query for series within a study.
| assoc | The established association to use |
| keys | Series-level query keys (study_uid required) |
Definition at line 309 of file query_scu.cpp.
References build_query_dataset(), config_, find(), kcenon::pacs::services::query_scu_config::level, and kcenon::pacs::services::series.
Referenced by kcenon::pacs::web::endpoints::register_remote_nodes_endpoints_impl().


|
nodiscard |
Perform a streaming C-FIND query for large result sets.
Sends a C-FIND request and calls the callback for each pending response. This is more memory-efficient for large result sets.
| assoc | The established association to use |
| query_keys | The DICOM dataset containing query keys |
| callback | Called for each matching dataset; return false to cancel |
Definition at line 164 of file query_scu.cpp.
References kcenon::pacs::network::association::accepted_context_id(), kcenon::pacs::error_codes::association_not_established, cancel(), kcenon::pacs::services::query_scu_config::cancel_on_max, config_, kcenon::pacs::error_codes::find_unexpected_command, get_sop_class_uid(), kcenon::pacs::network::association::is_established(), logger_, kcenon::pacs::services::query_scu_config::max_results, next_message_id(), kcenon::pacs::error_codes::no_acceptable_context, kcenon::pacs::pacs_error(), queries_performed_, kcenon::pacs::network::association::receive_dimse(), kcenon::pacs::network::association::send_dimse(), kcenon::pacs::services::query_scu_config::timeout, kcenon::pacs::services::to_string(), and total_matches_.

|
nodiscard |
Query for studies.
| assoc | The established association to use |
| keys | Study-level query keys |
Definition at line 295 of file query_scu.cpp.
References build_query_dataset(), config_, find(), kcenon::pacs::services::query_scu_config::level, and kcenon::pacs::services::study.
Referenced by kcenon::pacs::workflow::auto_prefetch_service::query_prior_studies(), and kcenon::pacs::web::endpoints::register_remote_nodes_endpoints_impl().


|
nodiscardprivatenoexcept |
Get SOP Class UID based on current configuration.
Definition at line 507 of file query_scu.cpp.
References config_, kcenon::pacs::services::get_find_sop_class_uid(), and kcenon::pacs::services::query_scu_config::model.
Referenced by cancel(), find_impl(), and find_streaming().


|
nodiscardprivatenoexcept |
Get the next message ID for DIMSE operations.
Definition at line 394 of file query_scu.cpp.
References message_id_counter_.
Referenced by find(), and find_streaming().

|
nodiscardnoexcept |
Get the number of queries performed since construction.
Definition at line 377 of file query_scu.cpp.
References queries_performed_.
|
noexcept |
Reset statistics counters to zero.
Definition at line 385 of file query_scu.cpp.
References queries_performed_, and total_matches_.
| void kcenon::pacs::services::query_scu::set_config | ( | const query_scu_config & | config | ) |
|
nodiscardnoexcept |
Get the total number of matches received since construction.
Definition at line 381 of file query_scu.cpp.
References total_matches_.
|
private |
Configuration.
Definition at line 515 of file query_scu.h.
Referenced by config(), find_impl(), find_instances(), find_patients(), find_series(), find_streaming(), find_studies(), get_sop_class_uid(), and set_config().
|
private |
Logger instance for service logging.
Definition at line 512 of file query_scu.h.
Referenced by find_impl(), and find_streaming().
|
private |
Message ID counter.
Definition at line 518 of file query_scu.h.
Referenced by next_message_id().
|
private |
Statistics: number of queries performed.
Definition at line 521 of file query_scu.h.
Referenced by find_impl(), find_streaming(), queries_performed(), and reset_statistics().
|
private |
Statistics: total number of matches received.
Definition at line 524 of file query_scu.h.
Referenced by find_impl(), find_streaming(), reset_statistics(), and total_matches().