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