User Data Sub-items

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 netdicom2.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.

Parameters:
  • 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 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 netdicom2.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

Parameters:
  • 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
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 netdicom2.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.

Parameters:
  • 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 netdicom2.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.

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