27 #include "../Config.h" 32 #define BOOST_TEST_NO_MAIN 33 #include <boost/test/unit_test.hpp> 34 #include <boost/shared_ptr.hpp> 42 std::map<std::string, std::string> auxRasterInfo;
44 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
47 BOOST_CHECK( inputRasterPtrPointer.get() );
55 algoInputParams.m_inRasterPtr = inputRasterPtrPointer.get();
57 algoInputParams.m_inRasterBands.push_back( 0 );
58 algoInputParams.m_inRasterBands.push_back( 1 );
59 algoInputParams.m_inRasterBands.push_back( 2 );
61 algoInputParams.m_iterationsNumber = 4;
65 algoOutputParams.
m_rInfo[
"URI"] =
"terralib_unittest_rp_Filter_SobelFilter.tif";
66 algoOutputParams.
m_rType =
"GDAL";
72 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
73 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
81 std::map<std::string, std::string> auxRasterInfo;
83 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
86 BOOST_CHECK( inputRasterPtrPointer.get() );
94 algoInputParams.m_inRasterPtr = inputRasterPtrPointer.get();
96 algoInputParams.m_inRasterBands.push_back( 0 );
97 algoInputParams.m_inRasterBands.push_back( 1 );
98 algoInputParams.m_inRasterBands.push_back( 2 );
100 algoInputParams.m_iterationsNumber = 4;
104 algoOutputParams.
m_rInfo[
"URI"] =
"terralib_unittest_rp_Filter_RobertsFilter.tif";
105 algoOutputParams.
m_rType =
"GDAL";
111 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
112 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
119 std::map<std::string, std::string> auxRasterInfo;
121 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
124 BOOST_CHECK( inputRasterPtrPointer.get() );
132 algoInputParams.m_inRasterPtr = inputRasterPtrPointer.get();
134 algoInputParams.m_inRasterBands.push_back( 0 );
135 algoInputParams.m_inRasterBands.push_back( 1 );
136 algoInputParams.m_inRasterBands.push_back( 2 );
138 algoInputParams.m_iterationsNumber = 4;
142 algoOutputParams.
m_rInfo[
"URI"] =
"terralib_unittest_rp_Filter_MeanFilter.tif";
143 algoOutputParams.
m_rType =
"GDAL";
149 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
150 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
158 std::map<std::string, std::string> auxRasterInfo;
160 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
163 BOOST_CHECK( inputRasterPtrPointer.get() );
171 algoInputParams.m_inRasterPtr = inputRasterPtrPointer.get();
173 algoInputParams.m_inRasterBands.push_back( 0 );
174 algoInputParams.m_inRasterBands.push_back( 1 );
175 algoInputParams.m_inRasterBands.push_back( 2 );
177 algoInputParams.m_iterationsNumber = 4;
181 algoOutputParams.
m_rInfo[
"URI"] =
"terralib_unittest_rp_Filter_ModeFilter.tif";
182 algoOutputParams.
m_rType =
"GDAL";
188 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
189 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
196 std::map<std::string, std::string> auxRasterInfo;
198 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
201 BOOST_CHECK( inputRasterPtrPointer.get() );
209 algoInputParams.m_inRasterPtr = inputRasterPtrPointer.get();
211 algoInputParams.m_inRasterBands.push_back( 0 );
212 algoInputParams.m_inRasterBands.push_back( 1 );
213 algoInputParams.m_inRasterBands.push_back( 2 );
215 algoInputParams.m_iterationsNumber = 4;
219 algoOutputParams.
m_rInfo[
"URI"] =
"terralib_unittest_rp_Filter_MedianFilter.tif";
220 algoOutputParams.
m_rType =
"GDAL";
226 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
227 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
234 std::map<std::string, std::string> auxRasterInfo;
236 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
239 BOOST_CHECK( inputRasterPtrPointer.get() );
247 algoInputParams.m_inRasterPtr = inputRasterPtrPointer.get();
249 algoInputParams.m_inRasterBands.push_back( 0 );
250 algoInputParams.m_inRasterBands.push_back( 1 );
251 algoInputParams.m_inRasterBands.push_back( 2 );
253 algoInputParams.m_iterationsNumber = 4;
255 algoInputParams.m_window = boost::numeric::ublas::matrix<double>( 3, 3, 1.0 );
259 algoOutputParams.
m_rInfo[
"URI"] =
"terralib_unittest_rp_Filter_DilationFilter.tif";
260 algoOutputParams.m_rType =
"GDAL";
266 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
267 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
274 std::map<std::string, std::string> auxRasterInfo;
276 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
279 BOOST_CHECK( inputRasterPtrPointer.get() );
287 algoInputParams.m_inRasterPtr = inputRasterPtrPointer.get();
289 algoInputParams.m_inRasterBands.push_back( 0 );
290 algoInputParams.m_inRasterBands.push_back( 1 );
291 algoInputParams.m_inRasterBands.push_back( 2 );
293 algoInputParams.m_iterationsNumber = 4;
295 algoInputParams.m_window = boost::numeric::ublas::matrix<double>( 3, 3, 1.0 );
299 algoOutputParams.
m_rInfo[
"URI"] =
"terralib_unittest_rp_Filter_ErosionFilter.tif";
300 algoOutputParams.m_rType =
"GDAL";
306 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
307 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
314 std::map<std::string, std::string> auxRasterInfo;
316 auxRasterInfo[
"URI"] = TERRALIB_DATA_DIR
"/geotiff/cbers_rgb342_crop1.tif";
319 BOOST_CHECK( inputRasterPtrPointer.get() );
323 boost::numeric::ublas::matrix<double> window(3, 3);
350 algoOutputParams.
m_rInfo[
"URI"] =
"terralib_unittest_rp_Filter_UserDefinedWindow.tif";
351 algoOutputParams.
m_rType =
"GDAL";
357 BOOST_CHECK( algorithmInstance.
initialize( algoInputParams ) );
358 BOOST_CHECK( algorithmInstance.
execute( algoOutputParams ) );
361 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(filter_tests) BOOST_AUTO_TEST_CASE(sobelFilter_test)
bool execute(AlgorithmOutputParameters &outputParams) _NOEXCEPT_OP(false)
Executes the algorithm using the supplied parameters.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
BOOST_AUTO_TEST_CASE(robertsFilter_test)
This file contains include headers for the TerraLib Raster Processing module.
A series of well-known filtering algorithms for images, linear and non-linear..
bool initialize(const AlgorithmInputParameters &inputParams) _NOEXCEPT_OP(false)
Initialize the algorithm instance making it ready for execution.
Filter output parameters.
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.