iRoCS Toolbox  1.1.0
Data Structures | Typedefs | Functions
segmentation Namespace Reference

Data Structures

class  _KMeans
 
class  LabellingError
 
class  MahalanobisDistance
 
class  NormalPDF
 Encapsulates a normal pdf. More...
 
class  ProfileFilter
 
class  ProfileSampler
 
class  SegmentationModel
 

Typedefs

typedef blitz::Array< std::complex< double >, 1 > FrequencyArray
 
typedef std::vector< FrequencyArray * > FrequencyVecArray
 
typedef blitz::Array< std::complex< double >, 2 > SpatialArray
 
typedef std::vector< SpatialArray * > SpatialVecArray
 

Functions

template<class DataT >
blitz::Array< DataT, 3 > _calculateGradients (blitz::Array< DataT, 3 > const &data, blitz::TinyVector< double, 3 > const &elSize, int direction, double scaling, iRoCS::ProgressReporter *progress)
 
template<typename T >
std::vector< blitz::Array< T, 2 > > collectSelectedClusterProfiles (const blitz::Array< T, 2 > &profiles, const std::vector< ptrdiff_t > &labels, const std::set< ptrdiff_t > &selected_clusters)
 Builds a vector of blitz Arrays (profiles) for selected clusters each element of the vector corresponds to the profiles of a selected cluster. More...
 
template<class DataT >
void edgeFilter (blitz::Array< DataT, 3 > const &data, blitz::TinyVector< double, 3 > const &elSize, blitz::Array< DataT, 3 > &result, blitz::TinyVector< double, 3 > const &lbUm=0.0, blitz::TinyVector< double, 3 > const &ubUm=(std::numeric_limits< double >::infinity()), iRoCS::ProgressReporter *progress=NULL)
 calculate gradient magnitude with non-maximum-supression More...
 
std::complex< double > evaluateSH (FrequencyArray const &coeffs, double theta, double phi)
 
void generateMask (FrequencyArray const &coeffs, blitz::Array< bool, 3 > &mask, blitz::TinyVector< double, 3 > const &elementSizeUm, blitz::TinyVector< double, 3 > const &centerUm)
 Generate a binary mask being true inside the spherical function and false outside. More...
 
void geodesic_sh (blitz::Array< blitz::TinyVector< float, 3 >, 3 > const &gvf, blitz::TinyVector< float, 3 > const &elementSizeUm, FrequencyArray &coeffs, blitz::TinyVector< float, 3 > positionUm, float radiusUm, int bw, double roundness, int num_iter, iRoCS::ProgressReporter *progress=NULL)
 Geodesic Active contours. More...
 
void geodesic_sh (blitz::Array< blitz::TinyVector< float, 3 >, 3 > const &gvf, blitz::TinyVector< float, 3 > const &el_size_um, blitz::TinyVector< float, 3 > best_center, float best_radius, int bandwidth, double roundness, int num_iter, blitz::Array< bool, 3 > &mask, blitz::Array< blitz::TinyVector< float, 3 >, 3 > &normals, iRoCS::ProgressReporter *progress=NULL)
 Geodesic Active contours. More...
 
template<typename DataT >
void geodesicSH (blitz::Array< blitz::TinyVector< DataT, 3 >, 3 > const &edgeForce, blitz::TinyVector< double, 3 > const &elementSizeUm, FrequencyArray &coeffs, blitz::TinyVector< double, 3 > const &positionUm, double radiusUm, int bw, double roundness, int nIter, double tau=0.1, iRoCS::ProgressReporter *progress=NULL)
 Evolve an active contour with spherical topology represented by a scalar spherical harmonic function, describing the structure's radius. More...
 
template<typename T >
void gradientVectorFlowSOR (blitz::Array< blitz::TinyVector< T, 3 >, 3 > &gradient, blitz::TinyVector< T, 3 > const &el_size_um, T mu, T nu, int max_iter, iRoCS::ProgressReporter *progress)
 Solve Euler-Lagrange equation for gradient vector flow using successive over-relaxation

\[ 0 = \mu \Delta u_i - \|\nabla f\|^2 ( u_i - \frac{\partial f}{\partial i} ) \]

u : output gradient vector flow f : input vector field. More...

 
blitz::TinyVector< double, 2 > indexToAngles (blitz::TinyVector< ptrdiff_t, 2 > const &index, int bw)
 
double indexToPhi (ptrdiff_t index, int bw)
 
double indexToTheta (ptrdiff_t index, int bw)
 
template<class DataT , int Dim>
double kmeans (const unsigned int k, const blitz::Array< DataT, 2 > &points, blitz::Array< DataT, 2 > &means, std::vector< int > &labels)
 
template<class DataT >
double kmeans (const unsigned int k, const blitz::Array< DataT, 2 > &points, blitz::Array< DataT, 2 > &means, std::vector< int > &labels)
 
ptrdiff_t linearIndex (int bw, int l, int m)
 
template<typename T >
void msGradientVectorFlow (blitz::Array< blitz::TinyVector< T, 3 >, 3 > &gradient, blitz::TinyVector< T, 3 > const &el_size_um, T mu, T hs, T hr, int max_iter, iRoCS::ProgressReporter *progress)
 
ptrdiff_t phiToIndex (double phi, int bw)
 
template<typename DataT , int Dim>
void radialProjection (blitz::Array< blitz::TinyVector< DataT, Dim >, Dim > const &field, blitz::TinyVector< double, Dim > const &elementSizeUm, blitz::TinyVector< double, Dim > const &centerUm, blitz::Array< DataT, Dim > &result)
 Project the elements of the given vector field to rays originating from the given center point. More...
 
void SH_curvature (double const *cx, double *curvature, int bw)
 
void SH_curvature (double const *cx, double const *cy, double const *cz, double *curvature, int bw)
 
void SH_curvature_gaussian (double const *cx, double const *cy, double const *cz, double *curvature, int bw)
 
void SH_curvature_hesse (double const *cx, double const *cy, double const *cz, double *curvature, int bw)
 
void SH_dpsi (double const *c, int bw, double *d_psi)
 
void SH_dtheta (FrequencyArray const &c, SpatialArray &d_theta, int degree)
 
void SH_dtheta (double const *c, int bw, double *d_theta, int degree=1)
 
void SH_dtheta_up (double const *c, int bw, double *d_theta)
 
void SH_normal (double const *cx, double const *cy, double const *cz, double *nx, double *ny, double *nz, int bw)
 
void SH_normal (double const *cx, double *nx, double *ny, double *nz, int bw)
 
float SH_volume (double const *cx, int bw)
 
ptrdiff_t thetaToIndex (double theta, int bw)
 

Typedef Documentation

◆ SpatialArray

typedef blitz::Array<std::complex<double>,2> segmentation::SpatialArray

Definition at line 37 of file SH_tools.hh.

◆ FrequencyArray

typedef blitz::Array<std::complex<double>,1> segmentation::FrequencyArray

Definition at line 38 of file SH_tools.hh.

◆ SpatialVecArray

Definition at line 39 of file SH_tools.hh.

◆ FrequencyVecArray

Definition at line 40 of file SH_tools.hh.

Function Documentation

◆ edgeFilter()

template<class DataT >
void segmentation::edgeFilter ( blitz::Array< DataT, 3 > const &  data,
blitz::TinyVector< double, 3 > const &  elSize,
blitz::Array< DataT, 3 > &  result,
blitz::TinyVector< double, 3 > const &  lbUm = 0.0,
blitz::TinyVector< double, 3 > const &  ubUm = (std::numeric_limits< double >::infinity()),
iRoCS::ProgressReporter progress = NULL 
)

calculate gradient magnitude with non-maximum-supression

Parameters
datainput dataset
elSizesampling size in micrometers
resultgradient magnitude with non-maximum supression

Definition at line 41 of file EdgeFilter-inl.hh.

◆ _calculateGradients()

template<class DataT >
blitz::Array< DataT, 3 > segmentation::_calculateGradients ( blitz::Array< DataT, 3 > const &  data,
blitz::TinyVector< double, 3 > const &  elSize,
int  direction,
double  scaling,
iRoCS::ProgressReporter progress 
)

Definition at line 138 of file EdgeFilter-inl.hh.

◆ radialProjection()

template<typename DataT , int Dim>
void segmentation::radialProjection ( blitz::Array< blitz::TinyVector< DataT, Dim >, Dim > const &  field,
blitz::TinyVector< double, Dim > const &  elementSizeUm,
blitz::TinyVector< double, Dim > const &  centerUm,
blitz::Array< DataT, Dim > &  result 
)

Project the elements of the given vector field to rays originating from the given center point.

Parameters
fieldThe vector field to project
elementSizeUmThe element size in micrometers
resultThe Array to store the projection of the vectors
centerUmThe point the rays originate from

◆ geodesicSH()

template<typename DataT >
void segmentation::geodesicSH ( blitz::Array< blitz::TinyVector< DataT, 3 >, 3 > const &  edgeForce,
blitz::TinyVector< double, 3 > const &  elementSizeUm,
FrequencyArray coeffs,
blitz::TinyVector< double, 3 > const &  positionUm,
double  radiusUm,
int  bw,
double  roundness,
int  nIter,
double  tau = 0.1,
iRoCS::ProgressReporter progress = NULL 
)

Evolve an active contour with spherical topology represented by a scalar spherical harmonic function, describing the structure's radius.

Parameters
edgeForceThe force field guiding the contour in the data term
elementSizeUmThe element size of the used Arrays in micrometers
coeffsAfter evolution the final spherical harmonic coefficients will be written to the coeffs array
positionUmThe center position of the initial sphere
radiusUmThe radius of the initial sphere
bwThe bandwidth up to which the spherical harmonics will be computed
roundnessThe weight for the roundness term. This is a value greater zero. The higher the value the worse curvature deviations from a sphere are penalized. The usual parameter range is between zero and one.
nIterThe maximum number of iterations to apply
tauThe update step width. 0.1 is stable and should not be increased. If you experience oscillations you can try to decrease this value on the expense of slower convergence
progressIf you want to get feedback about the progress of the evolution you can attach an iRoCS::ProgressReporter. The fraction of current iteration over all iterations will be reported based on the progress reporter's task min and max progress. This is a worst case estimate. Usually the contour will converge to the solution and immediately return before nIter is reached.

◆ generateMask()

void segmentation::generateMask ( FrequencyArray const &  coeffs,
blitz::Array< bool, 3 > &  mask,
blitz::TinyVector< double, 3 > const &  elementSizeUm,
blitz::TinyVector< double, 3 > const &  centerUm 
)

Generate a binary mask being true inside the spherical function and false outside.

The spherical function will be centered at the given center point. The mask Array has to be given in the appropriate shape.

Parameters
coeffsThe SH coefficients describing the surface of the object in spherical topology.
maskThe binary Array, the mask will be written to
elementSizeUmThe element size of the mask in micrometers
centerUmThe center of the object to generate a mask from

◆ geodesic_sh() [1/2]

void segmentation::geodesic_sh ( blitz::Array< blitz::TinyVector< float, 3 >, 3 > const &  gvf,
blitz::TinyVector< float, 3 > const &  elementSizeUm,
FrequencyArray coeffs,
blitz::TinyVector< float, 3 >  positionUm,
float  radiusUm,
int  bw,
double  roundness,
int  num_iter,
iRoCS::ProgressReporter progress = NULL 
)

Geodesic Active contours.

Parameters
gvfa gradient vector flow field
elementSizeUmelement size in um
coeffsThe SH coefficients describing the evolved surface
positionUmcenter of sphere used for initialization (in um)
radiusUmradius of wphere used for initialization (in um)
bwcutoff bandwidth
num_iternumber of gradient descent iterations

◆ geodesic_sh() [2/2]

void segmentation::geodesic_sh ( blitz::Array< blitz::TinyVector< float, 3 >, 3 > const &  gvf,
blitz::TinyVector< float, 3 > const &  el_size_um,
blitz::TinyVector< float, 3 >  best_center,
float  best_radius,
int  bandwidth,
double  roundness,
int  num_iter,
blitz::Array< bool, 3 > &  mask,
blitz::Array< blitz::TinyVector< float, 3 >, 3 > &  normals,
iRoCS::ProgressReporter progress = NULL 
)

Geodesic Active contours.

Parameters
gvfa gradient vector flow field
el_size_umelement size in um
best_centercenter of sphere used for initialization (in um)
best_radiusradius of wphere used for initialization (in um)
bandwidthcutoff bandwidth
num_iternumber of gradient descent iterations
maskoutput mask
normalnormals of mask

◆ gradientVectorFlowSOR()

template<typename T >
void segmentation::gradientVectorFlowSOR ( blitz::Array< blitz::TinyVector< T, 3 >, 3 > &  gradient,
blitz::TinyVector< T, 3 > const &  el_size_um,
mu,
nu,
int  max_iter,
iRoCS::ProgressReporter progress 
)

Solve Euler-Lagrange equation for gradient vector flow using successive over-relaxation

\[ 0 = \mu \Delta u_i - \|\nabla f\|^2 ( u_i - \frac{\partial f}{\partial i} ) \]

u : output gradient vector flow f : input vector field.

Definition at line 51 of file gvf-inl.hh.

◆ msGradientVectorFlow()

template<typename T >
void segmentation::msGradientVectorFlow ( blitz::Array< blitz::TinyVector< T, 3 >, 3 > &  gradient,
blitz::TinyVector< T, 3 > const &  el_size_um,
mu,
hs,
hr,
int  max_iter,
iRoCS::ProgressReporter progress 
)

Definition at line 147 of file gvf-inl.hh.

◆ collectSelectedClusterProfiles()

template<typename T >
std::vector<blitz::Array<T, 2> > segmentation::collectSelectedClusterProfiles ( const blitz::Array< T, 2 > &  profiles,
const std::vector< ptrdiff_t > &  labels,
const std::set< ptrdiff_t > &  selected_clusters 
)

Builds a vector of blitz Arrays (profiles) for selected clusters each element of the vector corresponds to the profiles of a selected cluster.

Parameters
profilesall profiles, as returned by ProfileSampler. Rows in the Array correspond to indiviual profiles
labelsa vector which associated a label [0, size() -1] to each profile
selected_clustersonly labels in this set are processed

Definition at line 52 of file helpers-inl.hh.

◆ kmeans() [1/2]

template<class DataT >
double segmentation::kmeans ( const unsigned int  k,
const blitz::Array< DataT, 2 > &  points,
blitz::Array< DataT, 2 > &  means,
std::vector< int > &  labels 
)

Definition at line 216 of file kmeans-inl.hh.

Referenced by kmeans().

◆ kmeans() [2/2]

template<class DataT , int Dim>
double segmentation::kmeans ( const unsigned int  k,
const blitz::Array< DataT, 2 > &  points,
blitz::Array< DataT, 2 > &  means,
std::vector< int > &  labels 
)

Definition at line 216 of file kmeans-inl.hh.

Referenced by kmeans().

◆ evaluateSH()

std::complex<double> segmentation::evaluateSH ( FrequencyArray const &  coeffs,
double  theta,
double  phi 
)

◆ thetaToIndex()

ptrdiff_t segmentation::thetaToIndex ( double  theta,
int  bw 
)

◆ phiToIndex()

ptrdiff_t segmentation::phiToIndex ( double  phi,
int  bw 
)

◆ indexToTheta()

double segmentation::indexToTheta ( ptrdiff_t  index,
int  bw 
)

◆ indexToPhi()

double segmentation::indexToPhi ( ptrdiff_t  index,
int  bw 
)

◆ indexToAngles()

blitz::TinyVector<double,2> segmentation::indexToAngles ( blitz::TinyVector< ptrdiff_t, 2 > const &  index,
int  bw 
)

◆ linearIndex()

ptrdiff_t segmentation::linearIndex ( int  bw,
int  l,
int  m 
)

◆ SH_dtheta_up()

void segmentation::SH_dtheta_up ( double const *  c,
int  bw,
double *  d_theta 
)

◆ SH_dtheta() [1/2]

void segmentation::SH_dtheta ( FrequencyArray const &  c,
SpatialArray d_theta,
int  degree 
)

◆ SH_dtheta() [2/2]

void segmentation::SH_dtheta ( double const *  c,
int  bw,
double *  d_theta,
int  degree = 1 
)

◆ SH_dpsi()

void segmentation::SH_dpsi ( double const *  c,
int  bw,
double *  d_psi 
)

◆ SH_normal() [1/2]

void segmentation::SH_normal ( double const *  cx,
double const *  cy,
double const *  cz,
double *  nx,
double *  ny,
double *  nz,
int  bw 
)

◆ SH_normal() [2/2]

void segmentation::SH_normal ( double const *  cx,
double *  nx,
double *  ny,
double *  nz,
int  bw 
)

◆ SH_curvature() [1/2]

void segmentation::SH_curvature ( double const *  cx,
double *  curvature,
int  bw 
)

◆ SH_volume()

float segmentation::SH_volume ( double const *  cx,
int  bw 
)

◆ SH_curvature() [2/2]

void segmentation::SH_curvature ( double const *  cx,
double const *  cy,
double const *  cz,
double *  curvature,
int  bw 
)

◆ SH_curvature_gaussian()

void segmentation::SH_curvature_gaussian ( double const *  cx,
double const *  cy,
double const *  cz,
double *  curvature,
int  bw 
)

◆ SH_curvature_hesse()

void segmentation::SH_curvature_hesse ( double const *  cx,
double const *  cy,
double const *  cz,
double *  curvature,
int  bw 
)