PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::network::dimse::dimse_message Class Reference

#include <dimse_message.h>

Collaboration diagram for kcenon::pacs::network::dimse::dimse_message:
Collaboration graph

Public Types

using encoded_message = std::pair<std::vector<uint8_t>, std::vector<uint8_t>>
 Encoded message result type: pair of (command_set_bytes, dataset_bytes)
 

Public Member Functions

 dimse_message (command_field cmd, uint16_t message_id)
 Construct a new DIMSE message.
 
 dimse_message ()=default
 Default constructor (creates an invalid message)
 
 dimse_message (const dimse_message &)=default
 Copy constructor.
 
 dimse_message (dimse_message &&) noexcept=default
 Move constructor.
 
auto operator= (const dimse_message &) -> dimse_message &=default
 Copy assignment.
 
auto operator= (dimse_message &&) noexcept -> dimse_message &=default
 Move assignment.
 
 ~dimse_message ()=default
 Destructor.
 
auto command () const noexcept -> command_field
 Get the command field.
 
auto message_id () const noexcept -> uint16_t
 Get the message ID.
 
auto command_set () noexcept -> core::dicom_dataset &
 Get mutable reference to the command set.
 
auto command_set () const noexcept -> const core::dicom_dataset &
 Get const reference to the command set.
 
auto has_dataset () const noexcept -> bool
 Check if the message has an associated data set.
 
auto dataset () -> kcenon::pacs::Result< std::reference_wrapper< core::dicom_dataset > >
 Get mutable reference to the data set.
 
auto dataset () const -> kcenon::pacs::Result< std::reference_wrapper< const core::dicom_dataset > >
 Get const reference to the data set.
 
void set_dataset (core::dicom_dataset ds)
 Set the data set for this message.
 
void clear_dataset () noexcept
 Remove the data set from this message.
 
auto status () const -> status_code
 Get the status code (for response messages)
 
void set_status (status_code status)
 Set the status code (for response messages)
 
auto affected_sop_class_uid () const -> std::string
 Get the Affected SOP Class UID.
 
void set_affected_sop_class_uid (std::string_view uid)
 Set the Affected SOP Class UID.
 
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 priority () const -> uint16_t
 Get the priority.
 
void set_priority (uint16_t priority)
 Set the priority.
 
auto message_id_responded_to () const -> uint16_t
 Get the Message ID Being Responded To (for responses)
 
void set_message_id_responded_to (uint16_t id)
 Set the Message ID Being Responded To (for responses)
 
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_requested_sop_class_uid (std::string_view uid)
 Set the Requested SOP Class UID.
 
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_requested_sop_instance_uid (std::string_view uid)
 Set the Requested SOP Instance UID.
 
auto event_type_id () const -> std::optional< uint16_t >
 Get the Event Type ID (for N-EVENT-REPORT)
 
void set_event_type_id (uint16_t type_id)
 Set the Event Type ID.
 
auto action_type_id () const -> std::optional< uint16_t >
 Get the Action Type ID (for N-ACTION)
 
void set_action_type_id (uint16_t type_id)
 Set the Action Type ID.
 
auto attribute_identifier_list () const -> std::vector< core::dicom_tag >
 Get the Attribute Identifier List (for N-GET)
 
void set_attribute_identifier_list (const std::vector< core::dicom_tag > &tags)
 Set the Attribute Identifier List.
 
auto remaining_subops () const -> std::optional< uint16_t >
 Get the number of remaining sub-operations.
 
void set_remaining_subops (uint16_t count)
 Set the number of remaining sub-operations.
 
auto completed_subops () const -> std::optional< uint16_t >
 Get the number of completed sub-operations.
 
void set_completed_subops (uint16_t count)
 Set the number of completed sub-operations.
 
auto failed_subops () const -> std::optional< uint16_t >
 Get the number of failed sub-operations.
 
void set_failed_subops (uint16_t count)
 Set the number of failed sub-operations.
 
auto warning_subops () const -> std::optional< uint16_t >
 Get the number of warning sub-operations.
 
void set_warning_subops (uint16_t count)
 Set the number of warning sub-operations.
 
auto is_valid () const noexcept -> bool
 Check if the message is valid.
 
auto is_request () const noexcept -> bool
 Check if this is a request message.
 
auto is_response () const noexcept -> bool
 Check if this is a response message.
 

Static Public Member Functions

static auto encode (const dimse_message &msg, const encoding::transfer_syntax &dataset_ts) -> dimse_result< encoded_message >
 Encode the DIMSE message to bytes.
 
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.
 

Private Member Functions

void update_data_set_type ()
 Update the CommandDataSetType field based on dataset presence.
 
void update_command_group_length ()
 Calculate and set CommandGroupLength.
 

Private Attributes

command_field command_ {}
 
uint16_t message_id_ {0}
 
core::dicom_dataset command_set_
 
std::optional< core::dicom_datasetdataset_
 

Detailed Description

Examples
get_scu/main.cpp, move_scu/main.cpp, and retrieve_scu/main.cpp.

Definition at line 202 of file dimse_message.h.

Member Typedef Documentation

◆ encoded_message

using kcenon::pacs::network::dimse::dimse_message::encoded_message = std::pair<std::vector<uint8_t>, std::vector<uint8_t>>

Encoded message result type: pair of (command_set_bytes, dataset_bytes)

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 488 of file dimse_message.h.

Constructor & Destructor Documentation

◆ dimse_message() [1/4]

kcenon::pacs::network::dimse::dimse_message::dimse_message ( command_field cmd,
uint16_t message_id )

Construct a new DIMSE message.

Parameters
cmdThe command field (type of operation)
message_idUnique message identifier

Definition at line 35 of file dimse_message.cpp.

37 // Initialize the command set with required fields
39 static_cast<uint16_t>(cmd));
42}
void set_numeric(dicom_tag tag, encoding::vr_type vr, T value)
Set a numeric value for the given tag.
auto message_id() const noexcept -> uint16_t
Get the message ID.
void update_data_set_type()
Update the CommandDataSetType field based on dataset presence.
@ US
Unsigned Short (2 bytes)
constexpr core::dicom_tag tag_command_field
Command Field (0000,0100) - US.
constexpr core::dicom_tag tag_message_id
Message ID (0000,0110) - US.

References command_set_, message_id(), kcenon::pacs::core::dicom_dataset::set_numeric(), kcenon::pacs::network::dimse::tag_command_field, kcenon::pacs::network::dimse::tag_message_id, update_data_set_type(), and kcenon::pacs::encoding::US.

Here is the call graph for this function:

◆ dimse_message() [2/4]

kcenon::pacs::network::dimse::dimse_message::dimse_message ( )
default

◆ dimse_message() [3/4]

kcenon::pacs::network::dimse::dimse_message::dimse_message ( const dimse_message & )
default

Copy constructor.

◆ dimse_message() [4/4]

kcenon::pacs::network::dimse::dimse_message::dimse_message ( dimse_message && )
defaultnoexcept

Move constructor.

◆ ~dimse_message()

kcenon::pacs::network::dimse::dimse_message::~dimse_message ( )
default

Member Function Documentation

◆ action_type_id()

auto kcenon::pacs::network::dimse::dimse_message::action_type_id ( ) const -> std::optional<uint16_t>
nodiscard

Get the Action Type ID (for N-ACTION)

Returns
The action type ID if present
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 174 of file dimse_message.cpp.

174 {
176}
auto get_numeric(dicom_tag tag) const -> std::optional< T >
Get the numeric value of an element.
constexpr core::dicom_tag tag_action_type_id
Action Type ID (0000,1008) - US.

References command_set_, kcenon::pacs::core::dicom_dataset::get_numeric(), and kcenon::pacs::network::dimse::tag_action_type_id.

Referenced by kcenon::pacs::services::print_scp::handle_n_action(), kcenon::pacs::services::storage_commitment_scp::handle_n_action(), kcenon::pacs::services::ups_push_scp::handle_n_action(), and kcenon::pacs::services::ups_watch_scp::handle_n_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ affected_sop_class_uid()

auto kcenon::pacs::network::dimse::dimse_message::affected_sop_class_uid ( ) const -> std::string
nodiscard

Get the Affected SOP Class UID.

Returns
The SOP Class UID if present
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 112 of file dimse_message.cpp.

112 {
114}
auto get_string(dicom_tag tag, std::string_view default_value="") const -> std::string
Get the string value of an element.
constexpr core::dicom_tag tag_affected_sop_class_uid
Affected SOP Class UID (0000,0002) - UI.

References command_set_, kcenon::pacs::core::dicom_dataset::get_string(), and kcenon::pacs::network::dimse::tag_affected_sop_class_uid.

Referenced by kcenon::pacs::network::dicom_server::dispatch_to_service(), kcenon::pacs::services::retrieve_scp::handle_c_get(), kcenon::pacs::services::retrieve_scp::handle_c_move(), kcenon::pacs::services::query_scp::handle_message(), kcenon::pacs::services::storage_scp::handle_message(), kcenon::pacs::services::ups_query_scp::handle_message(), kcenon::pacs::services::worklist_scp::handle_message(), kcenon::pacs::services::print_scp::handle_n_action(), kcenon::pacs::services::storage_commitment_scp::handle_n_action(), kcenon::pacs::services::mpps_scp::handle_n_create(), kcenon::pacs::services::print_scp::handle_n_create(), kcenon::pacs::services::ups_push_scp::handle_n_create(), kcenon::pacs::services::print_scp::handle_n_delete(), kcenon::pacs::services::print_scp::handle_n_get(), kcenon::pacs::services::mpps_scp::handle_n_set(), and kcenon::pacs::services::print_scp::handle_n_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ affected_sop_instance_uid()

auto kcenon::pacs::network::dimse::dimse_message::affected_sop_instance_uid ( ) const -> std::string
nodiscard

Get the Affected SOP Instance UID.

Returns
The SOP Instance UID if present
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 121 of file dimse_message.cpp.

121 {
123}
constexpr core::dicom_tag tag_affected_sop_instance_uid
Affected SOP Instance UID (0000,1000) - UI.

References command_set_, kcenon::pacs::core::dicom_dataset::get_string(), and kcenon::pacs::network::dimse::tag_affected_sop_instance_uid.

Referenced by kcenon::pacs::services::print_scp::create_film_box(), kcenon::pacs::services::print_scp::create_film_session(), kcenon::pacs::services::ups_watch_scu::handle_event_report(), kcenon::pacs::services::storage_scp::handle_message(), kcenon::pacs::services::print_scp::handle_n_action(), kcenon::pacs::services::ups_push_scp::handle_n_action(), kcenon::pacs::services::ups_watch_scp::handle_n_action(), kcenon::pacs::services::mpps_scp::handle_n_create(), kcenon::pacs::services::ups_push_scp::handle_n_create(), kcenon::pacs::services::print_scp::handle_n_delete(), kcenon::pacs::services::print_scp::handle_n_get(), kcenon::pacs::services::mpps_scp::handle_n_set(), kcenon::pacs::services::print_scp::handle_n_set(), and kcenon::pacs::services::ups_push_scp::handle_n_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ attribute_identifier_list()

auto kcenon::pacs::network::dimse::dimse_message::attribute_identifier_list ( ) const -> std::vector<core::dicom_tag>
nodiscard

Get the Attribute Identifier List (for N-GET)

Returns
Vector of tags to retrieve
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 182 of file dimse_message.cpp.

182 {
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}
auto get(dicom_tag tag) noexcept -> dicom_element *
Get a pointer to the element with the given tag.
constexpr core::dicom_tag tag_attribute_identifier_list
Attribute Identifier List (0000,1005) - AT.

References command_set_, kcenon::pacs::core::dicom_dataset::get(), and kcenon::pacs::network::dimse::tag_attribute_identifier_list.

Referenced by kcenon::pacs::services::n_get_scp::handle_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_dataset()

void kcenon::pacs::network::dimse::dimse_message::clear_dataset ( )
noexcept

Remove the data set from this message.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 91 of file dimse_message.cpp.

91 {
92 dataset_.reset();
94}
std::optional< core::dicom_dataset > dataset_

References dataset_, and update_data_set_type().

Here is the call graph for this function:

◆ command()

◆ command_set() [1/2]

auto kcenon::pacs::network::dimse::dimse_message::command_set ( ) const -> const core::dicom_dataset&
nodiscardnoexcept

Get const reference to the command set.

Returns
Const reference to the command dataset

Definition at line 60 of file dimse_message.cpp.

60 {
61 return command_set_;
62}

References command_set_.

◆ command_set() [2/2]

auto kcenon::pacs::network::dimse::dimse_message::command_set ( ) -> core::dicom_dataset&
nodiscardnoexcept

◆ completed_subops()

auto kcenon::pacs::network::dimse::dimse_message::completed_subops ( ) const -> std::optional<uint16_t>
nodiscard

Get the number of completed sub-operations.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 235 of file dimse_message.cpp.

235 {
237}
constexpr core::dicom_tag tag_number_of_completed_subops
Number of Completed Sub-operations (0000,1021) - US.

References command_set_, kcenon::pacs::core::dicom_dataset::get_numeric(), and kcenon::pacs::network::dimse::tag_number_of_completed_subops.

Here is the call graph for this function:

◆ dataset() [1/2]

auto kcenon::pacs::network::dimse::dimse_message::dataset ( ) -> kcenon::pacs::Result<std::reference_wrapper<core::dicom_dataset>>
nodiscard

Get mutable reference to the data set.

Returns
Result containing reference to the data set or error if not present
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 72 of file dimse_message.cpp.

72 {
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}

References kcenon::pacs::network::dimse::invalid_data_format.

Referenced by kcenon::pacs::services::print_scp::create_film_box(), kcenon::pacs::services::print_scp::create_film_session(), encode(), kcenon::pacs::services::retrieve_scp::handle_c_get(), kcenon::pacs::services::retrieve_scp::handle_c_move(), kcenon::pacs::services::storage_commitment_scu::handle_event_report(), kcenon::pacs::services::ups_watch_scu::handle_event_report(), kcenon::pacs::services::query_scp::handle_message(), kcenon::pacs::services::storage_scp::handle_message(), kcenon::pacs::services::ups_query_scp::handle_message(), kcenon::pacs::services::worklist_scp::handle_message(), kcenon::pacs::services::storage_commitment_scp::handle_n_action(), kcenon::pacs::services::ups_push_scp::handle_n_action(), kcenon::pacs::services::mpps_scp::handle_n_create(), kcenon::pacs::services::ups_push_scp::handle_n_create(), kcenon::pacs::services::mpps_scp::handle_n_set(), kcenon::pacs::services::print_scp::handle_n_set(), and kcenon::pacs::services::ups_push_scp::handle_n_set().

Here is the caller graph for this function:

◆ dataset() [2/2]

auto kcenon::pacs::network::dimse::dimse_message::dataset ( ) const -> kcenon::pacs::Result<std::reference_wrapper<const core::dicom_dataset>>
nodiscard

Get const reference to the data set.

Returns
Result containing reference to the data set or error if not present

Definition at line 79 of file dimse_message.cpp.

79 {
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}

References dataset_, and kcenon::pacs::network::dimse::invalid_data_format.

◆ decode()

auto kcenon::pacs::network::dimse::dimse_message::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>
staticnodiscard

Decode a DIMSE message from bytes.

Parameters
command_dataThe encoded command set (Implicit VR LE)
dataset_dataThe encoded data set (per transfer syntax)
dataset_tsThe transfer syntax of the data set
Returns
The decoded message or an error
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 293 of file dimse_message.cpp.

296 {
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)
328 : encoding::explicit_vr_codec::decode(dataset_data);
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}
static result< core::dicom_dataset > decode(std::span< const uint8_t > data)
Decode bytes to a dataset using Implicit VR Little Endian.
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.
auto command_set() noexcept -> core::dicom_dataset &
Get mutable reference to the command set.
@ implicit
VR determined from data dictionary lookup.
constexpr bool is_request(command_field cmd) noexcept
Check if a command field represents a request.

References command_set_, dataset_, kcenon::pacs::encoding::explicit_vr_codec::decode(), kcenon::pacs::encoding::implicit_vr_codec::decode(), kcenon::pacs::network::dimse::decoding_error, kcenon::pacs::encoding::implicit, kcenon::pacs::network::dimse::is_request(), kcenon::pacs::network::dimse::missing_required_field, kcenon::pacs::network::dimse::tag_command_field, and kcenon::pacs::network::dimse::tag_message_id.

Referenced by kcenon::pacs::network::v2::dicom_association_handler::handle_p_data_tf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ encode()

auto kcenon::pacs::network::dimse::dimse_message::encode ( const dimse_message & msg,
const encoding::transfer_syntax & dataset_ts ) -> dimse_result<encoded_message>
staticnodiscard

Encode the DIMSE message to bytes.

Parameters
msgThe message to encode
dataset_tsThe transfer syntax for the data set
Returns
Encoded command set and data set bytes as a pair

The command set is always encoded using Implicit VR Little Endian. The data set uses the specified transfer syntax.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 266 of file dimse_message.cpp.

268 {
269 // Create a mutable copy for encoding
270 dimse_message copy = msg;
271 copy.update_command_group_length();
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}
static std::vector< uint8_t > encode(const core::dicom_dataset &dataset)
Encode a dataset to bytes using Explicit VR Little Endian.
static std::vector< uint8_t > encode(const core::dicom_dataset &dataset)
Encode a dataset to bytes using Implicit VR Little Endian.
std::pair< std::vector< uint8_t >, std::vector< uint8_t > > encoded_message
Encoded message result type: pair of (command_set_bytes, dataset_bytes)

References command_set_, dataset(), kcenon::pacs::encoding::explicit_vr_codec::encode(), kcenon::pacs::encoding::implicit_vr_codec::encode(), has_dataset(), kcenon::pacs::encoding::implicit, and update_command_group_length().

Here is the call graph for this function:

◆ event_type_id()

auto kcenon::pacs::network::dimse::dimse_message::event_type_id ( ) const -> std::optional<uint16_t>
nodiscard

Get the Event Type ID (for N-EVENT-REPORT)

Returns
The event type ID if present
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 166 of file dimse_message.cpp.

166 {
168}
constexpr core::dicom_tag tag_event_type_id
Event Type ID (0000,1002) - US.

References command_set_, kcenon::pacs::core::dicom_dataset::get_numeric(), and kcenon::pacs::network::dimse::tag_event_type_id.

Referenced by kcenon::pacs::services::ups_watch_scu::handle_event_report().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ failed_subops()

auto kcenon::pacs::network::dimse::dimse_message::failed_subops ( ) const -> std::optional<uint16_t>
nodiscard

Get the number of failed sub-operations.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 244 of file dimse_message.cpp.

244 {
246}
constexpr core::dicom_tag tag_number_of_failed_subops
Number of Failed Sub-operations (0000,1022) - US.

References command_set_, kcenon::pacs::core::dicom_dataset::get_numeric(), and kcenon::pacs::network::dimse::tag_number_of_failed_subops.

Here is the call graph for this function:

◆ has_dataset()

◆ is_request()

auto kcenon::pacs::network::dimse::dimse_message::is_request ( ) const -> bool
nodiscardnoexcept

Check if this is a request message.

Returns
true if the command field represents a request
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 348 of file dimse_message.cpp.

348 {
350}

References command_, and kcenon::pacs::network::dimse::is_request().

Here is the call graph for this function:

◆ is_response()

auto kcenon::pacs::network::dimse::dimse_message::is_response ( ) const -> bool
nodiscardnoexcept

Check if this is a response message.

Returns
true if the command field represents a response
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 352 of file dimse_message.cpp.

352 {
354}
constexpr bool is_response(command_field cmd) noexcept
Check if a command field represents a response.

References command_, and kcenon::pacs::network::dimse::is_response().

Here is the call graph for this function:

◆ is_valid()

auto kcenon::pacs::network::dimse::dimse_message::is_valid ( ) const -> bool
nodiscardnoexcept

Check if the message is valid.

Returns
true if the message has valid command field and message ID
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 343 of file dimse_message.cpp.

343 {
346}
auto contains(dicom_tag tag) const noexcept -> bool
Check if the dataset contains an element with the given tag.

References command_set_, kcenon::pacs::core::dicom_dataset::contains(), kcenon::pacs::network::dimse::tag_command_field, and kcenon::pacs::network::dimse::tag_message_id.

Referenced by kcenon::pacs::network::association::send_dimse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ message_id()

auto kcenon::pacs::network::dimse::dimse_message::message_id ( ) const -> uint16_t
nodiscardnoexcept

Get the message ID.

Returns
The message ID
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 52 of file dimse_message.cpp.

52 {
53 return message_id_;
54}

References message_id_.

Referenced by kcenon::pacs::services::print_scp::create_film_box(), kcenon::pacs::services::print_scp::create_film_session(), dimse_message(), kcenon::pacs::services::retrieve_scp::handle_c_get(), kcenon::pacs::services::retrieve_scp::handle_c_move(), kcenon::pacs::services::n_get_scp::handle_message(), kcenon::pacs::services::query_scp::handle_message(), kcenon::pacs::services::storage_scp::handle_message(), kcenon::pacs::services::ups_query_scp::handle_message(), kcenon::pacs::services::verification_scp::handle_message(), kcenon::pacs::services::worklist_scp::handle_message(), kcenon::pacs::services::print_scp::handle_n_action(), kcenon::pacs::services::storage_commitment_scp::handle_n_action(), kcenon::pacs::services::ups_push_scp::handle_n_action(), kcenon::pacs::services::ups_watch_scp::handle_n_action(), kcenon::pacs::services::mpps_scp::handle_n_create(), kcenon::pacs::services::print_scp::handle_n_create(), kcenon::pacs::services::ups_push_scp::handle_n_create(), kcenon::pacs::services::print_scp::handle_n_delete(), kcenon::pacs::services::print_scp::handle_n_get(), kcenon::pacs::services::ups_push_scp::handle_n_get(), kcenon::pacs::services::mpps_scp::handle_n_set(), kcenon::pacs::services::print_scp::handle_n_set(), and kcenon::pacs::services::ups_push_scp::handle_n_set().

Here is the caller graph for this function:

◆ message_id_responded_to()

auto kcenon::pacs::network::dimse::dimse_message::message_id_responded_to ( ) const -> uint16_t
nodiscard

Get the Message ID Being Responded To (for responses)

Returns
The message ID being responded to
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 138 of file dimse_message.cpp.

138 {
139 return command_set_.get_numeric<uint16_t>(tag_message_id_responded_to).value_or(0);
140}
constexpr core::dicom_tag tag_message_id_responded_to
Message ID Being Responded To (0000,0120) - US.

References command_set_, kcenon::pacs::core::dicom_dataset::get_numeric(), and kcenon::pacs::network::dimse::tag_message_id_responded_to.

Here is the call graph for this function:

◆ operator=() [1/2]

auto kcenon::pacs::network::dimse::dimse_message::operator= ( const dimse_message & ) -> dimse_message &=default
default

◆ operator=() [2/2]

auto kcenon::pacs::network::dimse::dimse_message::operator= ( dimse_message && ) -> dimse_message &=default
defaultnoexcept

Move assignment.

◆ priority()

auto kcenon::pacs::network::dimse::dimse_message::priority ( ) const -> uint16_t
nodiscard

Get the priority.

Returns
The priority value (0=medium, 1=high, 2=low)
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 130 of file dimse_message.cpp.

130 {
131 return command_set_.get_numeric<uint16_t>(tag_priority).value_or(priority_medium);
132}
constexpr core::dicom_tag tag_priority
Priority (0000,0700) - US.
constexpr uint16_t priority_medium
Medium priority.

References command_set_, kcenon::pacs::core::dicom_dataset::get_numeric(), kcenon::pacs::network::dimse::priority_medium, and kcenon::pacs::network::dimse::tag_priority.

Referenced by set_priority().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remaining_subops()

auto kcenon::pacs::network::dimse::dimse_message::remaining_subops ( ) const -> std::optional<uint16_t>
nodiscard

Get the number of remaining sub-operations.

Returns
Optional count of remaining sub-operations
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 226 of file dimse_message.cpp.

226 {
228}
constexpr core::dicom_tag tag_number_of_remaining_subops
Number of Remaining Sub-operations (0000,1020) - US.

References command_set_, kcenon::pacs::core::dicom_dataset::get_numeric(), and kcenon::pacs::network::dimse::tag_number_of_remaining_subops.

Here is the call graph for this function:

◆ requested_sop_class_uid()

auto kcenon::pacs::network::dimse::dimse_message::requested_sop_class_uid ( ) const -> std::string
nodiscard

Get the Requested SOP Class UID (for N-SET, N-GET, N-ACTION, N-DELETE)

Returns
The SOP Class UID if present
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 150 of file dimse_message.cpp.

150 {
152}
constexpr core::dicom_tag tag_requested_sop_class_uid
Requested SOP Class UID (0000,0003) - UI.

References command_set_, kcenon::pacs::core::dicom_dataset::get_string(), and kcenon::pacs::network::dimse::tag_requested_sop_class_uid.

Referenced by kcenon::pacs::services::n_get_scp::handle_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ requested_sop_instance_uid()

auto kcenon::pacs::network::dimse::dimse_message::requested_sop_instance_uid ( ) const -> std::string
nodiscard

Get the Requested SOP Instance UID (for N-SET, N-GET, N-ACTION, N-DELETE)

Returns
The SOP Instance UID if present
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 158 of file dimse_message.cpp.

158 {
160}
constexpr core::dicom_tag tag_requested_sop_instance_uid
Requested SOP Instance UID (0000,1001) - UI.

References command_set_, kcenon::pacs::core::dicom_dataset::get_string(), and kcenon::pacs::network::dimse::tag_requested_sop_instance_uid.

Referenced by kcenon::pacs::services::n_get_scp::handle_message(), kcenon::pacs::services::ups_push_scp::handle_n_action(), kcenon::pacs::services::ups_watch_scp::handle_n_action(), and kcenon::pacs::services::ups_push_scp::handle_n_get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_action_type_id()

void kcenon::pacs::network::dimse::dimse_message::set_action_type_id ( uint16_t type_id)

◆ set_affected_sop_class_uid()

void kcenon::pacs::network::dimse::dimse_message::set_affected_sop_class_uid ( std::string_view uid)

Set the Affected SOP Class UID.

Parameters
uidThe SOP Class UID
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 116 of file dimse_message.cpp.

116 {
118 uid);
119}
void set_string(dicom_tag tag, encoding::vr_type vr, std::string_view value)
Set a string value for the given tag.
@ UI
Unique Identifier (64 chars max)
std::string_view uid

References command_set_, kcenon::pacs::core::dicom_dataset::set_string(), kcenon::pacs::network::dimse::tag_affected_sop_class_uid, kcenon::pacs::encoding::UI, and uid.

Referenced by kcenon::pacs::network::dimse::make_c_echo_rq(), kcenon::pacs::network::dimse::make_c_echo_rsp(), kcenon::pacs::network::dimse::make_c_find_rq(), kcenon::pacs::network::dimse::make_c_find_rsp(), kcenon::pacs::network::dimse::make_c_store_rq(), kcenon::pacs::network::dimse::make_c_store_rsp(), kcenon::pacs::network::dimse::make_n_action_rsp(), kcenon::pacs::network::dimse::make_n_create_rq(), kcenon::pacs::network::dimse::make_n_create_rsp(), kcenon::pacs::network::dimse::make_n_delete_rsp(), kcenon::pacs::network::dimse::make_n_event_report_rq(), kcenon::pacs::network::dimse::make_n_event_report_rsp(), kcenon::pacs::network::dimse::make_n_get_rsp(), and kcenon::pacs::network::dimse::make_n_set_rsp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_affected_sop_instance_uid()

◆ set_attribute_identifier_list()

void kcenon::pacs::network::dimse::dimse_message::set_attribute_identifier_list ( const std::vector< core::dicom_tag > & tags)

Set the Attribute Identifier List.

Parameters
tagsVector of tags to retrieve
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 205 of file dimse_message.cpp.

206 {
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}
void insert(dicom_element element)
Insert or replace an element in the dataset.
@ AT
Attribute Tag (4 bytes)

References kcenon::pacs::encoding::AT, command_set_, kcenon::pacs::core::dicom_dataset::insert(), and kcenon::pacs::network::dimse::tag_attribute_identifier_list.

Referenced by kcenon::pacs::network::dimse::make_n_get_rq().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_completed_subops()

void kcenon::pacs::network::dimse::dimse_message::set_completed_subops ( uint16_t count)

◆ set_dataset()

void kcenon::pacs::network::dimse::dimse_message::set_dataset ( core::dicom_dataset ds)

Set the data set for this message.

Parameters
dsThe data set to associate with this message
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 86 of file dimse_message.cpp.

86 {
87 dataset_ = std::move(ds);
89}

References dataset_, and update_data_set_type().

Here is the call graph for this function:

◆ set_event_type_id()

void kcenon::pacs::network::dimse::dimse_message::set_event_type_id ( uint16_t type_id)

◆ set_failed_subops()

void kcenon::pacs::network::dimse::dimse_message::set_failed_subops ( uint16_t count)

◆ set_message_id_responded_to()

◆ set_priority()

void kcenon::pacs::network::dimse::dimse_message::set_priority ( uint16_t priority)

◆ set_remaining_subops()

void kcenon::pacs::network::dimse::dimse_message::set_remaining_subops ( uint16_t count)

◆ set_requested_sop_class_uid()

void kcenon::pacs::network::dimse::dimse_message::set_requested_sop_class_uid ( std::string_view uid)

◆ set_requested_sop_instance_uid()

void kcenon::pacs::network::dimse::dimse_message::set_requested_sop_instance_uid ( std::string_view uid)

◆ set_status()

◆ set_warning_subops()

void kcenon::pacs::network::dimse::dimse_message::set_warning_subops ( uint16_t count)

Set the number of warning sub-operations.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 257 of file dimse_message.cpp.

257 {
259 count);
260}
constexpr core::dicom_tag tag_number_of_warning_subops
Number of Warning Sub-operations (0000,1023) - US.

References command_set_, kcenon::pacs::core::dicom_dataset::set_numeric(), kcenon::pacs::network::dimse::tag_number_of_warning_subops, and kcenon::pacs::encoding::US.

Here is the call graph for this function:

◆ status()

auto kcenon::pacs::network::dimse::dimse_message::status ( ) const -> status_code
nodiscard

Get the status code (for response messages)

Returns
The status code value
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 100 of file dimse_message.cpp.

100 {
101 return command_set_.get_numeric<uint16_t>(tag_status).value_or(0);
102}

References command_set_, kcenon::pacs::core::dicom_dataset::get_numeric(), and kcenon::pacs::network::dimse::tag_status.

Referenced by set_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_command_group_length()

void kcenon::pacs::network::dimse::dimse_message::update_command_group_length ( )
private

Calculate and set CommandGroupLength.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 370 of file dimse_message.cpp.

370 {
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}
auto remove(dicom_tag tag) -> bool
Remove an element from the dataset.
@ UL
Unsigned Long (4 bytes)
constexpr core::dicom_tag tag_command_group_length
Command Group Length (0000,0000) - UL.
@ length
Linear distance measurement.

References command_set_, kcenon::pacs::encoding::implicit_vr_codec::encode(), kcenon::pacs::core::dicom_dataset::remove(), kcenon::pacs::core::dicom_dataset::set_numeric(), kcenon::pacs::network::dimse::tag_command_group_length, and kcenon::pacs::encoding::UL.

Referenced by encode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_data_set_type()

void kcenon::pacs::network::dimse::dimse_message::update_data_set_type ( )
private

Update the CommandDataSetType field based on dataset presence.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/network/dimse/dimse_message.h.

Definition at line 360 of file dimse_message.cpp.

360 {
361 if (dataset_) {
364 } else {
367 }
368}
constexpr uint16_t command_data_set_type_present
Value indicating data set is present (any value other than 0x0101)
constexpr uint16_t command_data_set_type_null
Null value indicating no data set present.
constexpr core::dicom_tag tag_command_data_set_type
Command Data Set Type (0000,0800) - US.

References kcenon::pacs::network::dimse::command_data_set_type_null, kcenon::pacs::network::dimse::command_data_set_type_present, command_set_, dataset_, kcenon::pacs::core::dicom_dataset::set_numeric(), kcenon::pacs::network::dimse::tag_command_data_set_type, and kcenon::pacs::encoding::US.

Referenced by clear_dataset(), dimse_message(), and set_dataset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ warning_subops()

auto kcenon::pacs::network::dimse::dimse_message::warning_subops ( ) const -> std::optional<uint16_t>
nodiscard

Member Data Documentation

◆ command_

command_field kcenon::pacs::network::dimse::dimse_message::command_ {}
private

◆ command_set_

◆ dataset_

std::optional<core::dicom_dataset> kcenon::pacs::network::dimse::dimse_message::dataset_
private

◆ message_id_

uint16_t kcenon::pacs::network::dimse::dimse_message::message_id_ {0}
private

The documentation for this class was generated from the following files: