pynetdicom.pdu_items.PresentationContextItemRQ

class pynetdicom.pdu_items.PresentationContextItemRQ

A Presentation Context (RQ) Item.

Presentation Contexts (RQ) Items are used by the association requestor to propose Abstract Syntaxes (specifications of data elements with associated semantics) and Transfer Syntaxes (sets of encoding rules) [1].

abstract_syntax

The Presentation Context Item’s Abstract Syntax (if available).

Type:pydicom.uid.UID or None.
abstract_transfer_syntax_sub_items

The Abstract/Transfer Syntax Sub-Items field value. The order of the items is not guaranteed.

Type:list of AbstractSyntaxSubItem and TransferSyntaxSubItem
item_length

The number of bytes from the first byte following the Item Length field to the last byte of the Item.

Type:int
item_type

The Item Type field value (0x20).

Type:int
presentation_context_id

The Presentation Context ID field value, an odd integer between 1 and 255.

Type:int or None
transfer_syntax

The Presentation Context Item’s Transfer Syntax(es) (if available).

Type:list of pydicom.uid.UID

Notes

A Presentation Context (RQ) Item requires the following parameters:

  • Item type (1, fixed value, 0x20)
  • Item length (1)
  • Presentation context ID (1)
  • Abstract/Transfer Syntax Sub-items (1)
    • Abstract Syntax Sub-item (1)
      • Item type (1, fixed, 0x30)
      • Item length (1)
      • Abstract syntax name (1)
    • Transfer Syntax Sub-items (1 or more)
      • Item type (1, fixed, 0x40)
      • Item length (1)
      • Transfer syntax name(s) (1 or more)

Encoding

When encoded, a Presentation Context (RQ) Item has the following structure, taken from Table 9-13 [2] (offsets shown with Python indexing). Items are always encoded using Big Endian [3].

Offset Length Description
0 1 Item type
1 1 Reserved
2 2 Item length
4 1 Presentation context ID
5 1 Reserved
6 1 Reserved
7 1 Reserved
8 Variable Abstract/transfer syntax sub-items

References

[1]DICOM Standard, Part 8, Annex B
[2]DICOM Standard, Part 8, Section 9.3.2.2
[3]DICOM Standard, Part 8, Section 9.3.1
__init__()

Initialise a new Presentation Context (RQ) Item.

Methods

__init__() Initialise a new Presentation Context (RQ) Item.
decode(bytestream) Decode bytestream and use the result to set the field values of the PDU item.
encode() Return the encoded PDU as bytes.
from_primitive(primitive) Set the item’s values using a Presentation Context primitive.
to_primitive() Return a PresentationContext primitive from the current Item.

Attributes

abstract_syntax Return the Abstract Syntax, if available.
context_id Return the item’s Presentation Context ID field value as an int.
item_length Return the item’s Item Length field value as an int.
item_type Return the item’s Item Type field value as an int.
transfer_syntax Return the Transfer Syntax(es).
abstract_syntax

Return the Abstract Syntax, if available.

Returns:
Return type:pydicom.uid.UID or None
context_id

Return the item’s Presentation Context ID field value as an int.

decode(bytestream)

Decode bytestream and use the result to set the field values of the PDU item.

Parameters:bytestream (bytes) – The PDU data to be decoded.
encode()

Return the encoded PDU as bytes.

Returns:The encoded PDU.
Return type:bytes
from_primitive(primitive)

Set the item’s values using a Presentation Context primitive.

Parameters:primitive (presentation.PresentationContext) – The primitive to use to set the Item’s field values.
item_length

Return the item’s Item Length field value as an int.

item_type

Return the item’s Item Type field value as an int.

to_primitive()

Return a PresentationContext primitive from the current Item.

Returns:The primitive representation of the current Item.
Return type:presentation.PresentationContext
transfer_syntax

Return the Transfer Syntax(es).

Returns:
Return type:list of pydicom.uid.UID