27 #include "../Config.h" 37 #define BOOST_TEST_NO_MAIN 38 #include <boost/test/unit_test.hpp> 39 #include <boost/shared_ptr.hpp> 51 std::map<std::string, std::string> inputRasterInfo;
52 inputRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop.tif";
56 BOOST_CHECK( inputRasterPointer.get() );
60 std::map<std::string, std::string> outputRasterInfo;
61 outputRasterInfo[
"URI"] =
"terralib_unittest_rp_Segmenter_DummyStrategy_Test.tif";
84 algoOutputParams.
m_rInfo = outputRasterInfo;
85 algoOutputParams.
m_rType =
"GDAL";
91 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
92 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
103 std::map<std::string, std::string> inputRasterInfo;
104 inputRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop.tif";
108 BOOST_CHECK( inputRasterPointer.get() );
112 std::map<std::string, std::string> outputRasterInfo;
113 outputRasterInfo[
"URI"] =
"terralib_unittest_rp_Segmenter_BlockProcessingWithoutMerging_Test.tif";
136 algoOutputParams.
m_rInfo = outputRasterInfo;
137 algoOutputParams.
m_rType =
"GDAL";
143 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
144 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
155 std::map<std::string, std::string> inputRasterInfo;
156 inputRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop.tif";
160 BOOST_CHECK( inputRasterPointer.get() );
164 std::map<std::string, std::string> outputRasterInfo;
165 outputRasterInfo[
"URI"] =
"terralib_unittest_rp_Segmenter_BlockProcessingWithMerging_Test.tif";
188 algoOutputParams.
m_rInfo = outputRasterInfo;
189 algoOutputParams.
m_rType =
"GDAL";
195 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
196 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
207 std::map<std::string, std::string> inputRasterInfo;
208 inputRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop.tif";
212 BOOST_CHECK( inputRasterPointer.get() );
216 std::map<std::string, std::string> outputRasterInfo;
217 outputRasterInfo[
"URI"] =
"terralib_unittest_rp_Segmenter_ThreadedProcessing_Test.tif";
240 algoOutputParams.
m_rInfo = outputRasterInfo;
241 algoOutputParams.
m_rType =
"GDAL";
247 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
248 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
259 std::map<std::string, std::string> inputRasterInfo;
260 inputRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop.tif";
264 BOOST_CHECK( inputRasterPointer.get() );
268 std::map<std::string, std::string> outputRasterInfo;
269 outputRasterInfo[
"URI"] =
"terralib_unittest_rp_Segmenter_RegionGrowingMeanStrategy_Test.tif";
292 algoOutputParams.
m_rInfo = outputRasterInfo;
293 algoOutputParams.
m_rType =
"GDAL";
299 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
300 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
311 std::map<std::string, std::string> inputRasterInfo;
312 inputRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop.tif";
316 BOOST_CHECK( inputRasterPointer.get() );
320 std::map<std::string, std::string> outputRasterInfo;
321 outputRasterInfo[
"URI"] =
"terralib_unittest_rp_Segmenter_RegionGrowingMeanStrategyBlockProcessing_Test.tif";
344 algoOutputParams.
m_rInfo = outputRasterInfo;
345 algoOutputParams.
m_rType =
"GDAL";
351 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
352 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
363 std::map<std::string, std::string> inputRasterInfo;
364 inputRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop.tif";
368 BOOST_CHECK( inputRasterPointer.get() );
372 std::map<std::string, std::string> outputRasterInfo;
373 outputRasterInfo[
"URI"] =
"terralib_unittest_rp_Segmenter_RegionGrowingBaatzStrategy_Test.tif";
381 (
unsigned int)inputRasterPointer->getNumberOfBands(),
382 1.0 / ((double)inputRasterPointer->getNumberOfBands()) );
402 algoOutputParams.
m_rInfo = outputRasterInfo;
403 algoOutputParams.
m_rType =
"GDAL";
409 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
410 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
421 std::map<std::string, std::string> inputRasterInfo;
422 inputRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers2b_rgb342_crop.tif";
426 BOOST_CHECK( inputRasterPointer.get() );
430 std::map<std::string, std::string> outputRasterInfo;
431 outputRasterInfo[
"URI"] =
"terralib_unittest_rp_Segmenter_RegionGrowingBaatzStrategyBlockProcessing_Test.tif";
439 (
unsigned int)inputRasterPointer->getNumberOfBands(),
440 1.0 / ((double)inputRasterPointer->getNumberOfBands()) );
460 algoOutputParams.
m_rInfo = outputRasterInfo;
461 algoOutputParams.
m_rType =
"GDAL";
467 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
468 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
471 BOOST_AUTO_TEST_SUITE_END()
Segmenter Output Parameters.
double m_segmentsSimilarityThreshold
Segments similarity treshold - Use lower values to merge only those segments that are more similar - ...
std::vector< double > m_bandsWeights
The weight given to each band, when applicable (note: the bands weights sum must always be 1) or an e...
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
BOOST_AUTO_TEST_CASE(blockProcessingWithoutMerging_test)
double m_compactnessWeight
The weight given to the compactness component, deafult:0.5, valid range: [0,1].
double m_colorWeight
The weight given to the color component, deafult:0.9, valid range: [0,1].
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
unsigned int m_minSegmentSize
A positive minimum segment size (pixels number - default: 100).
BOOST_AUTO_TEST_SUITE(segmenter_tests) BOOST_AUTO_TEST_CASE(dummyStrategy_test)
This file contains include headers for the TerraLib Raster Processing module.
unsigned int m_segmentsSimIncreaseSteps
The maximum number of steps to increment the similarity threshold value for the cases where no segmen...
double m_segmentsSimilarityThreshold
Segments similarity treshold - Use lower values to merge only those segments that are more similar - ...
unsigned int m_minSegmentSize
A positive minimum segment size (pixels number - default: 100).
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
This file contains include headers for the TerraLib Common Runtime module.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
This file contains include headers for the Data Access module of TerraLib.
static Raster * open(const std::map< std::string, std::string > &rinfo, te::common::AccessPolicy p=te::common::RAccess)
It opens a raster with the given parameters and default raster driver.