25#ifndef __TERRALIB_RP_INTERNAL_SKELETON_H
26#define __TERRALIB_RP_INTERNAL_SKELETON_H
30#include "../raster/Raster.h"
31#include "../raster/BandProperty.h"
32#include "../raster/RasterFactory.h"
33#include "../raster/Grid.h"
34#include "../common/progress/TaskProgress.h"
36#include <boost/thread.hpp>
113 AbstractParameters* clone() const;
146 AbstractParameters* clone() const;
162 bool isInitialized() const;
239 const bool unitVectors,
249 template<
typename MatrixElementT >
257 if( ! output.
reset( nRows,nCols ) )
260 const unsigned int lastRowIdx = nRows - 1;
261 const unsigned int lastColIdx = nCols - 1;
262 unsigned int row = 0;
263 unsigned int col = 0;
264 unsigned int nextRow = 0;
265 unsigned int nextCol = 0;
266 unsigned int prevRow = 0;
267 unsigned int prevCol = 0;
269 for( row = 0 ; row < nRows ; ++row )
271 output[ row ][ 0 ] = input[ row ][ 0 ];
272 output[ row ][ lastColIdx ] = input[ row ][ lastColIdx ];
275 for( col = 0 ; col < nCols ; ++col )
277 output[ 0 ][ col ] = input[ 0 ][ col ];
278 output[ lastRowIdx ][ col ] = input[ lastRowIdx ][ col ];
281 for( row = 1 ; row < lastRowIdx ; ++row )
286 for( col = 1 ; col < lastColIdx ; ++col )
291 output[ row ][ col ] =
293 input[ row ][ prevCol ]
294 + input[ row ][ nextCol ]
295 + input[ prevRow ][ prevCol ]
296 + input[ prevRow ][ col ]
297 + input[ prevRow ][ nextCol ]
298 + input[ nextRow ][ prevCol ]
299 + input[ nextRow ][ col ]
300 + input[ nextRow ][ nextCol ]
315 template<
typename MatrixElementT >
330 if( ! magnitude.
reset( nRows,nCols ) )
334 unsigned int row = 0;
335 unsigned int col = 0;
339 for( row = 0 ; row < nRows ; ++row )
341 for( col = 0 ; col < nCols ; ++col )
343 xValue = xMap[ row ][ col ];
344 yValue = yMap[ row ][ col ];
346 magnitude[ row ][ col ] = std::sqrt( ( xValue * xValue ) +
347 ( yValue * yValue ) );
377 const unsigned int vecPixelStep,
378 const std::string& tifFileName )
const;
This class can be used to inform the progress of a task.
Raster Processing algorithm output parameters base interface.
Raster Processing algorithm base interface.
unsigned int getLinesNumber() const
The number of current matrix lines.
unsigned int getColumnsNumber() const
The number of current matrix columns.
void reset()
Reset (clear) the active instance data.
te::rp::Matrix< double > * m_outputMagBufPtr
A pointer to the output magnitude buffer.
ApplyVecDiffusionThreadParams & operator=(const ApplyVecDiffusionThreadParams &other)
~ApplyVecDiffusionThreadParams()
unsigned int m_lastRowIdx
Last row to process.
te::rp::Matrix< double > const * m_initialXBufPtr
A pointer to the input buffer initial X component.
unsigned int m_firstRowIdx
First row to process.
te::rp::Matrix< double > const * m_inputBufXPtr
A pointer to the input buffer X component.
ApplyVecDiffusionThreadParams()
boost::mutex * m_mutexPtr
A pointer to the sync mutex.
te::rp::Matrix< double > const * m_inputBufYPtr
A pointer to the input buffer Y component.
double m_diffusionRegularization
The diffusion regularization parameter.
ApplyVecDiffusionThreadParams(const ApplyVecDiffusionThreadParams &other)
te::rp::Matrix< double > * m_outputBufYPtr
A pointer to the output buffer X component.
te::rp::Matrix< double > * m_outputBufXPtr
A pointer to the output buffer X component.
te::rp::Matrix< double > const * m_initialYBufPtr
A pointer to the input buffer initial Y component.
te::rp::Matrix< double > const * m_inputMagBufPtr
A pointer to the input magnitude buffer.
double * m_currentIterationResiduePtr
A pointer the the current iteration residue;.
Skeleton output parameters.
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output registered raster.
OutputParameters(const OutputParameters &)
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Creation of skeleton images.
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.
bool applyMeanSmooth(const te::rp::Matrix< MatrixElementT > &input, te::rp::Matrix< MatrixElementT > &output) const
Apply a mean filter.
bool loadData(te::rp::Matrix< double > &rasterData) const
Load data from the input raster.
bool m_isInitialized
Tells if this instance is initialized.
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.
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.
bool getEdgeStrengthMap(const te::rp::Matrix< double > &inputMap, te::rp::Matrix< double > &edgeStrengthMap) const
Create an Edge strenght Map from the input data.
static void applyVecDiffusionThreadEntry(ApplyVecDiffusionThreadParams *paramsPtr)
Vector diffusion thread entry.
Skeleton::InputParameters m_inputParameters
Input execution parameters.
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.
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.
An abstract class for raster data strucutures.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.