binary nrrd file to RTStruct (it's a polyline type of structure, right?)

1,390 views
Skip to first unread message

Yi Gao

unread,
Nov 14, 2010, 12:53:41 AM11/14/10
to Plastimatch, yi....@gatech.edu
Dear group,

I am trying to export a binary nrrd file (or mha file), called a.nrrd,
to a RTStruct (it is a polyline type-of structure, right?)

The a.nrrd is the segmentation of a series of DICOM files in ct-dir/
directory.

Thanks to the plastimatch, I think I can export the a.nrrd as a series
of DICOM *image* files. Using "plastimatch convert --input a.nrrd --
output-dicom ../segDicomDir"

However, I was expecting a series of contours, saved in a single .dcm
file.

Could I know if there is a way to do that in plastimatch?

Moreover could I know if the output DICOM files (images or contour
structures) can be loaded into Eclipse? (Because when I was using the
"Converts-->Create DICOM series" in 3D Slicer to convert a binary
image to a series of DICOM images, the results can be loaded in Slicer
and itkSNAP, but not Eclipse...)

Thank you for any hint!

Best,
yi

Greg Sharp

unread,
Nov 14, 2010, 2:57:16 PM11/14/10
to plast...@googlegroups.com, gaoy...@gmail.com, yi....@gatech.edu

Hi Yi,

Yes, RT structures are a set of polylines. The plastimatch
converter can indeed convert images to polylines for making RT structs.
I have never tried import to Eclipse, but I guess it should be ok.
Here are some hints:

(1) You specify that a.nrrd is a "structure set image" on the command
line, like this:

plastimatch convert --input-ss-img a.nrrd --output-dicom foo

(2) The structure set image needs to be in a special format: each voxel
should be a 32-bit unsigned int, where each bit of the unsigned int
marks if the voxel is contained in one of (up to) 32 separate
structures. If your image isn't in this format, it won't work easily.

(3) In order to set the correct names for the structures, you can
supply a "ss list" file, like this:

plastimatch convert --input-ss-img a.nrrd --input-ss-list a.txt

An example of the ss list format is like this:

0|255\0\0|Patient
1|127\127\0|Tumor
2|0\255\0|R Lung

The first column is the "bit number" within the 32-bit unsigned integer.
The second column is the RGB values for the structure color.
The third column is the name of the structure.

(4) In order for the RT structure set to load in a commercial system,
you (almost always) have to match DICOM UIDs. This means that you need
to tell plastimatch which CT image the structure set should be attached
to. If your CT image is in the directory "my_ct", you do it like this:

plastimatch convert --input-ss-img a.nrrd --dicom-dir my_ct

If it is a newly created CT, you can create both at the same time:

plastimatch convert --input ct.nrrd --input-ss-img a.nrrd \
--output-dicom foo

I also had problems with images created with ITK-based programs such
as 3D Slicer. The most common reasons are: (a) images are not defined
as CT modality, (b) they are missing SliceThickness tag, or (c) they are
missing slope/offset tags. Plastimatch CT images are more likely to
work correctly, but I don't have Eclipse, so unfortunately I can't test.

-Greg

Yi Gao

unread,
Nov 14, 2010, 5:18:33 PM11/14/10
to Plastimatch, yi....@gatech.edu, greg...@gmail.com
Dear Dr. Sharp,

Thank you so much for the detailed answer.

I did the following things but still got some error:

1.
Load a directory of CT DICOM images (from http://www.insight-journal.org/browse/publication/316
"Exporting Contours to DICOM-RT Structure Set"), in ctDir, to Slicer,
and do a segmentation on the mandible using the RSS segmentation,
which gives a unsigned char nrrd iamge, mandible.nrrd. It is 0-1 where
0 is background and 1 is mandible.

2.
use unu to convert the mandible.nrrd to an unsigned int 32 bit
mandible_uint.nrrd.

3.
I used the

plastimatch convert --input-ss-img mandible_uint.nrrd --dicom-dir
ctDir --output-dicom M --input-ss-list a.txt

where the a.txt is:

0|255\0\0|mandible
1|255\255\0|a

(I also tried a.txt as:
0|255 0 0|mandible
1|255 255 0|a

or

0|255 0 0|mandible
1|255 255 0|a
2|255 255 255|b
3|0 255 0|c
4|0 255 1|d
5|0 255 2|e
6|0 255 3|f
7|0 255 4|g
8|0 255 5|h
9|0 255 6|i
10|0 255 7|j
11|0 255 8|k
12|0 255 9|l
13|0 255 10|m
14|0 255 110|n
)

3.1

No matter which ss-list file above I used, I get the same output
message ending like:
......
Substituted in name Unknown_structure
Substituted in name Unknown_structure
Substituted in name Unknown_structure
Hello from gdcm_rtss_save
Finished!

3.2
And I get a sub-dir M, inside of which there is a ss.dcm. I think this
should be the DICOM RT file I was expecting.

4.
Then, since I have not software to directly visualize that RT file, I
converted back again to a nrrd file, I did

plastimatch convert --input ss.dcm --dicom-dir ../ctDir --output-ss-
img a.nrrd

4.1
I got some messages like:
WARNING: In /home/digua/usr/package/build/InsightToolkit-3.20.0/Code/
IO/itkGDCMImageIO.cxx, line 348
GDCMImageIO (0x12af4f0): The DICOM file: ss.dcm does not have a
preamble.

4.2
The a.nrrd file is generated, however, it is all-zero.....



Could I get any hint on which step I was wrong?

Moreover, could I also know if there's some RT structure visualization
software available? So that I can avoid the 4th step above.

Thirdly, is there some example DICOM data I can use, to replace the
ones I used, just to synchronize everything with you?

(I used itk 3.20 configured as requested on plastimatch installation
page)

Thank you very much!

Best,
yi

Greg Sharp

unread,
Nov 14, 2010, 11:50:50 PM11/14/10
to Yi Gao, Plastimatch, yi....@gatech.edu

Hi Yi,

Your understanding of the process seems to be perfect.

I followed the same procedure, and got the same results.
The problem was a bug in plastimatch which I fixed. Could you
update and retry?

Regarding the question of inspecting the DICOM-RT structure
sets, I also sometimes create images like you did. The
other method that I use is "dcmdump". The actual contours
are stored in a section which looks like this:

(3006,0042) CS [CLOSED_PLANAR] # 14, 1 ContourGeometricType
(3006,0046) IS [591] # 4, 1 NumberOfContourPoints
(3006,0050) DS [17.7731\123.779\-187.5\16.5036\123.779\-187.5\15.234\123.779\-187....

If you don't find these sections, you will know that the contours
weren't created. You can also find things like contour names, etc.

-Greg

Yi Gao

unread,
Nov 15, 2010, 10:25:34 AM11/15/10
to Plastimatch, greg...@gmail.com, yi....@gatech.edu
Dear Dr. Sharp,

Yes it works!!!!

I svn up, compile again. Then I converted the binary nrrd to RT
structure and re-converted back to nrrd and everything is right!

Thank you so much for your help! And thank you so much for the great
package!

Could I know if there is plans for adding CUDA or openCL support for
registration with MI metric in plastimatch?


Best,
yi


On Nov 14, 11:50 pm, Greg Sharp <gregsh...@gmail.com> wrote:
> Hi Yi,
>
> Your understanding of the process seems to be perfect.
>
> I followed the same procedure, and got the same results.
> The problem was a bug in plastimatch which I fixed.  Could you
> update and retry?
>
> Regarding the question of inspecting the DICOM-RT structure
> sets, I also sometimes create images like you did.  The
> other method that I use is "dcmdump".  The actual contours
> are stored in a section which looks like this:
>
> (3006,0042) CS [CLOSED_PLANAR]          #  14, 1 ContourGeometricType
> (3006,0046) IS [591]                    #   4, 1 NumberOfContourPoints
> (3006,0050) DS [17.7731\123.779\-187.5\16.5036\123.779\-187.5\15.234\123.779\-187....
>
> If you don't find these sections, you will know that the contours
> weren't created.  You can also find things like contour names, etc.
>
> -Greg
>
> On Sun, 14 Nov 2010 14:18:33 -0800 (PST)
>

James

unread,
Nov 15, 2010, 6:18:50 PM11/15/10
to Plastimatch
Hello Yi,

I am very happy that you enjoy the plastimatch package!

CUDA accelerated MI registration is already a part of plastimatch. In
your command file, you can use the threading command to enable CUDA
acceleration of MI. For example:

-----------------------------
# command_file.txt
[GLOBAL]
fixed=ct2.mha
moving=ct1.mha
img_out=warped_1.mha
xform_out=bspline.txt

[STAGE]
xform=bspline
impl=plastimatch
metric=mi
threading=cuda
max_its=50
grid_spac=30 30 30
-----------------------------

Then invoke plastimatch from the command line:

./plastimatch register command_file.txt

-- James

anitha s murthy

unread,
Sep 10, 2012, 4:44:10 AM9/10/12
to plast...@googlegroups.com, yi....@gatech.edu
i need to convert the rt struct data to rdf format.... i have of method of converting rt struct data to xml then xml to rdf triple storage.... but i am trying to convert rt struct data to rdf directly without using xml step... can it be done? can some one help me in this idea

Sharp, Gregory C.

unread,
Sep 10, 2012, 10:44:13 AM9/10/12
to plast...@googlegroups.com, yi....@gatech.edu
Hi -- I'm not aware of a standard schema for rt structure sets in xml or rdf.
Which applications use these?  Could you please post a link?  -Greg
 
 

From: plast...@googlegroups.com [mailto:plast...@googlegroups.com] On Behalf Of anitha s murthy
Sent: Monday, September 10, 2012 4:44 AM
To: plast...@googlegroups.com
Cc: yi....@gatech.edu
Subject: [Plastimatch] Re: binary nrrd file to RTStruct (it's a polyline type of structure, right?)

The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

Bhawna

unread,
Aug 27, 2014, 7:28:53 PM8/27/14
to plast...@googlegroups.com, yi....@gatech.edu
Hello everyone,

Is there a tool to convert RTstruct file to XML?

thanks,
Bhawna

Sharp, Gregory C.

unread,
Aug 27, 2014, 8:38:33 PM8/27/14
to plast...@googlegroups.com, yi....@gatech.edu

Hi Bhawna,


Which XML schema would be appropriate for this task?

 

Greg

 

From: plast...@googlegroups.com [mailto:plast...@googlegroups.com] On Behalf Of Bhawna
Sent: Wednesday, August 27, 2014 7:29 PM
To: plast...@googlegroups.com
Cc: yi....@gatech.edu
Subject: [Plastimatch] Re: binary nrrd file to RTStruct (it's a polyline type of structure, right?)

 

Hello everyone,

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

Reply all
Reply to author
Forward
0 new messages