Reading DICOM-file as stream with Events

231 views
Skip to first unread message

Anatoly Tyurin

unread,
Feb 8, 2015, 7:19:15 AM2/8/15
to cornerston...@googlegroups.com
Hi, Chris.

I didn't find out is it possible to read DICOM-file as stream with generating events when some element appears?

My task is to get DICOM-file from user/3rd side apps and put it to file storage. I have 2 streams and small buffer between (pipes mechanism).
Is it possible to subsribe to some onElement event to get general elements like PatientID and Study?

If it' not, do you have plan to implement it? In general is it possible to do at all or the architecture doesn't suit it?

Thanks in advance,
Anatoly

Chris Hafey

unread,
Feb 8, 2015, 7:46:19 AM2/8/15
to cornerston...@googlegroups.com
Hi Anatoly,

The dicomParser library does not currently support reading from streams or event generation.  I also have a need for stream based parsing and event generation but have already decided to create a new project for this:

1) dicomParser was designed for use in a browser and I think it should stay that way
2) I want to switch to JavaScript ES6 for everything I am doing
3) I have plans to expand the dicom support beyond just file I/O to include a full port 104 DIMSE stack

There is another node.js dicom library which supports streaming and event generation today:


I haven't tried it out myself, but you may want to take a look and see if it meets your needs.  As part of #3 above, I plan to reach out to the author to see if we can combine forces somehow.

Chris

Anatoly Tyurin

unread,
Feb 8, 2015, 3:50:42 PM2/8/15
to cornerston...@googlegroups.com
Thanks Chris for answer.

Yes, of cause I know about node-dicom lib. Cool cornerstone (with its tools on top) is better for goal like showing dicom-image in browser. And our team has been already used it for this. But new use case has appeared recently.

Chris Hafey

unread,
Feb 8, 2015, 8:02:21 PM2/8/15
to cornerston...@googlegroups.com
OK I reread your original post and now see that you are trying to do this client side - I misunderstood. One strategy is to modify dicomParser to return the dataset of the elements it has already parsed when it throws an exception (e.g. due to a short read).  I actually started implementing this a few weeks back and it was working for some cases but not all.  I think adding it for all cases was going to take more time than I had - but this strategy does fit within the architecture and something I would accept as a contribution.  If you want to work on this with me, let me know.

Chris

Chris Hafey

unread,
Feb 9, 2015, 9:26:53 AM2/9/15
to cornerston...@googlegroups.com
I thought up a way to easily do this and went ahead and coded it this morning and pushed it.  If a parse error occurs, the exception thrown will include a property named dataSet which will contain the dataSet of items successfully parsed before the error.  Can you give it a shot and let me know how it works?


Chris
Reply all
Reply to author
Forward
0 new messages