User Data Sub-items (userdataitems)¶
This module contains User Data sub-item helper classes. Each sub-item class provides means for serialization and deserialization to and from binary formats as specified in PS 3.7 of DICOM standard.
-
class
pynetdicom2.userdataitems.
MaximumLengthSubItem
(maximum_length_received, reserved=0, item_length=4)¶ Represents sub-item described in PS 3.8 D.1 Maximum Length Negotiation
Note that item is used in both A-ASSOCIATE-RQ and A-ASSOCIATE-AC PDUs.
Variables: - reserved – this reserved field shall be sent with a value 00H but not tested to this value when received.
- item_length – item length, in the case of this item it’s fixed to 0x0004
- maximum_length_received – P-DATA-TF PDUs size limit
-
total_length
¶ Returns item total length.
This item has a fixed length of 8, so method always returns 8 regardless of specific instance :rtype int :return item total length
-
encode
()¶ Encodes itself into binary form
Returns: binary representation of an item
-
classmethod
decode
(stream)¶ Decodes maximum length sub-item from data stream
:rtype MaximumLengthSubItem :param stream: raw data stream :return decoded maximum length sub-item
-
class
pynetdicom2.userdataitems.
ImplementationClassUIDSubItem
(implementation_class_uid, reserved=0)¶ Represents sub-item described in PS 3.8 D.3.3.2 Implementation Identification Notification
Note that item is used in both A-ASSOCIATE-RQ and A-ASSOCIATE-AC PDUs.
Variables: - reserved – this reserved field shall be sent with a value 00H but not tested to this value when received.
- implementation_class_uid – This variable field shall contain the Implementation-class-uid
-
item_length
¶ Calculates item length
Returns: item length
-
total_length
¶ Returns total item length, including header.
Returns: total item length
-
encode
()¶ Encodes itself into binary form
Returns: binary representation of an item
-
classmethod
decode
(stream)¶ Decodes Implementation Class UID sub-item from data stream
:rtype ImplementationClassUIDSubItem :param stream: raw data stream :return decoded maximum length sub-item
-
class
pynetdicom2.userdataitems.
ImplementationVersionNameSubItem
(implementation_version_name, reserved=0)¶ Represents sub-item described in PS 3.8 D.3.3.2 Implementation Identification Notification
Note that item is used in both A-ASSOCIATE-RQ and A-ASSOCIATE-AC PDUs.
Variables: - reserved – this reserved field shall be sent with a value 00H but not tested to this value when received.
- implementation_version_name – This variable field shall contain the Implementation-version-name
-
item_length
¶ Calculates item length
Returns: item length
-
total_length
¶ Returns total item length, including header.
Returns: total item length
-
encode
()¶ Encodes itself into binary form
Returns: binary representation of an item
-
classmethod
decode
(stream)¶ Decodes Implementation Version Name sub-item from data stream
:rtype ImplementationVersionNameSubItem :param stream: raw data stream :return decoded Implementation Version Name sub-item
-
class
pynetdicom2.userdataitems.
AsynchronousOperationsWindowSubItem
(max_num_ops_invoked, max_num_ops_performed, reserved=0, item_length=4)¶ Represents sub-item described in PS 3.8 D.3.3.3 Asynchronous Operations (And Sub-Operations) Window Negotiation
Note that item is used in both A-ASSOCIATE-RQ and A-ASSOCIATE-AC PDUs.
Variables: - reserved – this reserved field shall be sent with a value 00H but not tested to this value when received.
- item_length – item length, in the case of this item it’s fixed to 0x0004
- max_num_ops_invoked – This field shall contain the Maximum-number-operations-invoked
- max_num_ops_performed – This field shall contain the Maximum-number-operations-performed
-
total_length
¶ Returns total item length, including header.
Returns: total item length
-
encode
()¶ Encodes itself into binary form
Returns: binary representation of an item
-
classmethod
decode
(stream)¶ Decodes Asynchronous Operations Window sub-item from data stream
:rtype AsynchronousOperationsWindowSubItem :param stream: raw data stream :return decoded Asynchronous Operations Window sub-item
-
class
pynetdicom2.userdataitems.
ScpScuRoleSelectionSubItem
(sop_class_uid, scu_role, scp_role, reserved=0)¶ Represents sub-item described in PS 3.8 D.3.3.4 SCP/SCU Role Selection Negotiation
Note that item is used in both A-ASSOCIATE-RQ and A-ASSOCIATE-AC PDUs.
Variables: - reserved – this reserved field shall be sent with a value 00H but not tested to this value when received.
- sop_class_uid – SOP Class UID or Meta SOP Class UID
- scu_role – 0 - non support of the SCU role, 1 - support of the SCU role
- scp_role – 0 - non support of the SCP role, 1 - support of the SCP role.
-
item_length
¶ Calculates item length
Returns: item length
-
total_length
¶ Returns total item length, including header.
Returns: total item length
-
encode
()¶ Encodes itself into binary form
Returns: binary representation of an item
-
classmethod
decode
(stream)¶ Decodes SCP/SCU Role Selection sub-item from data stream
:rtype ScpScuRoleSelectionSubItem :param stream: raw data stream :return decoded SCP/SCU Role Selection sub-item
-
class
pynetdicom2.userdataitems.
SOPClassExtendedNegotiationSubItem
(sop_class_uid, app_info, reserved=0)¶ Represents sub-item described in D.3.3.5 Service-Object Pair (SOP) Class Extended Negotiation.
Note that item is used in both A-ASSOCIATE-RQ and A-ASSOCIATE-AC PDUs.
Variables: - sop_class_uid – service’s SOP Class UID
- app_info – application information specific to Service Class
- reserved – reserved field, defaults to 0x00. In most cases you should not change it’s value or check it
-
item_length
¶ Calculates item length
Returns: item length
-
total_length
¶ Returns total item length, including the header.
Returns: total item length
-
encode
()¶ Encodes itself into binary form
Returns: binary representation of an item
-
classmethod
decode
(stream)¶ Factory method. Creates sub-item from binary stream.
Parameters: stream – binary stream that should be decoded Returns: new sub-item
-
class
pynetdicom2.userdataitems.
UserIdentityNegotiationSubItem
(primary_field, secondary_field='', user_identity_type=2, positive_response_req=0, reserved=0)¶ Represents sub-item described in D.3.3.7.1 User Identity sub-item structure(A-ASSOCIATE-RQ).
Passes user identification information based on login (and password) or kerberos service ticket
Variables: - primary_field – user name or kerberos ticket depending on value of user_identity_type
- secondary_field – password. Used only if user_identity_type has value of 2
- user_identity_type – type of user identification. Defaults to 2 which is username/password identification
- positive_response_req – 0 - no response requested, 1 - positive response requested
- reserved – reserved field, defaults to 0x00. In most cases you should not change it’s value or check it
-
primary_field
¶ Sub-item primary field value.
Meaning of the value depends on the user_identity_type value
Returns: primary field value Return type: str
-
secondary_field
¶ Sub-item secondary field value.
Meaning of the value depends on the user_identity_type value
Returns: secondary field value Return type: str
-
item_length
¶ Calculates item length
Returns: item length
-
total_length
¶ Returns total item length, including header.
Returns: total item length
-
encode
()¶ Encodes itself into binary form
Returns: binary representation of an item
-
classmethod
decode
(stream)¶ Factory method. Creates sub-item from binary stream.
Parameters: stream – binary stream that should be decoded Returns: new sub-item
-
class
pynetdicom2.userdataitems.
UserIdentityNegotiationSubItemAc
(server_response, reserved=0)¶ Represents sub-item described in D.3.3.7.2 User Identity sub-item structure(A-ASSOCIATE-AC).
Server response (accept) user identification sub-item. This item is expected only if positive_response_req was set to 1 in request sub-item.
Variables: - server_response – kerberos service ticket or SAML response, depending on requested user identification type
- reserved – reserved field, defaults to 0x00. In most cases you should not change it’s value or check it
-
item_length
¶ Calculates item length
Returns: item length
-
total_length
¶ Returns total item length, including header.
Returns: total item length
-
encode
()¶ Encodes itself into binary form
Returns: binary representation of an item
-
classmethod
decode
(stream)¶ Factory method. Creates sub-item from binary stream.
Parameters: stream – binary stream that should be decoded Returns: new sub-item
-
class
pynetdicom2.userdataitems.
GenericUserDataSubItem
(item_type, user_data, reserved=0)¶ This class is provided only to allow user data to converted to and from PDUs.
The actual data is not interpreted. This is left to the user.
-
item_length
¶ Calculates item length
Returns: item length
-
total_length
¶ Returns total item length, including header.
Returns: total item length
-
encode
()¶ Encodes itself into binary form
Returns: binary representation of an item
-
classmethod
decode
(stream)¶ Decodes generic data sub-item from data stream
User data value is left in raw string format. The Application Entity is responsible for dealing with it.
Parameters: stream – raw data stream Returns: decoded generic data sub-item
-