Margins around shapes

Eduard Schreibmann and Michael Lahanas

In radiotherapy the planning target volume (PTV) includes a region around the cancerous volume and therefore an expanded version of the PTV is required.

Figure 1 Margin around an object

We consider the general problem to obtain an expanded or compressed version of an object that its boundaries are given by points such as vertices of a triangulated surface.

In radiotherapy structures are usually given by points of contours that are parallel. The objects are described in a bounding box with coordinates the minimum and maximum values of the x, y and z coordinates of all points.

Figure 2 Objects defined in radiotherapy are usually defined by parallel contours

We consider the case to include individual values for margins for the 6 directions in the positive and negative directions in 3D.

The bounding box limits are transformed according to

(xmin, xmax) → (xmin + xm, xmax + xp)

(ymin, ymax) → (ymin + ym, ymax + yp)

(zmin, zmax) → (zmin + zm, ymax + zp)

The margins parameters are

(xm, xp) for the lower and upper x range

(ym, yp) for the lower and upper y range

(zm, zp) for the lower and upper z range

Figure 3 Anisotropic margins can be applied using different margin in the six directions of the bounding box.

The transformation is defined by a set of source and target landmarks. Any point close to a source landmark will be moved to a place close to the corresponding target landmark. The points in between are interpolated smoothly using a spline transformation algorithm. The source points are defined as the corners of the bounding box. The target points are shifted from the source points by “inflating” the bounding box, along each axis with the defined distance for the margin.

The advantage of this method over other methods is that it allows the construction of a non-isotropic margin that can be applied on both convex and concave surfaces. A set of eight points is chosen on the corners of the initial bounding box. The target points are arranged on a second box, shifted from the original box by user-defined margin distances for each axis. When the transformation is applied, the structure is “inflated” resulting in a non-isotropic margin around the initial object.

Figure 4 Example of isotropic margin

Figure 5 Example of anisotropic margin

It is based on the “ThinPlateSplineTransform” transformation that describes a nonlinear warp transform defined by a set of source and target landmarks using Booksteins Thin Plate Spline algorithm.

VTK method uses the transforms

vtkThinPlateSplineTransform.cpp a subclass of the transform vtkLandmarkTransform.cpp

Example of VTK code

Figure 6 Numbering of vertices of the bounding box used

Object to be deformed

vtkPolyData *Input;

Spline transformation source points

vtkPoints *SourcePoints;

Spline transformation target points

vtkPoints *TargetPoints;

The Spline transformation source points

vtkThinPlateSplineTransform *ThinPlateTransform;

The transformation used to rescale PTV points

vtkGeneralTransform *GeneralTransform;

VTK class to perform transformation of PTV points

vtkTransformPolyDataFilter *TransformFilter;

Set PTV input

void SetInput(vtkPolyData * I);

Get PTV margin

vtkPolyData* GetOutput(void);

Constructor of objects and possible user interface

void FormCreate();

Deform object according to specified margins

void Deform();

Get coordinates of object

void SetInput(vtkPolyData * I)

{

Input->DeepCopy( I );

float bounds[6]; Input->GetBounds( bounds);

Deform(this);

}

Return of result

vtkPolyData* GetOutput(void)

{

TransformFilter->Update();

return TransformFilter->GetOutput();

}

Constructor

void FormCreate()

{

Input = vtkPolyData::New();

SourcePoints = vtkPoints::New();

SourcePoints->SetNumberOfPoints( 8 );

TargetPoints = vtkPoints::New();

TargetPoints->SetNumberOfPoints( 8 );

ThinPlateTransform = vtkThinPlateSplineTransform::New();

ThinPlateTransform->SetSourceLandmarks( SourcePoints );

ThinPlateTransform->SetTargetLandmarks( TargetPoints );

GeneralTransform = vtkGeneralTransform::New();

GeneralTransform->SetInput( ThinPlateTransform );

GeneralTransform->Concatenate( ThinPlateTransform->GetInverse());

GeneralTransform->Concatenate( ThinPlateTransform );

TransformFilter = vtkTransformPolyDataFilter::New();

TransformFilter->SetInput( Input );

TransformFilter->SetTransform( GeneralTransform );

}

Free allocated memory

void FormDestroy()

{

Input->Delete();

SourcePoints->Delete();

TargetPoints->Delete();

GeneralTransform->Delete();

ThinPlateTransform->Delete();

TransformFilter->Delete();

}

The main function for the deformation of the object

void Deform()

{

Returns bounding box in the form (xmin, xmax, ymin, ymax, zmin, zmax) = (b[0], b[1], b[2], b[3], b[4], b[5])

float b[6]; Input->GetBounds(b);

Take Source Points of bounding box

SourcePoints->SetPoint( 0, b[0], b[3], b[5] );

SourcePoints->SetPoint( 1, b[1], b[3], b[5] );

SourcePoints->SetPoint( 2, b[0], b[3], b[4] );

SourcePoints->SetPoint( 3, b[1], b[3], b[4] );

SourcePoints->SetPoint( 4, b[0], b[2], b[5] );

SourcePoints->SetPoint( 5, b[1], b[2], b[5] );

SourcePoints->SetPoint( 6, b[0], b[2], b[4] );

SourcePoints->SetPoint( 7, b[1], b[2], b[4] );

Give Coordinates of expanded bounding box

TargetPoints->SetPoint( 0, b[0]+xm, b[3]+yp, b[5]+zp );

TargetPoints->SetPoint( 1, b[1]+xp, b[3]+yp, b[5]+zp );

TargetPoints->SetPoint( 2, b[0]+xm, b[3]+yp, b[4]+zm );

TargetPoints->SetPoint( 3, b[1]+xp, b[3]+yp, b[4]+zm );

TargetPoints->SetPoint( 4, b[0]+xm, b[2]+ym, b[5]+zp );

TargetPoints->SetPoint( 5, b[1]+xp, b[2]+ym, b[5]+zp );

TargetPoints->SetPoint( 6, b[0]+xm, b[2]+ym, b[4]+zm );

TargetPoints->SetPoint( 7, b[1]+xp, b[2]+ym, b[4]+zm );

VTK class vtkTransformPolyDataFilter to perform transformation of points

TransformFilter->SetInput( Input );

Update the modification time for this object. Many filters rely on the modification time to determine if they need to recompute their data.

Input->Modified();

The Spline transformation source points vtkThinPlateSplineTransform

ThinPlateTransform->Modified();

}

Remarks

For objects that are not aligned to the x-y-z coordinate system it is recommended to use as the bounding box the optimal oriented box. The geometrical transformations are described in this article.

The method can be applied for other problems such as registration or corrections of deformations if a corresponding set of source and target points is given.

References

Fred L. Bookstein (1997) "Shape and the Information in Medical Images: A Decade of the Morphometric Synthesis" Computer Vision and Image Understanding 66 97-118

Berthold K. P. Horn (1987) "Closed-form solution of absolute orientation using unit quaternions," Journal of the Optical Society of America A, 4 629-642 and online work published by Tim Cootes at http://www.wiau.man.ac.uk/~bim

BACK