exporting contours RT structure sets

535 views
Skip to first unread message

miki725

unread,
Feb 9, 2012, 11:49:31 PM2/9/12
to pydicom
I have a contour set along axial view for a structure. The contours
are a result of segmentations.

How can I export that to a dicom structure set file. I am new to the
library and so far was unable to figure that out. I need to do the
opposite of this post:
http://groups.google.com/group/pydicom/browse_thread/thread/71b1bb0561b22f3d/4dc8cf8e404c887d?lnk=gst&q=structure#4dc8cf8e404c887d.

Thank you.

Darcy Mason

unread,
Feb 14, 2012, 9:45:32 PM2/14/12
to pydicom

On Feb 9, 11:49 pm, miki725 <miki...@gmail.com> wrote:
> I have a contour set along axial view for a structure. The contours
> are a result of segmentations.
>
> How can I export that to a dicom structure set file. I am new to the
> library and so far was unable to figure that out. I need to do the
> opposite of this post:http://groups.google.com/group/pydicom/browse_thread/thread/71b1bb056....
>

I'm not exactly clear on the question, but I'll try a general answer
and if needed you can fill in some more details.

To export to a file, I would recommend having a "template" DICOM file
that is structured quite similar to what your output will be. Read
that in, then modify the parts you need to change. It is possible to
create a full file "from scratch" but that's a little trickier (see
simple example in the source examples folder for a start). You'd have
to go to the DICOM standard to figure out all the required fields and
construct all of them.

Now down to the details level... if you have structure via a
"template" and just want to modify them you can just set the values
with the same syntax in the link you gave.

ss.ROIContours[0].Contours[0].ContourData = [1, 2, 3, 4]

One issue though, and maybe this is where you are having problems, is
that until a recent revision, setting individual items within an
existing list didn't save to the file. The answer is to set the entire
list. See [1] for more info. The next release will not have this
issue.

Please provide some more specifics if the above does not help.

Darcy

[1] http://groups.google.com/group/pydicom/browse_thread/thread/bc6e19b6afcb342d/2ce2865759fa4e43

miki725

unread,
Feb 14, 2012, 10:02:08 PM2/14/12
to pydicom
Thank you so much.

I do have a template dicom file and I was trying to set only one item
in the list. You just saved me two weeks worth of trouble (trying to
use a c++ utility).

Again. THANK YOU!
> [1]http://groups.google.com/group/pydicom/browse_thread/thread/bc6e19b6a...
Reply all
Reply to author
Forward
0 new messages