Medical image analysis toolkit providing algorithms for segmentation, registration, and processing of medical images
—
ITK's core data structures provide the foundation for all medical image analysis operations. These classes handle n-dimensional images, geometric primitives, and region specifications with full template-based type safety.
The primary data structure for storing n-dimensional pixel data.
template<typename TPixel, unsigned int VDimension>
class Image : public ImageBase<VDimension>
{
public:
typedef Image Self;
typedef ImageBase<VDimension> Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
// Creation
static Pointer New();
// Pixel access
const TPixel & GetPixel(const IndexType & index) const;
void SetPixel(const IndexType & index, const TPixel & value);
TPixel & GetPixel(const IndexType & index);
// Memory management
void Allocate();
void FillBuffer(const TPixel & value);
// Container access
TPixel * GetBufferPointer();
const TPixel * GetBufferPointer() const;
// Region management
void SetRegions(const SizeType & size);
void SetRegions(const RegionType & region);
const RegionType & GetRequestedRegion() const;
const RegionType & GetLargestPossibleRegion() const;
};Abstract base class providing geometric information for images.
template<unsigned int VDimension>
class ImageBase : public DataObject
{
public:
typedef ImageBase Self;
typedef DataObject Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
// Geometric properties
virtual void SetOrigin(const PointType & origin);
virtual const PointType & GetOrigin() const;
virtual void SetSpacing(const SpacingType & spacing);
virtual const SpacingType & GetSpacing() const;
virtual void SetDirection(const DirectionType & direction);
virtual const DirectionType & GetDirection() const;
// Coordinate transformations
template<typename TCoordinate>
void TransformPhysicalPointToIndex(const Point<TCoordinate, VDimension> & point,
IndexType & index) const;
template<typename TCoordinate>
void TransformIndexToPhysicalPoint(const IndexType & index,
Point<TCoordinate, VDimension> & point) const;
// Region management
virtual void SetRegions(const RegionType & region);
virtual const RegionType & GetLargestPossibleRegion() const;
};Image class for variable-length pixel vectors.
template<typename TPixel, unsigned int VDimension>
class VectorImage : public ImageBase<VDimension>
{
public:
typedef VectorImage Self;
typedef ImageBase<VDimension> Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
// Vector-specific methods
void SetNumberOfComponentsPerPixel(unsigned int n);
unsigned int GetNumberOfComponentsPerPixel() const;
// Pixel access
const PixelType & GetPixel(const IndexType & index) const;
void SetPixel(const IndexType & index, const PixelType & value);
// Component access
const InternalPixelType & GetPixelComponent(const IndexType & index,
unsigned int component) const;
void SetPixelComponent(const IndexType & index, unsigned int component,
const InternalPixelType & value);
};N-dimensional point representation.
template<typename T, unsigned int VDimension>
class Point : public FixedArray<T, VDimension>
{
public:
typedef Point Self;
typedef FixedArray<T, VDimension> Superclass;
// Constructors
Point();
Point(const ValueType & value);
Point(const ValueType values[VDimension]);
// Arithmetic operations
VectorType operator-(const Self & point) const;
Self operator+(const VectorType & vector) const;
Self operator-(const VectorType & vector) const;
// Distance calculations
RealType EuclideanDistanceTo(const Self & point) const;
RealType SquaredEuclideanDistanceTo(const Self & point) const;
// Array access
ValueType & operator[](unsigned int index);
const ValueType & operator[](unsigned int index) const;
};N-dimensional vector representation.
template<typename T, unsigned int VDimension>
class Vector : public FixedArray<T, VDimension>
{
public:
typedef Vector Self;
typedef FixedArray<T, VDimension> Superclass;
// Constructors
Vector();
Vector(const ValueType & value);
Vector(const ValueType values[VDimension]);
// Vector operations
Self operator+(const Self & vector) const;
Self operator-(const Self & vector) const;
Self operator*(const ValueType & scalar) const;
Self operator/(const ValueType & scalar) const;
// Geometric operations
RealType GetNorm() const;
RealType GetSquaredNorm() const;
RealType Normalize();
// Dot product
ValueType operator*(const Self & vector) const;
};Vector that transforms covariantly under coordinate transformations.
template<typename T, unsigned int VDimension>
class CovariantVector : public FixedArray<T, VDimension>
{
public:
typedef CovariantVector Self;
typedef FixedArray<T, VDimension> Superclass;
// Vector operations
Self operator+(const Self & vector) const;
Self operator-(const Self & vector) const;
Self operator*(const ValueType & scalar) const;
// Geometric operations
RealType GetNorm() const;
RealType Normalize();
// Dot products with regular vectors
ValueType operator*(const Vector<T, VDimension> & vector) const;
};N-dimensional index for discrete grid positions.
template<unsigned int VDimension>
class Index : public FixedArray<IndexValueType, VDimension>
{
public:
typedef Index Self;
typedef FixedArray<IndexValueType, VDimension> Superclass;
// Constructors
Index();
Index(const IndexValueType value[VDimension]);
Index(const IndexValueType & value);
// Arithmetic operations
const Self operator+(const OffsetType & offset) const;
const Self operator-(const OffsetType & offset) const;
const OffsetType operator-(const Self & index) const;
// Element access
IndexValueType & operator[](unsigned int index);
const IndexValueType & operator[](unsigned int index) const;
// Utilities
void Fill(IndexValueType value);
static unsigned int GetIndexDimension();
};N-dimensional size specification.
template<unsigned int VDimension>
struct Size : public FixedArray<SizeValueType, VDimension>
{
public:
typedef Size Self;
typedef FixedArray<SizeValueType, VDimension> Superclass;
// Constructors
Size();
Size(const SizeValueType value[VDimension]);
Size(const SizeValueType & value);
// Element access
SizeValueType & operator[](unsigned int index);
const SizeValueType & operator[](unsigned int index) const;
// Utilities
void Fill(SizeValueType value);
static unsigned int GetSizeDimension();
};N-dimensional offset for relative positioning.
template<unsigned int VDimension>
class Offset : public FixedArray<OffsetValueType, VDimension>
{
public:
typedef Offset Self;
typedef FixedArray<OffsetValueType, VDimension> Superclass;
// Arithmetic operations
const Self operator+(const Self & offset) const;
const Self operator-(const Self & offset) const;
Self & operator+=(const Self & offset);
Self & operator-=(const Self & offset);
// Element access
OffsetValueType & operator[](unsigned int index);
const OffsetValueType & operator[](unsigned int index) const;
};Defines a rectangular region within an image.
template<unsigned int VDimension>
class ImageRegion
{
public:
typedef ImageRegion Self;
typedef IndexType IndexType;
typedef SizeType SizeType;
// Constructors
ImageRegion();
ImageRegion(const IndexType & index, const SizeType & size);
ImageRegion(const SizeType & size);
// Region properties
void SetIndex(const IndexType & index);
const IndexType & GetIndex() const;
IndexType & GetModifiableIndex();
void SetSize(const SizeType & size);
const SizeType & GetSize() const;
SizeType & GetModifiableSize();
// Computed properties
IndexType GetUpperIndex() const;
SizeValueType GetNumberOfPixels() const;
// Region operations
void Crop(const Self & region);
bool IsInside(const IndexType & index) const;
bool IsInside(const Self & region) const;
// Comparison
bool operator==(const Self & region) const;
bool operator!=(const Self & region) const;
};RGB color pixel representation.
template<typename TComponent>
class RGBPixel : public FixedArray<TComponent, 3>
{
public:
typedef RGBPixel Self;
typedef FixedArray<TComponent, 3> Superclass;
// Color component access
void SetRed(ComponentType red);
ComponentType GetRed() const;
void SetGreen(ComponentType green);
ComponentType GetGreen() const;
void SetBlue(ComponentType blue);
ComponentType GetBlue() const;
// Luminance calculation
ComponentType GetLuminance() const;
};RGBA color pixel with alpha channel.
template<typename TComponent>
class RGBAPixel : public FixedArray<TComponent, 4>
{
public:
typedef RGBAPixel Self;
typedef FixedArray<TComponent, 4> Superclass;
// Color component access
void SetRed(ComponentType red);
ComponentType GetRed() const;
void SetGreen(ComponentType green);
ComponentType GetGreen() const;
void SetBlue(ComponentType blue);
ComponentType GetBlue() const;
void SetAlpha(ComponentType alpha);
ComponentType GetAlpha() const;
};// Standard typedefs
typedef long IndexValueType;
typedef unsigned long SizeValueType;
typedef signed long OffsetValueType;
typedef double SpacePrecisionType;
typedef float FloatOffsetPrecisionType;
// Common instantiations
typedef Image<unsigned char, 2> UCharImage2D;
typedef Image<unsigned char, 3> UCharImage3D;
typedef Image<short, 2> ShortImage2D;
typedef Image<short, 3> ShortImage3D;
typedef Image<float, 2> FloatImage2D;
typedef Image<float, 3> FloatImage3D;
typedef Image<double, 2> DoubleImage2D;
typedef Image<double, 3> DoubleImage3D;
// Point and vector types
typedef Point<double, 2> Point2D;
typedef Point<double, 3> Point3D;
typedef Vector<double, 2> Vector2D;
typedef Vector<double, 3> Vector3D;
// Index and size types
typedef Index<2> Index2D;
typedef Index<3> Index3D;
typedef Size<2> Size2D;
typedef Size<3> Size3D;
typedef ImageRegion<2> Region2D;
typedef ImageRegion<3> Region3D;These core data structures form the foundation of all ITK operations, providing type-safe, efficient representations for medical image data and associated geometric information.
Install with Tessl CLI
npx tessl i tessl/cmake-itk