|
ML Reference
|
#include <mlSubImage.h>
Public Member Functions | |
| const SubImageBox & | getBox () const |
| Returns the box describing the origin/extent of the subimage. | |
| void | setSourceImageExtent (const ImageVector &extent) |
| ImageVector | getSourceImageExtent () const |
| SubImageBox | getValidRegion () const |
| MLint | getNumVoxels () const |
| MLint | getSizeInBytes () const |
| ImageVector | getStride () const |
| 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) |
| MLDataType | getDataType () const |
| Returns the type of image data. | |
| const MLTypeInfos * | getDataTypeInfos () const |
| Returns MLTypeInfos for image data type. | |
| MLEXPORT ImageProperties | toImageProperties () const |
| MLEXPORT void | setFromImageProperties (const ImageProperties &imageProperties) |
| void | toStream (std::ostream &ostr) const |
Constructors and assignments. | |
| SubImage () | |
| Constructor: Creates a subimage with no data. | |
| SubImage (const SubImage &si) | |
| SubImage (const SubImageBox &box, MLDataType datatype, void *data=nullptr) | |
| SubImage (const SubImage &si, const ImageVector &offset) | |
| virtual | ~SubImage ()=default |
| Virtual destructor to suppress compiler warnings. | |
| SubImage & | operator= (const SubImage &si) |
Origin, extents, region of image, offsets, and strides. | |
| void | setBox (const SubImageBox &subImageBox) |
| void | setBox (const ImageVector &imageExtent) |
| void | translate (const ImageVector &offset) |
Translates the box of the subimage by adding the vector offset. | |
| const ImageVector & | getOrigin () const |
| Returns the origin of the subimage, which is identical to getBox().v1. | |
| void | setOrigin (const ImageVector &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) |
| void | setExtent (const ImageVector &newExtent) |
Sets the extent of the subimage to newExtent. This also changes the strides. | |
| SubImageBox | getBoxFromExtent () const |
| Returns the size of image as box with origin 0. | |
Deprecated | |
| SubImageBox | getBoxFromImageExtent () const |
| ImageVector | getImageExtent () const |
| void | setImageExtent (const ImageVector &newExtent) |
Calculation of memory addresses of image voxels | |
| void * | getSubImagePointer (const ImageVector &voxelPosition) const |
| void * | getSubImagePointer (MLint x, MLint y, MLint z) const |
| void * | getImagePointer (const ImageVector &voxelPosition) const |
| void * | getImagePointer (MLint x, MLint y, MLint z) const |
Copy image data from one subimage to another. | |
| MLEXPORT void | copySubImage (const SubImage &fromImage, const ScaleShiftData &scaleShiftData) |
| MLEXPORT void | copySubImage (const SubImage &fromImage) |
Test for validity of coordinates. | |
| bool | isValidSubImagePosition (const ImageVector &voxelPosition) const |
| bool | isValidSubImagePosition (MLint x, MLint y, MLint z) const |
| bool | isValidImagePosition (const ImageVector &voxelPosition) const |
| bool | isValidImagePosition (MLint x, MLint y, MLint z) const |
Allocation and freeing of buffered data. | |
| MLEXPORT void | allocate (MLMemoryErrorHandling handleFailure) |
| MLEXPORT void | allocateAsMemoryBlockHandle (MLMemoryErrorHandling handleFailure=ML_RETURN_NULL) |
| Allocates data using the ML memory manager. For failure handing, see SubImage::allocate(). | |
| MLEXPORT void | free () |
Special properties | |
| MLEXPORT bool | isOneValued () const |
| MLEXPORT MLint | calculateMinMax (MLdouble &minValue, MLdouble &maxValue, const SubImageBox *const validBox=nullptr) const |
| MLEXPORT void | compare (const SubImage &subImage2, bool *regionsMatch, bool *dataTypesMatch, bool *thisBoxIsPartOfRegion2, bool *region2IsPartOfThisBox, bool *overlapHasSameValues, ImageVector *firstMismatchPos) const |
SUBIMAGE FILLING | |
| MLEXPORT void | fill (MLdouble value) |
Fills the subimage with a value that is cast to the data type of the subimage. | |
| MLEXPORT void | fillWithTypeData (const MLTypeData *value) |
| MLEXPORT void | fillBordersWithScalarValue (const SubImageBox &box, MLdouble fillValue) |
| MLEXPORT void | fillBordersWithTypeData (const SubImageBox &box, const MLTypeData *fillValue) |
| MLEXPORT void | fillBordersWithInputValues (const SubImageBox &box, const SubImage &inputSubImage) |
| MLEXPORT void | fillBordersWithBorderValues (const SubImageBox &box) |
| void | fillInvalidRegionWithScalarValue (MLdouble value) |
| void | fillInvalidRegionWithTypeData (const MLTypeData *value) |
| void | fillInvalidRegionWithBorderValues () |
Protected Member Functions | |
| 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) |
| void | _copySubImageGeneric (const SubImage &fromImage, const ScaleShiftData &scaleShiftData) |
| Generic, non-optimized version of copySubImage. | |
| const MLTypeInfos * | _getDataTypeInfos (MLDataType dt) const |
Returns MLTypeInfos for used datatypes, indicates error if the type dt is not registered. | |
Protected Attributes | |
| 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 |
| MLDataType | _dataType |
| Data type of the image. | |
Properties of subimage | |
| MLEXPORT bool | isValid () const |
| void * | getData () const |
| Returns the memory address of the memory managed by the subimage. | |
| MLEXPORT void | setData (void *data) |
| MLEXPORT void | setDataFromMemoryBlockHandle (const MLMemoryBlockHandle &data) |
| const MLMemoryBlockHandle & | getMemoryBlockHandle () const |
| static MLEXPORT MLint | coordToIndex (MLint x, MLint y, MLint z, MLint c, MLint t, MLint u, const ImageVector &size) |
| static MLEXPORT MLint | coordToIndex (const ImageVector &voxelPosition, const ImageVector &size) |
| static MLEXPORT ImageVector | indexToCoord (MLint index, const ImageVector &extent) |
This class manages/represents a rectangular 6D image region that is organized linearly in memory.
Thread-safety: This class is reentrant.
This class owns
IMPORTANT NOTES:
Other notes:
Definition at line 74 of file mlSubImage.h.
|
inline |
Constructor: Creates a subimage with no data.
Definition at line 84 of file mlSubImage.h.
References _data, _dataType, _sourceImageExtent, _stride, and MLuint8Type.
Referenced by _copySubImageGeneric(), compare(), copySubImage(), copySubImage(), fillBordersWithInputValues(), operator=(), SubImage(), SubImage(), ml::TSubImage< DATATYPE >::TSubImage(), ml::TSubImage< DATATYPE >::TSubImage(), and ml::TSubImage< DATATYPE >::TSubImage().
|
inline |
Copy constructor to get identical copy. Note that only the pointer to the data is copied, and not the data itself.
Definition at line 97 of file mlSubImage.h.
References _box, _data, _dataType, _memoryBlock, _sourceImageExtent, _stride, and SubImage().
|
inline |
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.
Definition at line 111 of file mlSubImage.h.
References _box, _data, _dataType, _sourceImageExtent, _stride, getExtent(), and MLSizeOf().
|
inline |
Copy constructor to get identical copy. Note that only the pointer to the data is copied, and not the data itself. The box of the input image is translated by the given offset vector.
Definition at line 124 of file mlSubImage.h.
References _box, _data, _dataType, _memoryBlock, _sourceImageExtent, _stride, and SubImage().
|
inlinevirtualdefault |
Virtual destructor to suppress compiler warnings.
|
protected |
Helper method to calculate important parameters for page based border filling. Input parameters: box Specifies the box that shall not be filled. maxValidInputRegion The region that is allowed to be read.
Return parameters: boxV1 and boxV2 are the corners of box. outputTSubImageV1 and outputTSubImageV2 are the corners of the box of this. fullLineLenX is the number of voxels in one row of this. fullLineLenXB is the number of bytes in one row of this. leftLineStartX is the first voxel left from box to be filled in x-rows. leftLineLenX is the number of voxels to be filled starting at voxel leftLineStartX. leftLineLenXB is the number of bytes to be filled starting at voxel leftLineStartX. rightLineStartX is the first voxel right from box to be filled in x-rows. rightLineLenX is the number of voxels to be filled starting at voxel rightLineStartX. rightLineLenXB is the number of bytes to be filled starting at voxel rightLineStartX.
|
protected |
Generic, non-optimized version of copySubImage.
References SubImage().
|
protected |
Returns MLTypeInfos for used datatypes, indicates error if the type dt is not registered.
| MLEXPORT void ml::SubImage::allocate | ( | MLMemoryErrorHandling | handleFailure | ) |
Allocates data with MLAlloc(). If the allocation fails, it is handled as described by handleFailure (see MLMemoryErrorHandling for description of modes). The internal pointer to the data buffer is simply overwritten; the application is responsible for freeing it before, for example, with SubImage::free(). The number of allocated bytes results from the size of the subimage box and the data type. An empty box will result in the allocation of zero bytes on the heap, which also need to be freed correctly.
IMPORTANT: By definition, the allocated data is not owned by the subimage and will not be freed on destruction of the SubImage instance. The calling application is responsible for that. Use SubImage::free() for that.
References MLEXPORT.
| MLEXPORT void ml::SubImage::allocateAsMemoryBlockHandle | ( | MLMemoryErrorHandling | handleFailure = ML_RETURN_NULL | ) |
Allocates data using the ML memory manager. For failure handing, see SubImage::allocate().
References ML_RETURN_NULL, and MLEXPORT.
| MLEXPORT MLint ml::SubImage::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. If validBox is passed as a NULL pointer (the default), all voxels are checked. The return value is the number of scanned voxels. If the subimage is empty, minValue and maxValue are set to 0 and the return value is 0. Warning: If used in calculateOutputSubImage, take into consideration that pages 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.
References MLEXPORT.
| MLEXPORT void ml::SubImage::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. All pointer parameters may be passed as NULL parameters if not needed and will silently be ignored then.
| subImage2 | Second subimage to be compared with. |
| regionsMatch | If passed as non-NULL pointer, *regionsMatch is set to true if regions are identical. |
| dataTypesMatch | If passed as non-NULL pointer, *dataTypesMatch is set to true if both datatypes are identical. |
| thisBoxIsPartOfRegion2 | If passed as non-NULL pointer, *region1IsPartOfRegion2 is set to true if the region of this is a subregion of subImage2 or is identical. |
| region2IsPartOfThisBox | If passed as non-NULL pointer, *region2IsPartOfRegion1 is set to true if the region of subImage2 is a subregion of this or is identical. |
| overlapHasSameValues | If passed as non-NULL pointer, *overlapHasSameValues is set to true if subimages have the same and valid types, data pointers are both non-NULL and all voxels in the overlapping region of this and subImage2 contain equal values. |
| firstMismatchPos | If passed as non-NULL pointer, *firstMismatchPos is set to the first value that does not match in overlapping regions. If no overlap exists or something is invalid (data pointers or types), it is set to (-1, ..., -1). |
References MLEXPORT, and SubImage().
|
static |
Converts the coordinate voxelPosition into the image with extents size to an index. This convenience function is static and can be used also without a class instance.
References MLEXPORT.
|
static |
Converts the coordinate (x, y, z, c, t,u) to an index into an image with 6D extents given by size. This convenience function is static and can be used also without a class instance.
References MLEXPORT.
Implements a special case for void copySubImage(const TSubImage<FROM_DATATYPE> &typedFromImg, const ScaleShiftData& scaleShiftData) where scaleShiftData is default.
References MLEXPORT, and SubImage().
| MLEXPORT void ml::SubImage::copySubImage | ( | const SubImage & | fromImage, |
| const ScaleShiftData & | scaleShiftData ) |
Copies image data from the subimage fromImage into the overlapping region of this subimage. Gray values are transformed linearly according to the settings in scaleShiftData (see ScaleShiftData). Notes:
scaleShiftData defines scaleShiftData.getScale()==1 and scaleShiftData.getShift()==0. This way, voxel value transformation does not change anything and copying is implemented as a special case, which is therefore faster. References MLEXPORT, and SubImage().
Referenced by ml::TSubImage< DATATYPE >::copySubImageTyped().
Fills the subimage with a value that is cast to the data type of the subimage.
References MLEXPORT.
| MLEXPORT void ml::SubImage::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. Note that box must be specified in global image coordinates. box must overlap the box of the subImage by at least one voxel to guarantee correct operation since copying can be done only from box area. If no overlap exists, then the routine returns without filling anything.
References MLEXPORT.
Referenced by fillInvalidRegionWithBorderValues(), and ml::TSubImage< DATATYPE >::fillInvalidRegionWithBorderValues().
| MLEXPORT void ml::SubImage::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. Unavailable regions from the input are ignored and may lead to unchanged regions outside box if inputSubImage does not cover all regions outside 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. This method should be called only if this and inputSubImage differ.
References MLEXPORT, and SubImage().
| MLEXPORT void ml::SubImage::fillBordersWithScalarValue | ( | const SubImageBox & | box, |
| MLdouble | fillValue ) |
Fills all regions with the fill value 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.
References MLEXPORT.
Referenced by fillInvalidRegionWithScalarValue().
| MLEXPORT void ml::SubImage::fillBordersWithTypeData | ( | const SubImageBox & | box, |
| const MLTypeData * | fillValue ) |
Fills all regions with the fill value fillValue which 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. fillValue must point to a valid and correctly sized value of the data type of the subimage. If fillValue is NULL, the call is ignored.
References MLEXPORT.
Referenced by ml::TSubImage< DATATYPE >::fillBordersWithValue(), and fillInvalidRegionWithTypeData().
|
inline |
Fills the invalid region. Everything outside of getValidRegion()) is filled with the values on the borders of the valid region. This is useful to initialize invalid regions of an output/input subimage.
Definition at line 633 of file mlSubImage.h.
References fillBordersWithBorderValues(), and getValidRegion().
|
inline |
Fills the invalid region (everything outside of getValidRegion()) with the given value. This is useful to initialize invalid regions of an output/input subimage.
Definition at line 620 of file mlSubImage.h.
References fillBordersWithScalarValue(), and getValidRegion().
|
inline |
Fills the invalid region (everything outside of getValidRegion()) with the given value. This is useful to initialize invalid regions of an output/input subimage.
Definition at line 626 of file mlSubImage.h.
References fillBordersWithTypeData(), and getValidRegion().
| MLEXPORT void ml::SubImage::fillWithTypeData | ( | const MLTypeData * | value | ) |
Fills the subimage with a value given as MLTypeData. value must point to a valid and correctly sized value of the data type of the subimage. If value is NULL, the call is ignored.
References MLEXPORT.
| MLEXPORT void ml::SubImage::free | ( | ) |
Frees data pointed to by getData() with MLFree(). as described by MLFree(). It is legal to call free() if getData() is NULL. In that case, the call is ignored. After this call, getData() will return NULL. If the memory has been set via setDataFromMemoryBlockHandle(), free() does not delete the memory but just clears the internal memory handle.
References MLEXPORT.
|
inline |
Returns the box describing the origin/extent of the subimage.
Definition at line 230 of file mlSubImage.h.
References _box.
Referenced by ml::TSubImage< DATATYPE >::calculateMinMax(), ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), ml::TSubImage< DATATYPE >::copySubImageTyped(), ml::TSubImage< DATATYPE >::TSubImage(), and ml::TSubImageCursorBase< DATATYPE >::TSubImageCursorBase().
|
inline |
Returns the size of image as box with origin 0.
Definition at line 212 of file mlSubImage.h.
References getExtent().
Referenced by getBoxFromImageExtent().
|
inline |
Definition at line 218 of file mlSubImage.h.
References getBoxFromExtent().
|
inline |
Returns the memory address of the memory managed by the subimage.
Definition at line 372 of file mlSubImage.h.
References _data.
Referenced by ml::TSubImage< DATATYPE >::TSubImage(), ml::tsubimage_cast(), ml::tsubimage_cast(), ml::tsubimage_cast(), and ml::tsubimage_cast().
|
inline |
Returns the type of image data.
Definition at line 288 of file mlSubImage.h.
References _dataType.
Referenced by ml::TSubImage< DATATYPE >::copySubImageTyped(), ml::createTSubImageVariantArrayPair(), ml::TSubImage< DATATYPE >::TSubImage(), ml::tsubimage_cast(), ml::tsubimage_cast(), ml::tsubimage_cast(), and ml::tsubimage_cast().
|
inline |
Returns MLTypeInfos for image data type.
Definition at line 291 of file mlSubImage.h.
References _dataType, and MLGetTypeInfosForDataType().
|
inline |
Returns the extent of the subimage, which is identical to getBox().getExtent().
Definition at line 197 of file mlSubImage.h.
References _box.
Referenced by ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), getBoxFromExtent(), getImageExtent(), isValidSubImagePosition(), isValidSubImagePosition(), and SubImage().
|
inline |
Definition at line 222 of file mlSubImage.h.
References getExtent().
Referenced by ml::TSubImage< DATATYPE >::convertPointerToSubImagePosition().
|
inline |
Returns a pointer to voxel data of image voxel at 6D position voxelPosition 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 323 of file mlSubImage.h.
References _box, and getSubImagePointer().
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 331 of file mlSubImage.h.
References _box, and getSubImagePointer().
|
inline |
Returns the memory block handle that manages the data of this SubImage if it has been set via setDataFromMemoryBlockHandle(). Returns an empty handle if the data has been set with setData().
Definition at line 388 of file mlSubImage.h.
References _memoryBlock.
|
inline |
Returns number of voxels in (sub)image. Note that it could become larger than 2^32 even on 32-bit systems. It will never be less than 0; the signed return type is used for safer signed arithmetics.
Definition at line 255 of file mlSubImage.h.
References _box.
Referenced by ml::TSubImage< DATATYPE >::copySubImageTyped(), ml::TSubImage< DATATYPE >::fill(), and getSizeInBytes().
|
inline |
Returns the array index offset from the origin (0,0,0,0,0,0) to the voxelPosition.
Definition at line 270 of file mlSubImage.h.
References _stride, and ml::TVector< TVector6DBase< MLint > >::dot().
|
inline |
Returns the origin of the subimage, which is identical to getBox().v1.
Definition at line 186 of file mlSubImage.h.
References _box.
|
inline |
Returns number of potential bytes in (sub)image. Note that it could become larger than 2^32 even on 32-bit systems. It will never be less than 0; the signed return type is used for safer signed arithmetics.
Definition at line 259 of file mlSubImage.h.
References getNumVoxels().
|
inline |
Returns the image extent of the source image that was used to create this SubImage. This is used for the intersection calculation of the getValidRegion() call.
Definition at line 241 of file mlSubImage.h.
References _sourceImageExtent.
Referenced by ml::TSubImage< DATATYPE >::TSubImage().
|
inline |
Returns a stride vector to address the memory efficiently. So the memory address of an subimage voxel can easily be calculated from the dot product of strides and voxel position. Usually, stride.x=1, stride.y=x, stride.z=x*y, stride.c=x*y*z, ...
Definition at line 264 of file mlSubImage.h.
References _stride.
Referenced by ml::TSubImage< DATATYPE >::convertPointerToSubImagePosition(), ml::TSubImage< DATATYPE >::convertPointerToSubImagePosition(), ml::TSubImage< DATATYPE >::copySubImageTyped(), and ml::TSubImageCursorBase< DATATYPE >::TSubImageCursorBase().
|
inline |
Returns a pointer to voxel data of image voxel at 6D voxelPosition 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 301 of file mlSubImage.h.
References _data, _stride, and ml::TVector< TVector6DBase< MLint > >::dot().
Referenced by getImagePointer(), and getImagePointer().
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.
Definition at line 312 of file mlSubImage.h.
|
inline |
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). The ML host automatically sets the source image extent on SubImages that it creates. If you want to use getValidRegion() on SubImages that you created on your own, you have to call setSourceImageExtent() yourself.
Definition at line 248 of file mlSubImage.h.
References _box, _sourceImageExtent, and ml::TSubImageBox< MLint >::intersect().
Referenced by fillInvalidRegionWithBorderValues(), ml::TSubImage< DATATYPE >::fillInvalidRegionWithBorderValues(), fillInvalidRegionWithScalarValue(), fillInvalidRegionWithTypeData(), and ml::TSubImage< DATATYPE >::fillInvalidRegionWithValue().
|
static |
Converts an index into an array with extents extent to a coordinate. This convenience function is static and can be used also without a class instance. Note that it is not really fast.
References MLEXPORT.
| MLEXPORT bool ml::SubImage::isOneValued | ( | ) | const |
Returns true if all page voxels have the same value or if the page contains only one voxel. If subimage has no voxels (empty) or more than one value, false is returned.
References MLEXPORT.
| MLEXPORT bool ml::SubImage::isValid | ( | ) | const |
Returns 1 (=true) if image region and data is valid. Returns 0 (=false) if not. This flag does not say anything about the validity of the contents of the memory.
References MLEXPORT.
|
inline |
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. If outside, false is returned. This way, the position p=getBox().v1 addresses the origin of the subimage.
Definition at line 446 of file mlSubImage.h.
References _box, ml::TVector6DBase< CompIntType >::c, ml::TVector6DBase< CompIntType >::t, ml::TVector6DBase< CompIntType >::u, ml::TVector6DBase< CompIntType >::x, ml::TVector6DBase< CompIntType >::y, and ml::TVector6DBase< CompIntType >::z.
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. If outside, false is returned. This way, the position p=getBox().v1 addresses the origin of the subimage.
Definition at line 458 of file mlSubImage.h.
References _box.
|
inline |
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. If outside, false is returned. This way, the position p=(0,0,0,0,0,0) addresses the origin of the subimage.
Definition at line 422 of file mlSubImage.h.
References ml::TVector6DBase< CompIntType >::c, getExtent(), ml::TVector6DBase< CompIntType >::t, ml::TVector6DBase< CompIntType >::u, ml::TVector6DBase< CompIntType >::x, ml::TVector6DBase< CompIntType >::y, and ml::TVector6DBase< CompIntType >::z.
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. If outside, false is returned. This way, the position p=(0,0,0,0,0,0) addresses the origin of the subimage and all higher coordinates for c, t, and u are always used as 0.
Definition at line 435 of file mlSubImage.h.
References getExtent(), ml::TVector6DBase< CompIntType >::x, ml::TVector6DBase< CompIntType >::y, and ml::TVector6DBase< CompIntType >::z.
Assignment operator to get identical copy. Note that only the pointer to the data is copied, and not the data itself.
Definition at line 141 of file mlSubImage.h.
References _box, _data, _dataType, _memoryBlock, _sourceImageExtent, _stride, and SubImage().
Referenced by ml::TSubImage< DATATYPE >::operator=().
|
inline |
Sets a rectangular 6D region of the subimage to imageExtent. This way, the origin of box will be (0,0,0,0,0,0) and the second box edge will result to the extent -1. This overloads the method from base class ImageProperties.
Definition at line 173 of file mlSubImage.h.
References _box, _stride, and ml::TVector< TVectorBase >::getStrides().
|
inline |
Sets a rectangular 6D region of the subimage to subImageBox. Overloads method from base class ImageProperties.
Definition at line 163 of file mlSubImage.h.
References _box, _stride, ml::TSubImageBox< intT >::getExtent(), and ml::TVector< TVectorBase >::getStrides().
Referenced by ml::TSubImage< DATATYPE >::TSubImage().
|
inline |
Sets data as a new memory block for the subimage. The previous block is not touched anymore and it is not freed or deleted. If the memory was previously set by setDataFromMemoryBlockHandle(), the memory block handle is cleared.
Definition at line 377 of file mlSubImage.h.
References _data, _memoryBlock, and MLEXPORT.
Referenced by ml::TSubImage< DATATYPE >::TSubImage().
|
inline |
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. This calls setData() with the data from the memory block handle.
Definition at line 383 of file mlSubImage.h.
References _data, _memoryBlock, and MLEXPORT.
|
inline |
Override the inherited setDataType method to set type of data to dataType. The validity flag is not changed.
Definition at line 281 of file mlSubImage.h.
References _dataType, and MLSizeOf().
Referenced by ml::TSubImage< DATATYPE >::TSubImage(), and ml::TSubImage< DATATYPE >::TSubImage().
|
inline |
Sets the extent of the subimage to newExtent. This also changes the strides.
Definition at line 206 of file mlSubImage.h.
References _box, _stride, and ml::TVector< TVectorBase >::getStrides().
|
inline |
Sets the extent of the subimage to newExtent. This also changes the strides. The default value for missing dimensions is 1.
Definition at line 201 of file mlSubImage.h.
References setExtent().
Referenced by setExtent(), and setImageExtent().
| MLEXPORT void ml::SubImage::setFromImageProperties | ( | const ImageProperties & | imageProperties | ) |
Sets the image box and data type from the imageProperties extent and data type. Note that this does not affect the stored data and that the resulting box will have v1 = ImageVector(0) and v2 = imageProperties.getImgExt()-1. This box is adequate for requesting the complete volume defined by imageProperties as a single tile.
References MLEXPORT.
|
inline |
Definition at line 226 of file mlSubImage.h.
References setExtent().
|
inline |
Sets the origin of the subimage, which moves the box of the subimage to newOrigin. This method ensures that the extent stays the same.
Definition at line 190 of file mlSubImage.h.
References _box.
|
inline |
Sets the image extent of the source image that was used to create this SubImage to extent. This is used for the intersection calculation of the getValidRegion() call.
Definition at line 237 of file mlSubImage.h.
References _sourceImageExtent.
Referenced by ml::TSubImage< DATATYPE >::TSubImage().
| MLEXPORT ImageProperties ml::SubImage::toImageProperties | ( | ) | const |
Converts the Subimage's data type and extend to an ImageProperties object. Note that the min/max values of the ImageProperties are not set, since a Subimage does not store the min/max values.
References MLEXPORT.
| void ml::SubImage::toStream | ( | std::ostream & | ostr | ) | const |
|
inline |
Translates the box of the subimage by adding the vector offset.
Definition at line 180 of file mlSubImage.h.
References _box.
|
protected |
The box of the subimage.
Definition at line 696 of file mlSubImage.h.
Referenced by ml::TSubImage< DATATYPE >::convertPointerToImagePosition(), ml::TSubImage< DATATYPE >::convertPointerToImagePosition(), ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), getBox(), getExtent(), getImagePointer(), getImagePointer(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImageValue(), getNumVoxels(), getOrigin(), getValidRegion(), isValidImagePosition(), isValidImagePosition(), operator=(), setBox(), setBox(), ml::TSubImageWithCursor< DATATYPE >::setCursorImagePosition(), ml::TSubImageWithCursor< DATATYPE >::setCursorImagePosition(), setExtent(), ml::TSubImage< DATATYPE >::setImageValue(), setOrigin(), SubImage(), SubImage(), SubImage(), and translate().
|
protected |
Memory chunk managed by this subimage.
Definition at line 702 of file mlSubImage.h.
Referenced by ml::TSubImage< DATATYPE >::calculateMinMax(), ml::TSubImage< DATATYPE >::convertPointerToSubImagePosition(), ml::TSubImage< DATATYPE >::convertPointerToSubImagePosition(), ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), ml::TSubImage< DATATYPE >::fill(), getData(), ml::TSubImage< DATATYPE >::getData(), ml::TSubImage< DATATYPE >::getData(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImageValue(), getSubImagePointer(), getSubImagePointer(), ml::TSubImage< DATATYPE >::getSubImagePointer(), ml::TSubImage< DATATYPE >::getSubImagePointer(), ml::TSubImage< DATATYPE >::getSubImagePointer(), ml::TSubImage< DATATYPE >::getSubImagePointer(), ml::TSubImage< DATATYPE >::getSubImageValue(), ml::TSubImage< DATATYPE >::getSubImageValue(), ml::TSubImage< DATATYPE >::getSubImageValue(), operator=(), ml::TSubImageWithCursor< DATATYPE >::setCursorImagePosition(), ml::TSubImageWithCursor< DATATYPE >::setCursorImagePosition(), ml::TSubImageWithCursor< DATATYPE >::setCursorSubImagePosition(), ml::TSubImageWithCursor< DATATYPE >::setCursorSubImagePosition(), setData(), setDataFromMemoryBlockHandle(), ml::TSubImage< DATATYPE >::setImageValue(), ml::TSubImage< DATATYPE >::setSubImageValue(), ml::TSubImage< DATATYPE >::setSubImageValue(), ml::TSubImage< DATATYPE >::setSubImageValue(), SubImage(), SubImage(), SubImage(), and SubImage().
|
protected |
Data type of the image.
Definition at line 713 of file mlSubImage.h.
Referenced by getDataType(), getDataTypeInfos(), operator=(), setDataType(), SubImage(), SubImage(), SubImage(), and SubImage().
|
protected |
Memory block used by this subimage.
Definition at line 705 of file mlSubImage.h.
Referenced by getMemoryBlockHandle(), operator=(), setData(), setDataFromMemoryBlockHandle(), SubImage(), and SubImage().
|
protected |
The extent of the source image, which is used for getValidRegion().
Definition at line 699 of file mlSubImage.h.
Referenced by getSourceImageExtent(), getValidRegion(), operator=(), setSourceImageExtent(), SubImage(), SubImage(), SubImage(), and SubImage().
|
protected |
Stride vector to address the memory efficiently. This way, the memory address of a subimage voxel can easily be calculated from the dot product of strides and the voxel position. Usually, stride.x=1, stride.y=x, stride.z=x*y, stride.c=x*y*z,...
Definition at line 710 of file mlSubImage.h.
Referenced by ml::TSubImageWithCursor< DATATYPE >::getCursorPointerWithOffset(), ml::TSubImageWithCursor< DATATYPE >::getCursorPointerWithOffset(), ml::TSubImageWithCursor< DATATYPE >::getCursorValueWithOffset(), ml::TSubImageWithCursor< DATATYPE >::getCursorValueWithOffset(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImagePointer(), ml::TSubImage< DATATYPE >::getImageValue(), getOffset(), getStride(), getSubImagePointer(), getSubImagePointer(), ml::TSubImage< DATATYPE >::getSubImagePointer(), ml::TSubImage< DATATYPE >::getSubImagePointer(), ml::TSubImage< DATATYPE >::getSubImagePointer(), ml::TSubImage< DATATYPE >::getSubImagePointer(), ml::TSubImage< DATATYPE >::getSubImageValue(), ml::TSubImage< DATATYPE >::getSubImageValue(), ml::TSubImage< DATATYPE >::getSubImageValue(), ml::TSubImageWithCursor< DATATYPE >::moveCursorByOffset(), ml::TSubImageWithCursor< DATATYPE >::moveCursorByOffset(), ml::TSubImageWithCursor< DATATYPE >::moveCursorC(), ml::TSubImageWithCursor< DATATYPE >::moveCursorT(), ml::TSubImageWithCursor< DATATYPE >::moveCursorU(), ml::TSubImageWithCursor< DATATYPE >::moveCursorX(), ml::TSubImageWithCursor< DATATYPE >::moveCursorY(), ml::TSubImageWithCursor< DATATYPE >::moveCursorZ(), operator=(), ml::TSubImageWithCursor< DATATYPE >::reverseMoveCursorC(), ml::TSubImageWithCursor< DATATYPE >::reverseMoveCursorT(), ml::TSubImageWithCursor< DATATYPE >::reverseMoveCursorU(), ml::TSubImageWithCursor< DATATYPE >::reverseMoveCursorX(), ml::TSubImageWithCursor< DATATYPE >::reverseMoveCursorY(), ml::TSubImageWithCursor< DATATYPE >::reverseMoveCursorZ(), setBox(), setBox(), ml::TSubImageWithCursor< DATATYPE >::setCursorImagePosition(), ml::TSubImageWithCursor< DATATYPE >::setCursorImagePosition(), ml::TSubImageWithCursor< DATATYPE >::setCursorSubImagePosition(), ml::TSubImageWithCursor< DATATYPE >::setCursorSubImagePosition(), ml::TSubImageWithCursor< DATATYPE >::setCursorValueWithOffset(), ml::TSubImageWithCursor< DATATYPE >::setCursorValueWithOffset(), setExtent(), ml::TSubImage< DATATYPE >::setImageValue(), ml::TSubImage< DATATYPE >::setSubImageValue(), ml::TSubImage< DATATYPE >::setSubImageValue(), ml::TSubImage< DATATYPE >::setSubImageValue(), SubImage(), SubImage(), SubImage(), and SubImage().