Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::ImagePixelAccessor< TPixel, VDimension > Class Template Reference

Provides templated image access for all inheriting classes. More...

#include <mitkImagePixelAccessor.h>

Inheritance diagram for mitk::ImagePixelAccessor< TPixel, VDimension >:
Collaboration diagram for mitk::ImagePixelAccessor< TPixel, VDimension >:

Public Types

typedef itk::Index< VDimension > IndexType
 
typedef ImagePixelAccessor< TPixel, VDimension > ImagePixelAccessorType
 
typedef Image::ConstPointer ImageConstPointer
 

Public Member Functions

int GetDimension (int i) const
 Get the size of the specified dimension from the underlying ImageDataItem. More...
 

Protected Member Functions

 ImagePixelAccessor (ImageConstPointer iP, const mitk::ImageDataItem *iDI)
 Construct the accessor from an image and an optional ImageDataItem. More...
 
virtual ~ImagePixelAccessor ()
 Destructor. More...
 
void CheckData (const Image *image)
 Validate that the accessor dimensions and pixel type match the image. More...
 
unsigned int GetOffset (const IndexType &idx) const
 Compute the linear memory offset for a given multi-dimensional image index. More...
 

Protected Attributes

const ImageDataItem * m_ImageDataItem
 Holds the specified ImageDataItem for pixel data access. More...
 
BaseGeometry::Pointer m_Geometry
 Pointer to the used Geometry. Since Geometry can be different to the Image (if memory was forced to be coherent) it is necessary to store Geometry separately. More...
 
itk::ImageRegion< VDimension > * m_SubRegion
 A Subregion defines an arbitrary area within the image. If no SubRegion is defined, the whole ImageDataItem or Image is regarded. A subregion (e.g. subvolume) can lead to non-coherent memory access where every dimension has a start- and end-offset. More...
 
int m_Options
 Stores all extended properties of an ImageAccessor. The different flags in mitk::ImageAccessorBase::Options can be unified by bitwise operations. More...
 

Detailed Description

template<class TPixel, unsigned int VDimension = 3>
class mitk::ImagePixelAccessor< TPixel, VDimension >

Provides templated image access for all inheriting classes.

Template Parameters
TPixelDefines the pixel type used for accessing image data.
VDimensionDefines the dimension for accessing data. Defaults to 3.
See also
ImageReadAccessor
ImageWriteAccessor

Definition at line 34 of file mitkImagePixelAccessor.h.

Member Typedef Documentation

◆ ImageConstPointer

template<class TPixel , unsigned int VDimension = 3>
typedef Image::ConstPointer mitk::ImagePixelAccessor< TPixel, VDimension >::ImageConstPointer

Definition at line 39 of file mitkImagePixelAccessor.h.

◆ ImagePixelAccessorType

template<class TPixel , unsigned int VDimension = 3>
typedef ImagePixelAccessor<TPixel, VDimension> mitk::ImagePixelAccessor< TPixel, VDimension >::ImagePixelAccessorType

Definition at line 38 of file mitkImagePixelAccessor.h.

◆ IndexType

template<class TPixel , unsigned int VDimension = 3>
typedef itk::Index<VDimension> mitk::ImagePixelAccessor< TPixel, VDimension >::IndexType

Definition at line 37 of file mitkImagePixelAccessor.h.

Constructor & Destructor Documentation

◆ ImagePixelAccessor()

template<class TPixel , unsigned int VDimension = 3>
mitk::ImagePixelAccessor< TPixel, VDimension >::ImagePixelAccessor ( ImageConstPointer  iP,
const mitk::ImageDataItem *  iDI 
)
inlineprotected

Construct the accessor from an image and an optional ImageDataItem.

If iDI is nullptr, the full channel data of the image is used instead.

Parameters
iPPointer to the image to access.
iDIThe allocated image data item (e.g. a slice, volume, or channel). If nullptr, the full channel data is retrieved from the image.

Definition at line 62 of file mitkImagePixelAccessor.h.

References mitk::ImagePixelAccessor< TPixel, VDimension >::CheckData(), and mitk::ImagePixelAccessor< TPixel, VDimension >::m_ImageDataItem.

◆ ~ImagePixelAccessor()

template<class TPixel , unsigned int VDimension = 3>
virtual mitk::ImagePixelAccessor< TPixel, VDimension >::~ImagePixelAccessor ( )
inlineprotectedvirtual

Destructor.

Definition at line 72 of file mitkImagePixelAccessor.h.

Member Function Documentation

◆ CheckData()

template<class TPixel , unsigned int VDimension = 3>
void mitk::ImagePixelAccessor< TPixel, VDimension >::CheckData ( const Image *  image)
inlineprotected

Validate that the accessor dimensions and pixel type match the image.

Parameters
imageThe image to validate against.
Exceptions
mitk::Exceptionif dimensions or pixel types do not match.

Definition at line 80 of file mitkImagePixelAccessor.h.

References mitk::Image::GetDimension(), mitk::ImageDataItem::GetDimension(), mitk::PixelType::GetNumberOfComponents(), mitk::Image::GetPixelType(), mitk::ImagePixelAccessor< TPixel, VDimension >::m_ImageDataItem, mitk::MakePixelType(), and mitkThrow.

Referenced by mitk::ImagePixelAccessor< TPixel, VDimension >::ImagePixelAccessor().

◆ GetDimension()

template<class TPixel , unsigned int VDimension = 3>
int mitk::ImagePixelAccessor< TPixel, VDimension >::GetDimension ( int  i) const
inline

Get the size of the specified dimension from the underlying ImageDataItem.

Parameters
iThe dimension index to query.
Returns
The size of the requested dimension.

Definition at line 47 of file mitkImagePixelAccessor.h.

References mitk::ImageDataItem::GetDimension(), and mitk::ImagePixelAccessor< TPixel, VDimension >::m_ImageDataItem.

◆ GetOffset()

Member Data Documentation

◆ m_Geometry

template<class TPixel , unsigned int VDimension = 3>
BaseGeometry::Pointer mitk::ImagePixelAccessor< TPixel, VDimension >::m_Geometry
protected

Pointer to the used Geometry. Since Geometry can be different to the Image (if memory was forced to be coherent) it is necessary to store Geometry separately.

Definition at line 122 of file mitkImagePixelAccessor.h.

◆ m_ImageDataItem

◆ m_Options

template<class TPixel , unsigned int VDimension = 3>
int mitk::ImagePixelAccessor< TPixel, VDimension >::m_Options
protected

Stores all extended properties of an ImageAccessor. The different flags in mitk::ImageAccessorBase::Options can be unified by bitwise operations.

Definition at line 134 of file mitkImagePixelAccessor.h.

◆ m_SubRegion

template<class TPixel , unsigned int VDimension = 3>
itk::ImageRegion<VDimension>* mitk::ImagePixelAccessor< TPixel, VDimension >::m_SubRegion
protected

A Subregion defines an arbitrary area within the image. If no SubRegion is defined, the whole ImageDataItem or Image is regarded. A subregion (e.g. subvolume) can lead to non-coherent memory access where every dimension has a start- and end-offset.

Definition at line 129 of file mitkImagePixelAccessor.h.


The documentation for this class was generated from the following file: