SMIL 1.1.2
|
Blobs More...
Blobs
Blobs are just maps (or dictionaries in Python) to represent disjoint regions in image.
blobs are probably the best way to handle measures on regions of images, as calling a function to evaluate a measure on a blobs map is equivalent to call the equivalent function for each blob. E.g. calling blobsArea() is equivalent to call area() for each blob in the map.
To handle blobs, you need to have a labeled image, generated by some method of segmentation (e.g. watershed()), and create them thanks to computeBlobs().
Example
Classes | |
struct | PixelSequence |
Start offset and length of pixels in an image. More... | |
struct | Blob |
List of offset and size of line contiguous pixels. More... | |
Functions | |
template<class T > | |
map< T, Blob > | computeBlobs (const Image< T > &imIn, bool onlyNonZero=true) |
Create a map of blobs from a labeled image. | |
template<class labelT , class T > | |
RES_T | drawBlobs (map< labelT, Blob > &blobs, Image< T > &imOut, T blobsValue=ImDtTypes< T >::max(), bool fillFirst=true, T defaultValue=T(0)) |
Represent Blobs in an image. | |
template<class labelT , class T > | |
RES_T | drawBlobs (map< labelT, Blob > &blobs, map< labelT, T > &lut, Image< T > &imOut, bool fillFirst=true, T defaultValue=T(0)) |
Represent Blobs in an image with a lookup map. | |
template<class labelT > | |
int | getBlobIDFromOffset (map< labelT, Blob > &blobs, size_t offset) |
getBlobIDFromOffset() - get the blob ID which contains a pixel (or voxel) given its offset | |
template<class labelT , class T > | |
int | getBlobIDFromOffset (Image< T > imIn, map< labelT, Blob > &blobs, int x, int y, int z=0) |
getBlobIDFromOffset() - get the blob ID which contains a pixel (or voxel) given its coordinates | |
template<class T > | |
map< T, double > | blobsArea (const Image< T > &imLbl, const bool onlyNonZero=true) |
blobsArea() - Calculate the area of each region in a labeled image | |
template<class labelT > | |
map< labelT, double > | blobsArea (map< labelT, Blob > &blobs) |
blobsArea() - Measure areas from a pre-generated Blob map (faster). | |
template<class T , class labelT > | |
map< labelT, double > | blobsVolume (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsVolume() - Measure the sum of values of each blob in imIn. | |
template<class T , class labelT > | |
map< labelT, T > | blobsMinVal (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsMinVal() - Measure the minimum value of each blob in imIn. | |
template<class T , class labelT > | |
map< labelT, T > | blobsMaxVal (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsMaxVal() - Measure the maximum value of each blob in imIn. | |
template<class T , class labelT > | |
map< labelT, vector< T > > | blobsRangeVal (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsRangeVal() - Measure the min and max values of each blob in imIn. | |
template<class T , class labelT > | |
map< labelT, Vector_double > | blobsMeanVal (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsMeanVal() - Measure the mean value and the std dev. | |
template<class T , class labelT > | |
map< labelT, vector< T > > | blobsValueList (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsValueList() - Measure the list of values of each blob in imIn. | |
template<class T , class labelT > | |
map< labelT, T > | blobsModeVal (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsModeVal() - Measure the mode value of imIn in each blob. | |
template<class T , class labelT > | |
map< labelT, T > | blobsMedianVal (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsMedianVal() - Measure the median value of imIn in each blob. | |
template<class T > | |
map< T, Vector_double > | blobsBarycenter (const Image< T > &imLbl, const bool onlyNonZero=true) |
blobsBarycenter() - Measure barycenter of a labeled image. | |
template<class T , class labelT > | |
map< labelT, Vector_double > | blobsBarycenter (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsBarycenter() - Measure the barycenter of each blob in imIn. | |
template<class T > | |
map< T, vector< size_t > > | blobsBoundBox (const Image< T > &imLbl, const bool onlyNonZero=true) |
blobsBoundBox() - Measure bounding boxes of labeled image. | |
template<class T , class labelT > | |
map< labelT, vector< size_t > > | blobsBoundBox (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsBoundBox() - Measure bounding boxes of each blob (faster with blobs pre-generated). | |
template<class T , class labelT > | |
map< labelT, Vector_double > | blobsMoments (const Image< T > &imIn, map< labelT, Blob > &blobs, bool central=false) |
blobsMoments() - Measure blobs image moments (faster with blobs pre-generated). | |
template<class T > | |
map< T, Vector_double > | blobsMoments (const Image< T > &imLbl, const bool onlyNonZero=true, bool central=false) |
blobsMoments() - Measure image moments of each label. | |
template<class T , class labelT > | |
map< labelT, double > | blobsEntropy (const Image< T > &imIn, map< labelT, Blob > &blobs) |
blobsEntropy() - Measure blobs entropy. | |
Create a map of blobs from a labeled image.
[in] | imIn | : input labeled image |
[in] | onlyNonZero | : ignore regions whose label is 0 |
RES_T drawBlobs | ( | map< labelT, Blob > & | blobs, |
Image< T > & | imOut, | ||
T | blobsValue = ImDtTypes<T>::max() , |
||
bool | fillFirst = true , |
||
T | defaultValue = T(0) |
||
) |
Represent Blobs in an image.
[in] | blobs | : input blobs map |
[in] | imOut | : output image |
[in] | blobsValue | : value to assign to each blob |
[in] | fillFirst | : fill the background before beginning |
[in] | defaultValue | : default value for the background (default : 0) |
blobsValue == 0
, each blobs is represented with its label value. RES_T drawBlobs | ( | map< labelT, Blob > & | blobs, |
map< labelT, T > & | lut, | ||
Image< T > & | imOut, | ||
bool | fillFirst = true , |
||
T | defaultValue = T(0) |
||
) |
Represent Blobs in an image with a lookup map.
[in] | blobs | : input blobs map |
[in] | lut | : lookup table with value to assign to each blob |
[in] | imOut | : output image |
[in] | fillFirst | : fill the background before beginning |
[in] | defaultValue | : default value for the background (default : 0) |
int getBlobIDFromOffset | ( | map< labelT, Blob > & | blobs, |
size_t | offset | ||
) |
getBlobIDFromOffset() - get the blob ID which contains a pixel (or voxel) given its offset
[in] | blobs | : the blobs map |
[in] | offset | : the offset to look for |
int getBlobIDFromOffset | ( | Image< T > | imIn, |
map< labelT, Blob > & | blobs, | ||
int | x, | ||
int | y, | ||
int | z = 0 |
||
) |
getBlobIDFromOffset() - get the blob ID which contains a pixel (or voxel) given its coordinates
[in] | blobs | : the blobs map |
[in] | imIn | : input image where blobs are defined |
[in] | x,y[,z] | : point coordinates |
map< T, double > blobsArea | ( | const Image< T > & | imLbl, |
const bool | onlyNonZero = true |
||
) |
blobsArea() - Calculate the area of each region in a labeled image
[in] | imLbl | : input labeled image |
[in] | onlyNonZero | : skip a blob having a null label |
Example
map< labelT, double > blobsArea | ( | map< labelT, Blob > & | blobs | ) |
blobsArea() - Measure areas from a pre-generated Blob map (faster).
[in] | blobs | : input Blob map |
map< labelT, double > blobsVolume | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsVolume() - Measure the sum of values of each blob in imIn.
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
map< labelT, T > blobsMinVal | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsMinVal() - Measure the minimum value of each blob in imIn.
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
map< labelT, T > blobsMaxVal | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsMaxVal() - Measure the maximum value of each blob in imIn.
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
map< labelT, vector< T > > blobsRangeVal | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsRangeVal() - Measure the min and max values of each blob in imIn.
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
map< labelT, Vector_double > blobsMeanVal | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsMeanVal() - Measure the mean value and the std dev.
of each blob in imIn.
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
map< labelT, vector< T > > blobsValueList | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsValueList() - Measure the list of values of each blob in imIn.
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
map< labelT, T > blobsModeVal | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsModeVal() - Measure the mode value of imIn in each blob.
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
map< labelT, T > blobsMedianVal | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsMedianVal() - Measure the median value of imIn in each blob.
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
map< T, Vector_double > blobsBarycenter | ( | const Image< T > & | imLbl, |
const bool | onlyNonZero = true |
||
) |
blobsBarycenter() - Measure barycenter of a labeled image.
[in] | imLbl | : input labeled image |
[in] | onlyNonZero | : skip a blob having a null label |
Example
map< labelT, Vector_double > blobsBarycenter | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsBarycenter() - Measure the barycenter of each blob in imIn.
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
map< T, vector< size_t > > blobsBoundBox | ( | const Image< T > & | imLbl, |
const bool | onlyNonZero = true |
||
) |
blobsBoundBox() - Measure bounding boxes of labeled image.
[in] | imLbl | : input labeled image |
[in] | onlyNonZero | : skip a blob having a null label |
map< labelT, vector< size_t > > blobsBoundBox | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsBoundBox() - Measure bounding boxes of each blob (faster with blobs pre-generated).
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
map< labelT, Vector_double > blobsMoments | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs, | ||
bool | central = false |
||
) |
blobsMoments() - Measure blobs image moments (faster with blobs pre-generated).
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |
[in] | central | : moments are evaluated with respect to the blob barycenter |
Example : Calculating moments
Example : Getting blob orientation in space
map< T, Vector_double > blobsMoments | ( | const Image< T > & | imLbl, |
const bool | onlyNonZero = true , |
||
bool | central = false |
||
) |
blobsMoments() - Measure image moments of each label.
[in] | imLbl | : input labeled image |
[in] | onlyNonZero | : skip a blob having a null label |
[in] | central | : moments are evaluated with respect to the blob barycenter |
map< labelT, double > blobsEntropy | ( | const Image< T > & | imIn, |
map< labelT, Blob > & | blobs | ||
) |
blobsEntropy() - Measure blobs entropy.
[in] | imIn | : input labeled image |
[in] | blobs | : input Blob map |