PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
dimse_process_job.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
18#pragma once
19
24
25#include <cstdint>
26#include <functional>
27#include <string>
28#include <vector>
29
31
36enum class dimse_command_type : uint16_t {
37 c_store_rq = 0x0001,
38 c_store_rsp = 0x8001,
39 c_get_rq = 0x0010,
40 c_get_rsp = 0x8010,
41 c_find_rq = 0x0020,
42 c_find_rsp = 0x8020,
43 c_move_rq = 0x0021,
44 c_move_rsp = 0x8021,
45 c_echo_rq = 0x0030,
46 c_echo_rsp = 0x8030,
47 n_event_report_rq = 0x0100,
48 n_event_report_rsp = 0x8100,
49 n_get_rq = 0x0110,
50 n_get_rsp = 0x8110,
51 n_set_rq = 0x0120,
52 n_set_rsp = 0x8120,
53 n_action_rq = 0x0130,
54 n_action_rsp = 0x8130,
55 n_create_rq = 0x0140,
56 n_create_rsp = 0x8140,
57 n_delete_rq = 0x0150,
58 n_delete_rsp = 0x8150,
59 c_cancel_rq = 0x0FFF,
60};
61
69
71 uint64_t session_id;
72
74 uint16_t message_id;
75
78
80 std::string sop_class_uid;
81
83 std::string sop_instance_uid;
84
86 std::vector<uint8_t> command_data;
87
89 std::vector<uint8_t> data_set;
90
92 uint16_t priority{0};
93};
94
109public:
111 using request_callback = std::function<void(const dimse_request& request)>;
112
114 using association_callback = std::function<void(uint64_t session_id,
116 const std::vector<uint8_t>& data)>;
117
119 using error_callback = std::function<void(uint64_t session_id,
120 const std::string& error)>;
121
131 request_callback on_request = nullptr,
132 association_callback on_association = nullptr,
133 error_callback on_error = nullptr);
134
135 ~dimse_process_job() override = default;
136
137 // Non-copyable, movable
142
151 [[nodiscard]] auto execute(pipeline_coordinator& coordinator) -> VoidResult override;
152
156 [[nodiscard]] auto get_context() const noexcept -> const job_context& override;
157 [[nodiscard]] auto get_context() noexcept -> job_context& override;
158
162 [[nodiscard]] auto get_name() const -> std::string override;
163
167 [[nodiscard]] auto get_pdu() const noexcept -> const decoded_pdu&;
168
169private:
175
177 [[nodiscard]] auto process_p_data() -> Result<dimse_request>;
178
180 [[nodiscard]] auto process_association_pdu() -> VoidResult;
181};
182
183} // namespace kcenon::pacs::network::pipeline
std::function< void(uint64_t session_id, const std::string &error)> error_callback
Callback type for processing errors.
auto get_name() const -> std::string override
Get the job name.
std::function< void(uint64_t session_id, kcenon::pacs::network::pdu_type type, const std::vector< uint8_t > &data)> association_callback
Callback type for association handling.
dimse_process_job(const dimse_process_job &)=delete
auto process_association_pdu() -> VoidResult
Process association PDUs (A-ASSOCIATE, A-RELEASE, A-ABORT)
dimse_process_job & operator=(const dimse_process_job &)=delete
auto get_context() const noexcept -> const job_context &override
Get the job context.
auto get_pdu() const noexcept -> const decoded_pdu &
Get the decoded PDU.
dimse_process_job(decoded_pdu pdu, request_callback on_request=nullptr, association_callback on_association=nullptr, error_callback on_error=nullptr)
Construct a DIMSE process job from decoded PDU.
auto process_p_data() -> Result< dimse_request >
Process P-DATA-TF PDU.
dimse_process_job(dimse_process_job &&)=default
dimse_process_job & operator=(dimse_process_job &&)=default
auto execute(pipeline_coordinator &coordinator) -> VoidResult override
Execute the DIMSE process job.
std::function< void(const dimse_request &request)> request_callback
Callback type for processed request.
Coordinates the 6-stage DICOM I/O pipeline.
dimse_command_type
DICOM DIMSE command types.
pdu_type
PDU (Protocol Data Unit) types as defined in DICOM PS3.8.
Definition pdu_types.h:25
std::variant< associate_rq, associate_ac, associate_rj, p_data_tf_pdu, release_rq_pdu, release_rp_pdu, abort_pdu > pdu
Variant type that can hold any PDU.
Definition pdu_decoder.h:62
kcenon::pacs::VoidResult VoidResult
VoidResult type alias for operations without return value.
Definition association.h:59
PDU decoding job for Stage 2 of the pipeline.
Main coordinator for the 6-stage DICOM I/O pipeline.
Job type definitions for the 6-stage DICOM I/O pipeline.
Result<T> type aliases and helpers for PACS system.
Result of PDU decoding containing the PDU type and data.
Parsed DIMSE request for service execution.
uint16_t priority
Priority (0=medium, 1=high, 2=low)
uint8_t presentation_context_id
Presentation context ID.
dimse_command_type command_type
The DIMSE command type.
std::vector< uint8_t > command_data
Command data set (serialized)
std::string sop_instance_uid
Affected/Requested SOP Instance UID.
uint16_t message_id
Message ID for correlation.
std::string sop_class_uid
Affected/Requested SOP Class UID.
std::vector< uint8_t > data_set
Data set (if present)
Context information attached to pipeline jobs for tracking.