i3dlib

Documentation

i3d::Shape< LABEL > Class Template Reference

#include <shape.h>

List of all members.


Public Member Functions

 Shape (const Image3d< LABEL > *_img, LABEL _label=0)
void EraseValues ()
void SetImage (const Image3d< LABEL > *_img)
void SetLabel (const LABEL _label)
unsigned long Area ()
unsigned long Volume ()
float AreaUm ()
float VolumeUm ()
Boundary GetBoundary ()
Boundary GetBoundary (const Neighbourhood &nbh)
NetBoundary NetBoundary3d ()
size_t Perimeter (const Neighbourhood &nbh=nb2D_4)
size_t Surface ()
size_t Surface (const Neighbourhood &nbh)
float PerimeterUm ()
float SurfaceUm ()
float Roundness ()
vector< float > Curvature2d (unsigned int dist)
vector< float > BSCurvature2d ()
double BendingEnergy2d ()
Vector3d< size_t > Centroid ()
unsigned long StatMoment (unsigned short ex, unsigned short ey, unsigned short ez=0)
float StatMomentUm (unsigned short ex, unsigned short ey, unsigned short ez=0)
long CStatMoment (unsigned short ex, unsigned short ey, unsigned short ez=0)
float CStatMomentUm (unsigned short ex, unsigned short ey, unsigned short ez=0)
void Radius (float &min, float &max, float &mean)
PrincipalAxes GetPrincipalAxes ()
void Elongation2d (float &elongation)
void Elongation3d (float &majorElongation, float &minorElongation)
void Elongation (float &majorElongation, float &minorElongation)
float Symmetry (Vector3d< float > normVect, Vector3d< size_t > center, char symType)
void PrincipalSymmetry (float &sym1, float &sym2, float &sym3)
float Rectangularity ()
float LPEnergy2d (unsigned koefNumber)
void NFDs2d (float &FF, float &NEnergy)

Detailed Description

template<class LABEL>
class i3d::Shape< LABEL >

Shape is wrapping object for all shape characterisation functions. It is designed to work with binary Image3d as well as with all LabeledImage3d types. Therefore it is necessary to specify the same LABEL template class as the LABEL class of LabeledImage3d to be used.
For use with binary images simply use Shape<BINARY>


Constructor & Destructor Documentation

template<class LABEL>
i3d::Shape< LABEL >::Shape ( const Image3d< LABEL > *  _img,
LABEL  _label = 0 
)

Constructor.

Parameters:
_limg input image, you can use LabeledImag.
_label label of object to be measured, for binary images use BINARY(1)


Member Function Documentation

template<class LABEL>
void i3d::Shape< LABEL >::EraseValues (  ) 

Call this function if you have made changes in input image, otherwise measurments could be incorrect

template<class LABEL>
void i3d::Shape< LABEL >::SetImage ( const Image3d< LABEL > *  _img  ) 

To use Shape for another image

Parameters:
_limg input image, you can use LabeledImag.

template<class LABEL>
void i3d::Shape< LABEL >::SetLabel ( const LABEL  _label  ) 

To use Shape for another object in image with different label

Parameters:
_label label of object to be measured, for binary images set BINARY(1)

template<class LABEL>
unsigned long i3d::Shape< LABEL >::Area (  ) 

Area of 2D object in pixels

template<class LABEL>
unsigned long i3d::Shape< LABEL >::Volume (  ) 

Volume of 3D object in voxels (For 2D images similar as calling Area)

template<class LABEL>
float i3d::Shape< LABEL >::AreaUm (  ) 

Area of 2D object in micrometers^2

template<class LABEL>
float i3d::Shape< LABEL >::VolumeUm (  ) 

Volume of 3D object in micrometers^3 (um). (For 2D images similar as calling AreaUm)

template<class LABEL>
Boundary i3d::Shape< LABEL >::GetBoundary (  ) 

2D/3D - Finds boundary with implicit neighbourhoods

  • nb2D_4 for 2D objects - boundary is 8-connected
  • nb3D_6 for 3D objects - boundary is 26-connected
For 2D images the boundary sequence is in chain, i.e. bdr[i+1] and bdr[i] are neighbours.
More precisely it finds "intermal boundary". Voxel belongs into this boundary if it has non-object voxel in given neighbourhood

template<class LABEL>
Boundary i3d::Shape< LABEL >::GetBoundary ( const Neighbourhood nbh  ) 

2D/3D - Finds boundary with given neighbourhood.
for 2D images is allowed:

  • nb2D_8: boundary is 4-connected
  • nb2D_4: boundary is 8-connected
All neighbourhoods for 3D images allowed.
For 2D images the boundary sequence is in chain, i.e. bdr[i+1] and bdr[i] are neighbours.
More precisely it finds "intermal boundary". Voxel belongs into this boundary if it has non-object voxel in given neighbourhood

template<class LABEL>
NetBoundary i3d::Shape< LABEL >::NetBoundary3d (  ) 

NetBoundary constructor, so far it is unuseful. It was ment for extremity (vertices) points finding

template<class LABEL>
size_t i3d::Shape< LABEL >::Perimeter ( const Neighbourhood nbh = nb2D_4  ) 

Perimeter of 2D object in pixels by given neighbourhood

  • nb2D_4: 8-connected boundary
  • nb2D_8: 4-connected boundary
Perimeter is simply number of pixels in boundary.

template<class LABEL>
size_t i3d::Shape< LABEL >::Surface (  ) 

Surface of 3D object in voxels
It uses boundary constructor (GetBoundary) with implicit nb3D_6 neighbourhood. Surface is simply number of voxels in boundary. (For 2D images similar as calling Perimeter)

template<class LABEL>
size_t i3d::Shape< LABEL >::Surface ( const Neighbourhood nbh  ) 

Surface of 3D object in voxels by given neighbourhood.
It uses boundary constructor (GetBoundary) with given neighbourhood. Surface is simply number of voxels in boundary.

template<class LABEL>
float i3d::Shape< LABEL >::PerimeterUm (  ) 

Perimeter in micrometers (um) of 2D object
Uses simple linear aproximation of 8-connected boundary

template<class LABEL>
float i3d::Shape< LABEL >::SurfaceUm (  ) 

Surface of binary image in microns by 3D-6 neighbourhood aproximation

template<class LABEL>
float i3d::Shape< LABEL >::Roundness (  ) 

2D/3D Roundness is based on ratio between area and perimeter(volume and surface). It is normalized to be in range (0,1]. 1 stands for circle (ball). The less compact is the shape the lower is roundness.

template<class LABEL>
vector< float > i3d::Shape< LABEL >::Curvature2d ( unsigned int  dist  ) 

Curvature of every boundary voxel of 2D object.
Curvature(img).size() == Boundary(img).size() and Curvature(img)[i] is curvature of voxel Boundary(img)[i].
Curvature is from interval <-1, 1>;

  • -1 stands for straight boundary;

1 stands for total tips (convex or concave) radius must be >1 and it influence how much the curvature measure is sensitive to noise, the higher the radius, the less sensitivity to noise but also to little details.

template<class LABEL>
vector< float > i3d::Shape< LABEL >::BSCurvature2d (  ) 

computes curvature using 5 neighbouring voxels B-spline approximation.
This curvature corresponds with connected (non-discrete) curve curvature definition. For boundary shorter than 5 voxels doesn't computation make sense.

See also:
Curvature2d

template<class LABEL>
double i3d::Shape< LABEL >::BendingEnergy2d (  ) 

Bending energy of 2D object.
It is average of curvature^2 from all boundary points. BSCurvature2d is used. The higher the bending energy is the more curved and complicated is the shape.

template<class LABEL>
Vector3d< size_t > i3d::Shape< LABEL >::Centroid (  ) 

center of mass.

template<class LABEL>
unsigned long i3d::Shape< LABEL >::StatMoment ( unsigned short  ex,
unsigned short  ey,
unsigned short  ez = 0 
)

2D/3D Statistical moment.

Parameters:
ex,ey,ez exponent coeficients moment for 3D is defined as Sum(x^ex * y^ey * z^ez * img3D(x,y,z)) for all x,y,z values combinations.
note that :
  • StatMoment(img, 1, 0, 0) / Volume(img) == x value of center of object
  • StatMoment(img, 0, 1, 0) / Volume(img) == y value of center of object
  • StatMoment(img, 0, 0, 1) / Volume(img) == z value of center of object
It is suitable also for 2D object, just leave 'ez' zero.

template<class LABEL>
float i3d::Shape< LABEL >::StatMomentUm ( unsigned short  ex,
unsigned short  ey,
unsigned short  ez = 0 
)

statistical moments but in micrometers.

See also:
StatMoment

template<class LABEL>
long i3d::Shape< LABEL >::CStatMoment ( unsigned short  ex,
unsigned short  ey,
unsigned short  ez = 0 
)

2D/3D Central statistical moment.
these are important to obtain translation invariance - useful for calculating eigenaxes and symmetry ex, ey, ez - are exponent coeficients moment for 3D is defined as Sum((x -x')^ex * (y-y')^ey * (z-z')^ez * img3D(x,y,z)) for all x,y,z values combinations, x',y',z' denotes x,y,z center coordinates Suitable for 2D objects.

See also:
StatMoment.

template<class LABEL>
float i3d::Shape< LABEL >::CStatMomentUm ( unsigned short  ex,
unsigned short  ey,
unsigned short  ez = 0 
)

Computes central statistical moment in micrometers, takes into account resolution These are important to obtain translation invariance - useful for calculating eigenaxes and symmetry. ex, ey, ez - are exponent coeficients moment for 3D is defined as Sum((x -x')^ex * (y-y')^ey * (z-z')^ez * img3D(x,y,z)) for all x,y,z values combinations, x',y',z' denotes x,y,z center coordinates Suitable for 2D objects.

See also:
StatMomentUm.

template<class LABEL>
void i3d::Shape< LABEL >::Radius ( float &  min,
float &  max,
float &  mean 
)

minimal, maximal and mean radius. Result is in micrometers. Euclidean metric is used.

template<class LABEL>
PrincipalAxes i3d::Shape< LABEL >::GetPrincipalAxes (  ) 

computes principal axes and their values using LAPACK ssyev (single(real) - symmetric - eigen vectors) function if input image isn't isometric (i.e. in Resolution x ,y ,z aren't the same ), than resolution is taken into account and statistical moments and eigen axes/values are computed in micrometers.

template<class LABEL>
void i3d::Shape< LABEL >::Elongation2d ( float &  elongation  ) 

Elongation, defined as ratio of eigenvalues, for 2D objects. Elongation is in range <1,inf), the higher is the value the more elongated is the shape.

template<class LABEL>
void i3d::Shape< LABEL >::Elongation3d ( float &  majorElongation,
float &  minorElongation 
)

Elongation, defined as ratio of eigenvalues, for 3D objects. Both majorElongation and minorElongation values are in range <1,inf). Some typical shape values:

  • major == 1, minor == 1 : ball shape
  • major >> 1, minor == 1 : pole shape
  • major == 1, minor >> 1 : disc shape
  • major >> 1, minor >> 1 : generic shape

template<class LABEL>
void i3d::Shape< LABEL >::Elongation ( float &  majorElongation,
float &  minorElongation 
)

2D/3D Elongation. Deprecated function, for 2D returns minorElongation=infinity. Please use Elongation2d or Elongation3d.

template<class LABEL>
float i3d::Shape< LABEL >::Symmetry ( Vector3d< float >  normVect,
Vector3d< size_t >  center,
char  symType 
)

2D/3D Symmetry with respect to given plane or ray.

Parameters:
normVect 
  • normal vector in case of plane symmetry
  • direction vector in case of ray symmetry
center point in plane or ray.
symType 
  • 'P' ... symmetry with respect to plane given by normal vector and one point ( center )
  • 'R' ... symmetry with respect to ray given by it's direction vector nad one point ( center )

symmetry is defined as ratio Sym / ( Sym + 2*Asym), where

  • Sym .... sum of voxels having their symmetric mirrors in object
  • Asym ... sum of voxels without their symmetric mirrors in object

Symmetry is in range (0,1>, 1 means full symmetry.

template<class LABEL>
void i3d::Shape< LABEL >::PrincipalSymmetry ( float &  sym1,
float &  sym2,
float &  sym3 
)

2D/3D Symmetry with respect to principal planes (those are defined by principal axes as normal vectors and center) sym1 is defined by axe1 etc. All values are from range (0,1>. Symmetric objects has higher values. For 2D objects sym3 is always 1.

See also:
Symmetry.

template<class LABEL>
float i3d::Shape< LABEL >::Rectangularity (  ) 

Rectangularity is based on recognizing MEP (minimum enclosing prism), MEP can be defined as minimal prism containing whole object, having edges perpendicular with object main axes. Rectangularity is in range (0,1>. Rectangles has value 1.

template<class LABEL>
float i3d::Shape< LABEL >::LPEnergy2d ( unsigned  koefNumber  ) 

energy of first koeficients obtained by Fast Fourier Transform, it means that only low frequencies are assumed.

Parameters:
koefNumber number of coefficients taken into account (usually something about ten coefficients are important)

template<class LABEL>
void i3d::Shape< LABEL >::NFDs2d ( float &  FF,
float &  NEnergy 
)

Normalized Fourier Descriptors : FF and Normalized Energy. These are object size independent.


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