PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
dimse_message.cpp
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
11
15
16#include <stdexcept>
17
19
20namespace {
22inline kcenon::pacs::error_info make_dimse_error(dimse_error err, const std::string& details = "") {
23 std::string msg = std::string(to_string(err));
24 if (!details.empty()) {
25 msg += ": " + details;
26 }
28}
29} // namespace
30
31// ============================================================================
32// Construction
33// ============================================================================
34
36 : command_(cmd), message_id_(message_id) {
37 // Initialize the command set with required fields
39 static_cast<uint16_t>(cmd));
42}
43
44// ============================================================================
45// Command Set Access
46// ============================================================================
47
48auto dimse_message::command() const noexcept -> command_field {
49 return command_;
50}
51
52auto dimse_message::message_id() const noexcept -> uint16_t {
53 return message_id_;
54}
55
56auto dimse_message::command_set() noexcept -> core::dicom_dataset& {
57 return command_set_;
58}
59
60auto dimse_message::command_set() const noexcept -> const core::dicom_dataset& {
61 return command_set_;
62}
63
64// ============================================================================
65// Dataset Access
66// ============================================================================
67
68auto dimse_message::has_dataset() const noexcept -> bool {
69 return dataset_.has_value();
70}
71
73 if (!dataset_) {
74 return make_dimse_error(dimse_error::invalid_data_format, "DIMSE message has no dataset");
75 }
76 return std::ref(*dataset_);
77}
78
79auto dimse_message::dataset() const -> kcenon::pacs::Result<std::reference_wrapper<const core::dicom_dataset>> {
80 if (!dataset_) {
81 return make_dimse_error(dimse_error::invalid_data_format, "DIMSE message has no dataset");
82 }
83 return std::cref(*dataset_);
84}
85
90
92 dataset_.reset();
94}
95
96// ============================================================================
97// Status (for responses)
98// ============================================================================
99
101 return command_set_.get_numeric<uint16_t>(tag_status).value_or(0);
102}
103
107
108// ============================================================================
109// Common Attributes
110// ============================================================================
111
115
120
124
129
130auto dimse_message::priority() const -> uint16_t {
131 return command_set_.get_numeric<uint16_t>(tag_priority).value_or(priority_medium);
132}
133
137
139 return command_set_.get_numeric<uint16_t>(tag_message_id_responded_to).value_or(0);
140}
141
145
146// ============================================================================
147// DIMSE-N Specific Attributes
148// ============================================================================
149
153
157
161
165
166auto dimse_message::event_type_id() const -> std::optional<uint16_t> {
168}
169
173
174auto dimse_message::action_type_id() const -> std::optional<uint16_t> {
176}
177
181
182auto dimse_message::attribute_identifier_list() const -> std::vector<core::dicom_tag> {
183 std::vector<core::dicom_tag> tags;
185 if (elem == nullptr) {
186 return tags;
187 }
188
189 auto bytes = elem->raw_data();
190 if (bytes.empty()) {
191 return tags;
192 }
193
194 // Each tag is 4 bytes (group:2 + element:2), little-endian
195 for (size_t i = 0; i + 3 < bytes.size(); i += 4) {
196 uint16_t group = static_cast<uint16_t>(bytes[i]) |
197 (static_cast<uint16_t>(bytes[i + 1]) << 8);
198 uint16_t element = static_cast<uint16_t>(bytes[i + 2]) |
199 (static_cast<uint16_t>(bytes[i + 3]) << 8);
200 tags.emplace_back(group, element);
201 }
202 return tags;
203}
204
206 const std::vector<core::dicom_tag>& tags) {
207 std::vector<uint8_t> bytes;
208 bytes.reserve(tags.size() * 4);
209
210 for (const auto& tag : tags) {
211 // Little-endian encoding
212 bytes.push_back(static_cast<uint8_t>(tag.group() & 0xFF));
213 bytes.push_back(static_cast<uint8_t>((tag.group() >> 8) & 0xFF));
214 bytes.push_back(static_cast<uint8_t>(tag.element() & 0xFF));
215 bytes.push_back(static_cast<uint8_t>((tag.element() >> 8) & 0xFF));
216 }
217
219 encoding::vr_type::AT, bytes));
220}
221
222// ============================================================================
223// Sub-operation Counts
224// ============================================================================
225
226auto dimse_message::remaining_subops() const -> std::optional<uint16_t> {
228}
229
234
235auto dimse_message::completed_subops() const -> std::optional<uint16_t> {
237}
238
243
244auto dimse_message::failed_subops() const -> std::optional<uint16_t> {
246}
247
252
253auto dimse_message::warning_subops() const -> std::optional<uint16_t> {
255}
256
261
262// ============================================================================
263// Encoding/Decoding
264// ============================================================================
265
267 const encoding::transfer_syntax& dataset_ts)
269 // Create a mutable copy for encoding
270 dimse_message copy = msg;
272
273 // Command set is always Implicit VR Little Endian
274 auto command_bytes = encoding::implicit_vr_codec::encode(copy.command_set_);
275
276 // Encode dataset if present
277 std::vector<uint8_t> dataset_bytes;
278 if (copy.has_dataset()) {
279 auto ds_result = copy.dataset();
280 if (ds_result.is_err()) {
281 return ds_result.error();
282 }
283 if (dataset_ts.vr_type() == encoding::vr_encoding::implicit) {
284 dataset_bytes = encoding::implicit_vr_codec::encode(ds_result.value().get());
285 } else {
286 dataset_bytes = encoding::explicit_vr_codec::encode(ds_result.value().get());
287 }
288 }
289
290 return encoded_message{std::move(command_bytes), std::move(dataset_bytes)};
291}
292
293auto dimse_message::decode(std::span<const uint8_t> command_data,
294 std::span<const uint8_t> dataset_data,
295 const encoding::transfer_syntax& dataset_ts)
297 // Decode command set (always Implicit VR Little Endian)
298 auto cmd_result = encoding::implicit_vr_codec::decode(command_data);
299 if (cmd_result.is_err()) {
300 return make_dimse_error(dimse_error::decoding_error, "Failed to decode command set");
301 }
302
303 auto command_set = std::move(cmd_result.value());
304
305 // Extract command field
306 auto cmd_value = command_set.get_numeric<uint16_t>(tag_command_field);
307 if (!cmd_value) {
308 return make_dimse_error(dimse_error::missing_required_field, "CommandField tag not found");
309 }
310 auto cmd = static_cast<command_field>(*cmd_value);
311
312 // Extract message ID
313 auto msg_id = command_set.get_numeric<uint16_t>(tag_message_id);
314 if (!msg_id && dimse::is_request(cmd)) {
315 return make_dimse_error(dimse_error::missing_required_field, "MessageID tag not found for request");
316 }
317 // For responses, use message_id_responded_to if message_id is not present
318 uint16_t message_id = msg_id.value_or(0);
319
320 dimse_message msg(cmd, message_id);
321 msg.command_set_ = std::move(command_set);
322
323 // Decode dataset if present
324 if (!dataset_data.empty()) {
326 (dataset_ts.vr_type() == encoding::vr_encoding::implicit)
329
330 if (ds_result.is_err()) {
331 return make_dimse_error(dimse_error::decoding_error, "Failed to decode dataset");
332 }
333 msg.dataset_ = std::move(ds_result.value());
334 }
335
336 return msg;
337}
338
339// ============================================================================
340// Validation
341// ============================================================================
342
347
348auto dimse_message::is_request() const noexcept -> bool {
350}
351
352auto dimse_message::is_response() const noexcept -> bool {
354}
355
356// ============================================================================
357// Private Methods
358// ============================================================================
359
369
371 // First, remove CommandGroupLength to calculate without it
373
374 // Encode command set to get the size
376 auto length = static_cast<uint32_t>(encoded.size());
377
378 // Set CommandGroupLength
380}
381
382// ============================================================================
383// Factory Functions
384// ============================================================================
385
386auto make_c_echo_rq(uint16_t message_id, std::string_view sop_class_uid)
387 -> dimse_message {
389 msg.set_affected_sop_class_uid(sop_class_uid);
390 return msg;
391}
392
393auto make_c_echo_rsp(uint16_t message_id_responded_to, status_code status,
394 std::string_view sop_class_uid) -> dimse_message {
396 msg.set_message_id_responded_to(message_id_responded_to);
397 msg.set_affected_sop_class_uid(sop_class_uid);
398 msg.set_status(status);
399 return msg;
400}
401
402auto make_c_store_rq(uint16_t message_id, std::string_view sop_class_uid,
403 std::string_view sop_instance_uid, uint16_t priority)
404 -> dimse_message {
406 msg.set_affected_sop_class_uid(sop_class_uid);
407 msg.set_affected_sop_instance_uid(sop_instance_uid);
408 msg.set_priority(priority);
409 return msg;
410}
411
412auto make_c_store_rsp(uint16_t message_id_responded_to,
413 std::string_view sop_class_uid,
414 std::string_view sop_instance_uid, status_code status)
415 -> dimse_message {
417 msg.set_message_id_responded_to(message_id_responded_to);
418 msg.set_affected_sop_class_uid(sop_class_uid);
419 msg.set_affected_sop_instance_uid(sop_instance_uid);
420 msg.set_status(status);
421 return msg;
422}
423
424auto make_c_find_rq(uint16_t message_id, std::string_view sop_class_uid,
425 uint16_t priority) -> dimse_message {
427 msg.set_affected_sop_class_uid(sop_class_uid);
428 msg.set_priority(priority);
429 return msg;
430}
431
432auto make_c_find_rsp(uint16_t message_id_responded_to,
433 std::string_view sop_class_uid, status_code status)
434 -> dimse_message {
436 msg.set_message_id_responded_to(message_id_responded_to);
437 msg.set_affected_sop_class_uid(sop_class_uid);
438 msg.set_status(status);
439 return msg;
440}
441
442// ============================================================================
443// DIMSE-N Factory Functions
444// ============================================================================
445
446auto make_n_create_rq(uint16_t message_id, std::string_view sop_class_uid,
447 std::string_view sop_instance_uid) -> dimse_message {
449 msg.set_affected_sop_class_uid(sop_class_uid);
450 if (!sop_instance_uid.empty()) {
451 msg.set_affected_sop_instance_uid(sop_instance_uid);
452 }
453 return msg;
454}
455
456auto make_n_create_rsp(uint16_t message_id_responded_to,
457 std::string_view sop_class_uid,
458 std::string_view sop_instance_uid, status_code status)
459 -> dimse_message {
461 msg.set_message_id_responded_to(message_id_responded_to);
462 msg.set_affected_sop_class_uid(sop_class_uid);
463 msg.set_affected_sop_instance_uid(sop_instance_uid);
464 msg.set_status(status);
465 return msg;
466}
467
468auto make_n_set_rq(uint16_t message_id, std::string_view sop_class_uid,
469 std::string_view sop_instance_uid) -> dimse_message {
470 dimse_message msg(command_field::n_set_rq, message_id);
471 msg.set_requested_sop_class_uid(sop_class_uid);
472 msg.set_requested_sop_instance_uid(sop_instance_uid);
473 return msg;
474}
475
476auto make_n_set_rsp(uint16_t message_id_responded_to,
477 std::string_view sop_class_uid,
478 std::string_view sop_instance_uid, status_code status)
479 -> dimse_message {
481 msg.set_message_id_responded_to(message_id_responded_to);
482 msg.set_affected_sop_class_uid(sop_class_uid);
483 msg.set_affected_sop_instance_uid(sop_instance_uid);
484 msg.set_status(status);
485 return msg;
486}
487
488auto make_n_get_rq(uint16_t message_id, std::string_view sop_class_uid,
489 std::string_view sop_instance_uid,
490 const std::vector<core::dicom_tag>& attribute_tags)
491 -> dimse_message {
492 dimse_message msg(command_field::n_get_rq, message_id);
493 msg.set_requested_sop_class_uid(sop_class_uid);
494 msg.set_requested_sop_instance_uid(sop_instance_uid);
495 if (!attribute_tags.empty()) {
496 msg.set_attribute_identifier_list(attribute_tags);
497 }
498 return msg;
499}
500
501auto make_n_get_rsp(uint16_t message_id_responded_to,
502 std::string_view sop_class_uid,
503 std::string_view sop_instance_uid, status_code status)
504 -> dimse_message {
506 msg.set_message_id_responded_to(message_id_responded_to);
507 msg.set_affected_sop_class_uid(sop_class_uid);
508 msg.set_affected_sop_instance_uid(sop_instance_uid);
509 msg.set_status(status);
510 return msg;
511}
512
513auto make_n_event_report_rq(uint16_t message_id, std::string_view sop_class_uid,
514 std::string_view sop_instance_uid,
515 uint16_t event_type_id) -> dimse_message {
517 msg.set_affected_sop_class_uid(sop_class_uid);
518 msg.set_affected_sop_instance_uid(sop_instance_uid);
519 msg.set_event_type_id(event_type_id);
520 return msg;
521}
522
523auto make_n_event_report_rsp(uint16_t message_id_responded_to,
524 std::string_view sop_class_uid,
525 std::string_view sop_instance_uid,
526 uint16_t event_type_id, status_code status)
527 -> dimse_message {
529 msg.set_message_id_responded_to(message_id_responded_to);
530 msg.set_affected_sop_class_uid(sop_class_uid);
531 msg.set_affected_sop_instance_uid(sop_instance_uid);
532 msg.set_event_type_id(event_type_id);
533 msg.set_status(status);
534 return msg;
535}
536
537auto make_n_action_rq(uint16_t message_id, std::string_view sop_class_uid,
538 std::string_view sop_instance_uid, uint16_t action_type_id)
539 -> dimse_message {
541 msg.set_requested_sop_class_uid(sop_class_uid);
542 msg.set_requested_sop_instance_uid(sop_instance_uid);
543 msg.set_action_type_id(action_type_id);
544 return msg;
545}
546
547auto make_n_action_rsp(uint16_t message_id_responded_to,
548 std::string_view sop_class_uid,
549 std::string_view sop_instance_uid, uint16_t action_type_id,
550 status_code status) -> dimse_message {
552 msg.set_message_id_responded_to(message_id_responded_to);
553 msg.set_affected_sop_class_uid(sop_class_uid);
554 msg.set_affected_sop_instance_uid(sop_instance_uid);
555 msg.set_action_type_id(action_type_id);
556 msg.set_status(status);
557 return msg;
558}
559
560auto make_n_delete_rq(uint16_t message_id, std::string_view sop_class_uid,
561 std::string_view sop_instance_uid) -> dimse_message {
563 msg.set_requested_sop_class_uid(sop_class_uid);
564 msg.set_requested_sop_instance_uid(sop_instance_uid);
565 return msg;
566}
567
568auto make_n_delete_rsp(uint16_t message_id_responded_to,
569 std::string_view sop_class_uid,
570 std::string_view sop_instance_uid, status_code status)
571 -> dimse_message {
573 msg.set_message_id_responded_to(message_id_responded_to);
574 msg.set_affected_sop_class_uid(sop_class_uid);
575 msg.set_affected_sop_instance_uid(sop_instance_uid);
576 msg.set_status(status);
577 return msg;
578}
579
580} // namespace kcenon::pacs::network::dimse
void set_numeric(dicom_tag tag, encoding::vr_type vr, T value)
Set a numeric value for the given tag.
auto get(dicom_tag tag) noexcept -> dicom_element *
Get a pointer to the element with the given tag.
auto remove(dicom_tag tag) -> bool
Remove an element from the dataset.
void insert(dicom_element element)
Insert or replace an element in the dataset.
auto get_numeric(dicom_tag tag) const -> std::optional< T >
Get the numeric value of an element.
void set_string(dicom_tag tag, encoding::vr_type vr, std::string_view value)
Set a string value for the given tag.
auto contains(dicom_tag tag) const noexcept -> bool
Check if the dataset contains an element with the given tag.
auto get_string(dicom_tag tag, std::string_view default_value="") const -> std::string
Get the string value of an element.
static result< core::dicom_dataset > decode(std::span< const uint8_t > data)
Decode bytes to a dataset using Explicit VR Little Endian.
static std::vector< uint8_t > encode(const core::dicom_dataset &dataset)
Encode a dataset to bytes using Explicit VR Little Endian.
static result< core::dicom_dataset > decode(std::span< const uint8_t > data)
Decode bytes to a dataset using Implicit VR Little Endian.
static std::vector< uint8_t > encode(const core::dicom_dataset &dataset)
Encode a dataset to bytes using Implicit VR Little Endian.
Represents a DICOM Transfer Syntax.
auto message_id() const noexcept -> uint16_t
Get the message ID.
auto status() const -> status_code
Get the status code (for response messages)
std::optional< core::dicom_dataset > dataset_
static auto encode(const dimse_message &msg, const encoding::transfer_syntax &dataset_ts) -> dimse_result< encoded_message >
Encode the DIMSE message to bytes.
void set_requested_sop_instance_uid(std::string_view uid)
Set the Requested SOP Instance UID.
void set_action_type_id(uint16_t type_id)
Set the Action Type ID.
auto affected_sop_class_uid() const -> std::string
Get the Affected SOP Class UID.
auto attribute_identifier_list() const -> std::vector< core::dicom_tag >
Get the Attribute Identifier List (for N-GET)
void set_priority(uint16_t priority)
Set the priority.
static auto decode(std::span< const uint8_t > command_data, std::span< const uint8_t > dataset_data, const encoding::transfer_syntax &dataset_ts) -> dimse_result< dimse_message >
Decode a DIMSE message from bytes.
void set_attribute_identifier_list(const std::vector< core::dicom_tag > &tags)
Set the Attribute Identifier List.
void set_event_type_id(uint16_t type_id)
Set the Event Type ID.
auto command_set() noexcept -> core::dicom_dataset &
Get mutable reference to the command set.
auto is_valid() const noexcept -> bool
Check if the message is valid.
auto message_id_responded_to() const -> uint16_t
Get the Message ID Being Responded To (for responses)
auto remaining_subops() const -> std::optional< uint16_t >
Get the number of remaining sub-operations.
void clear_dataset() noexcept
Remove the data set from this message.
auto warning_subops() const -> std::optional< uint16_t >
Get the number of warning sub-operations.
auto requested_sop_class_uid() const -> std::string
Get the Requested SOP Class UID (for N-SET, N-GET, N-ACTION, N-DELETE)
void set_completed_subops(uint16_t count)
Set the number of completed sub-operations.
auto is_request() const noexcept -> bool
Check if this is a request message.
void update_command_group_length()
Calculate and set CommandGroupLength.
void set_dataset(core::dicom_dataset ds)
Set the data set for this message.
auto requested_sop_instance_uid() const -> std::string
Get the Requested SOP Instance UID (for N-SET, N-GET, N-ACTION, N-DELETE)
void set_status(status_code status)
Set the status code (for response messages)
void set_affected_sop_class_uid(std::string_view uid)
Set the Affected SOP Class UID.
auto is_response() const noexcept -> bool
Check if this is a response message.
auto event_type_id() const -> std::optional< uint16_t >
Get the Event Type ID (for N-EVENT-REPORT)
auto has_dataset() const noexcept -> bool
Check if the message has an associated data set.
void update_data_set_type()
Update the CommandDataSetType field based on dataset presence.
auto failed_subops() const -> std::optional< uint16_t >
Get the number of failed sub-operations.
void set_remaining_subops(uint16_t count)
Set the number of remaining sub-operations.
auto dataset() -> kcenon::pacs::Result< std::reference_wrapper< core::dicom_dataset > >
Get mutable reference to the data set.
auto priority() const -> uint16_t
Get the priority.
std::pair< std::vector< uint8_t >, std::vector< uint8_t > > encoded_message
Encoded message result type: pair of (command_set_bytes, dataset_bytes)
void set_message_id_responded_to(uint16_t id)
Set the Message ID Being Responded To (for responses)
auto action_type_id() const -> std::optional< uint16_t >
Get the Action Type ID (for N-ACTION)
void set_failed_subops(uint16_t count)
Set the number of failed sub-operations.
auto affected_sop_instance_uid() const -> std::string
Get the Affected SOP Instance UID.
void set_affected_sop_instance_uid(std::string_view uid)
Set the Affected SOP Instance UID.
auto command() const noexcept -> command_field
Get the command field.
dimse_message()=default
Default constructor (creates an invalid message)
void set_requested_sop_class_uid(std::string_view uid)
Set the Requested SOP Class UID.
auto completed_subops() const -> std::optional< uint16_t >
Get the number of completed sub-operations.
void set_warning_subops(uint16_t count)
Set the number of warning sub-operations.
DIMSE message encoding and decoding.
Encoder/decoder for Explicit VR Little Endian transfer syntax.
Encoder/decoder for Implicit VR Little Endian transfer syntax.
@ UL
Unsigned Long (4 bytes)
@ UI
Unique Identifier (64 chars max)
@ US
Unsigned Short (2 bytes)
@ AT
Attribute Tag (4 bytes)
@ implicit
VR determined from data dictionary lookup.
constexpr int dimse_error
Definition result.h:90
constexpr core::dicom_tag tag_action_type_id
Action Type ID (0000,1008) - US.
constexpr core::dicom_tag tag_command_field
Command Field (0000,0100) - US.
constexpr core::dicom_tag tag_number_of_failed_subops
Number of Failed Sub-operations (0000,1022) - US.
constexpr core::dicom_tag tag_message_id
Message ID (0000,0110) - US.
auto make_n_set_rsp(uint16_t message_id_responded_to, std::string_view sop_class_uid, std::string_view sop_instance_uid, status_code status=status_success) -> dimse_message
Create an N-SET response message.
auto make_n_action_rsp(uint16_t message_id_responded_to, std::string_view sop_class_uid, std::string_view sop_instance_uid, uint16_t action_type_id, status_code status=status_success) -> dimse_message
Create an N-ACTION response message.
constexpr core::dicom_tag tag_number_of_remaining_subops
Number of Remaining Sub-operations (0000,1020) - US.
constexpr core::dicom_tag tag_priority
Priority (0000,0700) - US.
constexpr core::dicom_tag tag_command_group_length
Command Group Length (0000,0000) - UL.
constexpr std::string_view to_string(command_field cmd) noexcept
Convert command field to string representation.
auto make_n_create_rq(uint16_t message_id, std::string_view sop_class_uid, std::string_view sop_instance_uid="") -> dimse_message
Create an N-CREATE request message.
auto make_n_get_rq(uint16_t message_id, std::string_view sop_class_uid, std::string_view sop_instance_uid, const std::vector< core::dicom_tag > &attribute_tags={}) -> dimse_message
Create an N-GET request message.
constexpr core::dicom_tag tag_affected_sop_instance_uid
Affected SOP Instance UID (0000,1000) - UI.
constexpr bool is_response(command_field cmd) noexcept
Check if a command field represents a response.
auto make_n_event_report_rsp(uint16_t message_id_responded_to, std::string_view sop_class_uid, std::string_view sop_instance_uid, uint16_t event_type_id, status_code status=status_success) -> dimse_message
Create an N-EVENT-REPORT response message.
constexpr core::dicom_tag tag_number_of_warning_subops
Number of Warning Sub-operations (0000,1023) - US.
constexpr core::dicom_tag tag_attribute_identifier_list
Attribute Identifier List (0000,1005) - AT.
auto make_n_action_rq(uint16_t message_id, std::string_view sop_class_uid, std::string_view sop_instance_uid, uint16_t action_type_id) -> dimse_message
Create an N-ACTION request message.
auto make_n_set_rq(uint16_t message_id, std::string_view sop_class_uid, std::string_view sop_instance_uid) -> dimse_message
Create an N-SET request message.
constexpr uint16_t command_data_set_type_present
Value indicating data set is present (any value other than 0x0101)
auto make_c_echo_rq(uint16_t message_id, std::string_view sop_class_uid="1.2.840.10008.1.1") -> dimse_message
Create a C-ECHO request message.
auto make_c_find_rsp(uint16_t message_id_responded_to, std::string_view sop_class_uid, status_code status) -> dimse_message
Create a C-FIND response message.
constexpr core::dicom_tag tag_message_id_responded_to
Message ID Being Responded To (0000,0120) - US.
auto make_n_delete_rq(uint16_t message_id, std::string_view sop_class_uid, std::string_view sop_instance_uid) -> dimse_message
Create an N-DELETE request message.
auto make_c_find_rq(uint16_t message_id, std::string_view sop_class_uid, uint16_t priority=priority_medium) -> dimse_message
Create a C-FIND request message.
auto make_c_echo_rsp(uint16_t message_id_responded_to, status_code status=status_success, std::string_view sop_class_uid="1.2.840.10008.1.1") -> dimse_message
Create a C-ECHO response message.
constexpr bool is_request(command_field cmd) noexcept
Check if a command field represents a request.
dimse_error
Error codes for DIMSE message operations.
auto make_c_store_rsp(uint16_t message_id_responded_to, std::string_view sop_class_uid, std::string_view sop_instance_uid, status_code status=status_success) -> dimse_message
Create a C-STORE response message.
auto make_n_event_report_rq(uint16_t message_id, std::string_view sop_class_uid, std::string_view sop_instance_uid, uint16_t event_type_id) -> dimse_message
Create an N-EVENT-REPORT request message.
auto make_n_create_rsp(uint16_t message_id_responded_to, std::string_view sop_class_uid, std::string_view sop_instance_uid, status_code status=status_success) -> dimse_message
Create an N-CREATE response message.
command_field
DIMSE command field values.
@ n_get_rq
N-GET Request - Get attribute values.
@ c_store_rq
C-STORE Request - Store composite SOP instance.
@ n_create_rq
N-CREATE Request - Create SOP instance.
@ n_set_rq
N-SET Request - Set attribute values.
@ c_echo_rq
C-ECHO Request - Verify DICOM connection.
@ c_find_rq
C-FIND Request - Query for matching instances.
@ n_delete_rq
N-DELETE Request - Delete SOP instance.
@ n_event_report_rsp
N-EVENT-REPORT Response.
@ n_event_report_rq
N-EVENT-REPORT Request - Report event notification.
@ n_action_rq
N-ACTION Request - Request action.
auto make_c_store_rq(uint16_t message_id, std::string_view sop_class_uid, std::string_view sop_instance_uid, uint16_t priority=priority_medium) -> dimse_message
Create a C-STORE request message.
auto make_n_delete_rsp(uint16_t message_id_responded_to, std::string_view sop_class_uid, std::string_view sop_instance_uid, status_code status=status_success) -> dimse_message
Create an N-DELETE response message.
constexpr uint16_t priority_medium
Medium priority.
constexpr uint16_t command_data_set_type_null
Null value indicating no data set present.
constexpr core::dicom_tag tag_number_of_completed_subops
Number of Completed Sub-operations (0000,1021) - US.
constexpr core::dicom_tag tag_requested_sop_instance_uid
Requested SOP Instance UID (0000,1001) - UI.
constexpr core::dicom_tag tag_event_type_id
Event Type ID (0000,1002) - US.
uint16_t status_code
DIMSE status code type alias.
auto make_n_get_rsp(uint16_t message_id_responded_to, std::string_view sop_class_uid, std::string_view sop_instance_uid, status_code status=status_success) -> dimse_message
Create an N-GET response message.
constexpr core::dicom_tag tag_affected_sop_class_uid
Affected SOP Class UID (0000,0002) - UI.
constexpr core::dicom_tag tag_status
Status (0000,0900) - US.
constexpr core::dicom_tag tag_requested_sop_class_uid
Requested SOP Class UID (0000,0003) - UI.
constexpr core::dicom_tag tag_command_data_set_type
Command Data Set Type (0000,0800) - US.
kcenon::common::error_info error_info
Error information type.
Definition result.h:40
std::string_view uid