SMIL 1.1.1
Loading...
Searching...
No Matches
Base measures

Common useful measures on images, not based on Morphological operations. More...

Detailed Description

Common useful measures on images, not based on Morphological operations.

+ Collaboration diagram for Base measures:

Functions

template<class T >
size_t area (const Image< T > &imIn)
 area() - Area of an image
 
template<class T >
double vol (const Image< T > &imIn)
 vol() - Volume of an image
 
template<class T >
double volume (const Image< T > &imIn)
 colume() - Volume of an image
 
template<class T >
Vector_double meanVal (const Image< T > &imIn, bool onlyNonZero=false)
 meanVal() - Mean value and standard deviation
 
template<class T >
minVal (const Image< T > &imIn, bool onlyNonZero=false)
 minVal() - Min value of an image
 
template<class T >
minVal (const Image< T > &imIn, Point< UINT > &pt, bool onlyNonZero=false)
 minVal() - Min value of an image
 
template<class T >
maxVal (const Image< T > &imIn, bool onlyNonZero=false)
 maxVal() - Max value of an image
 
template<class T >
maxVal (const Image< T > &imIn, Point< UINT > &pt, bool onlyNonZero=false)
 maxVal() - Max value of an image
 
template<class T >
vector< T > rangeVal (const Image< T > &imIn, bool onlyNonZero=false)
 rangeVal() - Min and Max values of an image
 
template<class T >
vector< T > valueList (const Image< T > &imIn, bool onlyNonZero=true)
 valueList() - Get the list of the pixel values present in the image
 
template<class T >
modeVal (const Image< T > &imIn, bool onlyNonZero=true)
 modeVal() - Get the mode of the histogram present in the image, i.e.
 
template<class T >
medianVal (const Image< T > &imIn, bool onlyNonZero=true)
 medianVal() - Get the median of the image histogram.
 
template<class T >
vector< T > profile (const Image< T > &im, size_t x0, size_t y0, size_t x1, size_t y1, size_t z=0)
 profile() - Get image values along a line defined by the points $(x_0, y_0)$ and $(x_1, y_1)$ in the slice $z$.
 
template<class T >
Vector_double measBarycenter (Image< T > &im)
 measBarycenter() - Gets the barycenter coordinates of an image
 
template<class T >
vector< size_t > measBoundBox (Image< T > &im)
 measBoundBox() - Bounding Box measure - gets the coordinates of the bounding box
 
template<class T >
Vector_double measMoments (Image< T > &im, const bool onlyNonZero=true, const bool centered=false)
 measMoments() - Measure image moments
 
template<class T >
vector< double > measCovariance (const Image< T > &imIn1, const Image< T > &imIn2, size_t dx, size_t dy, size_t dz, size_t maxSteps=0, bool centered=false, bool normalize=false)
 measCovariance() - Centered covariance of two images in the direction defined by dx, dy and dz.
 
template<class T >
vector< double > measAutoCovariance (const Image< T > &imIn, size_t dx, size_t dy, size_t dz, size_t maxSteps=0, bool centered=false, bool normalize=false)
 measAutoCovariance() - Auto-covariance
 
template<class T >
double measEntropy (const Image< T > &imIn)
 measEntropy() - Image entropy
 
template<class T >
double measEntropy (const Image< T > &imIn, const Image< T > &imMask)
 measEntropy() - Image entropy
 
template<class T >
Vector_size_t nonZeroOffsets (Image< T > &imIn)
 nonZeroOffsets() - Returns the offsets of pixels having non nul values.
 
template<class T >
bool isBinary (const Image< T > &imIn)
 isBinary() - Test if an image is binary.
 

Function Documentation

◆ area()

template<class T >
size_t area ( const Image< T > &  imIn)

area() - Area of an image

The area of an image is defined as the number of non-zero pixels

Parameters
[in]imIn: Input image.
Returns
the number of non-zero pixels
Note
The name of this function comes from times where images were mostly 2D only. In those days, the area of an image was said to be the area of xy plane where pixel values are non-zero, i.e., the number of non-zero pixels. This may be confusing for 3D images, but the idea remains the same.

◆ vol()

template<class T >
double vol ( const Image< T > &  imIn)

vol() - Volume of an image

Parameters
[in]imIn: Input image.
Returns
the sum of pixel values

This is the same than the volume function call. Better use the unabridged name. The abridged name remains for back compatibility.

◆ volume()

template<class T >
double volume ( const Image< T > &  imIn)

colume() - Volume of an image

The volume of an image is defined as the sum of the pixel values.

Parameters
[in]imIn: Input image.
Returns
the sum of pixel values (as a double)
Note
The name of this function comes from times where images were mostly 2D only. In those days, the volume of an image was said to be the volume defined by the xy plane with the third dimension being the intensity (pixel values). This may be confusing for 3D images, but the idea remains the same.

◆ meanVal()

template<class T >
Vector_double meanVal ( const Image< T > &  imIn,
bool  onlyNonZero = false 
)

meanVal() - Mean value and standard deviation

Parameters
[in]imIn: Input image.
[in]onlyNonZero: If true, only non-zero pixels are considered.
Returns
a vector with the mean and standard deviation of pixel values

◆ minVal() [1/2]

template<class T >
T minVal ( const Image< T > &  imIn,
bool  onlyNonZero = false 
)

minVal() - Min value of an image

Parameters
[in]imIn: Input image.
[in]onlyNonZero: If true, only non-zero pixels are considered.
Returns
the min of the pixel values.

◆ minVal() [2/2]

template<class T >
T minVal ( const Image< T > &  imIn,
Point< UINT > &  pt,
bool  onlyNonZero = false 
)

minVal() - Min value of an image

Parameters
[in]imIn: Input image.
[out]pt: point coordinates of the minimum value in the image.
[in]onlyNonZero: If true, only non-zero pixels are considered.
Returns
the min of the pixel values.

◆ maxVal() [1/2]

template<class T >
T maxVal ( const Image< T > &  imIn,
bool  onlyNonZero = false 
)

maxVal() - Max value of an image

Parameters
[in]imIn: Input image.
[in]onlyNonZero: If true, only non-zero pixels are considered.
Returns
the max of the pixel values.

◆ maxVal() [2/2]

template<class T >
T maxVal ( const Image< T > &  imIn,
Point< UINT > &  pt,
bool  onlyNonZero = false 
)

maxVal() - Max value of an image

Parameters
[in]imIn: Input image.
[out]pt: point coordinates of the maximum value in the image.
[in]onlyNonZero: If true, only non-zero pixels are considered.
Returns
the max of the pixel values.

◆ rangeVal()

template<class T >
vector< T > rangeVal ( const Image< T > &  imIn,
bool  onlyNonZero = false 
)

rangeVal() - Min and Max values of an image

Parameters
[in]imIn: Input image.
[in]onlyNonZero: If true, only non-zero pixels are considered.
Returns
a vector with the min and the max of the pixel values.

◆ valueList()

template<class T >
vector< T > valueList ( const Image< T > &  imIn,
bool  onlyNonZero = true 
)

valueList() - Get the list of the pixel values present in the image

Parameters
[in]imIn: Input image.
[in]onlyNonZero: If true, only non-zero pixels are considered.
Returns
a vector with the values found in the image.
See also
histogram
Warning
In huge images of type UINT32, this function may return a huge vector.

◆ modeVal()

template<class T >
T modeVal ( const Image< T > &  imIn,
bool  onlyNonZero = true 
)

modeVal() - Get the mode of the histogram present in the image, i.e.

the value that appears most often.

Parameters
[in]imIn: input image
[in]onlyNonZero: consider only non zero values
Returns
the value that appears more often
Note
As this function returns only one value :
  • in a distribution with the same maximum for many values, it returns the first one;
  • in a multimodal distribution, it returns the first biggest one;

◆ medianVal()

template<class T >
T medianVal ( const Image< T > &  imIn,
bool  onlyNonZero = true 
)

medianVal() - Get the median of the image histogram.

Parameters
[in]imIn: Input image.
[in]onlyNonZero: If true, only non-zero pixels are considered.
Returns
the median of the image histogram

◆ profile()

template<class T >
vector< T > profile ( const Image< T > &  im,
size_t  x0,
size_t  y0,
size_t  x1,
size_t  y1,
size_t  z = 0 
)

profile() - Get image values along a line defined by the points $(x_0, y_0)$ and $(x_1, y_1)$ in the slice $z$.

Parameters
[in]im: input image
[in]x0,y0: start point
[in]x1,y1: end point
[in]z: slice
Returns
vector with pixel values

◆ measBarycenter()

template<class T >
Vector_double measBarycenter ( Image< T > &  im)

measBarycenter() - Gets the barycenter coordinates of an image

Parameters
[in]im: input image
Returns
vector with the coordinates of barycenter

◆ measBoundBox()

template<class T >
vector< size_t > measBoundBox ( Image< T > &  im)

measBoundBox() - Bounding Box measure - gets the coordinates of the bounding box

Parameters
[in]im: input image
Returns
a vector with xMin, yMin (,zMin), xMax, yMax (,zMax)

◆ measMoments()

template<class T >
Vector_double measMoments ( Image< T > &  im,
const bool  onlyNonZero = true,
const bool  centered = false 
)

measMoments() - Measure image moments

Parameters
[in]im: input image
[in]onlyNonZero: use only non zero values
[in]centered: returns centered moments
Returns
For 2D images: vector(m00, m10, m01, m11, m20, m02)
For 3D images: vector(m000, m100, m010, m001, m110, m101, m011, m200, m020, m002)
See also
blobsMoments() call if you want to evaluate moments for each blob.
Image moment on Wikipedia
Inertia matrix can be evaluated :
  • For 3D images :

    \[
   M =
     \begin{bmatrix}
       m020 + m002  & -m110 & -m101 \\
      -m110 & m200 + m002   & -m011 \\
      -m101 & -m011 &  m200 + m020
     \end{bmatrix}
   \]

  • For 2D images :

    \[
   M =
     \begin{bmatrix}
       m20 & -m11 \\
      -m11 &  m02
     \end{bmatrix}
   \]

◆ measCovariance()

template<class T >
vector< double > measCovariance ( const Image< T > &  imIn1,
const Image< T > &  imIn2,
size_t  dx,
size_t  dy,
size_t  dz,
size_t  maxSteps = 0,
bool  centered = false,
bool  normalize = false 
)

measCovariance() - Centered covariance of two images in the direction defined by dx, dy and dz.

The direction is given by dx, dy and dz.

The lenght corresponds to the max number of steps maxSteps. When 0, the length is limited by the dimensions of the image.

\[
   vec[h] = \sum_{p \:\in\: imIn1} \frac{imIn1(p) \;.\; imIn2(p + h)}{N_p}
\]

where h are displacements in the direction defined by dx, dy and dz.

$N_p$ is the number of pixels used in each term of the sum, which may different for each term in the sum.

Parameters
[in]imIn1,imIn2: Input Images
[in]dx,dy,dz: direction
[in]maxSteps: number maximum of displacements to evaluate
[in]centered: if this parameter is set to true, the mean value (meanVal()) will be subtracted from each input image
[in]normalize: normalize result with respect to vec[0]
Returns
vec[h]

◆ measAutoCovariance()

template<class T >
vector< double > measAutoCovariance ( const Image< T > &  imIn,
size_t  dx,
size_t  dy,
size_t  dz,
size_t  maxSteps = 0,
bool  centered = false,
bool  normalize = false 
)

measAutoCovariance() - Auto-covariance

The direction is given by dx, dy and dz. The lenght corresponds to the max number of steps maxSteps

Parameters
[in]imIn: Input Image
[in]dx,dy,dz: direction
[in]maxSteps: number maximum of displacements to evaluate
[in]centered: if this parameter is set to true, the mean value (meanVal()) will be subtracted from the input image
[in]normalize: normalize result with respect to vec[0]
Returns
vec[h]

◆ measEntropy() [1/2]

template<class T >
double measEntropy ( const Image< T > &  imIn)

measEntropy() - Image entropy

Evaluate Shannon entropy of the image (in bits)

Parameters
[in]imIn: input image
Returns
image entropy
See also
blobsEntropy() to compute entropy inside each label.

◆ measEntropy() [2/2]

template<class T >
double measEntropy ( const Image< T > &  imIn,
const Image< T > &  imMask 
)

measEntropy() - Image entropy

Evaluate Shannon entropy of the image in a region defined by a mask.

Parameters
[in]imIn: input image
[in]imMask: mask defining where the entropy shall be evaluated
Returns
image entropy
See also
blobsEntropy() to compute entropy inside each label.

◆ nonZeroOffsets()

template<class T >
Vector_size_t nonZeroOffsets ( Image< T > &  imIn)

nonZeroOffsets() - Returns the offsets of pixels having non nul values.

Parameters
[in]imIn: input image
Returns
a vector containing the offset of all non-zero points in image.
Warning
In huge images this can return a very big vector, in the same order than the image size.

◆ isBinary()

template<class T >
bool isBinary ( const Image< T > &  imIn)

isBinary() - Test if an image is binary.

Parameters
[in]imIn: image
Returns
true if the only pixel values are 0 and any other positive value.