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;
137 void reset() throw(
te::rp::Exception );
143 AbstractParameters* clone() const;
151 bool execute( AlgorithmOutputParameters& outputParams ) throw(
te::rp::Exception );
154 void reset() throw(
te::rp::Exception );
159 bool isInitialized() const;
195 ApplyVecDiffusionThreadParams&
operator=(
const ApplyVecDiffusionThreadParams& other )
234 bool getGradientMaps(
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 ) );
358 bool getEdgeStrengthMap(
370 void createTifFromVecField(
374 const unsigned int vecPixelStep,
375 const std::string& tifFileName )
const;
386 bool applyVecDiffusion(
403 bool createSkeletonStrengthMap(
414 static void applyVecDiffusionThreadEntry( ApplyVecDiffusionThreadParams* paramsPtr);
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.
te::rp::Matrix< double > const * m_initialYBufPtr
A pointer to the input buffer initial Y component.
double * m_currentIterationResiduePtr
A pointer the the current iteration residue;.
Skeleton::InputParameters m_inputParameters
Input execution parameters.
Skeleton output parameters.
Base exception class for plugin module.
te::rp::Matrix< double > const * m_inputMagBufPtr
A pointer to the input magnitude buffer.
bool m_isInitialized
Tells if this instance is initialized.
This class can be used to inform the progress of a task.
Raster Processing algorithm output parameters base interface.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
double m_diffusionRegularization
The diffusion regularization parameter.
Raster Processing algorithm base interface class.
te::rp::Matrix< double > const * m_initialXBufPtr
A pointer to the input buffer initial X component.
boost::mutex * m_mutexPtr
A pointer to the sync mutex.
bool applyMeanSmooth(const te::rp::Matrix< MatrixElementT > &input, te::rp::Matrix< MatrixElementT > &output) const
Apply a mean filter.
Raster Processing algorithm base interface.
An abstract class for raster data strucutures.
unsigned int getColumnsNumber() const
The number of current matrix columns.
unsigned int m_firstRowIdx
First row to process.
te::rp::Matrix< double > const * m_inputBufXPtr
A pointer to the input buffer X component.
ApplyVecDiffusionThreadParams & operator=(const ApplyVecDiffusionThreadParams &other)
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
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.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
unsigned int m_lastRowIdx
Last row to process.
void reset()
Reset (clear) the active instance data.
Creation of skeleton images.
te::rp::Matrix< double > * m_outputMagBufPtr
A pointer to the output magnitude buffer.
~ApplyVecDiffusionThreadParams()
ApplyVecDiffusionThreadParams(const ApplyVecDiffusionThreadParams &other)
ApplyVecDiffusionThreadParams()
unsigned int getLinesNumber() const
The number of current matrix lines.
std::auto_ptr< te::rst::Raster > m_outputRasterPtr
The generated output registered raster.
te::rp::Matrix< double > * m_outputBufYPtr
A pointer to the output buffer X component.