TsPostClassification.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9 
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14 
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19 
20 /*!
21 \file terralib/unittest/rp/cloud_detection/TsCloudDetection.cpp
22 
23 \brief A test suit for the Cloud Detection interface.
24 */
25 
26 // TerraLib
27 #include "../Config.h"
29 #include <terralib/rp.h>
30 #include <terralib/raster.h>
31 
32 // Boost
33 #define BOOST_TEST_NO_MAIN
34 #include <boost/test/unit_test.hpp>
35 #include <boost/shared_ptr.hpp>
36 #include <boost/uuid/random_generator.hpp>
37 #include <boost/uuid/uuid_io.hpp>
38 
39 BOOST_AUTO_TEST_CASE(postClassification_test)
40 {
41  /* Openning input raster */
42 
43  std::map<std::string, std::string> rasterInfo;
44 
45  rasterInfo["URI"] = "terralib_unittest_rp_Classifier_ED_Test.tif";//TERRALIB_DATA_DIR "/geotiff/terralib_unittest_rp_Classifier_ED_Test.tif";
46  te::rst::Raster* inputRaster = te::rst::RasterFactory::open(rasterInfo);
47 
48  /* Create output raster info */
49 
50  std::map<std::string, std::string> outputInfo;
51  outputInfo["URI"] = TERRALIB_DATA_DIR"/geotiff/terralib_unittest_rp_PostClassification.tif";
52 
53  /* Creating the algorithm parameters */
54 
55  te::rp::PostClassification algorithmInstance;
56 
58  algoInputParams.m_inRasterPtr = inputRaster;
59  algoInputParams.m_weight = 1;
60  algoInputParams.m_threshold = 1;
61 
63  algoOutputParams.m_rInfo = outputInfo;
64  algoOutputParams.m_rType = "GDAL";
65 
66  /* Run post classification */
67 
68  BOOST_CHECK(algorithmInstance.initialize(algoInputParams));
69  BOOST_CHECK(algorithmInstance.execute(algoOutputParams));
70 
71  delete inputRaster;
72 }
PostClassification output parameters.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Raster post classification.
unsigned int m_weight
The weight value defines the number of times the frequency of the central point has to be considered...
unsigned int m_threshold
The threshold value is the frequency value above which the central point is modified.
bool initialize(const AlgorithmInputParameters &inputParams) _NOEXCEPT_OP(false)
Initialize the algorithm instance making it ready for execution.
An abstract class for raster data strucutures.
This file contains include headers for the TerraLib Raster Processing module.
bool execute(AlgorithmOutputParameters &outputParams) _NOEXCEPT_OP(false)
Executes the algorithm using the supplied parameters.
Raster post classification.
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
te::rst::Raster const * m_inRasterPtr
Input raster.
BOOST_AUTO_TEST_CASE(postClassification_test)
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.