27 #include "../Functions.h"
28 #include "../IdlRaster.h"
54 IDL_VPTR inputArray = argv[ 0 ];
55 IDL_ENSURE_ARRAY( inputArray );
57 IDL_VPTR minSegmentSize = IDL_CvtUInt( 1, &argv[ 1 ] );
58 IDL_ENSURE_SCALAR( minSegmentSize );
60 IDL_VPTR segmentsSimilarityThreshold = IDL_CvtDbl( 1, &argv[ 2 ] );
61 IDL_ENSURE_SCALAR( segmentsSimilarityThreshold );
86 for(
unsigned int band = 0 ; band < nBands ; ++band )
94 algoOutputParams.
m_rType =
"MEM";
100 if( ! algorithmInstance.
initialize( algoInputParams ) )
102 IDL_Message(IDL_M_NAMED_GENERIC, IDL_MSG_LONGJMP ,
103 "Terralib segmenter initialization error" );
106 IDL_Message(IDL_M_NAMED_GENERIC, IDL_MSG_INFO,
107 "Terralib segmenter initialized" );
109 if( ! algorithmInstance.
execute( algoOutputParams ) )
111 IDL_Message(IDL_M_NAMED_GENERIC, IDL_MSG_LONGJMP,
112 "Terralib segmenter execution error" );
115 IDL_Message(IDL_M_NAMED_GENERIC, IDL_MSG_INFO,
116 "Terralib call finished" );
123 IDL_ARRAY_DIM outArrayDims;
124 outArrayDims[ 0 ] = (IDL_MEMINT)nCols;
125 outArrayDims[ 1 ] = (IDL_MEMINT)nLines;
128 if( IDL_MakeTempArray( outArrayDataType, 2, outArrayDims,
129 IDL_ARR_INI_NOP, &outArray ) == 0 )
131 IDL_Message(IDL_M_NAMED_GENERIC, IDL_MSG_LONGJMP,
132 "Output array allocation error" );
136 (
void*)outArray->value.arr->data );
138 IDL_Message(IDL_M_NAMED_GENERIC, IDL_MSG_INFO,
139 "Segmentation finished" );
IDL_VPTR RegionGrowingSegmenter(int argc, IDL_VPTR *argv, char *argk)
Raster region growing segmentation.
It describes one band (or dimension) of a raster.
Segmenter Output Parameters.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
std::size_t getNumberOfBands() const
Returns the number of bands (dimension of cells attribute values) in the raster.
std::auto_ptr< te::rst::Raster > m_outputRasterPtr
A pointer the ge generated output raster (label image).
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
unsigned int getNumberOfRows() const
Returns the raster number of rows.
Utility functions for the raster module.
It gives access to values in one band (dimension) of a raster.
unsigned int m_minSegmentSize
A positive minimum segment size (pixels number - default: 100).
double m_segmentsSimilarityThreshold
Segments similarity treshold - Use lower values to merge only those segments that are more similar - ...
A adaptor to an external existent raster in a idl array form.
Utility functions for dealing with strings.
This is the abstract factory for Rasters.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
UCHAR terralib2IdlType(const int &tlType)
Convert Terralib data types to IDL data types.
Raster region growing segmenter strategy.