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

send_c_cancel example #535

Closed
medihack opened this issue Sep 3, 2020 · 2 comments · Fixed by #644
Closed

send_c_cancel example #535

medihack opened this issue Sep 3, 2020 · 2 comments · Fixed by #644

Comments

@medihack
Copy link

medihack commented Sep 3, 2020

I am having difficulties to understand send_c_cancel(msg_id, context_id) and can't find an easy example for it. From where do I get the context_id?

Let's say I want to cancel a send_c_get operation with multiple accepted contexts (e.g. by requesting `StoragePresentationContexts´). How do I know which context at the end is used, and how it's context_id is?

I found some usage in test_service_qr.py, but I don't understand it either. Why are there two calls directly after each other (assoc.send_c_cancel(1, 3), assoc.send_c_cancel(11142, 1)). And where do these context IDs come from?

And a last question ... I guess the canceling must always come from the same association (maybe from another thread). Is that right?

@scaramallion scaramallion added this to the v2.0.0 milestone Sep 3, 2020
@scaramallion
Copy link
Member

The context_id is the ID of the presentation context you're using for the C-GET operation. Hmm, I admit it's not straight forward to get, I'll probably make that a bit easier next version.

from pynetdicom.sop_class import PatientRootQueryRetrieveInformationModelGet
# assuming this is the query model you're using in `send_c_get()`
to_match = PatientRootQueryRetrieveInformationModelGet
cxs = [cx for cx in assoc.accepted_contexts if cx.abstract_syntax == to_match]
cx_id = cxs[0].context_id

Might need a bit of tweaking if you're requesting multiple contexts with the same abstract syntax.

Yeah, cancellation must come from the same association.

@medihack
Copy link
Author

medihack commented Sep 4, 2020

Thanks a lot, this makes it clear. I leave the issue open to track it for a possible enhancement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants