[Insight-users] itkContourSpatialObject

Dirk Boye body at nabla.org
Wed Dec 22 10:56:19 EST 2010


Dear list,

I got a set of 2d-contours in xy-planes.
What I would like to create from that is a 3d binary mask image.
The pixels where the contour-points are on should also be set
to the "foreground" value.

What I tried to do:
Using PolygonSpatialObject and SpatialObjectToImageFilter and
iterating through the slices. Problem: This way the pixels on the contourline
where not included.

I found ContourSpatialObject and wanted to try that but it doesn't work
the way I want :)

Following code should create a contour box and test if 0,0 is inside
the contour, which should return 1 but it doesn't.

Thanks for your help.

Cheers,
Dirk



typedef itk::ContourSpatialObject<2>  ContourType;
typedef ContourType::Pointer ContourPointer;
typedef ContourType::ControlPointType ContourPointType;
typedef itk::Image< unsigned char, 2>       ImageType;

ContourType::ControlPointListType list;
ContourPointType p;
p.SetPickedPoint(-1,-1);
list.push_back(p);
ContourPointType p1;
p1.SetPickedPoint(-1,1);
list.push_back(p1);
ContourPointType p2;
p2.SetPickedPoint(1,1);
list.push_back(p2);
ContourPointType p3;
p3.SetPickedPoint(1,-1);
list.push_back(p3);
ContourPointer icontour = ContourType::New();
icontour->SetControlPoints(list);
ImageType::PointType testpoint;


More information about the Insight-users mailing list