pynetdicom.presentation.PresentationContext¶
-
class
pynetdicom.presentation.
PresentationContext
¶ A Presentation Context primitive.
Rules
Each Presentation Context (request) contains:
One context ID, an odd integer between 1 and 255.
One abstract syntax.
One or more transfer syntaxes.
Each Presentation Context (response) contains:
One context ID, corresponding to a Presentation Context received from the Requestor
A result, one of 0x00 (acceptance), 0x01 (user rejection), 0x02 (provider rejection), 0x03 (abstract syntax not supported) or 0x04 (transfer syntaxes not supported).
If the result is 0x00, then a transfer syntax.
If any other result, then a transfer syntax may or may not be present.
If the result is not 0x00 then the transfer syntax in the reply is not significant.
The same abstract syntax can be present in more than one Presententation Context.
Only one transfer syntax can be accepted per Presentation Context.
The Presentation Contexts may be sent by the Requestor in any order.
The Presentation Contexts may be sent by the Acceptor in any order.
SCP/SCU Role Selection Negotiation
If no role selection negotiation then the requestor is SCU and the acceptor is SCP
The association acceptor cannot accept a role that has not been proposed (i.e. cannot return 1 when the proposed value is 0).
The association requestor may be SCP only, SCU only or both SCU and SCP.
Requestor
Acceptor
Outcome
Notes
scu_role
scp_role
scu_role
scp_role
Req.
Acc.
N/A
N/A
N/A
N/A
SCU
SCP
Default
True
True
False
False
N/A
N/A
Rejected
True
SCP
SCU
True
False
SCU
SCP
Default
True
SCU/SCP
SCU/SCP
True
False
False
False
N/A
N/A
Rejected
True
SCU
SCP
Default
False
True
False
False
N/A
N/A
Rejected
True
SCP
SCU
False
False
False
False
N/A
N/A
Rejected
As can be seen from the above table there are four possible outcomes:
Requestor is SCU, acceptor is SCP (default roles)
Requestor is SCP, acceptor is SCU
Requestor and acceptor are both SCU/SCP
Requestor and acceptor are neither (context rejected)
-
abstract_syntax
¶ The Presentation Context’s Abstract Syntax.
- Type
pydicom.uid.UID or None
-
as_scp
¶ If True then the association acceptor can act as SCP for the current context, otherwise it cannot. A non-None value is only available after association negotiation has been completed.
- Type
bool or None
-
as_scu
¶ If True then the association acceptor can act as SCU for the current context, otherwise it cannot. A non-None value is only available after association negotiation has been completed.
- Type
bool or None
-
context_id
¶ The Presentation Context’s Context ID.
- Type
int or None
-
result
¶ If part of an A-ASSOCIATE (request) then None. If part of an A-ASSOCIATE (response) then one of 0x00, 0x01, 0x02, 0x03, 0x04.
- Type
int or None
-
scp_role
¶ Only used when acting as an association acceptor. If True then accept when the SCP role is proposed by the requestor, otherwise reject the proposal. If None (default) then no SCP/SCU Role Selection reply will be sent and the default roles will be used.
- Type
bool or None
-
scu_role
¶ Only used when acting as an association acceptor. If True then accept when the SCU role is proposed by the requestor, otherwise reject the proposal. If None (default) then no SCP/SCU Role Selection reply will be sent and the default roles will be used.
- Type
bool
-
transfer_syntax
¶ The Presentation Context’s Transfer Syntax(es).
- Type
list of pydicom.uid.UID
References
-
__init__
()¶ Create a new PresentationContext.
Methods
__init__
()Create a new PresentationContext.
add_transfer_syntax
(syntax)Append a transfer syntax to the presentation context.
Attributes
Return the presentation context’s Abstract Syntax as a UID.
Return True if can act as an SCP for the context.
Return True if can act as an SCU for the context.
Return a namedtuple representation of the presentation context.
Return the presentation context’s ID parameter as an int.
Return True if a proposed SCP role will be accepted.
Return True if a proposed SCU role will be accepted.
Return a descriptive str of the presentation context’s Result.
Return the presentation context’s Transfer Syntaxes as a list.
-
property
abstract_syntax
Return the presentation context’s Abstract Syntax as a UID.
- Returns
- Return type
pydicom.uid.UID
-
add_transfer_syntax
(syntax)¶ Append a transfer syntax to the presentation context.
- Parameters
syntax (pydicom.uid.UID, bytes or str) – The transfer syntax to add to the presentation context.
-
property
as_scp
Return True if can act as an SCP for the context.
-
property
as_scu
Return True if can act as an SCU for the context.
-
property
as_tuple
¶ Return a namedtuple representation of the presentation context.
Intended to be used when the result is 0x00 (accepted) as only the first transfer syntax item is returned in the tuple.
- Returns
A representation of an accepted presentation context.
- Return type
PresentationContextTuple
-
property
context_id
Return the presentation context’s ID parameter as an int.
-
property
scp_role
Return True if a proposed SCP role will be accepted.
-
property
scu_role
Return True if a proposed SCU role will be accepted.
-
property
status
¶ Return a descriptive str of the presentation context’s Result.
- Returns
The string representation of the result.
- Return type
str
-
property
transfer_syntax
Return the presentation context’s Transfer Syntaxes as a list.
- Returns
The transfer syntaxes.
- Return type
list of pydicom.uid.UID