pydicom / pynetdicom

A Python implementation of the DICOM networking protocol
https://pydicom.github.io/pynetdicom
MIT License
500 stars 176 forks source link

Store request succeeds with 2.0.2 but fails with 2.1.0 #952

Closed nbelakovski-mssm closed 4 weeks ago

nbelakovski-mssm commented 1 month ago

Describe the bug I'm trying to download some data from a PACS, and it fails for 2.1.0, but it succeeds if I downgrade to 2.0.2

Expected behavior I expected it to successfully download :)

Steps To Reproduce I'm not sure how to instruct others to reproduce it because I'm not entirely sure what's going on, but one thing that I've discovered is that while 4/5 files download successfully with 2.1.0, the one that fails is failing with presentation context 117 which translates to "Grayscale Softcopy Presentation State Storage." With 2.0.2 this context is proposed and accepted, but with 2.1.0 it is proposed and rejected. See the logs below for some details. I'm new to DICOM so if there are suggestions for further detective work I could do I'd be happy to entertain them.

Your environment I'm running this from a python:3.12-alpine docker container on x86 Linux

/workdir # python -c "import platform; print(platform.platform())"
Linux-5.4.0-187-generic-x86_64-with
/workdir # python -c "import sys; print('Python ', sys.version)"
Python  3.12.4 (main, Jul 22 2024, 23:17:26) [GCC 13.2.1 20240309]
/workdir # python -c "import pydicom; print('pydicom ', pydicom.__version__)"
pydicom  2.4.4
/workdir # python -c "import pynetdicom; print('pynetdicom ', pynetdicom.__version__)"
pynetdicom  2.1.0

log.202.txt log.210.txt

scaramallion commented 1 month ago

What does your code look like?

nbelakovski-mssm commented 1 month ago

What does your code look like?

Not substantially or meaningfully different from the example for send_c_store (I had mentioned that in an earlier draft of this issue but it got lost somehow, sorry about that).

However I believe I've figured it out. I was able to solve it by switching from StoragePresentationContexts to AllStoragePresentationContexts. I guess the default value of StoragePresentationContexts changed between 2.0.2 and 2.1.0. Do you think it might make sense to have the examples use AllStoragePresentationContexts?

scaramallion commented 1 month ago

Yeah, that was my suspicion.

The problem is that association requestors can only ask for a maximum of 128 presentation contexts, which is why StoragePresentationContexts exists and is used in the documentation.

nbelakovski-mssm commented 1 month ago

So then why did it work with AllStoragePresentationContexts which has 157 elements? python -c 'from pynetdicom import AllStoragePresentationContexts as a; print(len(a))'

Did it just take the first 128, and I just got lucky that ones I needed were in there?

scaramallion commented 1 month ago

Honestly, without seeing your code I can't really make any guesses.