13 #ifndef mitkImagePixelReadAccessor_h
14 #define mitkImagePixelReadAccessor_h
34 template <
class TPixel,
unsigned int VDimension = 3>
59 :
ImagePixelAccessor<TPixel, VDimension>(iP, iDI), m_ReadAccessor(iP, iDI, OptionFlags)
67 :
ImagePixelAccessor<TPixel, VDimension>(iP.GetPointer(), iDI), m_ReadAccessor(iP, iDI, OptionFlags)
83 :
ImagePixelAccessor<TPixel, VDimension>(iP, iDI), m_ReadAccessor(iP, iDI, OptionFlags)
103 int nrComponents)
const
118 TPixel *targetAddress = ((TPixel *)m_ReadAccessor.
m_AddressBegin) + offset;
122 mitkThrow() <<
"ImageAccessor Overflow: image access exceeds the requested image area at " << idx <<
".";
125 return *targetAddress;
133 itk::Index<3> itkIndex;
144 itk::Index<3> itkIndex;
150 itk::Index<4> itk4Index;
151 for (
int i = 0; i < 3; ++i)
152 itk4Index[i] = itkIndex[i];
154 itk4Index[3] = timestep;
174 template <
class TPixel>
176 mitk::Image::Pointer im,
188 template <
class TPixel>
190 mitk::Image::ConstPointer im,
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the BaseGeometry of the data at time step t as a non-const pointer.
unsigned int GetTimeSteps() const
Get the number of time steps from the TimeGeometry.
void WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const
Convert world coordinates (mm) of a point to continuous index coordinates.
@ DefaultBehavior
Default behavior: wait for locked memory to be released.
@ IgnoreLock
Bypass the lock mechanism for immediate access. Only valid for read accessors.
Internal container for image data used by mitk::Image.
Provides templated image access for all inheriting classes.
unsigned int GetOffset(const IndexType &idx) const
Compute the linear memory offset for a given multi-dimensional image index.
Gives locked and index-based read access for a particular image part.
ImagePixelReadAccessor(Image *iP, const ImageDataItem *iDI=nullptr, int OptionFlags=ImageAccessorBase::DefaultBehavior)
Instantiates a mitk::ImageReadAccessor from a non-const Image raw pointer.
ImagePixelAccessor< TPixel, VDimension > ImagePixelAccessorType
const TPixel & GetPixelByIndexSafe(const itk::Index< VDimension > &idx) const
const TPixel & GetPixelByIndex(const itk::Index< VDimension > &idx) const
const TPixel & GetPixelByWorldCoordinates(mitk::Point3D position)
~ImagePixelReadAccessor() override
itk::SmartPointer< mitk::Image > ImagePointer
itk::SmartPointer< const mitk::Image > ImageConstPointer
ImagePixelReadAccessor(ImageConstPointer iP, const ImageDataItem *iDI=nullptr, int OptionFlags=ImageAccessorBase::DefaultBehavior)
Instantiates a mitk::ImageReadAccessor (see its doxygen page for more details)
itk::VariableLengthVector< TPixel > GetConsecutivePixelsAsVector(const itk::Index< VDimension > &idx, int nrComponents) const
Returns consecutive pixel values starting at a given index as a variable length vector.
const TPixel * GetData() const
Gives const access to the data.
const TPixel & GetPixelByWorldCoordinates(mitk::Point3D position, unsigned int timestep)
ImagePixelReadAccessor(const Image *iP, const ImageDataItem *iDI=nullptr, int OptionFlags=ImageAccessorBase::DefaultBehavior)
Instantiates a mitk::ImageReadAccessor from a const Image raw pointer.
ImagePixelReadAccessor(ImagePointer iP, const ImageDataItem *iDI=nullptr, int OptionFlags=ImageAccessorBase::DefaultBehavior)
Instantiates a mitk::ImageReadAccessor from an Image smart pointer.
Provides locked read-only access to a particular region of image data.
const Image * GetImage() const override
Image class for storing multi-dimensional medical image data.
const mitk::PixelType GetPixelType(int n=0) const
Returns the PixelType of channel n.
Describes the data type of image pixels.
size_t GetNumberOfComponents() const
Get the number of components per pixel.
#define mitkThrow()
Throw a generic mitk::Exception with source location information.
Find image slices visible on a given plane.
mitk::ScalarType FastSinglePixelAccess(mitk::PixelType, mitk::Image::Pointer im, ImageDataItem *item, itk::Index< 3 > idx, mitk::ScalarType &val, int component=0)
double ScalarType
Scalar type used throughout MITK for geometric computations.