[Insight-users] Behavior of itkTubeSpatialObject

Robert Tamburo rjtst21+ at pitt.edu
Wed, 28 Apr 2004 08:39:15 -0400


Hi all,
I'm trying to create a test image consisting of a curved cylinder using
itkTubeSpatialObject in conjunction with itkSpatialObjectToImageFilter. Are
the geometric properties of a tube (the defining points have the same
radius) similar to a cylinder?

I ask because I've tried a few experiements and my tube isn't very circular
(in cross-section). The results of my trials can be found  at 
http://www.pitt.edu/~rjtst21/tubes.htm

Trial 1:
The first row of images shows a wireframe of the tube and a cross-section of
the corresponding gray
level image. The tube is flat and rectangular.

Trial 2:
I straightened out the tube and made it longer, but still got a
"rectangular" tube. Since the radius was only 2, I thought the pixel
resolution might be an issue. I compared it to a cylinder created with
itkFiniteCylinderSpatialFunction.  As you can see in the second row of
images (bottom) the cylinder is
circular, so a radius of 2 is large enough to observe a circle.

Trial 3:
I increased the radius to 5 and put the tube in the x-y plane.  The tube
formed "spikes" at each point. Also, the ends of the tube were rounded (are
they supposed to be flat?).

Is this consistent with how itkTubeSpatialObject should behave? Any info for
creating more cylindrical looking tubes would be greatly appreciated.

The code to generate the tube is below:
-------------
TubePointerType tube = TubeType::New();
TubePointListType list;

TubeType::TransformType::OffsetType offset;
offset.Fill(15); // origin
tube->GetObjectToParentTransform()->SetOffset(offset);
tube->ComputeObjectToWorldTransform();

// create list of points for the tube in x-y plane
for(unsigned int i = 0; i < 10; i++)
  {
  TubePointType p;
  p.SetPosition(i, i, 0);
  p.SetRadius(5.0);
  list.push_back(p);
  }

// set tube properties
tube->GetProperty()->SetName("tube");
tube->SetId(1);
tube->SetPoints(list);

// initialize filter
typedef SpatialObjectToImageFilter<TubeType, ImageType>
SpatialObjectToImageFilterType;
SpatialObjectToImageFilterType::Pointer imageFilter =
SpatialObjectToImageFilterType::New();
imageFilter->SetInput(tube);
imageFilter->SetInsideValue(255);
imageFilter->SetOutsideValue(0);
imageFilter->SetChildrenDepth(0);

ImageType::SizeType imageSizeObject;
imageSizeObject.SetSize(m_ImageSize);
imageFilter->SetSize(imageSizeObject);

imageFilter->Update();

m_Image = imageFilter->GetOutput();