3
votes

I'm currently working with DICOM-RT files (which contain DICOM along with dose delivery data and structure set files). I'm mainly interested in the "structure set" file (i.e. RTSS.dcm), which contains the set of contour points for an ROI of interest. In particular, the contour points surround a tumor volume. For instance, a tumor would have a set of 5 contours, each contour being a set of points that encircle that slice of the tumor.

I'm trying to use MatLab to use these contour points to construct a tumor volume in a binary 3D matrix (0 = nontumor, 1=tumor), and need help.

One possible approach is to fill each contour set as a binary slice, then interpolate the volume between slices. So far I've used the fill or patch function to create binary cross-sections of each contour slice, but I'm having difficulty figuring out how to interpolate these binary slices into a 3D volume. None of the built-in functions appear to apply to this particular problem (although maybe I'm just using them wrong?). A simple linear interpolation doesn't seem appropriate either, since the edges of one contour should blend into the adjacent contour in all directions.

Another option would be to take the points and tesselate them (without making slices first). However, I don't know how to make MatLab only tesselate the surface of the tumor and not intersecting the tumor volume. Currently it seems to find triangles within the tumor. If I could get it into just a surface, I'm not sure how to take that and convert it into a binary 3D matrix volume either.

Does anyone have experience with either 3D slice interpolation OR tesselation techniques that might apply here? Or perhaps any relevant toolkits that exist? I'm stuck... :(

I'm open to approaches in other languages as well: I'm somewhat familiar with C# and Python, although I assumed MatLab would handle the matrix operations a little easier.

Thanks in advance!

3
I'm a bit confused. Is the problem that your contours encircle the tumor in just some of the slices? So you need to interpolate the contours slices in 3d to cover the entire tumor volume?Ghaul
Yes. The contours are just a set of points (not the actual contour lines), but they are only defined every 2mm (in the slice-direction). In order to assemble an isotropic 3D binary matrix, I need to interpolate the slices between each defined contour set.superwillis
Another way of phrasing the question: Given a set of sparingly distributed points that lie on the surface of the tumor, how do I go about creating a surface from them and filling it in to make a 3D binary matrix volume?superwillis
Thanks -- although, what I'm actually looking for is something to deal with DICOM-RT files. Matlab can read dicoms just fine -- but the DICOM-RT files also contain "structure set" files which contain segmented tumor contour points that overlay on top of the normal DICOM images. I'm looking for a way to model these contour points, not the dicom images themselves.superwillis

3 Answers

3
votes

I'm not sure from what program you're exporting your dicom-rt structure files, but I believe I found a more elegant solution for you, already described in an open-source software (GDCM, CMake, ITK) in an Insight journal article.

I was discussing a similar problem with one of our physicists, and we saw your solution. It's fine if whatever structure you're attempting to binarize has no concavities, but if so, they'll be rendered inaccurately.

This method is verified for dicom-rt structure sets from Eclipse and Masterplan. Hope it helps.

http://www.midasjournal.org/download/viewpdf/701/4

1
votes

I think I found an answer in another post (here). Rather than trying to interpolate the "missing slices" between the defined contours, treating the contour points as a point cloud and finding the convex hull might be a more efficient way of doing it. This method created the binary 3D volume that I was after.

Here is the code I used, hope it might be helpful to those who need to work with DICOM-RT files:


    function mask = DicomRT2BinaryVol(file)
    points = abs(getContourPoints(file));

    %%NOTE: The getContourPoints function simply reads the file using
    %%'dicominfo' method and organizes the contour points into an n-by-3
    %%matrix, each column being the X,Y,Z coordinates.

    DT = DelaunayTri(points);
    [X,Y,Z] = meshgrid(1:50,1:50,1:50);
    simplexIndex = pointLocation(DT, X(:), Y(:), Z(:));
    mask = ~isnan(simplexIndex);
    mask = reshape(mask,size(X));
    end

This method is a slightly modified version of the method posted by @gnovice in the link above.

0
votes

iTk is an excellent library for this sort of thing: http://www.itk.org/ HTH