pynetdicom.presentation.negotiate_as_requestor

pynetdicom.presentation.negotiate_as_requestor(rq_contexts: List[PresentationContext], ac_contexts: List[PresentationContext], roles: Dict[UID, Tuple[bool | None, bool | None]] | None = None) List[PresentationContext][source]

Process the Presentation Contexts as an Association Requestor.

The Acceptor has processed the Requestor’s presentation context definition list and returned the results. We want to do two things:

  • Process the SCP/SCU Role Selection Negotiation items

  • Return a nice list of PresentationContext with the Results and original Abstract Syntax values to make things easier to use.

PresentationContextItemRQ

  • Presentation context ID

  • Abstract Syntax: one

  • Transfer syntax: one or more

PresentationContextItemAC

  • Presentation context ID

  • Result: one of 0x00, 0x01, 0x02, 0x03 or 0x04

  • Transfer syntax: one, not to be tested if result is not 0x00

Parameters:
  • rq_contexts (list of PresentationContext) – The Presentation Contexts sent to the peer as the A-ASSOCIATE’s Presentation Context Definition List.

  • ac_contexts (list of PresentationContext) – The Presentation Contexts return by the peer as the A-ASSOCIATE’s Presentation Context Definition Result List.

  • roles (dict or None) – If the Acceptor has included one or more SCP/SCU Role Selection Negotiation items then this will be a dict of {'SOP Class UID' : (SCU role, SCP role)}, otherwise None (default)

Returns:

The contexts in the returned Presentation Context Definition Result List, with added Abstract Syntax value. Items are sorted in increasing Context ID value and the SCP/SCU roles are set as per the negotiated outcome.

Return type:

list of PresentationContext