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

This template class manages/represents a rectangular 6d image region in memory which 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 which hold 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 shut up compiler warnings. More...
 
TSubImageoperator= (const TSubImage< DATATYPE > &typedSubImage)
 Assignment operator to get an identical copy. More...
 
Properties of TSubImage
const DATATYPE * getData () const
 Returns memory address of image region (Overloads method 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 begin 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 begin 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 begin 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 begin 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 6d voxel coordinates corresponding to the memory address pointer. More...
 
void convertPointerToSubImagePosition (DATATYPE *pointer, MLint *x, MLint *y, MLint *z) const
 Returns 3d voxel coordinates corresponding to the memory address pointer. More...
 
ImageVector convertPointerToImagePosition (DATATYPE *pointer) const
 Returns 6d voxel coordinates corresponding to the memory address pointer. More...
 
void convertPointerToImagePosition (DATATYPE *pointer, MLint *x, MLint *y, MLint *z) const
 Returns 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 positionis 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 minimum and maximum values of the region which 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 which 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 (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)
 Overwrite inherited setDataType method to set type of data to dataType. More...
 
MLDataType getDataType () const
 Return type of image data. More...
 
const MLTypeInfosgetDataTypeInfos () const
 Get MLTypeInfos for image data type. More...
 
MLEXPORT ImageProperties toImageProperties () const
 Converts the Subimage's datatype and extend to an ImageProperties object. More...
 
MLEXPORT void setFromImageProperties (const ImageProperties &imageProperties)
 Sets the image box and datatype from the imageProperties extent and datatype. 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 datatype 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 (which also changes the strides) to newExtent. More...
 
void setExtent (const ImageVector &newExtent)
 Sets the extent of the subimage (which also changes the strides) to newExtent. More...
 
SubImageBox getBoxFromExtent () const
 Returns 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 pointer to voxel data of image voxel at 6d voxelPosition relative to the begin of the subimage region. More...
 
void * getSubImagePointer (MLint x, MLint y, MLint z) const
 Returns pointer to voxel data of image voxel at 3d position p=(x,y,z) relative to the begin of the subimage region. More...
 
void * getImagePointer (const ImageVector &voxelPosition) const
 Returns pointer to voxel data of image voxel at 6d position voxelPosition relative to the begin of the complete image region. More...
 
void * getImagePointer (MLint x, MLint y, MLint z) const
 Returns pointer to voxel data of image voxel at 3d position p=(x, y, z) relative to the begin 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 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 6d voxelPosition is a valid position within 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 3d position p=(x, y, z) is a valid position within 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 6d voxelPosition is a valid position within 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 3d position p=(x, y, z) is a valid position within subimage region, i.e., if the position is within subImgBox.v1 and subImgBox.v2. More...
 
MLEXPORT void allocate (MLMemoryErrorHandling handleFailure)
 Allocate data with MLAlloc(). More...
 
MLEXPORT void allocateAsMemoryBlockHandle (MLMemoryErrorHandling handleFailure=ML_RETURN_NULL)
 Allocate 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 1 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
 Compare two subimages with respect to their regions and their contents. More...
 
MLEXPORT void fill (MLdouble value)
 Fills the subimage with a value 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)
 Fill all regions with the fill value fillValue which 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 of which is not inside box is filled with the nearest voxel which 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 (everything outside of getValidRegion()) with the values on the borders of the valid 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 sub image 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
 Get MLTypeInfos for used data types, indicates error if type 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
 Datatype 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 which 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, which allow to work 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, which 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 which 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 easy access to them. Then this class represents typed input tiles and output pages for image processing algorithms. Algorithms which 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 which hold the image region.

Note: The specification of dataType would usually not be necessary because it could be derived from DATATYPE. Anyway, one or two modules use differing DATATYPE and dataType for special purposes. Moreover, the derivation of dataType from template parameter DATATYPE is a little bit nasty, so we leave this constructor as it is. Note that this may be changed in future. Differing template data types 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 shut up 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 minimum and maximum values of the region which 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 return value is 0. Warning: If used in calculateOutputSubImage take in consideration that the page may also contain invalid data which 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 6d voxel coordinates corresponding to the memory address pointer.

The returned coordinates are relative to the origin of the complete image region. I.e., 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 3d voxel coordinates corresponding to the memory address pointer.

The returned coordinates are relative to the origin of the complete image region. I.e., 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 6d voxel coordinates corresponding to the memory address pointer.

The returned coordinates are relative to the origin of the subimage region. I.e., 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 3d voxel coordinates corresponding to the memory address pointer.

The returned coordinates are relative to the origin of the subimage region. I.e., 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.

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

  • The copied data always has the data type of this subimage. If necessary it is cast.
  • 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. So voxel value transformation does not change anything and copying is implemented as special case which is therefore faster.

Definition at line 591 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 778 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 which are not covered by box.

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

Definition at line 795 of file mlTSubImage.h.

◆ fillInvalidRegionWithBorderValues()

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

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

This is useful to initialize invalid regions of an output/input sub image.

Definition at line 813 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 to initialize invalid regions of an output/input sub image.

Definition at line 804 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 begin of the complete image region.

The subimage is a part of the complete image. I.e., 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 begin of the complete image region.

The subimage is a part of the complete image. I.e., 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. I.e., 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. I.e., 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. I.e., 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 begin of the subimage region.

I.e., 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 begin of the subimage region.

I.e., 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.

I.e., 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.

I.e., 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.

I.e., 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. I.e., 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. I.e., 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. I.e., 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.

I.e., 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.

I.e., 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 positionis relative to the origin of the subimage region.

I.e., 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: