pydicom / pynetdicom

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

Question about management of msg_id (DIMSE Message ID) for SCU role #925

Closed sjswerdloff closed 5 months ago

sjswerdloff commented 5 months ago

The msgid value is an input to the send[n,c]_xxxxx methods of the Association class. If no msg_id is passed in, it defaults to 1. If these methods get called multiple times without passing in a parameter for msg_id, then each of the messages will have the same message ID (1). A straight forward SCU can increment at the calling level, but if the Association is passed around that puts in a requirement for knowing what the last message ID was (assuming one wanted to increment monotonically) and passing that around along with the Association. I think for many scenarios the value of the message ID is not a huge deal. But for a C-MOVE-RQ... that can be important (I believe the message ID associated with the C-MOVE-RQ can be included in a C-STORE-RQ acting on the C-MOVE-RQ). Would it be reasonable to have the Association maintain a monotonically increasing internal counter for msg_id (assuming nothing gets passed in) rather than defaulting to 1? At least until it hits the maximum value (at which point rolling over to 1 seems like a reasonable option).

scaramallion commented 5 months ago

Seems reasonable

sjswerdloff commented 5 months ago

I'll get started on a draft PR.