How To Create a Symmetric Ellipsoid in an Image

Summary

This application demonstrates how to create a geometrical shape within an itkImage using Spatial Functions. Specifically, this application will use itkSymmetricEllipsoidInteriorExteriorSpatialFunction to create an itkImage consisting of a symmetric ellipsoid along an orientation vector. An n-dimensional symmetric ellipsoid is one, which has m axes of equal length and unique axes lengths. Specifically, itkSymmetricEllipsoidInteriorExteriorSpatialFunction creates a symmetric ellipsoid for the case where and the ellipsoid’s major axis is oriented along a single orientation vector.
Description

First, an , where a, b, and c are the lengths of the ellipsoid axes. |

The ellipsoid is also validated by checking that the center of the ellipsoid has been labeled as an interior pixel (a function value of 1) by evaluating the spatial function at the origin of the ellipsoid.

To Use this Application

Build and run itkSymmetricEllipsoidInteriorExteriorSpatialFunctionExample.cxx from the workspace generated from CMake. The resulting VTK image file is stored as:
Default settings should result in an image of an ellipsoid with its unique axis of length 45 oriented along the (1,1,0) direction and symmetric axes of length 30. The origin of the ellipsoid is sampled and evaluated by the spatial function and returns *function value*, which is 1 since the origin of the ellipsoid is within the ellipsoid.

calculated ellipsoid volume | 21205.8 pixels |

measured ellipsoid volume | 21197 pixels |

volume error | 0.04126% |

function value | 1 |

Insight Classes Used

These are the Insight classes used for this application including a brief description of each class. They appear in order of first use:
- itkImage.h: generates a physical image.
- itkImageRegionIterator.h: iterates through the pixels in the physical image and sets them to 128.
- itkSymmetricEllipsoidInteriorExteriorSpatialFunction.h: evaluates pixels in the image and determines whether they are within the symmetric ellipsoid or not.
- itkFloodFilledSpatialFunctionConditionalIterator.h: iterates the image and sets them to 256 if they are within the ellipsoid.

Possible Uses of Ellipsoids

The ellipsoid images created by SymmetricEllipsoidInteriorExteriorSpatialFunction are useful for testing imaging algorithms, pixel-sampling routines, establishing geometric domains of influence, etc. Symmetric ellipsoids are useful where only one orientation vector is known and minor axes of equal lengths are tolerable.
Non-ITK Requirements

A VTK image viewer is needed to visualize the output file symmetricEllipsoid.vtk.