27 #include "../Functions.h" 28 #include "../IdlRaster.h" 35 #include <terralib/rp/SegmenterRegionGrowingStrategy.h> 54 IDL_VPTR inputArray = argv[ 0 ];
55 IDL_ENSURE_ARRAY( inputArray );
58 IDL_ENSURE_SCALAR( minSegmentSize );
61 IDL_ENSURE_SCALAR( segmentsSimilarityThreshold );
75 te::rp::SegmenterRegionGrowingStrategy::Parameters strategyParameters;
77 strategyParameters.m_minSegmentSize = minSegmentSize->value.ui;
80 strategyParameters.m_segmentsSimilarityThreshold = segmentsSimilarityThreshold->value.d;
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 gives access to values in one band (dimension) of a raster.
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::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Utility functions for the raster module.
unsigned int unsigned int nCols
This is the abstract factory for Rasters.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
segmentsSimilarityThreshold
A adaptor to an external existent raster in a idl array form.
Utility functions for dealing with strings.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
A pointer the ge generated output raster (label image).
UCHAR terralib2IdlType(const int &tlType)
Convert Terralib data types to IDL data types.