Core data model and execution framework
ITK provides a shared object model for image processing and spatial data work. Reference-counted objects carry change state and events. Data objects carry values and metadata. Process objects connect those data objects and produce results on demand. This model gives images, meshes, and transforms common lifetime and pipeline behavior while allowing each type to represent its data in its own way.
Object hierarchy
Light objects
LightObject is the base for most ITK objects. It supplies controlled creation, runtime type names, printing, and reference counting. Indent is a small value object that supports readable nested output when objects print their state. SmartPointer keeps an object alive while a user holds a reference. WeakPointer records a link without extending the object's lifetime, which lets pipeline links avoid ownership loops. Standard creation also uses the object factory when a replacement is registered. ITK objects normally cannot be copied or moved because pointer ownership and pipeline links must stay explicit. Modules/…/itkLightObject.h• L36-49 Modules/…/itkSmartPointer.h• L30-49 Modules/…/itkWeakPointer.h• L26-37 Modules/…/itkMacro.h• L255-368 Modules/…/itkIndent.h• L37-48
The print helper provides shared formatting for numeric values and standard containers, including nested containers, so PrintSelf output stays readable. Runtime type information also supports casts across library boundaries when the compiler and C++ runtime provide that capability. ITK checks this capability during configuration so its type-based object model does not depend on unsupported hidden template symbols. Modules/…/itkPrintHelper.h• L47-113 Modules/…/itkPrintHelper.h• L115-189 Modules/Core/Common/CMake/itkCheckPrivateDynamicCast.cmake#L1-L8 Modules/Core/Common/CMake/itkCheckPrivateDynamicCast.cmake#L64-L103
References: Modules/…/itkLightObject.h• L55-88 Modules/…/itkLightObject.h• L120-166 Modules/…/itkSmartPointer.h• L50-103 Modules/…/itkWeakPointer.h• L43-63 Modules/…/itkMacro.h• L255-368 Modules/…/itkIndent.h• L37-90 Modules/…/itkPrintHelper.h• L47-189 Modules/…/itkCheckPrivateDynamicCast.cmake• L1-8 Modules/…/itkCheckPrivateDynamicCast.cmake• L64-103
Exception objects
ExceptionObject is ITK's common error value for reporting failures from framework operations. It carries a description and the place where the error was raised, with optional class information for the object that reported it. Applications can handle it as a standard C++ exception, while specific error types identify cases such as invalid arguments, range errors, allocation failures, and aborted processing. Modules/…/itkExceptionObject.h• L36-54 Modules/…/itkExceptionObject.h• L162-245
The exception also supports a stable text form and structured printing, so callers can show useful error context without knowing the failing process or data type. Modules/Core/Common/src/itkExceptionObject.cxx#L27-L73 Modules/Core/Common/src/itkExceptionObject.cxx#L170-L243
References: Modules/…/itkExceptionObject.h• L36-54 Modules/…/itkExceptionObject.h• L55-148 Modules/…/itkExceptionObject.h• L162-245 Modules/…/itkExceptionObject.cxx• L27-73 Modules/…/itkExceptionObject.cxx• L101-167 Modules/…/itkExceptionObject.cxx• L170-243
ITK objects
Object adds the state that active pipeline components need. It tracks modification time and supports observers for events such as progress or execution boundaries. A change to an object therefore becomes a signal that downstream work may need to run again. TimeStamp supplies the monotonically increasing values used by this change state. Its shared counter is safe when different objects change at the same time, while concurrent changes to the same timestamp instance are not a supported pattern. Modules/…/itkObject.h• L44-52 Modules/…/itkObject.h• L103-114 Modules/…/itkObject.h• L147-200 Modules/…/itkTimeStamp.h• L38-55
References: Modules/…/itkObject.h• L61-85 Modules/…/itkObject.h• L103-114 Modules/…/itkObject.h• L147-200 Modules/…/itkTimeStamp.h• L38-55 Modules/…/itkTimeStamp.h• L92-136 Modules/…/itkTimeStamp.cxx• L50-60
Python command bridge
PyCommand connects ITK's observer and command model to a Python callable. It retains the callable for the command's lifetime, protects calls and cleanup with Python's interpreter lock, and reports a missing callable or Python error through ITK's exception model. This lets Python code observe ITK events without changing the common event contract. Modules/…/itkPyCommand.h• L30-72 Modules/Core/Common/src/itkPyCommand.cxx#L26-L145
PyImageFilter applies the same bridge to image-process stages. Python callbacks can supply output information, enlarge the output request, set the input request, and generate image data. The filter keeps these callbacks alive and turns callback failures into ITK exceptions, so a Python-defined stage remains part of the normal process-object lifecycle. Modules/Core/Common/include/itkPyImageFilter.hxx#L26-L39 Modules/Core/Common/include/itkPyImageFilter.hxx#L145-L269
The wrapping declarations expose selected FunctionBase and BSplineInterpolationWeightFunction template forms to supported language bindings. These declarations extend the common function and interpolation contracts without changing the data-object model. Modules/Core/Common/wrapping/itkFunctionBase.wrap#L1-L42 Modules/Core/Common/wrapping/itkBSplineInterpolationWeightFunction.wrap#L1-L8
References: Modules/…/itkPyCommand.h• L30-72 Modules/…/itkPyCommand.cxx• L26-145 Modules/…/itkPyImageFilter.hxx• L26-39 Modules/…/itkPyImageFilter.hxx• L145-269 Modules/…/itkFunctionBase.wrap• L1-42 Modules/…/itkBSplineInterpolationWeightFunction.wrap• L1-8 Modules/…/itkPyCommandTest.py• L19-42
Factory-based creation
The object factory is the common extension point for object creation. A factory can replace a named ITK class with another compatible class. Built-in factories and optional dynamic factories are considered in registration order, so the first enabled match controls creation. The registry initializes on first use. Its search path can come from ITK_AUTOLOAD_PATH or from SetAutoloadPaths(), and a path change after initialization requires ReHash(). Empty path entries are ignored. Modules/…/itkObjectFactoryBase.h• L40-58 Modules/…/itkObjectFactoryBase.h• L74-110 Modules/Core/Common/src/itkObjectFactoryBase.cxx#L229-L315 Modules/Core/Common/src/itkObjectFactoryBase.cxx#L477-L601
Dynamic factory libraries expose the configured C entry point and are loaded from the configured search path when dynamic loading is enabled. This lets an application change selected object implementations without changing the process-object and data-object contracts. The common tests cover environment and API path setup, lazy loading, path rehashing, empty entries, and multiple path separators. Modules/…/itkFactoryTestLib.h• L21-33 Modules/Core/Common/src/itkConfigure.h.in#L71-L72 Modules/Core/Common/src/itkConfigure.h.in#L89-L91 Modules/Core/Common/src/itkConfigure.h.in#L197-L198 Modules/Core/Common/src/itkObjectFactoryBase.cxx#L305-L315 Modules/Core/Common/test/itkObjectFactoryAutoloadPathTest.cxx#L29-L40 Modules/Core/Common/test/itkObjectFactoryAutoloadPathTest.cxx#L54-L95
References: Modules/…/itkObjectFactoryBase.h• L40-58 Modules/…/itkObjectFactoryBase.h• L74-105 Modules/…/itkObjectFactoryBase.h• L152-173 Modules/…/itkObjectFactoryBase.cxx• L188-243 Modules/…/itkObjectFactoryBase.cxx• L247-315 Modules/…/itkObjectFactoryBase.cxx• L477-601 Modules/…/itkConfigure.h.in• L71-72 Modules/…/itkConfigure.h.in• L89-91 Modules/…/itkConfigure.h.in• L197-198 Modules/…/itkFactoryTestLib.h• L21-33 Modules/…/itkObjectFactoryAutoloadPathTest.cxx• L29-95 Modules/…/itkObjectFactoryTest2.cxx• L83-171 Modules/…/CMakeLists.txt• L147-214 Modules/…/CMakeLists.txt• L998-1014
Data-object abstraction
Data objects
DataObject is the common carrier for data that moves through a pipeline. It keeps a link to the process object that produces it, records when its data was generated, and defines the common operations for update, metadata transfer, region requests, and data release. The output of one process object can therefore become the input of another without the next object knowing how the data was made. Modules/…/itkDataObject.h• L133-168 Modules/…/itkDataObject.h• L277-325
Data objects can also be created outside a pipeline. DisconnectPipeline() removes the upstream route while preserving the data object as an independent value. Initialize(), PrepareForNewData(), and DataHasBeenGenerated() define the shared reset and completion points used when a process object replaces or regenerates output data. Modules/…/itkDataObject.h• L296-330 Modules/…/itkDataObject.h• L444-463
References: Modules/…/itkDataObject.h• L133-168 Modules/…/itkDataObject.h• L277-325 Modules/…/itkDataObject.h• L327-368 Modules/…/itkDataObject.h• L444-463
Decorated data objects
Data-object decorators adapt values that do not already use the full data-object interface. DataObjectDecorator carries an ITK object, SimpleDataObjectDecorator carries a value such as a number or vector, and AutoPointerDataObjectDecorator carries an ordinary pointer with ownership of its target. These wrappers let small results and auxiliary objects use the same pipeline input and output contract as images or meshes. Modules/…/itkDataObjectDecorator.h• L36-57 Modules/…/itkSimpleDataObjectDecorator.h• L36-57 Modules/…/itkAutoPointerDataObjectDecorator.h• L37-55
The wrapper type also defines the ownership rule for the carried value. ITK-object wrappers share the component through a smart pointer, simple wrappers store the value, and auto-pointer wrappers delete the pointed-to value when the wrapper releases it. DataObjectDecorator also includes the component's modification time in its own change state, so changes to the carried object remain visible to pipeline users. Modules/…/itkDataObjectDecorator.h• L77-116 Modules/…/itkSimpleDataObjectDecorator.h• L65-112 Modules/…/itkAutoPointerDataObjectDecorator.h• L60-106
References: Modules/…/itkDataObjectDecorator.h• L36-57 Modules/…/itkDataObjectDecorator.h• L77-116 Modules/…/itkSimpleDataObjectDecorator.h• L36-57 Modules/…/itkSimpleDataObjectDecorator.h• L65-112 Modules/…/itkAutoPointerDataObjectDecorator.h• L37-55 Modules/…/itkAutoPointerDataObjectDecorator.h• L60-106
Data-object regions
Region support describes how much data exists, how much is resident, and how much a caller needs. Image data uses rectangular regions, while other data objects may use a different region meaning or no sub-region at all. This shared contract lets the pipeline ask for a useful portion of data without forcing every data type to use image-like bounds. Modules/…/itkDataObject.h• L170-205 Modules/…/itkDataObject.h• L465-525
The three image-region roles are related but not interchangeable:
| Region | Meaning |
|---|---|
| Largest possible region | The full extent that the data object can represent. |
| Buffered region | The extent whose bulk data is currently available in memory. |
| Requested region | The extent needed for the current operation. |
The pipeline execution page explains how these roles guide demand-driven work. The image data representation page explains their image-specific form. Modules/…/itkDataObject.h• L178-205 Modules/…/itkImageBase.h• L78-89
References: Modules/…/itkDataObject.h• L170-205 Modules/…/itkDataObject.h• L472-525 Modules/…/itkImageBase.h• L78-89
Image iterator family
Image iterators provide read-only or writable traversal over image values and regions. The family covers common region and index walks as well as linear, scanline, slice, exclusion, reverse, and random access. The linear and scanline forms move through line-shaped spans, while the non-repeating random form visits selected pixels without repeating a position. Modules/…/itkImageLinearConstIteratorWithIndex.h• L26-47 Modules/…/itkImageScanlineConstIterator.h• L26-35 Modules/…/itkImageRandomNonRepeatingConstIteratorWithIndex.h• L153-179
Line iterators keep a selected direction or fastest-axis span and expose line boundaries so an algorithm can move between lines. The non-repeating random iterator can visit a requested sample count, use a seed, and apply an optional priority image while keeping each visited pixel unique. All iterator forms remain constrained to a chosen image region. Modules/…/itkImageLinearConstIteratorWithIndex.h• L139-204 Modules/…/itkImageScanlineConstIterator.h• L102-108 Modules/…/itkImageRandomNonRepeatingConstIteratorWithIndex.h• L247-375
The image model also provides one shared conversion between an index in the buffered region and its linear buffer offset. This keeps image access and iterator traversal aligned with the same region layout. Modules/…/itkImageBase.h• L352-415 Modules/…/itkImageHelper.h• L52-113
References: Modules/…/itkImageIterator.hxx• L25-52 Modules/…/itkImageIteratorWithIndex.hxx• L25-52 Modules/…/itkImageLinearConstIteratorWithIndex.h• L26-47 Modules/…/itkImageLinearConstIteratorWithIndex.h• L139-204 Modules/…/itkImageScanlineConstIterator.h• L26-35 Modules/…/itkImageScanlineConstIterator.h• L102-108 Modules/…/itkImageRandomNonRepeatingConstIteratorWithIndex.h• L153-179 Modules/…/itkImageRandomNonRepeatingConstIteratorWithIndex.h• L247-375 Modules/…/itkImageRandomNonRepeatingIteratorWithIndex.hxx• L24-51 Modules/…/itkImageRegionExclusionIteratorWithIndex.hxx• L24-50 Modules/…/itkImageRegionIterator.hxx• L24-48 Modules/…/itkImageRegionIteratorWithIndex.hxx• L24-48 Modules/…/itkImageRegionReverseConstIterator.h• L154-213 Modules/…/itkImageReverseIterator.hxx• L24-48 Modules/…/itkImageScanlineIterator.hxx• L24-47 Modules/…/itkImageSliceIteratorWithIndex.hxx• L24-47 Modules/…/itkImageRandomConstIteratorWithIndex.h• L51-67 Modules/…/itkImageRandomConstIteratorWithIndex.hxx• L25-53 Modules/…/itkImageBufferRange.h• L38-43 Modules/…/itkImageBase.h• L352-415 Modules/…/itkImageHelper.h• L52-113 Modules/…/itkImageIteratorsGTest.cxx• L178-236
Process-object abstraction
Process objects
ProcessObject is the common actor for sources, filters, and mappers. It accepts named or indexed inputs and exposes named or indexed outputs. The primary input and primary output provide the default path, while additional entries support operations with several data inputs or results. Modules/…/itkProcessObject.h• L47-91 Modules/…/itkProcessObject.h• L174-235
The process object owns the rules that connect a request to work. It checks required inputs and input metadata, describes output information, maps output requests to input requests, and generates output data. Subclasses can override the information, requested-region, and data-generation stages when their data dependency differs from the default. Modules/…/itkProcessObject.h• L809-881 See pipeline execution for the full update flow.
It also provides shared execution state. A process can report progress, accept an abort request, choose a threader and work-unit count, and reset its pipeline after an interrupted update. Its output controls separate release of data after downstream use from release of data before a later update. Modules/…/itkProcessObject.h• L295-440 Modules/…/itkProcessObject.h• L461-537
References: Modules/…/itkProcessObject.h• L47-91 Modules/…/itkProcessObject.h• L174-235 Modules/…/itkProcessObject.h• L277-293 Modules/…/itkProcessObject.h• L357-459 Modules/…/itkProcessObject.h• L461-537 Modules/…/itkProcessObject.h• L809-903
Typed sources
ImageSource and MeshSource specialize the process-object contract for their result types. They create the correct output data object and provide typed access to it. This keeps the general pipeline interface based on DataObject while giving image and mesh algorithms a useful domain-specific interface. Modules/…/itkImageSource.h• L39-57 Modules/…/itkMeshSource.h• L36-47
References: Modules/…/itkImageSource.h• L39-57 Modules/…/itkImageSource.h• L89-103 Modules/…/itkMeshSource.h• L36-47 Modules/…/itkMeshSource.h• L66-78
Image streaming
StreamingImageFilter controls how a large image request moves through the upstream pipeline. It divides the output region into pieces, asks upstream stages to produce one piece at a time, and assembles those pieces into one output image. This lowers peak memory use without changing the final output shape. ImageRegionSplitterBase defines the shared contract for deciding how many pieces a region can support and for returning each piece. See pipeline execution for how requested regions drive this work. Modules/…/itkStreamingImageFilter.h• L26-37 Modules/…/itkStreamingImageFilter.h• L81-107 Modules/…/itkImageRegionSplitterBase.h• L28-49
The stream splitter limits the number of pieces to the requested count and to the number that the region can support. Each piece is requested upstream and copied into its matching output region. Progress and abort state remain part of the normal process-object contract. Modules/…/itkImageRegionSplitterBase.h• L72-117 Modules/Core/Common/include/itkStreamingImageFilter.hxx#L148-L181 Modules/Core/Common/include/itkStreamingImageFilter.hxx#L184-L213
References: Modules/…/itkStreamingImageFilter.h• L26-37 Modules/…/itkStreamingImageFilter.h• L81-107 Modules/…/itkImageRegionSplitterBase.h• L28-49 Modules/…/itkImageRegionSplitterBase.h• L72-117 Modules/…/itkStreamingImageFilter.hxx• L94-181 Modules/…/itkStreamingImageFilter.hxx• L184-213
Threaded work execution
TBBMultiThreader supplies a parallel work layer for process objects that operate on arrays or image regions. It divides work into non-overlapping pieces, limits active parallelism, and reports progress or an abort request through the process-object contract. This keeps thread scheduling separate from the data and pipeline abstractions. Modules/Core/Common/src/itkTBBMultiThreader.cxx#L54-L162 Modules/Core/Common/src/itkTBBMultiThreader.cxx#L258-L301
The TBB path preserves complete coverage of the requested work. Its tests check one-time visits for arrays and image regions, whole-row behavior for suitable image shapes, work-unit sizing, and prompt response to an abort request. The pipeline execution page explains how this work layer fits inside a process update. Modules/Core/Common/test/itkTBBMultiThreaderGTest.cxx#L100-L198 Modules/…/CMakeLists.txt• L1585-1608
References: Modules/…/itkTBBMultiThreader.cxx• L54-162 Modules/…/itkTBBMultiThreader.cxx• L258-301 Modules/…/itkTBBMultiThreaderGTest.cxx• L33-98 Modules/…/itkTBBMultiThreaderGTest.cxx• L100-198 Modules/…/CMakeLists.txt• L780-820 Modules/…/CMakeLists.txt• L1585-1608
Image abstraction
Image geometry
ImageBase defines the spatial meaning of an image without storing its pixel values. It represents an n-dimensional grid through an origin, spacing, direction, and extent. It also converts between grid indices and physical points, so an algorithm can keep sampled data aligned with the space in which it was acquired or measured. Modules/…/itkImageBase.h• L56-101 Modules/…/itkImageBase.h• L113-171 Modules/…/itkImageBase.h• L448-552
The image model also maps a position in the buffered region to a linear buffer offset and maps that offset back to an index. The shared ImageHelper contract keeps this relationship consistent for image access and traversal. Modules/…/itkImageBase.h• L352-415 Modules/…/itkImageHelper.h• L25-37 Modules/…/itkImageHelper.h• L52-113
When an extraction changes image dimension, the output must also receive a valid spatial direction. ITK therefore makes the collapse choice explicit: it can use an identity direction, retain the non-collapsed submatrix when it is valid, or use a fallback strategy. An unspecified or invalid choice raises an exception instead of silently selecting a spatial meaning. Modules/…/itkDirectionAlgorithm.h• L35-83 Modules/Core/Common/src/itkDirectionAlgorithm.cxx#L59-L129 Modules/…/itkExtractImageFilter.h• L60-74 Modules/Core/Common/include/itkExtractImageFilter.hxx#L156-L189
References: Modules/…/itkImageBase.h• L56-101 Modules/…/itkImageBase.h• L113-171 Modules/…/itkImageBase.h• L352-415 Modules/…/itkImageBase.h• L448-552 Modules/…/itkImageHelper.h• L25-37 Modules/…/itkImageHelper.h• L52-113 Modules/…/itkDirectionAlgorithm.h• L35-83 Modules/…/itkDirectionAlgorithm.cxx• L59-129 Modules/…/itkExtractImageFilter.h• L60-74 Modules/…/itkExtractImageFilter.hxx• L156-189
Image values
Image combines the geometry from ImageBase with a typed pixel grid. The pixel type can represent scalar, vector, color, or user-defined values. The image exposes pixel access and a pixel container while keeping the same data-object lifecycle and region contract as other pipeline data. See image data representation for pixel storage, access, and alternate image views. Modules/…/itkImage.h• L34-67 Modules/…/itkImage.h• L87-145 Modules/…/itkImage.h• L187-210
References: Modules/…/itkImage.h• L34-67 Modules/…/itkImage.h• L87-145 Modules/…/itkImage.h• L187-210
Image boundary conditions
ImageBoundaryCondition defines how neighborhood-based image operations obtain values outside an image's valid bounds. A boundary condition can state whether a full neighborhood is needed and can map an output request to the input region required to compute it. This keeps edge behavior and streaming needs within the image and pipeline contracts. Modules/…/itkImageBoundaryCondition.h• L27-49 Modules/…/itkImageBoundaryCondition.h• L117-154
References: Modules/…/itkImageBoundaryCondition.h• L27-49 Modules/…/itkImageBoundaryCondition.h• L91-106 Modules/…/itkImageBoundaryCondition.h• L117-154
Mesh abstraction
Mesh geometry and topology
Mesh represents unstructured spatial data. It combines points with cells that describe topology, and it can carry attributes on points, cells, or boundaries. Its traits define the coordinate and identifier types without fixing one storage choice, so the same conceptual mesh interface can support different data needs. Modules/…/itkMesh.h• L57-83 Modules/…/itkMesh.h• L123-153
PointSet supplies the point and point-attribute part of this model. Mesh adds cells and the relationships needed to describe boundaries and neighborhood structure. Both remain DataObject values, so mesh sources and filters use the same source, output, update, and lifetime model as image processes. See mesh and spatial objects for mesh use with other spatial data. Modules/…/itkPointSet.h• L38-66 Modules/…/itkMesh.h• L297-323 Modules/…/itkMeshSource.h• L136-165
The mesh model is also exposed to supported language bindings through selected dimension and scalar-type forms. These bindings cover the mesh region, cell interfaces, and the containers and visitors used to describe mesh topology, so wrapped code can use the same data model as native code. Modules/Core/Mesh/wrapping/itkMeshBase.wrap#L4-L17 Modules/Core/Mesh/wrapping/itkMeshBase.wrap#L20-L32 Modules/Core/Mesh/wrapping/itkMeshBase.wrap#L62-L104
References: Modules/…/itkMesh.h• L57-83 Modules/…/itkMesh.h• L123-153 Modules/…/itkPointSet.h• L38-66 Modules/…/itkMesh.h• L297-323 Modules/…/itkMeshSource.h• L136-165 Modules/…/itkMeshBase.wrap• L4-17 Modules/…/itkMeshBase.wrap• L20-32 Modules/…/itkMeshBase.wrap• L62-104
Mesh modifier functions
Some mesh operations use a function-object model for small local changes instead of a pipeline filter. A mesh modifier receives the mesh to change and applies a limited geometry or connectivity update in place. Larger changes use the normal filter model when a separate output is safer or clearer. Modules/…/itkQuadEdgeMeshFunctionBase.h• L26-45
References: Modules/…/itkQuadEdgeMeshFunctionBase.h• L26-45 Modules/…/itkQuadEdgeMeshFunctionBase.h• L54-99
Transform abstraction
Spatial transforms
Transform defines a mapping from an input space to an output space. Its common interface maps points and can map vectors or covariant vectors when a concrete transform supports those operations. It does not assume that every transform has an inverse, so inverse behavior belongs to types that can provide it. A concrete transform can expose either direction as its forward operation while still using the same point-mapping contract. Modules/…/itkTransform.h• L33-45 Modules/…/itkTransform.h• L176-240 Modules/…/itkAzimuthElevationToCartesianTransform.h• L145-205
For images, TransformGeometryImageFilter applies a supported linear transform to image geometry while preserving the image values. It changes the physical-space description instead of resampling the image onto a new grid. This gives spatial algorithms a way to change image placement without adding interpolation artifacts. Modules/…/itkTransformGeometryImageFilter.h• L28-48 Modules/Core/Transform/include/itkTransformGeometryImageFilter.hxx#L39-L94
References: Modules/…/itkTransform.h• L33-45 Modules/…/itkTransform.h• L97-181 Modules/…/itkAzimuthElevationToCartesianTransform.h• L145-205 Modules/…/itkTransformGeometryImageFilter.h• L28-48 Modules/…/itkTransformGeometryImageFilter.h• L137-160 Modules/…/itkTransformGeometryImageFilter.hxx• L39-94
Transform state
TransformBase gives transforms a representation that other systems can use without knowing the concrete transform type. It exposes parameter and fixed-parameter sets, input and output dimensions, a stable type description, and the named spaces at each end of the mapping. Registration and other generic consumers can therefore change or inspect transform state through one contract. A transform may derive from a matrix-based class for API reuse and still report that it is not linear when its mapping is not linear. Modules/…/itkTransformBase.h• L58-108 Modules/…/itkTransformBase.h• L110-179 Modules/…/itkAzimuthElevationToCartesianTransform.h• L173-187
Versor provides a normalized four-value representation for 3D rotation. It converts between axis-angle, matrix, quaternion, and vector forms, and it rejects zero-length or invalid rotation inputs instead of creating an undefined rotation. Modules/Core/Common/include/itkVersor.hxx#L29-L37 Modules/Core/Common/include/itkVersor.hxx#L164-L181 Modules/Core/Common/include/itkVersor.hxx#L301-L381 Modules/Core/Common/include/itkVersor.hxx#L521-L579
References: Modules/…/itkTransform.h• L33-45 Modules/…/itkTransformBase.h• L58-108 Modules/…/itkTransformBase.h• L110-179 Modules/…/itkAzimuthElevationToCartesianTransform.h• L173-187 Modules/…/itkVersor.hxx• L29-37 Modules/…/itkVersor.hxx• L164-181 Modules/…/itkVersor.hxx• L301-381 Modules/…/itkVersor.hxx• L521-579 Modules/…/itkAzimuthElevationToCartesianTransformTest.cxx• L179-228
Lifecycle and memory ownership
Object lifetime
ITK uses reference counting as the normal lifetime model for its object types. Copying a SmartPointer adds a reference and releasing it removes a reference. Internal non-owning links use WeakPointer when ownership must not flow back through the pipeline. This lets a data object refer to its source without keeping a source alive through a cycle. Modules/…/itkSmartPointer.h• L63-103 Modules/…/itkWeakPointer.h• L26-37 Modules/…/itkDataObject.h• L546-575
References: Modules/…/itkSmartPointer.h• L63-103 Modules/…/itkWeakPointer.h• L26-37 Modules/…/itkDataObject.h• L546-575
Data lifetime
Data lifetime has two separate parts: the lifetime of the data object and the lifetime of its bulk data. A data object can stay connected and current while its bulk data is released to reduce memory use. A later request can cause the owning process object to generate that data again. ReleaseDataFlag controls release after downstream use. ReleaseDataBeforeUpdateFlag controls release of output data that a later update will replace. Modules/…/itkDataObject.h• L327-379 Modules/…/itkProcessObject.h• L461-499
ImageSource keeps output storage by default when it can reuse the memory for new values. This differs from the general process-object default and helps avoid needless allocation for large image outputs. Applications can choose earlier release when peak memory matters more than storage reuse. Modules/…/itkImageSource.h• L48-57 Modules/…/itkProcessObject.h• L518-525
Process-level memory observation is separate from data-object lifetime. MemoryUsageObserver selects a platform-specific way to report the running process's memory use; it does not own data objects or decide when their bulk data is released. Modules/…/itkMemoryUsageObserver.h• L35-58 Modules/…/itkMemoryUsageObserver.h• L149-175 Modules/Core/Common/src/itkMemoryUsageObserver.cxx#L267-L330
References: Modules/…/itkSmartPointer.h• L63-103 Modules/…/itkWeakPointer.h• L26-37 Modules/…/itkDataObject.h• L327-379 Modules/…/itkDataObject.h• L546-575 Modules/…/itkProcessObject.h• L461-525 Modules/…/itkImageSource.h• L48-57 Modules/…/itkMemoryUsageObserver.h• L35-58 Modules/…/itkMemoryUsageObserver.h• L149-175 Modules/…/itkMemoryUsageObserver.cxx• L267-330
Concept relationships
The core abstractions form a small set of related responsibilities rather than separate execution systems:
| Concept | Main responsibility | Relationship |
|---|---|---|
Object | Change state and events | Supports active framework objects. |
ExceptionObject | Error context and reporting | Carries failure details across framework boundaries. |
DataObject | Values, metadata, and data state | Moves between process objects. |
| Data-object decorator | Pipeline wrapper for a value or auxiliary object | Gives non-pipeline values a DataObject contract. |
ProcessObject | Inputs, outputs, and production rules | Generates or transforms data objects. |
| Threader | Work partition and parallel execution | Runs process work over arrays or regions. |
Image | Typed grid samples and physical geometry | Uses the data-object contract for image data. |
| Image range | Pixel traversal over buffered or selected image regions | Gives image values a standard range interface. |
| Image iterator | Read-only or writable traversal through image regions | Gives image algorithms several access and walk patterns. |
| Image boundary condition | Values and input needs at image borders | Extends neighborhood operations beyond the valid image region. |
Mesh | Points, cells, topology, and attributes | Uses the data-object contract for unstructured data. |
Transform | Space-to-space mappings and parameters | Supplies spatial behavior to algorithms and registration. |
In a typical operation, a process object holds references to input and output data objects. An output points back to its source without owning that source. The source and its data use modification state, region state when available, and bulk-data state to decide whether a request needs new work. A threader can divide that work while preserving the same process state and abort contract. Failures from this work use the common exception contract so callers can inspect the error without depending on the concrete process or data type. This relationship is the foundation for the demand-driven pipeline. Modules/…/itkDataObject.h• L304-325 Modules/…/itkProcessObject.h• L357-391 Modules/Core/Common/src/itkTBBMultiThreader.cxx#L127-L162 Modules/…/itkExceptionObject.h• L36-50
References: Modules/…/itkObject.h• L44-52 Modules/…/itkExceptionObject.h• L36-50 Modules/…/itkDataObject.h• L133-168 Modules/…/itkProcessObject.h• L47-63 Modules/…/itkTBBMultiThreader.cxx• L127-162 Modules/…/itkImageBufferRange.h• L38-43 Modules/…/itkImageIterator.hxx• L25-34 Modules/…/itkImageBoundaryCondition.h• L129-154 Modules/…/itkTransform.h• L33-45
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to object lifetime links must preserve non-owning source relationships so pipeline cycles do not become ownership cycles.
- Changes to
DataObjectstate must keep generated-data time, modification time, region state, and released-data state distinct. - Changes to modification-time generation must preserve monotonic ordering across objects and the supported concurrency boundary for one object.
- Changes to
Indentor print-helper formatting must preserve readable nesting, numeric output, and nested-container output for the shared object-printing contract. - Changes to exception construction or enrichment must preserve location, description, thrower context, and standard
what()output. - Changes to decorator ownership must keep the carried value's lifetime rule aligned with the decorator type and must preserve modification visibility for wrapped ITK objects.
- Changes to region behavior must keep image sources, image filters, and non-image data objects valid under the shared data-object contract.
- Changes to image range or iterator construction must keep traversal limited to valid buffered data and must preserve const access, writable access, specialized image storage behavior, line boundaries, selected directions, random sampling bounds, non-repeating visits, and reverse-region spans.
- Changes to image index-to-offset mapping must preserve agreement between buffered-region indices, linear offsets, and iterator traversal.
- Changes to image boundary conditions must keep border values consistent with the input region required for neighborhood computation and streaming.
- Changes to image dimension reduction must keep the extraction region, output dimension, retained direction matrix, and selected collapse strategy consistent.
- Changes to output creation must preserve the concrete data type expected by each typed source and by filters with more than one output type.
- Changes to streaming image updates or region splitting must preserve disjoint region coverage, the supported number of pieces, final output assembly, progress reporting, abort handling, and upstream requested-region propagation.
- Changes to factory registration or loading must preserve override order, lazy initialization, autoload-path setup, rehash behavior, version checks, and the configured load entry point.
- Changes to runtime type visibility or private RTTI checks must preserve supported cross-library casts.
- Changes to shared index, size, offset, or identifier aliases must preserve the signedness and width expected by image and mesh consumers.
- Changes to image geometry must preserve the agreement between index space, physical space, and downstream transforms.
- Changes to mesh point or cell structure must preserve the identifiers and relationships used by mesh consumers.
- Changes to local mesh modifier behavior must keep in-place edits distinct from filter outputs and must preserve mesh ownership expectations.
- Changes to mesh wrapping must keep supported dimensions, scalar types, cell interfaces, containers, and visitors aligned so language bindings expose a usable mesh contract.
- Changes to transform parameters or space names must preserve the contract used by generic registration and spatial algorithms.
- Changes to image-geometry transform behavior must keep linear-transform validation separate from pixel-value preservation and metadata updates.
- Changes to
Versormust preserve normalized rotations and reject invalid axis, matrix, and zero-norm inputs. - Changes to TBB work partitioning must preserve one-time coverage of requested array or image-region work, progress reporting, and abort handling.
- Changes to
PyCommandorPyImageFiltermust preserve Python callable ownership, interpreter-lock handling, event or filter execution, and conversion of Python failures to ITK exceptions. - Changes to wrapped function templates must preserve the supported image dimensions, pixel types, and interpolation orders expected by language bindings.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A pipeline link owns its source instead of using a non-owning relationship | Objects can remain alive through a reference cycle | Keep source links weak and keep application ownership explicit |
| A caller reads image pixels before the needed region is buffered | The requested values are not available in memory | Update the data and check the buffered region before access |
| A range or iterator is built for a non-empty region outside the buffered image | Construction fails or pixel access is invalid | Request or buffer the region before traversal |
| A writable iterator treats an accessor-backed or specialized image as direct storage | Reads or writes can bypass the image's pixel representation | Use the iterator's access contract rather than assuming direct storage |
| A line iterator uses a direction outside the image dimension | Iterator setup stops with an exception | Select a direction within the image dimension |
| A scanline iterator is incremented after it reaches the end of a line | Iterator state becomes undefined | Check the line boundary before incrementing and call NextLine() |
| A random iterator is used as if it visits every pixel exactly once | Sampling results do not represent a full ordered traversal | Use an ordered iterator for full coverage and set the sample count for random sampling |
| A non-repeating random iterator requests more samples than its region contains | The request is reduced to the number of pixels and may not match the caller's expected count | Check the accepted sample count before processing |
| A neighborhood operation uses a boundary condition with an input region that is too small | Border values or streamed output are wrong | Use the boundary condition's required input-region contract |
| An extraction region has the wrong number of collapsed axes | Output information cannot match the requested image dimension | Set one zero-sized axis for each dimension removed from the output |
| Direction collapse is left unspecified or the retained direction block is singular under a strict strategy | Image extraction stops with an exception or receives an unintended spatial direction | Select the identity, submatrix, or fallback strategy that matches the spatial meaning |
| A data object reports current state after its bulk data was released | A later consumer can read missing data | Keep released-data state separate from modification state and regenerate on demand |
| A wrapped value uses an ownership rule that does not match its decorator | The value can be deleted too soon or leak after the data object ends | Select the decorator that matches an ITK object, a stored value, or an owned raw pointer |
| A process object creates an output with the wrong data type | Downstream typed access fails or receives an incompatible object | Keep output creation aligned with the process object's declared output contract |
Different threads call Modified() on the same timestamp instance | The shared counter remains valid but that instance's local time can be wrong | Synchronize access to one timestamp instance or modify separate objects |
| Stream pieces overlap or leave gaps in the output region | The assembled image contains duplicate or missing data | Use the region splitter and copy each piece into its matching output region |
An autoload path changes after factory initialization without ReHash() | New libraries are not considered and old registrations remain active | Set the path before first factory use or call ReHash() after changing it |
| A factory with an incompatible version is loaded under strict checking | Factory registration fails before the replacement can be used | Build dynamic factories against the running ITK version or keep version checking intentional |
| A compiler or runtime cannot perform a private cross-library dynamic cast | Type-based use of an object can fail at a library boundary | Keep the configuration check aligned with the visibility and runtime support |
| A caller assumes all index and identifier values have the same signedness or width | Large data sets or negative offsets can be truncated or misread | Use the shared ITK aliases for each count, index, offset, and identifier role |
| Image geometry changes without a matching coordinate update | Spatial algorithms use the wrong physical locations | Treat origin, spacing, direction, and extent as one geometry contract |
| A geometry filter receives a non-linear transform | The update stops because geometry changes require a linear mapping | Use a transform that satisfies the geometry filter's linear contract |
| A transform is used as if every mapping has an inverse or is linear | Backward mapping or scale-based reasoning fails for a non-linear transform | Use inverse operations and linear behavior only through contracts that support them |
| A rotation is built from a zero axis, an invalid matrix, or an unnormalized value | Vector mapping is undefined or an exception stops the operation | Use valid rotation inputs and keep the Versor normalized |
| Mesh identifiers or point-cell links become inconsistent | Topology and neighborhood queries return incorrect results | Preserve identifier and link consistency when changing mesh structure |
| A mesh binding requests a dimension or scalar type that is not wrapped | The binding cannot construct or use the expected mesh or cell type | Keep wrapper template coverage aligned with supported mesh dimensions and scalar types |
| An ITK exception loses its location or description while an error is enriched | The caller cannot trace the failure to its source or understand its cause | Preserve the ExceptionObject context when setting or forwarding error details |
| A TBB region split overlaps or omits work, or an array callback ignores abort state | Pixels or indices can be processed more than once, not at all, or long after cancellation | Preserve complete non-overlapping splits and use the process abort contract |
A PyCommand or PyImageFilter has no callable or the callable raises a Python error | The observer or filter action fails and ITK reports an exception | Set a callable before execution and handle the propagated ITK error |
Key files
| File | Why to read it |
|---|---|
| Modules/…/itkLightObject.h | Defines the base lifetime and object-creation contract. |
| Modules/…/itkObject.h | Adds modification state and event observation. |
| Modules/…/itkSmartPointer.h | Defines owning reference-counted handles. |
| Modules/…/itkWeakPointer.h | Defines non-owning links used to avoid lifetime cycles. |
| Modules/…/itkMacro.h | Defines common object creation, cloning, and copy/move rules used by framework classes. |
| Modules/…/itkIndent.h | Defines the shared indentation state used for nested object printing. |
| Modules/…/itkPrintHelper.h | Defines shared formatting for numeric values and standard containers in object output. |
Modules/Core/Common/src/itkIndent.cxx | Shows the bounded indentation behavior used by object output. |
| Modules/…/itkTimeStamp.h | Defines modification-time values and their supported concurrency behavior. |
Modules/Core/Common/src/itkTimeStamp.cxx | Shows how modification times advance from the shared counter. |
| Modules/…/itkExceptionObject.h | Defines the common error contract and standard error subtypes. |
Modules/Core/Common/src/itkExceptionObject.cxx | Shows how ITK stores, formats, updates, and prints exception context. |
Modules/Core/Common/CMake/itkCheckPrivateDynamicCast.cmake | Defines the configuration check for cross-library runtime type casts. |
| Modules/…/itkObjectFactoryBase.h | Defines factory registration, class replacement, autoload paths, and version policy. |
Modules/Core/Common/src/itkObjectFactoryBase.cxx | Shows how registered and dynamic factories participate in object creation. |
Modules/Core/Common/test/itkObjectFactoryAutoloadPathTest.cxx | Shows lazy factory loading and path configuration through the environment or API. |
Modules/Core/Common/test/itkObjectFactoryTest2.cxx | Shows factory replacement of an image container and image allocation checks. |
| Modules/…/CMakeLists.txt | Defines the build conditions and test modes for dynamic factories, threaders, and common behavior. |
Modules/Core/Common/src/itkConfigure.h.in | Defines build choices that affect dynamic loading, wrapping, IDs, and cross-library behavior. |
| Modules/…/itkPyCommand.h | Defines the command bridge from ITK events to Python callables. |
Modules/Core/Common/src/itkPyCommand.cxx | Shows callable lifetime, interpreter-lock use, and error propagation. |
Modules/Core/Common/include/itkPyImageFilter.hxx | Shows how Python callbacks participate in image filter lifecycle stages. |
Modules/Core/Common/wrapping/itkFunctionBase.wrap | Defines wrapped function forms for supported image and value types. |
Modules/Core/Common/wrapping/itkBSplineInterpolationWeightFunction.wrap | Defines wrapped interpolation weight functions and their supported orders. |
| Modules/…/itkPyCommandTest.py | Shows the Python callback and ownership contract. |
| Modules/…/itkDataObject.h | Defines pipeline data state, source links, regions, and release behavior. |
| Modules/…/itkDataObjectDecorator.h | Defines wrappers for ITK objects carried as pipeline data. |
| Modules/…/itkSimpleDataObjectDecorator.h | Defines wrappers for simple values carried as pipeline data. |
| Modules/…/itkAutoPointerDataObjectDecorator.h | Defines wrappers that own ordinary pointed-to values. |
| Modules/…/itkProcessObject.h | Defines process inputs, outputs, update rules, and memory controls. |
| Modules/…/itkIntTypes.h | Defines shared numeric roles for indices, counts, offsets, IDs, and modification times. |
| Modules/…/itkStreamingImageFilter.h | Defines image-region streaming as a process-object operation. |
Modules/Core/Common/include/itkStreamingImageFilter.hxx | Shows region splitting, upstream updates, output assembly, progress, and abort behavior. |
| Modules/…/itkImageRegionSplitterBase.h | Defines the contract for counting and returning valid image-region pieces. |
Modules/Core/Common/src/itkTBBMultiThreader.cxx | Defines parallel array and image-region work with progress and abort support. |
Modules/Core/Common/test/itkTBBMultiThreaderGTest.cxx | Verifies complete work coverage, region splitting, and abort behavior for the TBB threader. |
| Modules/…/itkImageBase.h | Defines image geometry, region roles, and index-to-buffer mapping. |
| Modules/…/itkImageHelper.h | Defines the shared index and linear-offset conversion used by image access. |
| Modules/…/itkImage.h | Defines typed image values and pixel access. |
| Modules/…/itkImageSource.h | Defines typed image outputs and image-source memory behavior. |
| Modules/…/itkDirectionAlgorithm.h | Defines the common choices for preserving image direction when dimensions collapse. |
Modules/Core/Common/src/itkDirectionAlgorithm.cxx | Shows validation and fallback behavior for collapsed direction matrices. |
| Modules/…/itkExtractImageFilter.h | Defines dimension-reducing image extraction and its spatial-direction contract. |
Modules/Core/Common/include/itkExtractImageFilter.hxx | Shows how extraction maps regions and assigns output geometry. |
| Modules/…/itkImageBufferRange.h | Defines range-style traversal over buffered image pixels. |
| Modules/…/itkImageRegionRange.h | Defines range-style traversal over a selected buffered image region. |
Modules/Core/Common/include/itkImageIterator.hxx | Illustrates the common writable iterator construction contract. |
Modules/Core/Common/include/itkImageRegionIterator.hxx | Illustrates region-scoped writable traversal. |
| Modules/…/itkImageLinearConstIteratorWithIndex.h | Defines line-wise read-only traversal along a selected image direction. |
| Modules/…/itkImageScanlineConstIterator.h | Defines fast read-only traversal across image scanlines. |
| Modules/…/itkImageRandomNonRepeatingConstIteratorWithIndex.h | Defines random read-only traversal without repeated pixels. |
| Modules/…/itkImageRandomConstIteratorWithIndex.h | Defines bounded random sampling for read-only image traversal. |
Modules/Core/Common/include/itkImageRandomConstIteratorWithIndex.hxx | Shows random-position selection and seed handling. |
| Modules/…/itkImageRegionReverseConstIterator.h | Defines reverse read-only traversal within an image region. |
Modules/Core/Common/include/itkImageRandomNonRepeatingIteratorWithIndex.hxx | Illustrates indexed random traversal without repeated pixels. |
| Modules/…/itkImageBoundaryCondition.h | Defines border-value and required-input-region behavior for neighborhood work. |
Modules/Core/Common/test/itkImageIteratorsGTest.cxx | Shows the iterator construction, deduction, and storage-access contract. |
Modules/Core/Common/test/itkDirectionAlgorithmGTest.cxx | Shows direction-collapse choices, shape checks, and singular-matrix behavior. |
Modules/Core/Common/include/itkVersor.hxx | Defines normalized 3D rotation values and their vector and matrix conversions. |
| Modules/…/itkMesh.h | Defines unstructured geometry, cells, topology, and mesh attributes. |
| Modules/…/itkPointSet.h | Defines points and point attributes as the base of mesh data. |
| Modules/…/itkMeshSource.h | Defines typed mesh outputs within the process-object model. |
Modules/Core/Mesh/wrapping/itkMeshBase.wrap | Defines the mesh, cell, container, and visitor forms exposed to language bindings. |
| Modules/…/itkQuadEdgeMeshFunctionBase.h | Defines the in-place model for small local mesh changes. |
| Modules/…/itkTransformBase.h | Defines generic transform state and parameter access. |
| Modules/…/itkTransform.h | Defines mappings between points, vectors, and coordinate spaces. |
| Modules/…/itkTransformGeometryImageFilter.h | Defines image geometry changes driven by a linear transform. |
Modules/Core/Transform/include/itkTransformGeometryImageFilter.hxx | Shows validation, metadata updates, and pixel-data preservation. |
| Modules/…/itkAzimuthElevationToCartesianTransform.h | Shows that a concrete mapping can be directional and non-linear while using the common transform interface. |
Modules/Core/Common/src/itkMemoryUsageObserver.cxx | Shows the platform-specific process memory observation path. |
| Modules/…/itkMemoryUsageObserver.h | Defines the platform-selected memory usage observer contract. |
| docs/pipeline-execution.md | Explains how these abstractions execute a demand-driven pipeline. |
| docs/image-data-representation.md | Explains image regions, storage, geometry, and pixel access in detail. |
| docs/mesh-and-spatial-objects.md | Explains mesh use with other spatial data. |