|
MeVisLab Toolbox Reference
|
Class to manage a binary image. More...
#include <mlBitImage.h>
Public Types | |
Operation modes to write bit images into normal subimages. | |
| enum | OperationModes { SET_MODE = 0 , OR_MODE , AND_MODE , XOR_MODE , CLEAR_MODE , NUM_MODES } |
| Public Types inherited from ml::Base | |
| enum | PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream } |
| This enum describes the different persistence interfaces available. More... | |
Public Member Functions | |
Construction, Destruction, Assignment | |
| BitImage (bool useExceptions=false) | |
| BitImage (const ImageVector &ext, bool useExceptions=false) | |
| MLTOOLS_EXPORT | BitImage (const BitImage &bitImg) |
| MLTOOLS_EXPORT | ~BitImage () override |
| Destructor. Never throws controlled diagnostic exceptions. | |
| void | reset () |
| bool | useExceptionHandling () const |
| MLTOOLS_EXPORT void | useExceptionHandling (bool useExceptions) |
| MLTOOLS_EXPORT const BitImage & | operator= (const BitImage &bitImg) |
Extents | |
| bool | setExtent (const ImageVector &ext) |
| const ImageVector & | getExtent () const |
| Return image size. Never throws controlled diagnostic exceptions. | |
| const SubImageBox | getBoxFromImageExtent () const |
| Return a SubImageBox representing the image extent of the BitImage. | |
| const SubImageBox & | getSourceBox () const |
| void | setSourceBox (const SubImageBox &box) |
Miscellaneous | |
| const ImageVector & | getStrides () const |
| MLint | getCursorBitIndex () const |
| Return strides for words. Never throws controlled diagnostic exceptions. | |
| bool | isEmpty () const |
| Returns true if image is empty. Never throws controlled diagnostic exceptions. | |
| void | clear (bool val) |
| Clears/sets all bits in the image. Never throws controlled diagnostic exceptions. | |
| MLTOOLS_EXPORT void | getStatistics (MLuint64 *numBits, MLuint64 *numSetBits, MLuint64 *numClearedBits) |
| MLTOOLS_EXPORT BitImage * | getDownScaledBitImage (const ImageVector &scales) const |
| MLTOOLS_EXPORT long | updateBitImageFromVolume (const void *data, const MLDataType dType, const SubImageBox &origBox, const double minVal, const double maxVal, const unsigned char addBorderPixels=0) |
| MLTOOLS_EXPORT SubImageBox | calculateBoundingBox (bool val=true) |
| MLTOOLS_EXPORT void | copyToBitImage (BitImage &dstBitImg, OperationModes mode=SET_MODE, const SubImageBox &box=SubImageBox(), const ImageVector &offset=ImageVector(0)) |
| MLTOOLS_EXPORT BitImage * | getSubBitImageByMask (bool val, SubImageBox *maskedBox=nullptr) |
Direct access to image content | |
| bool | operator[] (const ImageVector &pos) const |
| void | setValue (const ImageVector &pos, const bool v) |
| void | set (const ImageVector &pos) |
| void | clear (const ImageVector &pos) |
| void | toggle (const ImageVector &pos) |
| bool | isSet (const ImageVector &pos) const |
| bool | isInRange (const ImageVector &p) const |
| bool | isInRange (const Vector6 &p) const |
General cursor management. | |
| void | setCursorPosition (const ImageVector &pos) |
| const ImageVector & | getCursorPosition () const |
| Return current cursor position. Never throws controlled diagnostic exceptions. | |
| bool | getCursorValue () const |
Return true if bit under cursor is true; otherwise, it returns false. Never throws controlled diagnostic exceptions. | |
| void | setCursorValue (const bool val) |
| Sets the bit under the cursor to 1 if true is passed as val, otherwise 0 is set. Never throws controlled diagnostic exceptions. | |
| void | setCursorValue () |
| Sets the bit under the cursor to 1. Never throws controlled diagnostic exceptions. | |
| void | toggleCursorValue () |
| Toggles the bit under the cursor. Never throws controlled diagnostic exceptions. | |
| void | clearCursorValue () |
| Clears the bit under the cursor to 0. Never throws controlled diagnostic exceptions. | |
| size_t | getCursorWordIndex () const |
| Return index to word in image to which the cursor points. Never throws controlled diagnostic exceptions. | |
| ML_BIT_IMG_DATA_TYPE | getCursorWord () const |
| ML_BIT_IMG_DATA_TYPE | getCursorBitMask () const |
| Return the bit mask specifying the bit in the cursor word. Never throws controlled diagnostic exceptions. | |
Cursor movements forward in X/Y/Z/C/T/U direction. Throws MLErrorCode exceptions when going to invalid position if exception handling is enabled, otherwise state becomes instable. | |
| void | moveCursorX () |
| void | moveCursorY () |
| void | moveCursorZ () |
| void | moveCursorC () |
| void | moveCursorT () |
| void | moveCursorU () |
Cursor movements backward in X/Y/Z/C/T/U direction. Throws MLErrorCode exceptions when going to invalid position if exception handling is enabled, otherwise state becomes instable. | |
| void | reverseMoveCursorX () |
| void | reverseMoveCursorY () |
| void | reverseMoveCursorZ () |
| void | reverseMoveCursorC () |
| void | reverseMoveCursorT () |
| void | reverseMoveCursorU () |
Linear image traversal. | |
| MLTOOLS_EXPORT void | resetCursor () |
| MLTOOLS_EXPORT bool | moveCursorXWrapAround () |
Interactions with subimages and subimage boxes | |
| MLTOOLS_EXPORT void | fill (const SubImageBox &box, const bool value) |
| MLTOOLS_EXPORT void | invert (const SubImageBox &box) |
| MLTOOLS_EXPORT void | copyToSubImage (SubImage &outSubImg, const double bkVal, const double fgVal, const OperationModes mode=SET_MODE) const |
| MLTOOLS_EXPORT void | copyFromSubImage (SubImage &inImg, const SubImageBox &box, const ImageVector &pos, const double intMin, const double intMax) |
Save/load bit image from file. | |
| MLTOOLS_EXPORT bool | is64BitVersion () const |
| MLTOOLS_EXPORT bool | writeToFile (const std::string &path, bool overwrite=true) |
| MLTOOLS_EXPORT MLErrorCode | save (const std::string &path, bool overwrite=true) |
| MLTOOLS_EXPORT bool | readFromFile (const std::string &path) |
| MLTOOLS_EXPORT MLErrorCode | load (const std::string &path) |
Direct manipulation interface. | |
| ML_BIT_IMG_DATA_TYPE * | getImageMemory () |
| size_t | getNumberOfAllocatedImageMemoryWords () const |
| Returns the number of currently allocated ML_BIT_IMG_DATA_TYPE words. | |
| Public Member Functions inherited from ml::Base | |
| Base () | |
| Constructor. | |
| virtual | ~Base () |
| Destructor. | |
| virtual Base * | deepCopy () const |
| bool | isOfAllowedType (const std::vector< const RuntimeType * > &types) const |
| virtual bool | isRefCountedBase () const |
| Returns whether the instance is derived from RefCountedBase. | |
| virtual std::string | detailString () const |
| virtual bool | implementsPersistence (PersistenceInterface) const |
| virtual std::string | persistentState () const |
| Returns a string describing the object's internal state. | |
| virtual void | setPersistentState (const std::string &state) |
| virtual void | addStateToTree (TreeNode *) const |
| Attaches the object state as children of the given parent node. | |
| virtual void | readStateFromTree (TreeNode *) |
| Reads the object state from the children of the given parent node. | |
| virtual void | writeTo (AbstractPersistenceOutputStream *) const |
| virtual void | readFrom (AbstractPersistenceInputStream *, int) |
Static Public Member Functions | |
| static MLTOOLS_EXPORT MLuint32 | selfTest () |
Class to manage a binary image.
Definition at line 67 of file mlBitImage.h.
Definition at line 73 of file mlBitImage.h.
|
inline |
Constructor. Creates an empty bit image (extents (0,0,0,0,0,0)). If useExceptions is passed as true then all errors in bit image usage throw exceptions instead of causing damage. Otherwise no checks are performed which will damage the program usually.
Definition at line 89 of file mlBitImage.h.
Referenced by BitImage(), copyToBitImage(), getDownScaledBitImage(), getSubBitImageByMask(), operator=(), and selfTest().
|
inline |
Convenience constructor. Create a bit image with extents given by ext. If useExceptions is passed as true then all errors in bit image usage throw exceptions instead of causing damage. Otherwise no checks are performed which will damage the program usually. Image contents image will be undefined after creation.
Definition at line 96 of file mlBitImage.h.
| MLTOOLS_EXPORT ml::BitImage::BitImage | ( | const BitImage & | bitImg | ) |
Copy constructor, copies bitImg to this instance. If copying fails due to lack of memory then *this is left in reset state and ML_NO_MEMORY is thrown; without activated exception handling the program runs in an undefined state.
References BitImage(), and MLTOOLS_EXPORT.
|
inlineoverride |
Destructor. Never throws controlled diagnostic exceptions.
Definition at line 106 of file mlBitImage.h.
References MLTOOLS_EXPORT.
| MLTOOLS_EXPORT SubImageBox ml::BitImage::calculateBoundingBox | ( | bool | val = true | ) |
Calculates the bounding box of all bits of value val (default is true). An empty SubImageBox is returned if no bits of value val are found.
References MLTOOLS_EXPORT.
|
inline |
Clears/sets all bits in the image. Never throws controlled diagnostic exceptions.
Definition at line 189 of file mlBitImage.h.
Referenced by setExtent(), and setValue().
|
inline |
Clear bit at position pos optimized for all extents of a bit image. If exceptions are on and pos is out of range then the error code ML_OUT_OF_RANGE is thrown. Otherwise program state becomes undefined.
Definition at line 214 of file mlBitImage.h.
References ML_BIT_IMG_ALL_BITS, ML_BIT_IMG_DATA_TYPE, ML_BIT_IMG_INDEX_BITS, ML_BIT_IMG_LOW_BIT, and ML_BIT_IMG_SHIFT.
|
inline |
Clears the bit under the cursor to 0. Never throws controlled diagnostic exceptions.
Definition at line 259 of file mlBitImage.h.
References ML_BIT_IMG_ALL_BITS, ML_BIT_IMG_DATA_TYPE, ML_BIT_IMG_INDEX_BITS, ML_BIT_IMG_LOW_BIT, and ML_BIT_IMG_SHIFT.
Referenced by setCursorValue().
| MLTOOLS_EXPORT void ml::BitImage::copyFromSubImage | ( | SubImage & | inImg, |
| const SubImageBox & | box, | ||
| const ImageVector & | pos, | ||
| const double | intMin, | ||
| const double | intMax ) |
Copy the area given by box from inImg to the position p of the bitImage. The box position (0,0,0,0,0,0) is considered the first valid voxel in inImg. Before copying the region to copy is limited to valid areas. All values >= intMin and < intMax are set to true all other values are set to false.
References MLTOOLS_EXPORT.
| MLTOOLS_EXPORT void ml::BitImage::copyToBitImage | ( | BitImage & | dstBitImg, |
| OperationModes | mode = SET_MODE, | ||
| const SubImageBox & | box = SubImageBox(), | ||
| const ImageVector & | offset = ImageVector(0) ) |
Copy all bits from the overlapping regions from box and *this to the position box.v1+offset to dstBitImg. Only valid regions in *this are read and copied to dstBitImg. offset defaults to the 0 vector. If box is empty (the default) then the full *this image is copied to position offset as far as target pixels are inside dstBitImg. mode (which defaults to SET_MODE) determines the way how bits in the target image are modified by the copy operation.
References BitImage(), MLTOOLS_EXPORT, and SET_MODE.
| MLTOOLS_EXPORT void ml::BitImage::copyToSubImage | ( | SubImage & | outSubImg, |
| const double | bkVal, | ||
| const double | fgVal, | ||
| const OperationModes | mode = SET_MODE ) const |
Copy area from the bit image into the subimage given by outSubImg. Note that only valid regions of the bit image are read - if outSubImg reaches outside the bit image the corresponding areas are not read, i.e. these regions are left undefined in outSubImg. bkVal is written for false bits, fgVal for true bits. mode describes how the values are written into the voxel values of outSubImage; default is BitImage::SET_MODE. On non integer data types all modes not equal to BitImage::SET_MODE cast the values to MLint64, apply the operations and cast back the results to the data type of outSubImg. Note: bkVal and fgVal are always cast to the data type of outSubImg.
References MLTOOLS_EXPORT, and SET_MODE.
| MLTOOLS_EXPORT void ml::BitImage::fill | ( | const SubImageBox & | box, |
| const bool | value ) |
Fill the area given by box in the bit image with value value. If area reaches outside the image then it's automatically clamped to a valid region.
References MLTOOLS_EXPORT.
|
inline |
Return a SubImageBox representing the image extent of the BitImage.
Definition at line 153 of file mlBitImage.h.
|
inline |
Return strides for words. Never throws controlled diagnostic exceptions.
Definition at line 183 of file mlBitImage.h.
|
inline |
Return the bit mask specifying the bit in the cursor word. Never throws controlled diagnostic exceptions.
Definition at line 269 of file mlBitImage.h.
References ML_BIT_IMG_DATA_TYPE, ML_BIT_IMG_INDEX_BITS, and ML_BIT_IMG_LOW_BIT.
|
inline |
Return current cursor position. Never throws controlled diagnostic exceptions.
Definition at line 244 of file mlBitImage.h.
Referenced by ml::TVirtualVolume< DATATYPE >::copyMaskToSubImage().
|
inline |
Return true if bit under cursor is true; otherwise, it returns false. Never throws controlled diagnostic exceptions.
Definition at line 247 of file mlBitImage.h.
References ML_BIT_IMG_INDEX_BITS, ML_BIT_IMG_LOW_BIT, and ML_BIT_IMG_SHIFT.
Referenced by ml::TVirtualVolume< DATATYPE >::copyMaskToSubImage().
|
inline |
Return content of word in image to which the cursor points. Bits of positions outside the image contain undefined values. Never throws controlled diagnostic exceptions.
Definition at line 266 of file mlBitImage.h.
References ML_BIT_IMG_DATA_TYPE, and ML_BIT_IMG_SHIFT.
|
inline |
Return index to word in image to which the cursor points. Never throws controlled diagnostic exceptions.
Definition at line 262 of file mlBitImage.h.
References ML_BIT_IMG_SHIFT.
| MLTOOLS_EXPORT BitImage * ml::BitImage::getDownScaledBitImage | ( | const ImageVector & | scales | ) | const |
Create a down scaled mlBitImage from this. Each extent in all dimensions is scaled down by the corresponding component in scales and increased by 1. A component wise multiplication of a coordinate of the pixel of the result with scales is the original coordinate in the bit image. E.g. (3,1,2,0,0) in the down scaled image comes from position (6,4,2,0,0,0) if scales is (2,4,1,1,1,1). NULL is returned if the original image is empty or the allocation of the result image fails. The user must delete the result after usage.
References BitImage(), and MLTOOLS_EXPORT.
|
inline |
Return image size. Never throws controlled diagnostic exceptions.
Definition at line 150 of file mlBitImage.h.
Referenced by ml::TVirtualVolume< DATATYPE >::copyMaskToSubImage().
|
inline |
Provide access to the BitImage memory. It can be used for fast memory copy operations, however, it has to be used very carefully, because it requires detailed knowledge about the internal memory structure.
Definition at line 460 of file mlBitImage.h.
References ML_BIT_IMG_DATA_TYPE.
|
inline |
Returns the number of currently allocated ML_BIT_IMG_DATA_TYPE words.
Definition at line 463 of file mlBitImage.h.
|
inline |
Returns the original placement of the bit image corresponding to a potential image the bit image is created from. Default is always empty if not set by setSourceBox() or updateBitImageFromVolume() or by instance assignment/loading. Note that box sometimes is used differently: v1 contains the location of the BitImage mask relative to the origin of the original image which starts at (0,0,0,0,0) and v2 the extent of the image. Never throws controlled diagnostic exceptions.
Definition at line 162 of file mlBitImage.h.
| MLTOOLS_EXPORT void ml::BitImage::getStatistics | ( | MLuint64 * | numBits, |
| MLuint64 * | numSetBits, | ||
| MLuint64 * | numClearedBits ) |
Returns some basic statistical values. Passed NULL pointers are not set. Not const but it doesn't modify the instance really.
References MLTOOLS_EXPORT.
|
inline |
Return strides for binary pixels. Must be divided by 32 (>> ML_BIT_IMG_SHIFT) to get word index of bit. Never throws controlled diagnostic exceptions.
Definition at line 180 of file mlBitImage.h.
| MLTOOLS_EXPORT BitImage * ml::BitImage::getSubBitImageByMask | ( | bool | val, |
| SubImageBox * | maskedBox = nullptr ) |
Calculates the bounding box of all bits of value val and returns a new BitImage containing exactly that area. If the pointer maskedBox is passed non NULL then it will be filled with the bounding box of the determined mask. If NULL (the default) it will be ignored. A NULL pointer is returned on failure or if no bits of value val are found.
References BitImage(), and MLTOOLS_EXPORT.
| MLTOOLS_EXPORT void ml::BitImage::invert | ( | const SubImageBox & | box | ) |
Toggle the area given by box in the bit image. If area reaches outside the image then it's automatically clamped to a valid region.
References MLTOOLS_EXPORT.
| MLTOOLS_EXPORT bool ml::BitImage::is64BitVersion | ( | ) | const |
Returns true if any member or allocated buffer requires 64 handling, otherwise false is returned.
References MLTOOLS_EXPORT.
|
inline |
Returns true if image is empty. Never throws controlled diagnostic exceptions.
Definition at line 186 of file mlBitImage.h.
|
inline |
Test for ImageVector coordinates in valid range. Only the image dimensions are tested. Never throws controlled diagnostic exceptions.
Definition at line 228 of file mlBitImage.h.
|
inline |
Test for Vector6 coordinates in valid range. Only the image dimensions are tested. Never throws controlled diagnostic exceptions.
Definition at line 232 of file mlBitImage.h.
|
inline |
Return true if bit at position pos is set; otherwise, it returns false. If exceptions are on and pos is out of range then the error code ML_OUT_OF_RANGE is thrown. Otherwise program state becomes undefined.
Definition at line 224 of file mlBitImage.h.
References ML_BIT_IMG_INDEX_BITS, ML_BIT_IMG_LOW_BIT, and ML_BIT_IMG_SHIFT.
Referenced by operator[]().
| MLTOOLS_EXPORT MLErrorCode ml::BitImage::load | ( | const std::string & | path | ) |
Read bit image from file specified by path and returns ML_RESULT_OK success or another error code in case of failure. Content of *this will be undefined in case of non ML_RESULT_OK return value .
References MLTOOLS_EXPORT.
|
inline |
Definition at line 277 of file mlBitImage.h.
|
inline |
Definition at line 278 of file mlBitImage.h.
|
inline |
Definition at line 279 of file mlBitImage.h.
|
inline |
Definition at line 274 of file mlBitImage.h.
Referenced by ml::TVirtualVolume< DATATYPE >::copyMaskToSubImage().
| MLTOOLS_EXPORT bool ml::BitImage::moveCursorXWrapAround | ( | ) |
Special cursor move: Increment x coordinate of cursor. When going out of image set x to zero and increase y. If y overflows then increment z etc. So an image can easily scanned as a one dimensional sequence. If the cursor is on the last voxel it won't be moved outside the image; it remains there without throwing exceptions or causing errors. It just returns false instead of true. So the sequence resetCursor(); do {} while (moveCursorXWrapAround()); permits easy bit image scanning. Throws no controlled diagnostic exceptions even if exception handling is on.
References MLTOOLS_EXPORT.
|
inline |
Definition at line 275 of file mlBitImage.h.
|
inline |
Definition at line 276 of file mlBitImage.h.
| MLTOOLS_EXPORT const BitImage & ml::BitImage::operator= | ( | const BitImage & | bitImg | ) |
Assignment operator. Assigns bitImg to this instance. Throws ML_NO_MEMORY as diagnostic exceptions if exception handling is on and assignment fails due to lack of memory. In such a case *this is left unchanged.
References BitImage(), and MLTOOLS_EXPORT.
|
inline |
Constant vector index read access to voxel value at position pos. If exceptions are on and pos is out of range then the error code ML_OUT_OF_RANGE is thrown. Otherwise program state becomes undefined.
Definition at line 199 of file mlBitImage.h.
References isSet().
| MLTOOLS_EXPORT bool ml::BitImage::readFromFile | ( | const std::string & | path | ) |
Reads a bit image from file specified by path and returns true on success, false on error. Only for backward compatibility, use load() instead.
References MLTOOLS_EXPORT.
|
inline |
Make image empty and restore default construction state with disabled exceptions. Never throws controlled diagnostic exceptions.
Definition at line 110 of file mlBitImage.h.
| MLTOOLS_EXPORT void ml::BitImage::resetCursor | ( | ) |
Set cursor and dependent members to default position (0,0,0,0,0,0). Throws no controlled diagnostic exceptions even if exception handling is on.
References MLTOOLS_EXPORT.
|
inline |
Definition at line 287 of file mlBitImage.h.
|
inline |
Definition at line 288 of file mlBitImage.h.
|
inline |
Definition at line 289 of file mlBitImage.h.
|
inline |
Definition at line 284 of file mlBitImage.h.
|
inline |
Definition at line 285 of file mlBitImage.h.
|
inline |
Definition at line 286 of file mlBitImage.h.
| MLTOOLS_EXPORT MLErrorCode ml::BitImage::save | ( | const std::string & | path, |
| bool | overwrite = true ) |
Writes bit image content into file specified by path. Return ML_RESULT_OK on success or another error code on failure. If overwrite is true (default) then existing files are overwritten, otherwise they won't be harmed and ML_OBJECT_OR_FILE_EXISTS is returned.
References MLTOOLS_EXPORT.
|
static |
Starts a self test of the mlBitImage class. Returns a nonzero value if test failed. Return value is 0 if everything is okay.
References BitImage(), ML_BIT_IMG_BIT_IDX_TYPE, and MLTOOLS_EXPORT.
|
inline |
Set bit at position pos optimized for all extents of a bit image. If exceptions are on and pos is out of range then the error code ML_OUT_OF_RANGE is thrown. Otherwise program state becomes undefined.
Definition at line 209 of file mlBitImage.h.
References ML_BIT_IMG_DATA_TYPE, ML_BIT_IMG_INDEX_BITS, ML_BIT_IMG_LOW_BIT, and ML_BIT_IMG_SHIFT.
Referenced by setValue().
|
inline |
Set cursor position to position pos. If exceptions are on and pos is out of range then the error code ML_OUT_OF_RANGE is thrown. Otherwise program state becomes undefined.
Definition at line 241 of file mlBitImage.h.
Referenced by ml::TVirtualVolume< DATATYPE >::copyMaskToSubImage().
|
inline |
Sets the bit under the cursor to 1. Never throws controlled diagnostic exceptions.
Definition at line 253 of file mlBitImage.h.
References ML_BIT_IMG_DATA_TYPE, ML_BIT_IMG_INDEX_BITS, ML_BIT_IMG_LOW_BIT, and ML_BIT_IMG_SHIFT.
|
inline |
Sets the bit under the cursor to 1 if true is passed as val, otherwise 0 is set. Never throws controlled diagnostic exceptions.
Definition at line 250 of file mlBitImage.h.
References clearCursorValue(), and setCursorValue().
Referenced by setCursorValue().
|
inline |
Resize image. Contents are destroyed and initialized to zero. On memory allocation failure or too large extents (> 4 giga bit) false is returned, and image is left in reset state without allocated memory. Otherwise true is returned. On extent changes the cursor is reset to position 0. Negative extents are handled as ImageVector(0,0,0,0,0,0) extent and no memory is allocated, and true is returned. Throws no controlled diagnostic exceptions even if exception handling is on.
Definition at line 140 of file mlBitImage.h.
References clear().
|
inline |
Sets the original placement of the bit image corresponding to a potential image the bit image is created from. Default is always empty if not set by this method, updateBitImageFromVolume() or by instance assignment/loading. Never throws controlled diagnostic exceptions. Note that box sometimes is used differently: v1 contains the location of the BitImage mask relative to the origin of the original image which starts at (0,0,0,0,0) and v2 the extent of the image.
Definition at line 171 of file mlBitImage.h.
|
inline |
Set bit at position pos to value v. If exceptions are on and pos is out of range then the error code ML_OUT_OF_RANGE is thrown. Otherwise program state becomes undefined.
Definition at line 204 of file mlBitImage.h.
|
inline |
Toggle bit at position pos. If exceptions are on and pos is out of range then the error code ML_OUT_OF_RANGE is thrown. Otherwise program state becomes undefined.
Definition at line 219 of file mlBitImage.h.
References ML_BIT_IMG_DATA_TYPE, ML_BIT_IMG_INDEX_BITS, ML_BIT_IMG_LOW_BIT, and ML_BIT_IMG_SHIFT.
|
inline |
Toggles the bit under the cursor. Never throws controlled diagnostic exceptions.
Definition at line 256 of file mlBitImage.h.
References ML_BIT_IMG_DATA_TYPE, ML_BIT_IMG_INDEX_BITS, ML_BIT_IMG_LOW_BIT, and ML_BIT_IMG_SHIFT.
| MLTOOLS_EXPORT long ml::BitImage::updateBitImageFromVolume | ( | const void * | data, |
| const MLDataType | dType, | ||
| const SubImageBox & | origBox, | ||
| const double | minVal, | ||
| const double | maxVal, | ||
| const unsigned char | addBorderPixels = 0 ) |
Scan volume given by data and origBox and filter all values through the interval given by [minVal, maxVal). Find a bounding box so that all values within this interval are within that box and set the bitImage to this size. All voxels within the interval result in a set bit in the bitImage all others result to false. The method returns the number of set bits in bitImage and the resulting bounding box is stored in _sourceBox. If addBorderPixels has bits set of its first six bits then the corresponding dimensions get a surrounding border pixel filled with false bits. E.g. if addBorderPixels is 6 the bits 1 and 2 are set, so dimension y and z get border pixels. Note that border pixels are created only if borders still fit in origBox. So the BitImage never becomes bigger than origBox. If no valid input volume (origBox empty or data is NULL) exists then -1 is returned. If no result volume could be created (e.g. memory allocation error) then -2 is returned.
References MLTOOLS_EXPORT.
|
inline |
Return true if exception handling is on, otherwise return false. Never throws controlled diagnostic exceptions.
Definition at line 114 of file mlBitImage.h.
| MLTOOLS_EXPORT void ml::BitImage::useExceptionHandling | ( | bool | useExceptions | ) |
Pass true to enable exception handling, false to disable it. Never throws controlled diagnostic exceptions.
References MLTOOLS_EXPORT.
| MLTOOLS_EXPORT bool ml::BitImage::writeToFile | ( | const std::string & | path, |
| bool | overwrite = true ) |
Writes bit image content into file specified by path path and return true on success and false on failure. If overwrite is true (default) then existing files are overwritten, otherwise they won't be harmed and false is returned. Only for backward compatibility, use save() instead.
References MLTOOLS_EXPORT.