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

Gives locked and index-based write access for a particular image part. More...

#include <mitkImagePixelWriteAccessor.h>

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

Public Types

typedef ImagePixelAccessor< TPixel, VDimension > ImagePixelAccessorType
 
typedef itk::SmartPointer< mitk::Image > ImagePointer
 
- Public Types inherited from mitk::ImagePixelAccessor< TPixel, 3 >
typedef itk::Index< VDimension > IndexType
 
typedef ImagePixelAccessor< TPixel, VDimension > ImagePixelAccessorType
 
typedef Image::ConstPointer ImageConstPointer
 

Public Member Functions

 ImagePixelWriteAccessor (ImagePointer iP, const ImageDataItem *iDI=nullptr, int OptionFlags=ImageAccessorBase::DefaultBehavior)
 Instantiates a mitk::ImageWriteAccessor (see its doxygen page for more details) More...
 
virtual TPixel * GetData () const
 Gives full data access. More...
 
void SetPixelByIndex (const itk::Index< VDimension > &idx, const TPixel &value)
 Sets a pixel value at the given index. More...
 
void SetPixelByIndexSafe (const itk::Index< VDimension > &idx, const TPixel &value)
 
const TPixel & GetPixelByIndex (const itk::Index< VDimension > &idx) const
 
const TPixel & GetPixelByIndexSafe (const itk::Index< VDimension > &idx) const
 
const TPixel & GetPixelByWorldCoordinates (mitk::Point3D position)
 
void SetPixelByWorldCoordinates (const mitk::Point3D &, const TPixel &value, unsigned int timestep=0)
 
 ~ImagePixelWriteAccessor () override
 Destructor informs Image to unlock memory. More...
 
- Public Member Functions inherited from mitk::ImagePixelAccessor< TPixel, 3 >
int GetDimension (int i) const
 Get the size of the specified dimension from the underlying ImageDataItem. More...
 

Additional Inherited Members

- Protected Member Functions inherited from mitk::ImagePixelAccessor< TPixel, 3 >
 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 inherited from mitk::ImagePixelAccessor< TPixel, 3 >
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::ImagePixelWriteAccessor< TPixel, VDimension >

Gives locked and index-based write access for a particular image part.

The class provides several set- and get-methods, which allow easy pixel access. It needs to know about pixel type and dimension of its image at compile time.

Template Parameters
TPixelDefines the pixel type.
VDimensionDefines the dimension for accessing data.

Definition at line 33 of file mitkImagePixelWriteAccessor.h.

Member Typedef Documentation

◆ ImagePixelAccessorType

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

Definition at line 38 of file mitkImagePixelWriteAccessor.h.

◆ ImagePointer

template<class TPixel , unsigned int VDimension = 3>
typedef itk::SmartPointer<mitk::Image> mitk::ImagePixelWriteAccessor< TPixel, VDimension >::ImagePointer

Definition at line 39 of file mitkImagePixelWriteAccessor.h.

Constructor & Destructor Documentation

◆ ImagePixelWriteAccessor()

template<class TPixel , unsigned int VDimension = 3>
mitk::ImagePixelWriteAccessor< TPixel, VDimension >::ImagePixelWriteAccessor ( ImagePointer  iP,
const ImageDataItem *  iDI = nullptr,
int  OptionFlags = ImageAccessorBase::DefaultBehavior 
)
inline

Instantiates a mitk::ImageWriteAccessor (see its doxygen page for more details)

Parameters
iPspecifies the associated Image
iDIspecifies the allocated image part
OptionFlagsproperties from mitk::ImageAccessorBase::Options can be chosen and assembled with bitwise unification.
Exceptions
mitk::Exceptionif the Constructor was created inappropriately
mitk::MemoryIsLockedExceptionif requested image area is exclusively locked and mitk::ImageAccessorBase::ExceptionIfLocked is set in OptionFlags

Includes a check if typeid of PixelType coincides with templated TPixel and a check if VDimension equals to the Dimension of the Image.

Note
To avoid intermittent Update() calls to a predecessing filter pipeline, a call to Modified() method after the access is finished is left to the developer.

Definition at line 57 of file mitkImagePixelWriteAccessor.h.

◆ ~ImagePixelWriteAccessor()

template<class TPixel , unsigned int VDimension = 3>
mitk::ImagePixelWriteAccessor< TPixel, VDimension >::~ImagePixelWriteAccessor ( )
inlineoverride

Destructor informs Image to unlock memory.

Definition at line 134 of file mitkImagePixelWriteAccessor.h.

Member Function Documentation

◆ GetData()

template<class TPixel , unsigned int VDimension = 3>
virtual TPixel* mitk::ImagePixelWriteAccessor< TPixel, VDimension >::GetData ( ) const
inlinevirtual

Gives full data access.

Definition at line 65 of file mitkImagePixelWriteAccessor.h.

References mitk::ImageAccessorBase::m_AddressBegin.

◆ GetPixelByIndex()

template<class TPixel , unsigned int VDimension = 3>
const TPixel& mitk::ImagePixelWriteAccessor< TPixel, VDimension >::GetPixelByIndex ( const itk::Index< VDimension > &  idx) const
inline

◆ GetPixelByIndexSafe()

template<class TPixel , unsigned int VDimension = 3>
const TPixel& mitk::ImagePixelWriteAccessor< TPixel, VDimension >::GetPixelByIndexSafe ( const itk::Index< VDimension > &  idx) const
inline

Extends GetPixel by integrating index validation to prevent overflow.

Exceptions
mitk::Exceptionin case of overflow

Definition at line 105 of file mitkImagePixelWriteAccessor.h.

References mitk::ImagePixelAccessor< TPixel, VDimension >::GetOffset(), mitk::ImageAccessorBase::m_AddressBegin, mitk::ImageAccessorBase::m_AddressEnd, and mitkThrow.

◆ GetPixelByWorldCoordinates()

template<class TPixel , unsigned int VDimension = 3>
const TPixel& mitk::ImagePixelWriteAccessor< TPixel, VDimension >::GetPixelByWorldCoordinates ( mitk::Point3D  position)
inline

Returns a const reference to the pixel at given world coordinate - works only with three-dimensional ImageAccessor

Definition at line 122 of file mitkImagePixelWriteAccessor.h.

References mitk::BaseData::GetGeometry(), mitk::ImageWriteAccessor::GetImage(), mitk::ImagePixelWriteAccessor< TPixel, VDimension >::GetPixelByIndex(), and mitk::BaseGeometry::WorldToIndex().

◆ SetPixelByIndex()

template<class TPixel , unsigned int VDimension = 3>
void mitk::ImagePixelWriteAccessor< TPixel, VDimension >::SetPixelByIndex ( const itk::Index< VDimension > &  idx,
const TPixel &  value 
)
inline

Sets a pixel value at the given index.

Definition at line 67 of file mitkImagePixelWriteAccessor.h.

References mitk::ImagePixelAccessor< TPixel, VDimension >::GetOffset(), and mitk::ImageAccessorBase::m_AddressBegin.

◆ SetPixelByIndexSafe()

template<class TPixel , unsigned int VDimension = 3>
void mitk::ImagePixelWriteAccessor< TPixel, VDimension >::SetPixelByIndexSafe ( const itk::Index< VDimension > &  idx,
const TPixel &  value 
)
inline

Extends SetPixel by integrating index validation to prevent overflow.

Definition at line 75 of file mitkImagePixelWriteAccessor.h.

References mitk::ImagePixelAccessor< TPixel, VDimension >::GetOffset(), mitk::ImageAccessorBase::m_AddressBegin, mitk::ImageAccessorBase::m_AddressEnd, and mitkThrow.

◆ SetPixelByWorldCoordinates()

template<class TPixel , unsigned int VDimension = 3>
void mitk::ImagePixelWriteAccessor< TPixel, VDimension >::SetPixelByWorldCoordinates ( const mitk::Point3D &  ,
const TPixel &  value,
unsigned int  timestep = 0 
)

Returns a reference to the pixel at given world coordinate


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