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.
 
typedef TSubImageCursor< DATATYPECursor
 A read/write cursor.
 
typedef ConstTSubImageCursor< DATATYPEConstCursor
 A read-only cursor.
 

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.
 
 TSubImage ()
 Default constructor to build a typed subimage (with an empty box) from scratch.
 
 TSubImage (const SubImage &subImage)
 Constructor to build a typed subimage from an untyped subImage.
 
 TSubImage (const TSubImage< DATATYPE > &typedSubImage)
 Copy constructor to get an identical copy.
 
 ~TSubImage () override=default
 Virtual destructor to shut up compiler warnings.
 
TSubImageoperator= (const TSubImage< DATATYPE > &typedSubImage)
 Assignment operator to get an identical copy.
 
Properties of TSubImage
const DATATYPEgetData () const
 Returns memory address of image region (Overloads method from SubImage)
 
DATATYPEgetData ()
 
Calculation of memory addresses of image voxels
const DATATYPEgetSubImagePointer (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.
 
DATATYPEgetSubImagePointer (const ImageVector &position)
 
const DATATYPEgetSubImagePointer (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.
 
DATATYPEgetSubImagePointer (MLint x, MLint y, MLint z)
 
const DATATYPEgetImagePointer (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.
 
DATATYPEgetImagePointer (const ImageVector &position)
 
const DATATYPEgetImagePointer (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.
 
DATATYPEgetImagePointer (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.
 
void convertPointerToSubImagePosition (DATATYPE *pointer, MLint *x, MLint *y, MLint *z) const
 Returns 3d voxel coordinates corresponding to the memory address pointer.
 
ImageVector convertPointerToImagePosition (DATATYPE *pointer) const
 Returns 6d voxel coordinates corresponding to the memory address pointer.
 
void convertPointerToImagePosition (DATATYPE *pointer, MLint *x, MLint *y, MLint *z) const
 Returns 3d voxel coordinates corresponding to the memory address pointer.
 
Set/Get voxel data
const DATATYPEoperator[] (const ImageVector &position) const
 Constant reference access to voxel value at the given position.
 
DATATYPEoperator[] (const ImageVector &position)
 Reference access to voxel value at the given position.
 
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.
 
DATATYPE getSubImageValue (const ImageVector &position) const
 Returns voxel value at the given position where position is relative to the origin of the subimage region.
 
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.
 
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.
 
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.
 
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.
 
void setImageValue (const ImageVector &position, DATATYPE value)
 Sets the 6d voxel at the given position to the given value.
 
DATATYPE getImageValue (const ImageVector &position) const
 Returns the 6d voxel value from the given position.
 
void setImageValue (MLint x, MLint y, DATATYPE value)
 Sets the 2d voxel at the given position (x, y) to the the given value.
 
DATATYPE getImageValue (MLint x, MLint y) const
 Returns the 2d voxel value from the given position (x, y).
 
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.
 
DATATYPE getImageValue (MLint x, MLint y, MLint z) const
 Returns the 3d voxel value from given position (x, y, z).
 
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.
 
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.
 
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.
 
SUBIMAGE FILLING
void fill (DATATYPE value)
 Sets all voxel values in subimage to value.
 
void fillBordersWithValue (const SubImageBox &box, DATATYPE fillValue)
 Fills all regions with fillValue which are not covered by box.
 
void fillInvalidRegionWithValue (DATATYPE value)
 Fills the invalid region (everything outside of getValidRegion()) with the given value.
 
void fillInvalidRegionWithBorderValues ()
 Fills the invalid region (everything outside of getValidRegion()) with the values on the borders of the valid region.
 
- Public Member Functions inherited from ml::SubImage
const SubImageBoxgetBox () const
 Returns the box describing the origin/extent of the subimage.
 
void setSourceImageExtent (const ImageVector &extent)
 Sets the image extent of the source image that was used to create this SubImage to extent.
 
ImageVector getSourceImageExtent () const
 Returns the image extent of the source image that was used to create this SubImage.
 
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).
 
MLint getNumVoxels () const
 Returns number of voxels in (sub)image.
 
MLint getSizeInBytes () const
 Returns number of potential bytes in (sub)image.
 
ImageVector getStride () const
 Returns a stride vector to address the memory efficiently.
 
MLint getOffset (const ImageVector &voxelPosition) const
 Returns the array index offset from the origin (0,0,0,0,0,0) to the voxelPosition.
 
void setDataType (MLDataType dataType)
 Overwrite inherited setDataType method to set type of data to dataType.
 
MLDataType getDataType () const
 Return type of image data.
 
const MLTypeInfosgetDataTypeInfos () const
 Get MLTypeInfos for image data type.
 
MLEXPORT ImageProperties toImageProperties () const
 Converts the Subimage's datatype and extend to an ImageProperties object.
 
MLEXPORT void setFromImageProperties (const ImageProperties &imageProperties)
 Sets the image box and datatype from the imageProperties extent and datatype.
 
void toStream (std::ostream &ostr) const
 
 SubImage ()
 Constructor: Creates a subimage with no data.
 
 SubImage (const SubImage &si)
 Copy constructor to get identical copy.
 
 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.
 
 SubImage (const SubImage &si, const ImageVector &offset)
 Copy constructor to get identical copy.
 
virtual ~SubImage ()=default
 Virtual destructor to suppress compiler warnings.
 
SubImageoperator= (const SubImage &si)
 Assignment operator to get identical copy.
 
void setBox (const SubImageBox &subImageBox)
 Sets a rectangular 6d region of the subimage to subImageBox.
 
void setBox (const ImageVector &imageExtent)
 Sets a rectangular 6d region of the subimage to imageExtent.
 
void translate (const ImageVector &offset)
 Translates the box of the subimage by adding the vector offset.
 
const ImageVectorgetOrigin () const
 Returns the origin of the subimage (which is identical to getBox().v1).
 
void setOrigin (const ImageVector &newOrigin)
 Sets the origin of the subimage (which moves the box of the subimage to newOrigin).
 
ImageVector getExtent () const
 Returns the extent of the subimage (which is identical to getBox().getExtent()).
 
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.
 
void setExtent (const ImageVector &newExtent)
 Sets the extent of the subimage (which also changes the strides) to newExtent.
 
SubImageBox getBoxFromExtent () const
 Returns size of image as box with origin 0.
 
SubImageBox getBoxFromImageExtent () const
 
ImageVector getImageExtent () const
 
void setImageExtent (const ImageVector &newExtent)
 
voidgetSubImagePointer (const ImageVector &voxelPosition) const
 Returns pointer to voxel data of image voxel at 6d voxelPosition relative to the begin of the subimage region.
 
voidgetSubImagePointer (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.
 
voidgetImagePointer (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.
 
voidgetImagePointer (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.
 
MLEXPORT void copySubImage (const SubImage &fromImage, const ScaleShiftData &scaleShiftData)
 Copies image data from the subimage fromImage into the overlapping region of this subimage.
 
MLEXPORT void copySubImage (const SubImage &fromImage)
 Implements special case for void copySubImage(const TSubImage<FROM_DATATYPE> &typedFromImg, const ScaleShiftData& scaleShiftData) where scaleShiftData is default.
 
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.
 
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.
 
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.
 
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.
 
MLEXPORT void allocate (MLMemoryErrorHandling handleFailure)
 Allocate data with MLAlloc().
 
MLEXPORT void allocateAsMemoryBlockHandle (MLMemoryErrorHandling handleFailure=ML_RETURN_NULL)
 Allocate data using the ML memory manager. For failure handing, see SubImage::allocate().
 
MLEXPORT void free ()
 Frees data pointed to by getData() with MLFree().
 
MLEXPORT bool isOneValued () const
 Returns true if all page voxels have the same value or if the page contains only 1 voxel.
 
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.
 
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.
 
MLEXPORT void fill (MLdouble value)
 Fills the subimage with a value cast to the data type of the subimage.
 
MLEXPORT void fillWithTypeData (const MLTypeData *value)
 Fills the subimage with a value given as MLTypeData.
 
MLEXPORT void fillBordersWithScalarValue (const SubImageBox &box, MLdouble fillValue)
 Fill all regions with the fill value fillValue which are not covered by box.
 
MLEXPORT void fillBordersWithTypeData (const SubImageBox &box, const MLTypeData *fillValue)
 Fills all regions with the fill value fillValue which are not covered by box.
 
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.
 
MLEXPORT void fillBordersWithBorderValues (const SubImageBox &box)
 Each voxel of which is not inside box is filled with the nearest voxel which is inside box.
 
void fillInvalidRegionWithScalarValue (MLdouble value)
 Fills the invalid region (everything outside of getValidRegion()) with the given value.
 
void fillInvalidRegionWithTypeData (const MLTypeData *value)
 Fills the invalid region (everything outside of getValidRegion()) with the given value.
 
void fillInvalidRegionWithBorderValues ()
 Fills the invalid region (everything outside of getValidRegion()) with the values on the borders of the valid region.
 
MLEXPORT bool isValid () const
 Returns 1(=true) if image region and data is valid.
 
voidgetData () const
 Returns the memory address of the memory managed by the subimage.
 
MLEXPORT void setData (void *data)
 Sets data as a new memory block for the subimage.
 
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.
 
const MLMemoryBlockHandlegetMemoryBlockHandle () const
 Returns the memory block handle that manages the data of this SubImage if it has been set via setDataFromMemoryBlockHandle().
 

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.
 
static MLEXPORT MLint coordToIndex (const ImageVector &voxelPosition, const ImageVector &size)
 Converts the coordinate voxelPosition into the image with extents size to an index.
 
static MLEXPORT ImageVector indexToCoord (MLint index, const ImageVector &extent)
 Converts an index into an array with extents extent to a coordinate.
 
- 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.
 
void _copySubImageGeneric (const SubImage &fromImage, const ScaleShiftData &scaleShiftData)
 Generic, non-optimized version of copySubImage.
 
const MLTypeInfos_getDataTypeInfos (MLDataType dt) const
 Get MLTypeInfos for used data types, indicates error if type is not registered.
 
- Protected Attributes inherited from ml::SubImage
SubImageBox _box
 The box of the subimage.
 
ImageVector _sourceImageExtent
 The extent of the source image, which is used for getValidRegion()
 
void_data
 Memory chunk managed by this subimage.
 
MLMemoryBlockHandle _memoryBlock
 Memory block used by this subimage.
 
ImageVector _stride
 Stride vector to address the memory efficiently.
 
MLDataType _dataType
 Datatype of the image.
 

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

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

A read-only cursor.

Definition at line 120 of file mlTSubImage.h.

◆ 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_BAD_DATA_TYPE, ML_PRINT_FATAL_ERROR, and mlrange_cast().

◆ 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::TSubImageBox< intT >::getNumVoxels(), ML_CHECK_THROW, mlrange_cast(), ml::TImageVector< CompIntType >::set(), ml::TSubImageBox< intT >::v1, and ml::TSubImageBox< intT >::v2.

◆ 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(), and mlrange_cast().

◆ 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, and mlrange_cast().

◆ 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_CHECK_THROW, MLIsScalarTypePtr(), mlrange_cast(), MLSizeOf(), and MLValuesAreEqual().

◆ 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, and mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ getData() [2/2]

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

Returns memory address of image region (Overloads method from SubImage)

Definition at line 217 of file mlTSubImage.h.

References mlrange_cast().

◆ 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, and mlrange_cast().

◆ 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, and mlrange_cast().

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

◆ 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, and mlrange_cast().

◆ 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, and mlrange_cast().

◆ 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, and mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ operator[]() [1/2]

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.

◆ 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, and mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().


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