Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Adjust default StoragePresentationContexts to match DCMTK implementation #980

Merged
merged 6 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/examples/storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ single CT dataset.
Of course it's rarely the case that someone wants to store just CT images,
so you can also use the inbuilt
:attr:`~pynetdicom.presentation.StoragePresentationContexts` which contains
presentation contexts for the first 128 storage SOP Classes when setting
presentation contexts for the first 120 storage SOP Classes when setting
the requested contexts, or just add as many contexts as you need.

.. code-block:: python
Expand Down
13 changes: 7 additions & 6 deletions docs/user/ae.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Adding presentation contexts all at once:
>>> ae.requested_contexts = StoragePresentationContexts

Here :attr:`~pynetdicom.presentation.StoragePresentationContexts` is a
prebuilt list of presentation contexts containing (almost) all the Storage
Service Class' :dcm:`supported SOP Classes <part04/sect_B.5.html>`,
prebuilt list of presentation contexts containing 120 of the most commonly used Storage
Service Classes' :dcm:`supported SOP Classes <part04/sect_B.5.html>`,
and there's a :ref:`similar list<api_presentation_prebuilt>` for all
the supported service classes.
Alternatively you can build your own list of presentation contexts, either
Expand All @@ -115,12 +115,13 @@ Combining the all-at-once and one-by-one approaches:
>>> from pynetdicom import AE, StoragePresentationContexts
>>> from pynetdicom.sop_class import Verification
>>> ae = AE()
>>> ae.requested_contexts = StoragePresentationContexts[:127]
>>> ae.requested_contexts = StoragePresentationContexts
>>> ae.add_requested_context(Verification)

As the association *Requestor* you're limited to a total of 128 requested
presentation contexts, so attempting to add more than 128 contexts will raise
a :class:`ValueError` exception.
a :class:`ValueError` exception. StoragePresentationContexts consists of 120 of most commonly used Storage
mdebic marked this conversation as resolved.
Show resolved Hide resolved
Service Classes, therefore you are able to add 8 additional Service Classes without rasing a :class:`ValueError` exception.
mdebic marked this conversation as resolved.
Show resolved Hide resolved

When you add presentation contexts as shown above, the following transfer
syntaxes are used by default for each context:
Expand Down Expand Up @@ -285,8 +286,8 @@ Adding presentation contexts all at once:
>>> ae.supported_contexts = StoragePresentationContexts

Here :attr:`~pynetdicom.presentation.StoragePresentationContexts` is a prebuilt
:class:`list` of presentation contexts containing (almost) all the Storage
Service Class' :dcm:`supported SOP Classes<part04/sect_B.5.html>`,
:class:`list` of presentation contexts containing 120 of the most commonly used Storage
Service Classes' :dcm:`supported SOP Classes<part04/sect_B.5.html>`,
and there's a :ref:`similar list<api_presentation_prebuilt>` for
all the supported service classes. Alternatively you can build your own list
of presentation contexts, either through creating new
Expand Down
6 changes: 2 additions & 4 deletions docs/user/association.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,13 @@ also acting as a Storage SCP), plus a *User Identity Negotiation* item:

ae = AE()
# Contexts supported as a Storage SCP - requires Role Selection
# Note that we are limited to a maximum of 128 contexts so we
# only include 127 to make room for the QR Get context
ae.requested_contexts = StoragePresentationContexts[:127]
ae.requested_contexts = StoragePresentationContexts
mdebic marked this conversation as resolved.
Show resolved Hide resolved
# Contexts proposed as a QR SCU
ae.add_requested_context = PatientRootQueryRetrieveInformationModelGet

# Add role selection items for the contexts we will be supporting as an SCP
negotiation_items = []
for context in StoragePresentationContexts[:127]:
for context in StoragePresentationContexts:
role = build_role(context.abstract_syntax, scp_role=True)
negotiation_items.append(role)

Expand Down
15 changes: 1 addition & 14 deletions pynetdicom/apps/getscu/getscu.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
PatientRootQueryRetrieveInformationModelGet,
StudyRootQueryRetrieveInformationModelGet,
PatientStudyOnlyQueryRetrieveInformationModelGet,
EncapsulatedSTLStorage,
EncapsulatedOBJStorage,
EncapsulatedMTLStorage,
)


Expand Down Expand Up @@ -248,16 +245,6 @@ def main(args=None):
APP_LOGGER.exception(exc)
sys.exit(1)

# Exclude these SOP Classes
_exclusion = [
EncapsulatedSTLStorage,
EncapsulatedOBJStorage,
EncapsulatedMTLStorage,
]
store_contexts = [
cx for cx in StoragePresentationContexts if cx.abstract_syntax not in _exclusion
]

# Create application entity
# Binding to port 0 lets the OS pick an available port
ae = AE(ae_title=args.calling_aet)
Expand All @@ -270,7 +257,7 @@ def main(args=None):
ae.add_requested_context(PatientRootQueryRetrieveInformationModelGet)
ae.add_requested_context(StudyRootQueryRetrieveInformationModelGet)
ae.add_requested_context(PatientStudyOnlyQueryRetrieveInformationModelGet)
for cx in store_contexts:
for cx in StoragePresentationContexts:
ae.add_requested_context(cx.abstract_syntax)
# Add SCP/SCU Role Selection Negotiation to the extended negotiation
# We want to act as a Storage SCP
Expand Down
Loading
Loading