Creation of skeleton images. More...
#include <Skeleton.h>
Classes | |
class | ApplyVecDiffusionThreadParams |
class | InputParameters |
Skeleton input parameters. More... | |
class | OutputParameters |
Skeleton output parameters. More... | |
Public Member Functions | |
bool | execute (AlgorithmOutputParameters &outputParams) throw ( te::rp::Exception ) |
Executes the algorithm using the supplied parameters. More... | |
bool | initialize (const AlgorithmInputParameters &inputParams) throw ( te::rp::Exception ) |
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 () throw ( te::rp::Exception ) |
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 backgroundDataPtr, 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... | |
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... | |
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.
Definition at line 70 of file Skeleton.h.
te::rp::Skeleton::Skeleton | ( | ) |
Definition at line 155 of file Skeleton.cpp.
References reset().
te::rp::Skeleton::~Skeleton | ( | ) |
Definition at line 160 of file Skeleton.cpp.
|
inlineprotected |
Apply a mean filter.
input | The input data. |
output | The output data. |
Definition at line 247 of file Skeleton.h.
References te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), and te::rp::Matrix< TemplateElementType >::reset().
Referenced by execute().
|
protected |
Apply a vector diffusion over the given vector field.
inputX | The vector decomposed X component; |
inputY | The vector decomposed Y component; |
backGroundMapPtr | An optional background image (0 means no background image). |
progressPtr | A pointer to a progress interface or an NULL pointer. |
outputX | The diffused X component. |
outputX | The diffused Y component. |
Definition at line 852 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, te::rp::Matrix< TemplateElementType >::reset(), and TERP_TRUE_OR_RETURN_FALSE.
Referenced by execute().
|
staticprotected |
Vector diffusion thread entry.
paramsPtr | A pointer to the thread parameters. |
Definition at line 1096 of file Skeleton.cpp.
References DIFFUSENEIGHBOR, te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_currentIterationResiduePtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_diffusionRegularization, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_firstRowIdx, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_inputBufXPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_inputBufYPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_inputMagBufPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_lastRowIdx, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_mutexPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_outputBufXPtr, te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_outputBufYPtr, and te::rp::Skeleton::ApplyVecDiffusionThreadParams::m_outputMagBufPtr.
Referenced by applyVecDiffusion().
|
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.
inputX | The vector decomposed X component; |
inputY | The vector decomposed Y component; |
edgeStrengthMap | The edge strength map (values between 0 and 1). |
skelSMap | The skeleton map (values between 0 and 1). |
Definition at line 1378 of file Skeleton.cpp.
References te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), te::rp::Matrix< TemplateElementType >::reset(), SKELSTRENGTHNEIGHBOR, and TERP_TRUE_OR_RETURN_FALSE.
Referenced by execute().
|
protected |
Create a tiff file from a vector field.
inputVecFieldX | The vector decomposed X component; |
inputVecFieldY | The vector decomposed Y component; |
backGroundMapPtr | An optional background image (0 means no background image). |
vecPixelStep | The step between each vector. |
tifFileName | Tif file name. |
Definition at line 706 of file Skeleton.cpp.
References te::rst::BlueCInt, te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), te::rst::GreenCInt, te::sa::Grid, te::rst::RasterFactory::make(), te::rst::RedCInt, TERP_TRUE_OR_THROW, and te::dt::UCHAR_TYPE.
|
virtual |
Executes the algorithm using the supplied parameters.
outputParams | Output parameters. |
Implements te::rp::Algorithm.
Definition at line 164 of file Skeleton.cpp.
References applyMeanSmooth(), applyVecDiffusion(), te::rp::Matrix< TemplateElementType >::clear(), createSkeletonStrengthMap(), te::rst::Raster::getBand(), getEdgeStrengthMap(), getGradientMaps(), te::rst::Raster::getGrid(), te::rst::Band::getProperty(), te::rst::GrayIdxCInt, loadData(), te::rp::Skeleton::InputParameters::m_enableProgress, m_inputParameters, te::rp::Skeleton::InputParameters::m_inputRasterBand, te::rp::Skeleton::InputParameters::m_inputRasterPtr, m_isInitialized, te::rp::Skeleton::OutputParameters::m_outputRasterPtr, te::rp::Skeleton::OutputParameters::m_rInfo, te::rp::Skeleton::OutputParameters::m_rType, te::rp::Skeleton::InputParameters::m_skeletonThreshold, te::rst::RasterFactory::make(), te::rp::Matrix< TemplateElementType >::reset(), TERP_TRUE_OR_RETURN_FALSE, TERP_TRUE_OR_THROW, and te::dt::UCHAR_TYPE.
|
protected |
Create an Edge strenght Map from the input data.
inputMap | The input map. |
edgeStrengthMap | The edge strength map (values between 0 and 1). |
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 te::rp::Matrix< TemplateElementType >::getColumnsNumber(), getGradientMaps(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), te::rp::Matrix< TemplateElementType >::reset(), and TERP_TRUE_OR_RETURN_FALSE.
Referenced by execute().
|
protected |
Create an gradient maps from the input image.
inputData | The input data. |
unitVectors | If true, unit vectors will be created. |
gradXMap | The created gradient X vectors map. |
gradYMap | The created gradient Y vectors map. |
Definition at line 478 of file Skeleton.cpp.
References te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), te::rp::Matrix< TemplateElementType >::reset(), and TERP_TRUE_OR_RETURN_FALSE.
Referenced by execute(), and getEdgeStrengthMap().
|
inlineprotected |
Generate the magnitude map from the input vectors.
xMap | The input data X component. |
yMap | The input data Y component. |
magnitude | The magnitude output data. |
Definition at line 313 of file Skeleton.h.
References te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), and te::rp::Matrix< TemplateElementType >::reset().
Referenced by applyVecDiffusion().
|
virtual |
Initialize the algorithm instance making it ready for execution.
inputParams | Input parameters. |
Implements te::rp::Algorithm.
Definition at line 370 of file Skeleton.cpp.
References te::rst::Raster::getAccessPolicy(), te::rst::Raster::getNumberOfBands(), te::rst::Raster::getNumberOfColumns(), te::rst::Raster::getNumberOfRows(), te::rp::Skeleton::InputParameters::m_diffusionRegularization, te::rp::Skeleton::InputParameters::m_diffusionThreshold, te::rp::Skeleton::InputParameters::m_inputMaskRasterPtr, m_inputParameters, te::rp::Skeleton::InputParameters::m_inputRasterBand, te::rp::Skeleton::InputParameters::m_inputRasterPtr, m_isInitialized, te::rp::Skeleton::InputParameters::m_skeletonThreshold, te::common::RAccess, reset(), TERP_TRUE_OR_RETURN_FALSE, and TERP_TRUE_OR_THROW.
|
virtual |
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.
|
protected |
Load data from the input raster.
rasterData | The loaded data buffer. |
Definition at line 441 of file Skeleton.cpp.
References te::rst::Raster::getBand(), te::rst::Raster::getNumberOfColumns(), te::rst::Raster::getNumberOfRows(), te::rst::Band::getValue(), te::rp::Skeleton::InputParameters::m_inputMaskRasterPtr, m_inputParameters, te::rp::Skeleton::InputParameters::m_inputRasterBand, te::rp::Skeleton::InputParameters::m_inputRasterPtr, and te::rp::Matrix< TemplateElementType >::reset().
Referenced by execute().
|
virtual |
Clear all internal allocated objects and reset the algorithm to its initial state.
Implements te::rp::Algorithm.
Definition at line 364 of file Skeleton.cpp.
References m_inputParameters, m_isInitialized, and te::rp::Skeleton::InputParameters::reset().
Referenced by initialize(), te::rp::Skeleton::InputParameters::InputParameters(), te::rp::Skeleton::InputParameters::operator=(), te::rp::Skeleton::OutputParameters::operator=(), te::rp::Skeleton::OutputParameters::OutputParameters(), Skeleton(), te::rp::Skeleton::InputParameters::~InputParameters(), and te::rp::Skeleton::OutputParameters::~OutputParameters().
|
protected |
Input execution parameters.
Definition at line 215 of file Skeleton.h.
Referenced by applyVecDiffusion(), execute(), initialize(), loadData(), and reset().
|
protected |
Tells if this instance is initialized.
Definition at line 217 of file Skeleton.h.
Referenced by execute(), initialize(), isInitialized(), and reset().