Creation of skeleton images. More...

#include <Skeleton.h>

Inheritance diagram for te::rp::Skeleton:
te::rp::Algorithm

Classes

class  ApplyVecDiffusionThreadParams
 
class  InputParameters
 Skeleton input parameters. More...
 
class  OutputParameters
 Skeleton output parameters. More...
 

Public Member Functions

bool execute (AlgorithmOutputParameters &outputParams) _NOEXCEPT_OP(false)
 Executes the algorithm using the supplied parameters. More...
 
const std::string & getErrorMessage () const
 Return the current error message if there is any. More...
 
bool initialize (const AlgorithmInputParameters &inputParams) _NOEXCEPT_OP(false)
 Initialize the algorithm instance making it ready for execution. More...
 
bool isInitialized () const
 Returns true if the algorithm instance is initialized and ready for execution. More...
 
void reset () _NOEXCEPT_OP(false)
 Clear all internal allocated objects and reset the algorithm to its initial state. More...
 
 Skeleton ()
 
 ~Skeleton ()
 

Protected Member Functions

template<typename MatrixElementT >
bool applyMeanSmooth (const te::rp::Matrix< MatrixElementT > &input, te::rp::Matrix< MatrixElementT > &output) const
 Apply a mean filter. More...
 
bool applyVecDiffusion (const te::rp::Matrix< double > &inputX, const te::rp::Matrix< double > &inputY, te::rp::Matrix< double > const *const, te::common::TaskProgress *progressPtr, te::rp::Matrix< double > &outputX, te::rp::Matrix< double > &outputY) const
 Apply a vector diffusion over the given vector field. More...
 
bool createSkeletonStrengthMap (const te::rp::Matrix< double > &inputX, const te::rp::Matrix< double > &inputY, const te::rp::Matrix< double > &edgeStrengthMap, te::rp::Matrix< double > &skelMap) const
 Create a skeleton strength map. More...
 
void createTifFromVecField (const te::rp::Matrix< double > &inputVecFieldX, const te::rp::Matrix< double > &inputVecFieldY, te::rp::Matrix< double > const *const backGroundMapPtr, const unsigned int vecPixelStep, const std::string &tifFileName) const
 Create a tiff file from a vector field. More...
 
bool getEdgeStrengthMap (const te::rp::Matrix< double > &inputMap, te::rp::Matrix< double > &edgeStrengthMap) const
 Create an Edge strenght Map from the input data. More...
 
bool getGradientMaps (const te::rp::Matrix< double > &inputData, const bool unitVectors, te::rp::Matrix< double > &gradXMap, te::rp::Matrix< double > &gradYMap) const
 Create an gradient maps from the input image. More...
 
template<typename MatrixElementT >
bool getMagnitude (const te::rp::Matrix< double > &xMap, const te::rp::Matrix< double > &yMap, te::rp::Matrix< MatrixElementT > &magnitude) const
 Generate the magnitude map from the input vectors. More...
 
bool loadData (te::rp::Matrix< double > &rasterData) const
 Load data from the input raster. More...
 
void setErrorMessage (const std::string &newErrorMessage)
 Set the current error message. More...
 

Static Protected Member Functions

static void applyVecDiffusionThreadEntry (ApplyVecDiffusionThreadParams *paramsPtr)
 Vector diffusion thread entry. More...
 

Protected Attributes

Skeleton::InputParameters m_inputParameters
 Input execution parameters. More...
 
bool m_isInitialized
 Tells if this instance is initialized. More...
 

Detailed Description

Creation of skeleton images.

The skeleton of a region may be defined via the media axis transformation MAT proposed by Blum [1967]. The MAT of a region R with border B is as follows: For each point p in R, we find its closest neightbor in B. If p has more than one such neighbor, it is said to belong to the medial axis (skeleton) of R.

Note
Reference: Blum, H. 1967. A transformation for extracting new descriptors of form.
Reference: Normalized Gradient Vector Diffusion and Image Segmentation, Zeyun Yu, Chandrajit Bajaj.
Reference: Image Segmentation Using Gradient Vector Diffusion and Region Merging, Zeyun Yu, Chandrajit Bajaj.
Reference: A Segmentation-Free Approach for Skeletonization of Gray-Scale Images via Anisotropic Vector Diffusion, Zeyun Yu and Chandrajit Bajaj.

Definition at line 70 of file Skeleton.h.

Constructor & Destructor Documentation

te::rp::Skeleton::Skeleton ( )

Definition at line 155 of file Skeleton.cpp.

References te::rp::Skeleton::InputParameters::reset(), and ~Skeleton().

te::rp::Skeleton::~Skeleton ( )
default

Referenced by Skeleton().

Member Function Documentation

template<typename MatrixElementT >
bool te::rp::Skeleton::applyMeanSmooth ( const te::rp::Matrix< MatrixElementT > &  input,
te::rp::Matrix< MatrixElementT > &  output 
) const
inlineprotected

Apply a mean filter.

Parameters
inputThe input data.
outputThe output data.
Returns
true if OK, false on errors.

Definition at line 247 of file Skeleton.h.

References col, te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), nCols, and te::rp::Matrix< TemplateElementType >::reset().

Referenced by execute().

bool te::rp::Skeleton::applyVecDiffusion ( const te::rp::Matrix< double > &  inputX,
const te::rp::Matrix< double > &  inputY,
te::rp::Matrix< double > const * const  ,
te::common::TaskProgress progressPtr,
te::rp::Matrix< double > &  outputX,
te::rp::Matrix< double > &  outputY 
) const
protected

Apply a vector diffusion over the given vector field.

Parameters
inputXThe vector decomposed X component;
inputYThe vector decomposed Y component;
backGroundMapPtrAn optional background image (0 means no background image).
progressPtrA pointer to a progress interface or an NULL pointer.
outputXThe diffused X component.
outputXThe diffused Y component.

Definition at line 844 of file Skeleton.cpp.

References applyVecDiffusionThreadEntry(), te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), getMagnitude(), te::common::GetPhysProcNumber(), te::common::TaskProgress::isActive(), te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_currentIterationResiduePtr, te::rp::Skeleton::InputParameters::m_diffusionMaxIterations, te::rp::Skeleton::InputParameters::m_diffusionRegularization, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_diffusionRegularization, te::rp::Skeleton::InputParameters::m_diffusionThreshold, te::rp::Skeleton::InputParameters::m_enableMultiThread, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_firstRowIdx, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_initialXBufPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_initialYBufPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_inputBufXPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_inputBufYPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_inputMagBufPtr, m_inputParameters, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_lastRowIdx, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_mutexPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_outputBufXPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_outputBufYPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_outputMagBufPtr, nCols, te::rp::Matrix< TemplateElementType >::reset(), and TERP_TRUE_OR_RETURN_FALSE.

Referenced by execute().

bool te::rp::Skeleton::createSkeletonStrengthMap ( const te::rp::Matrix< double > &  inputX,
const te::rp::Matrix< double > &  inputY,
const te::rp::Matrix< double > &  edgeStrengthMap,
te::rp::Matrix< double > &  skelMap 
) const
protected

Create a skeleton strength map.

The skeleton strength map is a scalar map defined on every pixel and indicates the likelihood of each pixel being on the skeletons.

Parameters
inputXThe vector decomposed X component;
inputYThe vector decomposed Y component;
edgeStrengthMapThe edge strength map (values between 0 and 1).
skelSMapThe skeleton map (values between 0 and 1).
Returns
true if ok, false on errors.

Definition at line 1370 of file Skeleton.cpp.

References col, te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), nCols, te::rp::Matrix< TemplateElementType >::reset(), SKELSTRENGTHNEIGHBOR, and TERP_TRUE_OR_RETURN_FALSE.

Referenced by execute().

void te::rp::Skeleton::createTifFromVecField ( const te::rp::Matrix< double > &  inputVecFieldX,
const te::rp::Matrix< double > &  inputVecFieldY,
te::rp::Matrix< double > const *const  backGroundMapPtr,
const unsigned int  vecPixelStep,
const std::string &  tifFileName 
) const
protected

Create a tiff file from a vector field.

Parameters
inputVecFieldXThe vector decomposed X component;
inputVecFieldYThe vector decomposed Y component;
backGroundMapPtrAn optional background image (0 means no background image).
vecPixelStepThe step between each vector.
tifFileNameTif file name.

Definition at line 698 of file Skeleton.cpp.

References te::rst::BlueCInt, col, te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), te::rst::GreenCInt, te::sa::Grid, line, te::rst::RasterFactory::make(), nCols, nLines, te::rst::RedCInt, TERP_TRUE_OR_THROW, and te::dt::UCHAR_TYPE.

bool te::rp::Skeleton::getEdgeStrengthMap ( const te::rp::Matrix< double > &  inputMap,
te::rp::Matrix< double > &  edgeStrengthMap 
) const
protected

Create an Edge strenght Map from the input data.

Parameters
inputMapThe input map.
edgeStrengthMapThe edge strength map (values between 0 and 1).
Returns
true if OK, false on errors.

The edge map have the property that the values are large near image boundaries and small within homogeneous regions.

Definition at line 577 of file Skeleton.cpp.

References col, te::rp::Matrix< TemplateElementType >::getColumnsNumber(), getGradientMaps(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), nCols, te::rp::Matrix< TemplateElementType >::reset(), and TERP_TRUE_OR_RETURN_FALSE.

Referenced by execute().

bool te::rp::Skeleton::getGradientMaps ( const te::rp::Matrix< double > &  inputData,
const bool  unitVectors,
te::rp::Matrix< double > &  gradXMap,
te::rp::Matrix< double > &  gradYMap 
) const
protected

Create an gradient maps from the input image.

Parameters
inputDataThe input data.
unitVectorsIf true, unit vectors will be created.
gradXMapThe created gradient X vectors map.
gradYMapThe created gradient Y vectors map.
Returns
true if OK, false on errors.

Definition at line 478 of file Skeleton.cpp.

References col, te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), nCols, te::rp::Matrix< TemplateElementType >::reset(), and TERP_TRUE_OR_RETURN_FALSE.

Referenced by execute(), and getEdgeStrengthMap().

template<typename MatrixElementT >
bool te::rp::Skeleton::getMagnitude ( const te::rp::Matrix< double > &  xMap,
const te::rp::Matrix< double > &  yMap,
te::rp::Matrix< MatrixElementT > &  magnitude 
) const
inlineprotected

Generate the magnitude map from the input vectors.

Parameters
xMapThe input data X component.
yMapThe input data Y component.
magnitudeThe magnitude output data.
Returns
true if OK, false on errors.

Definition at line 313 of file Skeleton.h.

References col, te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), nCols, and te::rp::Matrix< TemplateElementType >::reset().

Referenced by applyVecDiffusion().

bool te::rp::Skeleton::isInitialized ( ) const
virtual

Returns true if the algorithm instance is initialized and ready for execution.

Returns
true if the algorithm instance is initialized and ready for execution.

Implements te::rp::Algorithm.

Definition at line 436 of file Skeleton.cpp.

References m_isInitialized.

bool te::rp::Skeleton::loadData ( te::rp::Matrix< double > &  rasterData) const
protected
void te::rp::Skeleton::reset ( )
virtual

Clear all internal allocated objects and reset the algorithm to its initial state.

Reimplemented from te::rp::Algorithm.

Definition at line 362 of file Skeleton.cpp.

References m_inputParameters, m_isInitialized, te::rp::Algorithm::reset(), and te::rp::Skeleton::InputParameters::reset().

void te::rp::Algorithm::setErrorMessage ( const std::string &  newErrorMessage)
protectedinherited

Set the current error message.

Parameters
newErrorMessageNew error message;

Definition at line 49 of file rp/Algorithm.cpp.

References te::rp::Algorithm::m_errorMessage.

Member Data Documentation

Skeleton::InputParameters te::rp::Skeleton::m_inputParameters
protected

Input execution parameters.

Definition at line 215 of file Skeleton.h.

Referenced by applyVecDiffusion(), execute(), initialize(), loadData(), and reset().

bool te::rp::Skeleton::m_isInitialized
protected

Tells if this instance is initialized.

Definition at line 217 of file Skeleton.h.

Referenced by execute(), initialize(), isInitialized(), and reset().


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