storescp: number of series, number of images?

337 views
Skip to first unread message

Ross Mitchell

unread,
Apr 26, 2016, 8:27:08 PM4/26/16
to pynetdicom
Hello:

Thank you very much for pynetdicom (and pydicom) - very nice. I downloaded and tried the storescp.py example, and it worked perfectly, "right out of the box"! Fantastic!

What I need to do now is determine when a series transmission has ended, so that I can do some processing on all the images in a series. 

For example, I might want to extract the 2D pixel data from each image in the series, then stack all of the 2D arrays to create a 3D volume, then save the volume as a separate data file.

I read Patrice's answer to a similar question for SCU (when have all series/images in a study been sent):


I have done additional research, and it seems that it may not generally be possible to determine when all data in a study has been received (!?!)... See:


Hard to believe... An alternate might be a function (call back) that gets called when the SCP decides the transmission is over - perhaps after a timeout, or a closed association.

Is such a call back available in pynetdicom? Would it be difficult to add?

Any help with the general problem of deciding when a storescp can conclude a transmission is over would be greatly appreciated.

Sincerely,

--
J Ross Mitchell, PhD
Professor of Radiology, Mayo Clinic College of Medicine
Senior Associate Consultant, Department of Research
Precision Neurotherapeutics Innovations Lab
Mayo Clinic, 5777 East Mayo Blvd., Phoenix AZ 85054
SSB 2-700

Patrice Munger

unread,
Apr 28, 2016, 9:37:17 AM4/28/16
to pynetdicom
Can you assume that all images are sent over a single association? If its the case, You can the use the association release to determine when the series transfer has completed. To be more specific here is how you could proceed:
  • Encapsulate you application entity instance in a class with an attribute initialized to an empty list.
  • In your store callback, append received datasets to this list.
  • In you association release callback, process the list, which presumably contains all the dataset in the series.
You could also do the same at module level by using a global variable.

Hope it helps!

ta...@zebra-med.com

unread,
May 2, 2016, 5:09:05 PM5/2/16
to pynetdicom
After a short research with a serious PACS vendor, I implemented it with a timeout mechanism - once a DICOM of specific study didn't arrive for X seconds (e.g. 120 seconds), mark it as done.

You can see other soultion, such as the dcmtk storescp suggest the same solution:
  -tos  --eostudy-timeout  [t]imeout: integer
          specifies a timeout of t seconds for end-of-study
          determination

Brian O’Brien

unread,
Mar 30, 2017, 10:09:58 PM3/30/17
to pynetdicom
Hi Ross.
I think I can help you with that.
I'm just about to try this very same thing!

Brian O’Brien

unread,
Mar 31, 2017, 10:57:37 AM3/31/17
to pynetdicom
There is a way Ross...


On Tuesday, April 26, 2016 at 6:27:08 PM UTC-6, Ross Mitchell wrote:

Patrice Munger

unread,
Mar 31, 2017, 6:35:35 PM3/31/17
to pynet...@googlegroups.com
I'm not sure I fully understand the issue, but here are some thoughts. 

If the SCU send the series in a single association, the call of the onrelease will tell you that transmission is over. So if you accumulate all instance in a list (in the onreceive callback), you will have you're whole series ready to be processed. If many series are sent in an association you can just do the same thing, accumulating instances in different lists (perhaps in a dict of lists, where the key would be the series UID), an then process the series you're interested in after the onrelease has been called. 

I don't think there a general solution to this problem: it depends on the way the SCU sends the data.



If you believe you have received this electronic transmission in error, please notify the original sender of this email and destroy all copies of this communication.

--
You received this message because you are subscribed to the Google Groups "pynetdicom" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynetdicom+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Patrice Munger
Reply all
Reply to author
Forward
0 new messages