Go to the documentation of this file.
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;
143 AbstractParameters* clone() const;
159 bool isInitialized() const;
236 const bool unitVectors,
246 template<
typename MatrixElementT >
254 if( ! output.
reset( nRows,nCols ) )
257 const unsigned int lastRowIdx = nRows - 1;
258 const unsigned int lastColIdx = nCols - 1;
259 unsigned int row = 0;
260 unsigned int col = 0;
261 unsigned int nextRow = 0;
262 unsigned int nextCol = 0;
263 unsigned int prevRow = 0;
264 unsigned int prevCol = 0;
266 for( row = 0 ; row < nRows ; ++row )
268 output[ row ][ 0 ] = input[ row ][ 0 ];
269 output[ row ][ lastColIdx ] = input[ row ][ lastColIdx ];
272 for( col = 0 ; col < nCols ; ++col )
274 output[ 0 ][ col ] = input[ 0 ][ col ];
275 output[ lastRowIdx ][ col ] = input[ lastRowIdx ][ col ];
278 for( row = 1 ; row < lastRowIdx ; ++row )
283 for( col = 1 ; col < lastColIdx ; ++col )
288 output[ row ][ col ] =
290 input[ row ][ prevCol ]
291 + input[ row ][ nextCol ]
292 + input[ prevRow ][ prevCol ]
293 + input[ prevRow ][ col ]
294 + input[ prevRow ][ nextCol ]
295 + input[ nextRow ][ prevCol ]
296 + input[ nextRow ][ col ]
297 + input[ nextRow ][ nextCol ]
312 template<
typename MatrixElementT >
327 if( ! magnitude.
reset( nRows,nCols ) )
331 unsigned int row = 0;
332 unsigned int col = 0;
336 for( row = 0 ; row < nRows ; ++row )
338 for( col = 0 ; col < nCols ; ++col )
340 xValue = xMap[ row ][ col ];
341 yValue = yMap[ row ][ col ];
343 magnitude[ row ][ col ] = std::sqrt( ( xValue * xValue ) +
344 ( yValue * yValue ) );
374 const unsigned int vecPixelStep,
375 const std::string& tifFileName )
const;
void reset()
Reset (clear) the active instance data.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
Raster Processing algorithm output parameters base interface.
static void applyVecDiffusionThreadEntry(ApplyVecDiffusionThreadParams *paramsPtr)
Vector diffusion thread entry.
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.
te::rp::Matrix< double > const * m_inputMagBufPtr
A pointer to the input magnitude buffer.
An abstract class for raster data strucutures.
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
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.
te::rp::Matrix< double > const * m_initialXBufPtr
A pointer to the input buffer initial X component.
bool applyMeanSmooth(const te::rp::Matrix< MatrixElementT > &input, te::rp::Matrix< MatrixElementT > &output) const
Apply a mean filter.
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.
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output registered raster.
Creation of skeleton images.
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.
bool getEdgeStrengthMap(const te::rp::Matrix< double > &inputMap, te::rp::Matrix< double > &edgeStrengthMap) const
Create an Edge strenght Map from the input data.
te::rp::Matrix< double > const * m_inputBufXPtr
A pointer to the input buffer X component.
Raster Processing algorithm base interface.
boost::mutex * m_mutexPtr
A pointer to the sync mutex.
double m_diffusionRegularization
The diffusion regularization parameter.
ApplyVecDiffusionThreadParams & operator=(const ApplyVecDiffusionThreadParams &other)
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.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
unsigned int getColumnsNumber() const
The number of current matrix columns.
te::rp::Matrix< double > * m_outputBufXPtr
A pointer to the output buffer X component.
te::rp::Matrix< double > const * m_inputBufYPtr
A pointer to the input buffer Y component.
OutputParameters(const OutputParameters &)
unsigned int m_firstRowIdx
First row to process.
~ApplyVecDiffusionThreadParams()
Skeleton output parameters.
Skeleton::InputParameters m_inputParameters
Input execution parameters.
bool loadData(te::rp::Matrix< double > &rasterData) const
Load data from the input raster.
te::rp::Matrix< double > * m_outputMagBufPtr
A pointer to the output magnitude buffer.
unsigned int m_lastRowIdx
Last row to process.
This class can be used to inform the progress of a task.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
ApplyVecDiffusionThreadParams(const ApplyVecDiffusionThreadParams &other)
unsigned int getLinesNumber() const
The number of current matrix lines.
te::rp::Matrix< double > * m_outputBufYPtr
A pointer to the output buffer X component.
bool m_isInitialized
Tells if this instance is initialized.
double * m_currentIterationResiduePtr
A pointer the the current iteration residue;.
ApplyVecDiffusionThreadParams()
te::rp::Matrix< double > const * m_initialYBufPtr
A pointer to the input buffer initial Y component.