MeVisLab Toolbox Reference
ml::TSubImage< DATATYPE > Class Template Reference

This template class manages/represents a rectangular 6D image region in memory that is organized linearly. More...

#include <mlTSubImage.h>

Inheritance diagram for ml::TSubImage< DATATYPE >:
ml::SubImage ml::TSubImageWithCursor< DATATYPE >

Public Types

typedef DATATYPE ComponentType
 A typedef to 'export' the type of voxels components. More...
 
typedef TSubImageCursor< DATATYPE > Cursor
 A read/write cursor. More...
 
typedef ConstTSubImageCursor< DATATYPE > ConstCursor
 A read-only cursor. More...
 

Public Member Functions

Constructors
 TSubImage (const SubImageBox &box, MLDataType dataType, void *data)
 Constructor for an image region with location/extent box with data type dataType (must fit to DATATYPE!) and the memory address data that holds the image region. More...
 
 TSubImage ()
 Default constructor to build a typed subimage (with an empty box) from scratch. More...
 
 TSubImage (const SubImage &subImage)
 Constructor to build a typed subimage from an untyped subImage. More...
 
 TSubImage (const TSubImage< DATATYPE > &typedSubImage)
 Copy constructor to get an identical copy. More...
 
 ~TSubImage () override=default
 Virtual destructor to suppress compiler warnings. More...
 
TSubImageoperator= (const TSubImage< DATATYPE > &typedSubImage)
 Assignment operator to get an identical copy. More...
 
Properties of TSubImage
const DATATYPE * getData () const
 Returns the memory address of the image region. Overloads methods from SubImage. More...
 
DATATYPE * getData ()
 
Calculation of memory addresses of image voxels
const DATATYPE * getSubImagePointer (const ImageVector &position) const
 Returns a pointer to voxel data of image voxel at the 6D position relative to the origin of the subimage region. More...
 
DATATYPE * getSubImagePointer (const ImageVector &position)
 
const DATATYPE * getSubImagePointer (MLint x, MLint y, MLint z) const
 Returns a pointer to voxel data of image voxel at 3D position p=(x, y, z) relative to the origin of the subimage region. More...
 
DATATYPE * getSubImagePointer (MLint x, MLint y, MLint z)
 
const DATATYPE * getImagePointer (const ImageVector &position) const
 Returns a pointer to voxel data of image voxel at 6D position position relative to the origin of the complete image region. More...
 
DATATYPE * getImagePointer (const ImageVector &position)
 
const DATATYPE * getImagePointer (MLint x, MLint y, MLint z) const
 Returns a pointer to voxel data of image voxel at 3D position p=(x, y, z) relative to the origin of the complete image region. More...
 
DATATYPE * getImagePointer (MLint x, MLint y, MLint z)
 
Calculate coordinates from pointers into image data(from memory positions)
ImageVector convertPointerToSubImagePosition (DATATYPE *pointer) const
 Returns the 6D voxel coordinates corresponding to the memory address pointer. More...
 
void convertPointerToSubImagePosition (DATATYPE *pointer, MLint *x, MLint *y, MLint *z) const
 Returns the 3D voxel coordinates corresponding to the memory address pointer. More...
 
ImageVector convertPointerToImagePosition (DATATYPE *pointer) const
 Returns the 6D voxel coordinates corresponding to the memory address pointer. More...
 
void convertPointerToImagePosition (DATATYPE *pointer, MLint *x, MLint *y, MLint *z) const
 Returns the 3D voxel coordinates corresponding to the memory address pointer. More...
 
Set/Get voxel data
const DATATYPE & operator[] (const ImageVector &position) const
 Constant reference access to voxel value at the given position. More...
 
DATATYPE & operator[] (const ImageVector &position)
 Reference access to voxel value at the given position. More...
 
void setSubImageValue (const ImageVector &position, DATATYPE value)
 Sets the voxel value at the given position to the given value where position is relative to the origin of the subimage region. More...
 
DATATYPE getSubImageValue (const ImageVector &position) const
 Returns voxel value at the given position where position is relative to the origin of the subimage region. More...
 
void setSubImageValue (MLint x, MLint y, DATATYPE value)
 Sets the voxel value at the given position(x, y) to the given value where the position is relative to the origin of the subimage region. More...
 
DATATYPE getSubImageValue (MLint x, MLint y) const
 Returns the voxel value at position (x, y) where the position is relative to the origin of the subimage region. More...
 
void setSubImageValue (MLint x, MLint y, MLint z, DATATYPE value)
 Sets the voxel value at the given position (x, y, z) to the given value where the position is relative to the origin of the subimage region. More...
 
DATATYPE getSubImageValue (MLint x, MLint y, MLint z) const
 Returns the voxel value at the given position (x, y, z) where the position is relative to the origin of the subimage region. More...
 
void setImageValue (const ImageVector &position, DATATYPE value)
 Sets the 6D voxel at the given position to the given value. More...
 
DATATYPE getImageValue (const ImageVector &position) const
 Returns the 6D voxel value from the given position. More...
 
void setImageValue (MLint x, MLint y, DATATYPE value)
 Sets the 2D voxel at the given position (x, y) to the the given value. More...
 
DATATYPE getImageValue (MLint x, MLint y) const
 Returns the 2D voxel value from the given position (x, y). More...
 
void setImageValue (MLint x, MLint y, MLint z, DATATYPE value)
 Sets the 3D voxel at the given position (x, y, z) to the given value. More...
 
DATATYPE getImageValue (MLint x, MLint y, MLint z) const
 Returns the 3D voxel value from given position (x, y, z). More...
 
Return min/max values of subimage
MLint calculateMinMax (DATATYPE &minValue, DATATYPE &maxValue, const SubImageBox *const validBox=nullptr) const
 Scans subimage and determines the minimum and maximum values of the region that is part of subimage box and of validBox. More...
 
Copying voxel from one subimage to another
template<typename FROM_DATATYPE >
void copySubImageReorderColorPlanesToInterleaved (const TSubImage< FROM_DATATYPE > &typedFromImage, const ScaleShiftData &scaleShiftData)
 Implements special case for void copySubImageTyped(const TSubImage<FROM_DATATYPE> &typedFromImg, const ScaleShiftData& scaleShiftData) where color planes shall be interleaved instead of in planes. More...
 
template<typename FROM_DATATYPE >
void copySubImageTyped (const TSubImage< FROM_DATATYPE > &typedFromImg, const ScaleShiftData &scaleShiftData)
 Copies image data from the subimage fromImg into the overlapping region of this subimage. More...
 
SUBIMAGE FILLING
void fill (DATATYPE value)
 Sets all voxel values in subimage to value. More...
 
void fillBordersWithValue (const SubImageBox &box, DATATYPE fillValue)
 Fills all regions with fillValue that are not covered by box. More...
 
void fillInvalidRegionWithValue (DATATYPE value)
 Fills the invalid region (everything outside of getValidRegion()) with the given value. More...
 
void fillInvalidRegionWithBorderValues ()
 Fills the invalid region (i.e., everything outside of getValidRegion() ) with the values on the borders of the valid region. More...
 
- Public Member Functions inherited from ml::SubImage
const SubImageBoxgetBox () const
 Returns the box describing the origin/extent of the subimage. More...
 
void setSourceImageExtent (const ImageVector &extent)
 Sets the image extent of the source image that was used to create this SubImage to extent. More...
 
ImageVector getSourceImageExtent () const
 Returns the image extent of the source image that was used to create this SubImage. More...
 
SubImageBox getValidRegion () const
 Returns the valid region of the SubImage, which is defined by the intersection of the SubImage::getBox() and the SubImageBox(ImageVector(0), SubImage::getSourceImageExtent()-1). More...
 
MLint getNumVoxels () const
 Returns number of voxels in (sub)image. More...
 
MLint getSizeInBytes () const
 Returns number of potential bytes in (sub)image. More...
 
ImageVector getStride () const
 Returns a stride vector to address the memory efficiently. More...
 
MLint getOffset (const ImageVector &voxelPosition) const
 Returns the array index offset from the origin (0,0,0,0,0,0) to the voxelPosition. More...
 
void setDataType (MLDataType dataType)
 Override the inherited setDataType method to set type of data to dataType. More...
 
MLDataType getDataType () const
 Returns the type of image data. More...
 
const MLTypeInfosgetDataTypeInfos () const
 Returns MLTypeInfos for image data type. More...
 
MLEXPORT ImageProperties toImageProperties () const
 Converts the Subimage's data type and extend to an ImageProperties object. More...
 
MLEXPORT void setFromImageProperties (const ImageProperties &imageProperties)
 Sets the image box and data type from the imageProperties extent and data type. More...
 
void toStream (std::ostream &ostr) const
 
 SubImage ()
 Constructor: Creates a subimage with no data. More...
 
 SubImage (const SubImage &si)
 Copy constructor to get identical copy. More...
 
 SubImage (const SubImageBox &box, MLDataType datatype, void *data=nullptr)
 Constructor for a rectangular 6D image region with position and extent given by box, with data type data type and memory given by the pointer data. More...
 
 SubImage (const SubImage &si, const ImageVector &offset)
 Copy constructor to get identical copy. More...
 
virtual ~SubImage ()=default
 Virtual destructor to suppress compiler warnings. More...
 
SubImageoperator= (const SubImage &si)
 Assignment operator to get identical copy. More...
 
void setBox (const SubImageBox &subImageBox)
 Sets a rectangular 6D region of the subimage to subImageBox. More...
 
void setBox (const ImageVector &imageExtent)
 Sets a rectangular 6D region of the subimage to imageExtent. More...
 
void translate (const ImageVector &offset)
 Translates the box of the subimage by adding the vector offset. More...
 
const ImageVectorgetOrigin () const
 Returns the origin of the subimage, which is identical to getBox().v1. More...
 
void setOrigin (const ImageVector &newOrigin)
 Sets the origin of the subimage, which moves the box of the subimage to newOrigin. More...
 
ImageVector getExtent () const
 Returns the extent of the subimage, which is identical to getBox().getExtent(). More...
 
void setExtent (MLint x, MLint y, MLint z=1, MLint c=1, MLint t=1, MLint u=1)
 Sets the extent of the subimage to newExtent. More...
 
void setExtent (const ImageVector &newExtent)
 Sets the extent of the subimage to newExtent. This also changes the strides. More...
 
SubImageBox getBoxFromExtent () const
 Returns the size of image as box with origin 0. More...
 
SubImageBox getBoxFromImageExtent () const
 
ImageVector getImageExtent () const
 
void setImageExtent (const ImageVector &newExtent)
 
void * getSubImagePointer (const ImageVector &voxelPosition) const
 Returns a pointer to voxel data of image voxel at 6D voxelPosition relative to the origin of the subimage region. More...
 
void * getSubImagePointer (MLint x, MLint y, MLint z) const
 Returns a pointer to voxel data of image voxel at 3D position p=(x,y,z) relative to the origin of the subimage region. More...
 
void * getImagePointer (const ImageVector &voxelPosition) const
 Returns a pointer to voxel data of image voxel at 6D position voxelPosition relative to the origin of the complete image region. More...
 
void * getImagePointer (MLint x, MLint y, MLint z) const
 Returns a pointer to voxel data of image voxel at 3D position p=(x, y, z) relative to the origin of the complete image region. More...
 
MLEXPORT void copySubImage (const SubImage &fromImage, const ScaleShiftData &scaleShiftData)
 Copies image data from the subimage fromImage into the overlapping region of this subimage. More...
 
MLEXPORT void copySubImage (const SubImage &fromImage)
 Implements a special case for void copySubImage(const TSubImage<FROM_DATATYPE> &typedFromImg, const ScaleShiftData& scaleShiftData) where scaleShiftData is default. More...
 
bool isValidSubImagePosition (const ImageVector &voxelPosition) const
 Returns true if the 6D voxelPosition is a valid position within the subimage region, i.e., if voxelPosition is within (0,0,0,0,0,0) and subimage extents. More...
 
bool isValidSubImagePosition (MLint x, MLint y, MLint z) const
 Returns true if the 3D position p=(x, y, z) is a valid position within the subimage region, i.e., if the position is within (0,0,0) and subimage extents. More...
 
bool isValidImagePosition (const ImageVector &voxelPosition) const
 Returns true if the 6D voxelPosition is a valid position within the subimage region, i.e., if voxelPosition is within subImgBox.v1 and subImgBox.v2. More...
 
bool isValidImagePosition (MLint x, MLint y, MLint z) const
 Returns true if the 3D position p=(x, y, z) is a valid position within the subimage region, i.e., if the position is within subImgBox.v1 and subImgBox.v2. More...
 
MLEXPORT void allocate (MLMemoryErrorHandling handleFailure)
 Allocates data with MLAlloc(). More...
 
MLEXPORT void allocateAsMemoryBlockHandle (MLMemoryErrorHandling handleFailure=ML_RETURN_NULL)
 Allocates data using the ML memory manager. For failure handing, see SubImage::allocate(). More...
 
MLEXPORT void free ()
 Frees data pointed to by getData() with MLFree(). More...
 
MLEXPORT bool isOneValued () const
 Returns true if all page voxels have the same value or if the page contains only one voxel. More...
 
MLEXPORT MLint calculateMinMax (MLdouble &minValue, MLdouble &maxValue, const SubImageBox *const validBox=nullptr) const
 Scans subimage and determines minimum and maximum values on region, which is part of subimage box and of validBox. More...
 
MLEXPORT void compare (const SubImage &subImage2, bool *regionsMatch, bool *dataTypesMatch, bool *thisBoxIsPartOfRegion2, bool *region2IsPartOfThisBox, bool *overlapHasSameValues, ImageVector *firstMismatchPos) const
 Compares two subimages with respect to their regions and their contents. More...
 
MLEXPORT void fill (MLdouble value)
 Fills the subimage with a value that is cast to the data type of the subimage. More...
 
MLEXPORT void fillWithTypeData (const MLTypeData *value)
 Fills the subimage with a value given as MLTypeData. More...
 
MLEXPORT void fillBordersWithScalarValue (const SubImageBox &box, MLdouble fillValue)
 Fills all regions with the fill value fillValue that are not covered by box. More...
 
MLEXPORT void fillBordersWithTypeData (const SubImageBox &box, const MLTypeData *fillValue)
 Fills all regions with the fill value fillValue which are not covered by box. More...
 
MLEXPORT void fillBordersWithInputValues (const SubImageBox &box, const SubImage &inputSubImage)
 Fills all regions with values from inputSubImage which are not covered by box; however, only valid regions of inputSubImage are read. More...
 
MLEXPORT void fillBordersWithBorderValues (const SubImageBox &box)
 Each voxel that is not inside box is filled with the voxel value of the nearest voxel that is inside box. More...
 
void fillInvalidRegionWithScalarValue (MLdouble value)
 Fills the invalid region (everything outside of getValidRegion()) with the given value. More...
 
void fillInvalidRegionWithTypeData (const MLTypeData *value)
 Fills the invalid region (everything outside of getValidRegion()) with the given value. More...
 
void fillInvalidRegionWithBorderValues ()
 Fills the invalid region. More...
 
MLEXPORT bool isValid () const
 Returns 1 (=true) if image region and data is valid. More...
 
void * getData () const
 Returns the memory address of the memory managed by the subimage. More...
 
MLEXPORT void setData (void *data)
 Sets data as a new memory block for the subimage. More...
 
MLEXPORT void setDataFromMemoryBlockHandle (const MLMemoryBlockHandle &data)
 Sets the managed data from a given MLMemoryBlockHandle, the subimage will store this handle and thus reference count the memory managed by the handle as long as the SubImage stays alive. More...
 
const MLMemoryBlockHandlegetMemoryBlockHandle () const
 Returns the memory block handle that manages the data of this SubImage if it has been set via setDataFromMemoryBlockHandle(). More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ml::SubImage
static MLEXPORT MLint coordToIndex (MLint x, MLint y, MLint z, MLint c, MLint t, MLint u, const ImageVector &size)
 Converts the coordinate (x, y, z, c, t,u) to an index into an image with 6D extents given by size. More...
 
static MLEXPORT MLint coordToIndex (const ImageVector &voxelPosition, const ImageVector &size)
 Converts the coordinate voxelPosition into the image with extents size to an index. More...
 
static MLEXPORT ImageVector indexToCoord (MLint index, const ImageVector &extent)
 Converts an index into an array with extents extent to a coordinate. More...
 
- Protected Member Functions inherited from ml::SubImage
void _calcFillAreaParams (const SubImageBox &box, const SubImageBox &maxValidInputRegion, ImageVector &boxV1, ImageVector &boxV2, ImageVector &outputTSubImageV1, ImageVector &outputTSubImageV2, MLint &fullLineLenX, MLint &fullLineLenXB, MLint &leftLineStartX, MLint &leftLineLenX, MLint &leftLineLenXB, MLint &rightLineStartX, MLint &rightLineLenX, MLint &rightLineLenXB)
 Helper method to calculate important parameters for page based border filling. More...
 
void _copySubImageGeneric (const SubImage &fromImage, const ScaleShiftData &scaleShiftData)
 Generic, non-optimized version of copySubImage. More...
 
const MLTypeInfos_getDataTypeInfos (MLDataType dt) const
 Returns MLTypeInfos for used datatypes, indicates error if the type dt is not registered. More...
 
- Protected Attributes inherited from ml::SubImage
SubImageBox _box
 The box of the subimage. More...
 
ImageVector _sourceImageExtent
 The extent of the source image, which is used for getValidRegion(). More...
 
void * _data
 Memory chunk managed by this subimage. More...
 
MLMemoryBlockHandle _memoryBlock
 Memory block used by this subimage. More...
 
ImageVector _stride
 Stride vector to address the memory efficiently. More...
 
MLDataType _dataType
 Data type of the image. More...
 

Detailed Description

template<typename DATATYPE>
class ml::TSubImage< DATATYPE >

This template class manages/represents a rectangular 6D image region in memory that is organized linearly.

It inherits the functionality of SubImage and adds data type specific access functions to that class. Apart from the direct data access methods, there are the TSubImage::Cursor and TSubImage::ConstCursor classes that allow working on the typed data with cursor positioning/movements.

A const TSubImage can be used to only allow const access to the underlying image data.

Thread-safety: This class is reentrant.

This template class owns

  • All functionality from SubImage
  • Methods query and set of (sub)image properties that are inherited from the class ImageProperties (via SubImage)
  • A typed pointer to the memory chunk. The data type is given by the template parameter DATATYPE
  • Access functions/methods for image data. Examples are
    DATATYPE value;
    ImageVector p(......); // Define coordinate
    value = getImgVal(p); // Get voxel value from image
    setImgVal(p,value); // Set value of voxel p in image
    TImageVector< MLint > ImageVector
    Defines the standard ImageVector type that is used by the ML for indexing and coordinates.

Notes: In the overloaded Module::calculateOutputSubImage, the Host passes untyped subimages (see SubImage). The image processing module usually needs to build typed wrappers around these untyped SubImages to have an easy access to them. This class represents typed input tiles and output pages for image processing algorithms. Algorithms that have different typed input images can build easily template code to access the image data correctly. The methods to access image voxels are designed for image manipulation to be used by algorithm developers.

Definition at line 109 of file mlTSubImage.h.

Member Typedef Documentation

◆ ComponentType

template<typename DATATYPE >
typedef DATATYPE ml::TSubImage< DATATYPE >::ComponentType

A typedef to 'export' the type of voxels components.

Definition at line 115 of file mlTSubImage.h.

◆ ConstCursor

template<typename DATATYPE >
typedef ConstTSubImageCursor<DATATYPE> ml::TSubImage< DATATYPE >::ConstCursor

A read-only cursor.

Definition at line 120 of file mlTSubImage.h.

◆ Cursor

template<typename DATATYPE >
typedef TSubImageCursor<DATATYPE> ml::TSubImage< DATATYPE >::Cursor

A read/write cursor.

Definition at line 118 of file mlTSubImage.h.

Constructor & Destructor Documentation

◆ TSubImage() [1/4]

template<typename DATATYPE >
ml::TSubImage< DATATYPE >::TSubImage ( const SubImageBox box,
MLDataType  dataType,
void *  data 
)
inline

Constructor for an image region with location/extent box with data type dataType (must fit to DATATYPE!) and the memory address data that holds the image region.

Note: The specification of dataType would usually not be necessary because it could be derived from DATATYPE. However, one or two modules use differing DATATYPE and dataType for special purposes. Moreover, the derivation of dataType from template parameter DATATYPE is a bit cumbersome, so we leave this constructor as it is. Note that this may be changed in future. Differing template datatypes and passed dataType enums will be handled as fatal error if real data is set.

Definition at line 137 of file mlTSubImage.h.

References ML_BAD_DATA_TYPE, and ML_PRINT_FATAL_ERROR.

◆ TSubImage() [2/4]

template<typename DATATYPE >
ml::TSubImage< DATATYPE >::TSubImage ( )
inline

Default constructor to build a typed subimage (with an empty box) from scratch.

Initial values will be an empty SubImageBox as box, the ML data type is derived from the template type, and data is initialized to NULL. See also the documentation of TSubImage(const SubImageBox& box, MLDataType dataType, void* data).

Definition at line 152 of file mlTSubImage.h.

References ML_BAD_DATA_TYPE, ML_INVALID_DATA_TYPE, and ML_PRINT_FATAL_ERROR.

◆ TSubImage() [3/4]

template<typename DATATYPE >
ml::TSubImage< DATATYPE >::TSubImage ( const SubImage subImage)
inline

Constructor to build a typed subimage from an untyped subImage.

See also the documentation of TSubImage(const SubImageBox& box, MLDataType dataType, void* data). Note: this does not take over the MemoryBlockHandle of the given subImage for performance reasons. You need to explicitly set the handle on the TSubImage if you want the TSubImage to reference-count the data.

Definition at line 169 of file mlTSubImage.h.

References ml::SubImage::getBox(), ml::SubImage::getData(), ml::SubImage::getDataType(), ml::SubImage::getSourceImageExtent(), ML_BAD_DATA_TYPE, and ML_PRINT_FATAL_ERROR.

◆ TSubImage() [4/4]

template<typename DATATYPE >
ml::TSubImage< DATATYPE >::TSubImage ( const TSubImage< DATATYPE > &  typedSubImage)
inline

Copy constructor to get an identical copy.

Note that only the pointer to the data is copied, and not the data itself.

Definition at line 194 of file mlTSubImage.h.

◆ ~TSubImage()

template<typename DATATYPE >
ml::TSubImage< DATATYPE >::~TSubImage ( )
inlineoverridedefault

Virtual destructor to suppress compiler warnings.

Member Function Documentation

◆ calculateMinMax()

template<typename DATATYPE >
MLint ml::TSubImage< DATATYPE >::calculateMinMax ( DATATYPE &  minValue,
DATATYPE &  maxValue,
const SubImageBox *const  validBox = nullptr 
) const
inline

Scans subimage and determines the minimum and maximum values of the region that is part of subimage box and of validBox.

If no validBox is passed (default), all voxels are checked. The return value is the number of scanned voxels. If subimage is empty, minValue and maxValue are set to 0 and the return value is 0. Warning: If used in calculateOutputSubImage, take in consideration that the page may also contain invalid data that is not part of the image. Pass image box as validBox to be sure to access only valid regions.

Definition at line 420 of file mlTSubImage.h.

References ml::TVector6DBase< CompIntType >::c, ml::TSubImageBox< intT >::getNumVoxels(), ml::WEMSetOp::intersect(), ML_CHECK_THROW, ml::TImageVector< CompIntType >::set(), ml::TVector6DBase< CompIntType >::t, ml::TVector6DBase< CompIntType >::u, ml::TSubImageBox< intT >::v1, ml::TSubImageBox< intT >::v2, ml::TVector6DBase< CompIntType >::x, ml::TVector6DBase< CompIntType >::y, and ml::TVector6DBase< CompIntType >::z.

◆ convertPointerToImagePosition() [1/2]

template<typename DATATYPE >
ImageVector ml::TSubImage< DATATYPE >::convertPointerToImagePosition ( DATATYPE *  pointer) const
inline

Returns the 6D voxel coordinates corresponding to the memory address pointer.

The returned coordinates are relative to the origin of the complete image region. That is, the position p=getBox.v1() is considered the origin of the image region/subimage.

Definition at line 311 of file mlTSubImage.h.

◆ convertPointerToImagePosition() [2/2]

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::convertPointerToImagePosition ( DATATYPE *  pointer,
MLint x,
MLint y,
MLint z 
) const
inline

Returns the 3D voxel coordinates corresponding to the memory address pointer.

The returned coordinates are relative to the origin of the complete image region. That is, the position p=getBox.v1() is considered the origin of the image region/subimage. It is legal to pass x, y, and/or z as NULL pointers; their values are only set if pointer is non-NULL.

Definition at line 320 of file mlTSubImage.h.

◆ convertPointerToSubImagePosition() [1/2]

template<typename DATATYPE >
ImageVector ml::TSubImage< DATATYPE >::convertPointerToSubImagePosition ( DATATYPE *  pointer) const
inline

Returns the 6D voxel coordinates corresponding to the memory address pointer.

The returned coordinates are relative to the origin of the subimage region. That is, the position (0,0,0,0,0,0) is considered the origin of the subimage.

Definition at line 274 of file mlTSubImage.h.

References ml::TVector< TVectorBase >::getVectorPosition().

◆ convertPointerToSubImagePosition() [2/2]

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::convertPointerToSubImagePosition ( DATATYPE *  pointer,
MLint x,
MLint y,
MLint z 
) const
inline

Returns the 3D voxel coordinates corresponding to the memory address pointer.

The returned coordinates are relative to the origin of the subimage region. That is, the position (0,0,0,0,0,0) is considered the origin of the subimage. It is legal to pass x, y, and/or z as NULL pointers; their values are only set if pointer is non-NULL.

Definition at line 282 of file mlTSubImage.h.

References ML_CHECK_THROW, ml::TVector6DBase< CompIntType >::x, ml::TVector6DBase< CompIntType >::y, and ml::TVector6DBase< CompIntType >::z.

◆ copySubImageReorderColorPlanesToInterleaved()

template<typename DATATYPE >
template<typename FROM_DATATYPE >
void ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved ( const TSubImage< FROM_DATATYPE > &  typedFromImage,
const ScaleShiftData scaleShiftData 
)
inline

◆ copySubImageTyped()

template<typename DATATYPE >
template<typename FROM_DATATYPE >
void ml::TSubImage< DATATYPE >::copySubImageTyped ( const TSubImage< FROM_DATATYPE > &  typedFromImg,
const ScaleShiftData scaleShiftData 
)
inline

Copies image data from the subimage fromImg into the overlapping region of this subimage.

Gray values are transformed linearly according to the settings in scaleShiftData (see ScaleShiftData). Notes:

  • The copied data always has the data type of this subimage. It is cast if necessary.
  • By transforming voxel values linearly before copying them, it is possible to avoid information loss due to type casting.
  • The default case of scaleShiftData defines scaleShiftData.getScale()==1 and scaleShiftData.getShift()==0. This way, a voxel value transformation does not change anything and copying is implemented as a special case that is therefore faster.

Definition at line 590 of file mlTSubImage.h.

References _ML_CHECK_SUBIMAGE_DATA_POINTERS, ml::TVector6DBase< CompIntType >::c, ml::SubImage::getBox(), ml::TSubImage< DATATYPE >::getData(), ml::SubImage::getDataType(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TScaleShiftData< DT >::getReorderMode(), ml::TScaleShiftData< DT >::getScale(), ml::TScaleShiftData< DT >::getShift(), ml::SubImage::getStride(), ml::WEMSetOp::intersect(), ml::TSubImageBox< intT >::isEmpty(), ML_CHECK_THROW, MLIsScalarTypePtr(), MLSizeOf(), MLValuesAreEqual(), ml::TVector6DBase< CompIntType >::t, ml::TVector6DBase< CompIntType >::u, ml::TSubImageBox< intT >::v1, ml::TSubImageBox< intT >::v2, ml::TVector6DBase< CompIntType >::x, ml::TVector6DBase< CompIntType >::y, and ml::TVector6DBase< CompIntType >::z.

◆ fill()

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::fill ( DATATYPE  value)
inline

Sets all voxel values in subimage to value.

Definition at line 777 of file mlTSubImage.h.

References ML_CHECK_THROW.

Referenced by ml::RasterFunction::_fillRaster().

◆ fillBordersWithValue()

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::fillBordersWithValue ( const SubImageBox box,
DATATYPE  fillValue 
)
inline

Fills all regions with fillValue that are not covered by box.

Note that box must be specified in global image coordinates. This way, two subimages with different origins and same sizes are filled differently, depending on their overlap with the box in global image coordinates. The cursor position is left undefined.

Definition at line 794 of file mlTSubImage.h.

◆ fillInvalidRegionWithBorderValues()

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::fillInvalidRegionWithBorderValues ( )
inline

Fills the invalid region (i.e., everything outside of getValidRegion() ) with the values on the borders of the valid region.

This is useful for initializing invalid regions of an output/input subimage.

Definition at line 812 of file mlTSubImage.h.

◆ fillInvalidRegionWithValue()

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::fillInvalidRegionWithValue ( DATATYPE  value)
inline

Fills the invalid region (everything outside of getValidRegion()) with the given value.

This is useful for initializing invalid regions of an output/input subimage.

Definition at line 803 of file mlTSubImage.h.

◆ getData() [1/2]

template<typename DATATYPE >
DATATYPE* ml::TSubImage< DATATYPE >::getData ( )
inline

Definition at line 218 of file mlTSubImage.h.

◆ getData() [2/2]

◆ getImagePointer() [1/4]

template<typename DATATYPE >
DATATYPE* ml::TSubImage< DATATYPE >::getImagePointer ( const ImageVector position)
inline

Definition at line 254 of file mlTSubImage.h.

References _ML_TSUBIMG_SUBDOT6.

◆ getImagePointer() [2/4]

template<typename DATATYPE >
const DATATYPE* ml::TSubImage< DATATYPE >::getImagePointer ( const ImageVector position) const
inline

Returns a pointer to voxel data of image voxel at 6D position position relative to the origin of the complete image region.

The subimage is a part of the complete image. That is, the position p=getBox.v1() is considered the origin of the image region/subimage.

Definition at line 253 of file mlTSubImage.h.

References _ML_TSUBIMG_SUBDOT6.

Referenced by ml::ReleaseToolsMisc::calculateAverageOfSumOfSquaredDifferences(), ml::TVirtualVolume< DATATYPE >::copyMaskToSubImage(), ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), and ml::TSubImage< DATATYPE >::copySubImageTyped().

◆ getImagePointer() [3/4]

template<typename DATATYPE >
DATATYPE* ml::TSubImage< DATATYPE >::getImagePointer ( MLint  x,
MLint  y,
MLint  z 
)
inline

Definition at line 262 of file mlTSubImage.h.

References _ML_TSUBIMG_SUBDOT3.

◆ getImagePointer() [4/4]

template<typename DATATYPE >
const DATATYPE* ml::TSubImage< DATATYPE >::getImagePointer ( MLint  x,
MLint  y,
MLint  z 
) const
inline

Returns a pointer to voxel data of image voxel at 3D position p=(x, y, z) relative to the origin of the complete image region.

The subimage is a part of the complete image. That is, the position p=getBox.v1() is considered the origin of the image region/subimage.

Definition at line 261 of file mlTSubImage.h.

References _ML_TSUBIMG_SUBDOT3.

◆ getImageValue() [1/3]

template<typename DATATYPE >
DATATYPE ml::TSubImage< DATATYPE >::getImageValue ( const ImageVector position) const
inline

Returns the 6D voxel value from the given position.

The position is relative to the origin of the complete image region. That is, the position p=getBox.v1() is considered the origin of the image region/subimage.

Definition at line 383 of file mlTSubImage.h.

◆ getImageValue() [2/3]

template<typename DATATYPE >
DATATYPE ml::TSubImage< DATATYPE >::getImageValue ( MLint  x,
MLint  y 
) const
inline

Returns the 2D voxel value from the given position (x, y).

The given position is relative to the origin of the complete image region. That is, the position p=getBox.v1() is considered the origin of the image region/subimage.

Definition at line 392 of file mlTSubImage.h.

References _ML_TSUBIMG_SUBDOT2.

◆ getImageValue() [3/3]

template<typename DATATYPE >
DATATYPE ml::TSubImage< DATATYPE >::getImageValue ( MLint  x,
MLint  y,
MLint  z 
) const
inline

Returns the 3D voxel value from given position (x, y, z).

The given position is relative to the origin of the complete image region. That is, the position p=getBox.v1() is considered the origin of the image region/subimage.

Definition at line 401 of file mlTSubImage.h.

◆ getSubImagePointer() [1/4]

template<typename DATATYPE >
DATATYPE* ml::TSubImage< DATATYPE >::getSubImagePointer ( const ImageVector position)
inline

Definition at line 234 of file mlTSubImage.h.

◆ getSubImagePointer() [2/4]

template<typename DATATYPE >
const DATATYPE* ml::TSubImage< DATATYPE >::getSubImagePointer ( const ImageVector position) const
inline

Returns a pointer to voxel data of image voxel at the 6D position relative to the origin of the subimage region.

That is, the position (0,0,0,0,0,0) is considered the origin of the subimage.

Definition at line 233 of file mlTSubImage.h.

◆ getSubImagePointer() [3/4]

template<typename DATATYPE >
DATATYPE* ml::TSubImage< DATATYPE >::getSubImagePointer ( MLint  x,
MLint  y,
MLint  z 
)
inline

Definition at line 246 of file mlTSubImage.h.

◆ getSubImagePointer() [4/4]

template<typename DATATYPE >
const DATATYPE* ml::TSubImage< DATATYPE >::getSubImagePointer ( MLint  x,
MLint  y,
MLint  z 
) const
inline

Returns a pointer to voxel data of image voxel at 3D position p=(x, y, z) relative to the origin of the subimage region.

That is, the position (0,0,0,0,0,0) is considered the origin of the subimage and higher coordinates c, t, and u are taken as 0 values.

Definition at line 245 of file mlTSubImage.h.

◆ getSubImageValue() [1/3]

template<typename DATATYPE >
DATATYPE ml::TSubImage< DATATYPE >::getSubImageValue ( const ImageVector position) const
inline

Returns voxel value at the given position where position is relative to the origin of the subimage region.

That is, the position (0,0,0,0,0,0) is considered the origin of the subimage.

Definition at line 356 of file mlTSubImage.h.

Referenced by ml::TVirtualVolume< DATATYPE >::copyFromSubImage().

◆ getSubImageValue() [2/3]

template<typename DATATYPE >
DATATYPE ml::TSubImage< DATATYPE >::getSubImageValue ( MLint  x,
MLint  y 
) const
inline

Returns the voxel value at position (x, y) where the position is relative to the origin of the subimage region.

That is, the position (0,0) is considered the origin of the subimage.

Definition at line 365 of file mlTSubImage.h.

◆ getSubImageValue() [3/3]

template<typename DATATYPE >
DATATYPE ml::TSubImage< DATATYPE >::getSubImageValue ( MLint  x,
MLint  y,
MLint  z 
) const
inline

Returns the voxel value at the given position (x, y, z) where the position is relative to the origin of the subimage region.

That is, the position (0,0,0) is considered the origin of the subimage.

Definition at line 374 of file mlTSubImage.h.

◆ operator=()

template<typename DATATYPE >
TSubImage& ml::TSubImage< DATATYPE >::operator= ( const TSubImage< DATATYPE > &  typedSubImage)
inline

Assignment operator to get an identical copy.

Note that only the pointer to the data is copied, and not the data itself.

Definition at line 204 of file mlTSubImage.h.

◆ operator[]() [1/2]

template<typename DATATYPE >
DATATYPE& ml::TSubImage< DATATYPE >::operator[] ( const ImageVector position)
inline

Reference access to voxel value at the given position.

The caller must guarantee that position is inside valid subimage region. The position (0,0,0,0,0,0) is considered the origin of the image, getBox.v1() is considered the origin of the valid subimage area. Note that this operator access always calculates all six coordinate components.

Definition at line 346 of file mlTSubImage.h.

◆ operator[]() [2/2]

template<typename DATATYPE >
const DATATYPE& ml::TSubImage< DATATYPE >::operator[] ( const ImageVector position) const
inline

Constant reference access to voxel value at the given position.

The caller must guarantee that position is inside valid subimage region. The position (0,0,0,0,0,0) is considered the origin of the image, getBox.v1() is considered the origin of the valid subimage area. Note that this operator access always calculates all six coordinate components.

Definition at line 340 of file mlTSubImage.h.

◆ setImageValue() [1/3]

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::setImageValue ( const ImageVector position,
DATATYPE  value 
)
inline

Sets the 6D voxel at the given position to the given value.

The position is relative to the origin of the complete image region. That is, the position p=getBox.v1() is considered the origin of the image region/subimage.

Definition at line 379 of file mlTSubImage.h.

Referenced by ml::RasterFunction::_fillRaster().

◆ setImageValue() [2/3]

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::setImageValue ( MLint  x,
MLint  y,
DATATYPE  value 
)
inline

Sets the 2D voxel at the given position (x, y) to the the given value.

The given position is relative to the origin of the complete image region. That is, the position p=getBox.v1() is considered the origin of the image region/subimage.

Definition at line 388 of file mlTSubImage.h.

References _ML_TSUBIMG_SUBDOT2.

◆ setImageValue() [3/3]

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::setImageValue ( MLint  x,
MLint  y,
MLint  z,
DATATYPE  value 
)
inline

Sets the 3D voxel at the given position (x, y, z) to the given value.

The given position is relative to the origin of the complete image region. That is, the position p=getBox.v1() is considered the origin of the image region/subimage.

Definition at line 397 of file mlTSubImage.h.

◆ setSubImageValue() [1/3]

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::setSubImageValue ( const ImageVector position,
DATATYPE  value 
)
inline

Sets the voxel value at the given position to the given value where position is relative to the origin of the subimage region.

That is, the position (0,0,0,0,0,0) is considered the origin of the subimage.

Definition at line 351 of file mlTSubImage.h.

◆ setSubImageValue() [2/3]

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::setSubImageValue ( MLint  x,
MLint  y,
DATATYPE  value 
)
inline

Sets the voxel value at the given position(x, y) to the given value where the position is relative to the origin of the subimage region.

That is, the position (0,0) is considered the origin of the subimage.

Definition at line 361 of file mlTSubImage.h.

◆ setSubImageValue() [3/3]

template<typename DATATYPE >
void ml::TSubImage< DATATYPE >::setSubImageValue ( MLint  x,
MLint  y,
MLint  z,
DATATYPE  value 
)
inline

Sets the voxel value at the given position (x, y, z) to the given value where the position is relative to the origin of the subimage region.

That is, the position (0,0,0) is considered the origin of the subimage.

Definition at line 370 of file mlTSubImage.h.


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