Functions.h
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/rp/Functions.h
22  \brief Raster Processing functions.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_FUNCTIONS_H
26 #define __TERRALIB_RP_INTERNAL_FUNCTIONS_H
27 
28 #include "Config.h"
29 
30 #include "FeedersRaster.h"
31 #include "Matrix.h"
32 #include "Macros.h"
33 #include "RasterHandler.h"
34 #include "../dataaccess/datasource/DataSource.h"
35 #include "../raster/Raster.h"
36 #include "../raster/RasterFactory.h"
37 #include "../raster/Grid.h"
38 #include "../raster/BandProperty.h"
39 #include "../raster/RasterFactory.h"
40 #include "../raster/Interpolator.h"
41 #include "../raster/Utils.h"
42 #include "../srs/Converter.h"
43 #include "../geometry/LinearRing.h"
44 #include "../geometry/GTParameters.h"
45 #include "../geometry/MultiPoint.h"
46 #include "../geometry/Surface.h"
47 
48 // STL
49 #include <memory>
50 #include <map>
51 #include <vector>
52 #include <string>
53 #include <limits>
54 
55 // Boost
56 #include <boost/numeric/ublas/matrix.hpp>
57 #include <boost/shared_ptr.hpp>
58 
59 namespace te
60 {
61  namespace rst
62  {
63  class BandProperty;
64  class Grid;
65  }
66 
67  namespace rp
68  {
69  /*!
70  \brief Wavelet Atrous Filter types.
71  \ingroup rp_func
72  */
74  {
75  InvalidWAFilter, //!< Invalid filter type
76  B3SplineWAFilter, //!< Spline filter type.
77  TriangleWAFilter //!< Triangle filter type.
78  };
79 
81  {
83 
84  SpectralSensorParams(const int &band, const double &lower, const double &upper, const double &min, const double &max) :
85  m_band(band),
86  m_lower(lower),
87  m_upper(upper),
88  m_min(min),
89  m_max(max)
90  {}
91 
92  int m_band;
93  double m_lower;
94  double m_upper;
95  double m_min;
96  double m_max;
97  };
98 
99  /*!
100  \brief Create a new raster into the givem data source.
101  \param rasterGrid The template grid used to create the output raster.
102  \param bandsProperties The template band properties used to create the output raster.
103  \param outDataSetName The data set name to give to the created data set.
104  \param dataSourceType The data source type string (i.e. GDAL, MEM.)( See te::rst::RasterFactory dictionary for valid registered values ).
105  \param outRasterHandler The created raster handler.
106  \return true if OK, false on errors.
107  \note All bandsProperties pointed objects will be acquired by this function and must not be deleted.
108  \ingroup rp_func
109  */
110  bool TERPEXPORT CreateNewRaster( const te::rst::Grid& rasterGrid,
111  const std::vector< te::rst::BandProperty* >& bandsProperties,
112  const std::string& outDataSetName,
113  const std::string& dataSourceType,
114  RasterHandler& outRasterHandler );
115 
116  /*!
117  \brief Create a new raster into the givem data source.
118  \param rasterGrid The template grid used to create the output raster.
119  \param bandsProperties The template band properties used to create the output raster.
120  \param outDataSetName The data set name to give to the created data set.
121  \param outDataSource The data source to use when creating the output data set.
122  \param outRasterHandler The created raster handler.
123  \return true if OK, false on errors.
124  \note All bandsProperties pointed objects will be acquired by this function and must not be deleted.
125  \ingroup rp_func
126  */
127  bool TERPEXPORT CreateNewRaster( const te::rst::Grid& rasterGrid,
128  const std::vector< te::rst::BandProperty* >& bandsProperties,
129  const std::string& outDataSetName,
130  te::da::DataSource& outDataSource,
131  RasterHandler& outRasterHandler );
132 
133  /*!
134  \brief Create a new raster into the givem data source.
135  \param rasterGrid The template grid used to create the output raster.
136  \param bandsProperties The template band properties used to create the output raster.
137  \param rasterInfo The output raster info (specific driver info).
138  \param rasterType The output raster type (specific driver name - See te::rst::RasterFactory dictorary for more info).
139  \param outRasterPtr The created raster pointer.
140  \return true if OK, false on errors.
141  \note All bandsProperties pointed objects will be acquired by this function and must not be deleted.
142  \ingroup rp_func
143  */
144  bool TERPEXPORT CreateNewRaster( const te::rst::Grid& rasterGrid,
145  const std::vector< te::rst::BandProperty* >& bandsProperties,
146  const std::map< std::string, std::string>& rasterInfo,
147  const std::string& rasterType,
148  std::unique_ptr< te::rst::Raster >& outRasterPtr );
149 
150  /*!
151  \brief Create a new raster into a new memory datasource.
152  \param rasterGrid The template grid used to create the output raster.
153  \param bandsProperties The template band properties used to create the output raster.
154  \param outRasterHandler The created raster handler.
155  \return true if OK, false on errors.
156  \note All bandsProperties pointed objects will be acquired by this function and must not be deleted.
157  \ingroup rp_func
158  */
159  bool TERPEXPORT CreateNewMemRaster( const te::rst::Grid& rasterGrid,
160  std::vector< te::rst::BandProperty* > bandsProperties,
161  RasterHandler& outRasterHandler );
162 
163  /*!
164  \brief Create a new raster into a GDAL datasource.
165  \param rasterGrid The template grid used to create the output raster.
166  \param bandsProperties The template band properties used to create the output raster.
167  \param fileName The output tif file name.
168  \param outRasterHandler The created raster handler.
169  \return true if OK, false on errors.
170  \note All bandsProperties pointed objects will be acquired by this function and must not be deleted.
171  \ingroup rp_func
172  */
173  bool TERPEXPORT CreateNewGdalRaster( const te::rst::Grid& rasterGrid,
174  std::vector< te::rst::BandProperty* > bandsProperties,
175  const std::string& fileName,
176  RasterHandler& outRasterHandler );
177 
178  /*!
179  \brief Create a new raster into a GDAL datasource.
180  \param rasterGrid The template grid used to create the output raster.
181  \param bandsProperties The template band properties used to create the output raster.
182  \param fileName The output tif file name.
183  \param outRasterPtr The created raster pointer.
184  \return true if OK, false on errors.
185  \note All bandsProperties pointed objects will be acquired by this function and must not be deleted.
186  \ingroup rp_func
187  */
188  bool TERPEXPORT CreateNewGdalRaster( const te::rst::Grid& rasterGrid,
189  std::vector< te::rst::BandProperty* > bandsProperties,
190  const std::string& fileName,
191  std::unique_ptr< te::rst::Raster >& outRasterPtr );
192 
193  /*!
194  \brief Create a new raster into a GDAL datasource.
195  \param rasterGrid The template grid used to create the output raster.
196  \param bandsProperties The template band properties used to create the output raster.
197  \param fileName The output tif file name.
198  \param outRasterHandler The created raster handler.
199  \return true if OK, false on errors.
200  \note All bandsProperties pointed objects will be acquired by this function and must not be deleted.
201  \ingroup rp_func
202  */
204  const te::rst::Raster& inputRaster,
205  const std::string& fileName );
206 
207  /*!
208  \brief Returns the real data type range (all values that can be represented by the given data type).
209  \param dataType The data type.
210  \param min The minimum value.
211  \param max The maximum value.
212  \note The types are listed in terralib/datatype/DataTypes.h
213  \ingroup rp_func
214  */
215  inline void TERPEXPORT GetDataTypeRange( const int dataType, double& min, double& max )
216  {
217  te::rst::GetDataTypeRanges( dataType, min, max );
218  }
219 
220  /*!
221  \brief Convert vector elements.
222  \param inputVector Input vector.
223  \param inputVectorDataType Input vector data type.
224  \param inputVectorSize The numer of input vector elements.
225  \param outputVector A pré-allocated output vector.
226  \note The types are listed in terralib/datatype/DataTypes.h
227  \ingroup rp_func
228  */
229  void TERPEXPORT Convert2DoublesVector( void* inputVector, const int inputVectorDataType,
230  unsigned int inputVectorSize, double* outputVector );
231 
232  /*!
233  \brief Convert a doubles vector.
234  \param inputVector Input vector.
235  \param inputVectorSize The numer of input vector elements.
236  \param inputVectorDataType Input vector data type.
237  \param outputVector A pré-allocated output vector.
238  \note The types are listed in terralib/datatype/DataTypes.h
239  \ingroup rp_func
240  */
241  void TERPEXPORT ConvertDoublesVector( double* inputVector,
242  unsigned int inputVectorSize, const int outputVectorDataType,
243  void* outputVector );
244 
245  /*!
246  \brief Create a tiff file from a matrix.
247  \param matrix The matrix.
248  \param normalize Enable/disable pixel normalization (8bit);
249  \param tifFileName Tif file name.
250  \param return true if OK, false on errors.
251  \ingroup rp_func
252  */
253  template< typename MatrixElementT >
255  const bool normalize, const std::string& fileName )
256  {
257  std::map<std::string, std::string> rInfo;
258  rInfo["URI"] = fileName;
259 
260  std::vector<te::rst::BandProperty*> bandsProperties;
261  if( normalize )
262  bandsProperties.push_back(new te::rst::BandProperty( 0, te::dt::UCHAR_TYPE, "" ));
263  else
264  bandsProperties.push_back(new te::rst::BandProperty( 0, te::dt::DOUBLE_TYPE, "" ));
265  bandsProperties[0]->m_colorInterp = te::rst::GrayIdxCInt;
266  bandsProperties[0]->m_noDataValue = -1.0 * std::numeric_limits<double>::max();
267 
268  te::rst::Grid* newgrid = new te::rst::Grid( matrix.getColumnsNumber(),
269  matrix.getLinesNumber(), 0, -1 );
270 
271  std::unique_ptr< te::rst::Raster > outputRasterPtr(
272  te::rst::RasterFactory::make( "GDAL", newgrid, bandsProperties, rInfo, 0, 0));
273  TERP_TRUE_OR_RETURN_FALSE( outputRasterPtr.get(), "Output raster creation error");
274 
275  unsigned int line = 0;
276  unsigned int col = 0;
277  const unsigned int nLines = matrix.getLinesNumber();
278  const unsigned int nCols = matrix.getColumnsNumber();
279  MatrixElementT matrixValue = 0;
280 
281  MatrixElementT gain = 1.0;
282  MatrixElementT offset = 0.0;
283  if( normalize )
284  {
285  MatrixElementT matrixValueMin = std::numeric_limits< MatrixElementT >::max();
286  MatrixElementT matrixValueMax = -1.0 * matrixValueMin;
287  for( line = 0 ; line < nLines ; ++line )
288  {
289  for( col = 0 ; col < nCols ; ++col )
290  {
291  matrixValue = matrix[ line ][ col ];
292  if( matrixValue < matrixValueMin )
293  matrixValueMin = matrixValue;
294  if( matrixValue > matrixValueMax )
295  matrixValueMax = matrixValue;
296  }
297  }
298 
299  if( matrixValueMax == matrixValueMin )
300  {
301  gain = 0.0;
302  offset = 0.0;
303  }
304  else
305  {
306  gain = 255.0 / ( matrixValueMax - matrixValueMin );
307  offset = -1.0 * ( matrixValueMin );
308  }
309  }
310 
311  const MatrixElementT min0 = 0;
312  const MatrixElementT max255 = 255;
313 
314  for( line = 0 ; line < nLines ; ++line )
315  {
316  for( col = 0 ; col < nCols ; ++col )
317  {
318  matrixValue = matrix[ line ][ col ];
319 
320  if( normalize )
321  {
322  matrixValue += offset;
323  matrixValue *= gain;
324  matrixValue = std::max( min0, matrixValue );
325  matrixValue = std::min( max255, matrixValue );
326  }
327 
328  outputRasterPtr->setValue( col, line, static_cast<double>(matrixValue), 0 );
329  }
330  }
331 
332  return true;
333  }
334 
335  /*!
336  \brief Returns a json filename with spectral sensors parameters.
337  \ingroup rp_func
338  */
339  TERPEXPORT std::string GetSensorFilename();
340 
341  /*!
342  \brief Returns a vector os with band's names.
343  \ingroup rp_func
344  */
345  TERPEXPORT std::vector<std::string> GetBandNames();
346 
347  /*!
348  \brief Returns a map with spectral sensors parameters defined in SpectralSensor.json file.
349  \ingroup rp_func
350  */
351  TERPEXPORT std::map<std::string, SpectralSensorParams > getSensorParams();
352 
353  /*!
354  \brief Saves in SpectralSensor.json file the spectral sensors parameters.
355  \ingroup rp_func
356  */
357  TERPEXPORT void SaveSensorParams(std::map<std::string, SpectralSensorParams > &);
358 
359  /*!
360  \brief Returns the maximun and minimum reflectance values of a given sensor/band.
361  \ingroup rp_func
362  */
363  TERPEXPORT SpectralSensorParams GetSpectralBandInfo(std::string bandName);
364 
365  /*!
366  \brief Returns the minimum reflectance value of a given sensor/band.
367  \ingroup rp_func
368  */
369  TERPEXPORT double GetSpectralBandMin(std::string bandName);
370 
371  /*!
372  \brief Returns the maximum reflectance value of a given sensor/band.
373  \ingroup rp_func
374  */
375  TERPEXPORT double GetSpectralBandMax(std::string bandName);
376 
377  /*!
378  \brief Returns the maximun and minimum digital numbers of a given sensor/band.
379  \ingroup rp_func
380  */
381  TERPEXPORT std::pair<double, double> GetDigitalNumberBandInfo(std::string bandName);
382 
383  /*!
384  \brief Returns the maximum digital number of a given sensor/band.
385  \ingroup rp_func
386  */
387  TERPEXPORT double GetDigitalNumberBandMax(std::string bandName);
388 
389  /*!
390  \brief Returns the minimum digital number of a given sensor/band.
391  \ingroup rp_func
392  */
393  TERPEXPORT double GetDigitalNumberBandMin(std::string bandName);
394 
395  /*!
396  \brief Normalizes one raster in a given interval.
397 
398  \param inputRaster The given raster.
399  \param nmin The new minimum value (default = 0.0).
400  \param nmax The new maximum value (default = 255.0).
401 
402  \return true if normalization occurs and false otherwise.
403  \ingroup rp_func
404  */
405  TERPEXPORT bool NormalizeRaster(te::rst::Raster& inputRaster, double nmin = 0.0, double nmax = 255.0);
406 
407  /*!
408  \brief Normalizes a raster in a given interval.
409 
410  \param inputRaster The given raster.
411 
412  \return a raster normalized.
413  \ingroup rp_func
414  */
416 
417  /*!
418  \brief RGB to IHS conversion.
419  \param inputRGBRaster The input raster.
420  \param redBandIdx The red band index.
421  \param greenBandIdx The red band index.
422  \param blueBandIdx The red band index.
423  \param rgbRangeMin The minimum RGB value.
424  \param rgbRangeMax The maximum RGB value.
425  \param outputIHSRaster An output pré-initiated raster (with the same dimensions of inputRGBRaster) where the IHS data will be written (double or float as the data type).
426  \return true if OK, false on errors.
427  \note The outputIHSRaster mas have a float or double data type.
428  \note IHS data with the following channels ranges: I:[0,1] H:[0,2pi] (radians) S:[0,1].
429  \ingroup rp_func
430  */
431  TERPEXPORT bool ConvertRGB2IHS( const te::rst::Raster& inputRGBRaster,
432  const unsigned int redBandIdx, const unsigned int greenBandIdx,
433  const unsigned int blueBandIdx, const double rgbRangeMin,
434  const double rgbRangeMax, te::rst::Raster& outputIHSRaster );
435 
436  /*!
437  \brief RGB to IHS conversion.
438  \param inputRedRaster The input red raster.
439  \param redBandIdx The red band index.
440  \param inputGreenRaster The input green raster.
441  \param greenBandIdx The green band index.
442  \param inputBlueRaster The input blue raster.
443  \param blueBandIdx The blue band index.
444  \param rgbRangeMin The minimum RGB value.
445  \param rgbRangeMax The maximum RGB value.
446  \param outputIHSRaster An output pré-initiated raster (with the same dimensions of inputRGBRaster) where the IHS data will be written (double or float as the data type).
447  \return true if OK, false on errors.
448  \note The outputIHSRaster mas have a float or double data type.
449  \note IHS data with the following channels ranges: I:[0,1] H:[0,2pi] (radians) S:[0,1].
450  \ingroup rp_func
451  */
452  TERPEXPORT bool ConvertRGB2IHS(const te::rst::Raster& inputRedRaster, const unsigned int redBandIdx,
453  const te::rst::Raster& inputGreenRaster, const unsigned int greenBandIdx,
454  const te::rst::Raster& inputBlueRaster, const unsigned int blueBandIdx,
455  const double rgbRangeMin, const double rgbRangeMax, te::rst::Raster& outputIHSRaster);
456 
457  /*!
458  \brief IHS to RGB conversion.
459  \param inputIHSRaster The input raster.
460  \param intensityBandIdx The intensity band index.
461  \param hueBandIdx The hue band index.
462  \param saturationBandIdx The saturation band index.
463  \param rgbRangeMin The minimum RGB value.
464  \param rgbRangeMax The maximum RGB value.
465  \param outputRGBRaster An output pré-initiated raster (with the same dimensions of inputIHSRaster) where the RGB data will be written.
466  \return true if OK, false on errors.
467  \note IHS data with the following channels ranges: I:[0,1] H:[0,2pi] (radians) S:[0,1].
468  \ingroup rp_func
469  */
470  TERPEXPORT bool ConvertIHS2RGB( const te::rst::Raster& inputIHSRaster,
471  const unsigned int intensityBandIdx, const unsigned int hueBandIdx,
472  const unsigned int saturationBandIdx, const double rgbRangeMin,
473  const double rgbRangeMax, te::rst::Raster& outputRGBRaster );
474 
475  /*!
476  \brief IHS to RGB conversion.
477  \param inputIRaster The input intensity raster.
478  \param intensityBandIdx The intensity band index.
479  \param inputHRaster The input hue raster.
480  \param hueBandIdx The hue band index.
481  \param inputSRaster The input saturation raster.
482  \param saturationBandIdx The saturation band index.
483  \param rgbRangeMin The minimum RGB value.
484  \param rgbRangeMax The maximum RGB value.
485  \param outputRGBRaster An output pré-initiated raster (with the same dimensions of inputIHSRaster) where the RGB data will be written.
486  \return true if OK, false on errors.
487  \note IHS data with the following channels ranges: I:[0,1] H:[0,2pi] (radians) S:[0,1].
488  \ingroup rp_func
489  */
490  TERPEXPORT bool ConvertIHS2RGB(const te::rst::Raster& inputIRaster, const unsigned int intensityBandIdx,
491  const te::rst::Raster& inputHRaster, const unsigned int hueBandIdx,
492  const te::rst::Raster& inputSRaster, const unsigned int saturationBandIdx,
493  const double rgbRangeMin, const double rgbRangeMax, te::rst::Raster& outputRGBRaster);
494 
495  /*!
496  \brief RGB to HLS conversion.
497  \param inputRGBRaster The input raster.
498  \param redBandIdx The red band index.
499  \param greenBandIdx The red band index.
500  \param blueBandIdx The red band index.
501  \param rgbRangeMin The minimum RGB value.
502  \param rgbRangeMax The maximum RGB value.
503  \param outputHLSRaster An output pré-initiated raster (with the same dimensions of inputRGBRaster) where the HLS data will be written (double or float as the data type).
504  \return true if OK, false on errors.
505  \note The outputHLSRaster mas have a float or double data type.
506  \ingroup rp_func
507  */
508  TERPEXPORT bool ConvertRGB2HLS(const te::rst::Raster& inputRGBRaster,
509  const unsigned int redBandIdx, const unsigned int greenBandIdx,
510  const unsigned int blueBandIdx, const double rgbRangeMin,
511  const double rgbRangeMax, te::rst::Raster& outputHLSRaster);
512 
513  /*!
514  \brief RGB to HLS conversion.
515  \param inputRedRaster The input red raster.
516  \param redBandIdx The red band index.
517  \param inputGreenRaster The input green raster.
518  \param greenBandIdx The green band index.
519  \param inputBlueRaster The input blue raster.
520  \param blueBandIdx The blue band index.
521  \param rgbRangeMin The minimum RGB value.
522  \param rgbRangeMax The maximum RGB value.
523  \param outputHLSRaster An output pré-initiated raster (with the same dimensions of inputRGBRaster) where the HLS data will be written (double or float as the data type).
524  \return true if OK, false on errors.
525  \note The outputHLSRaster mas have a float or double data type.
526  \ingroup rp_func
527  */
528  TERPEXPORT bool ConvertRGB2HLS(const te::rst::Raster& inputRedRaster, const unsigned int redBandIdx,
529  const te::rst::Raster& inputGreenRaster, const unsigned int greenBandIdx,
530  const te::rst::Raster& inputBlueRaster, const unsigned int blueBandIdx,
531  const double rgbRangeMin, const double rgbRangeMax, te::rst::Raster& outputHLSRaster);
532 
533  /*!
534  \brief HLS to RGB conversion.
535  \param inputHLSRaster The input raster.
536  \param hueBandIdx The hue band index.
537  \param lightBandIdx The light band index.
538  \param saturationBandIdx The saturation band index.
539  \param rgbRangeMin The minimum RGB value.
540  \param rgbRangeMax The maximum RGB value.
541  \param outputRGBRaster An output pré-initiated raster (with the same dimensions of inputHLSRaster) where the RGB data will be written.
542  \return true if OK, false on errors.
543  \ingroup rp_func
544  */
545  TERPEXPORT bool ConvertHLS2RGB(const te::rst::Raster& inputHLSRaster,
546  const unsigned int hueBandIdx, const unsigned int lightBandIdx,
547  const unsigned int saturationBandIdx, const double rgbRangeMin,
548  const double rgbRangeMax, te::rst::Raster& outputRGBRaster);
549 
550  /*!
551  \brief HLS to RGB conversion.
552  \param inputHRaster The input hue raster.
553  \param hueBandIdx The hue band index.
554  \param inputLRaster The input light raster.
555  \param lightBandIdx The light band index.
556  \param inputSRaster The input saturation raster.
557  \param saturationBandIdx The saturation band index.
558  \param rgbRangeMin The minimum RGB value.
559  \param rgbRangeMax The maximum RGB value.
560  \param outputRGBRaster An output pré-initiated raster (with the same dimensions of inputHLSRaster) where the RGB data will be written.
561  \return true if OK, false on errors.
562  \ingroup rp_func
563  */
564  TERPEXPORT bool ConvertHLS2RGB(const te::rst::Raster& inputHRaster, const unsigned int hueBandIdx,
565  const te::rst::Raster& inputLRaster, const unsigned int lightBandIdx,
566  const te::rst::Raster& inputSRaster, const unsigned int saturationBandIdx,
567  const double rgbRangeMin, const double rgbRangeMax, te::rst::Raster& outputRGBRaster);
568 
569  /*!
570  \brief Get the mean of band pixel values.
571  \param inputRaster The input raster.
572  \param inputBandIndex Input band index.
573  \param maxThreads The maximum number of threads to use (0-auto, 1-single thread used).
574  \param meanValue The calculated mean value.
575  \return true if OK, false on errors.
576  \note Optimized for rasters where the used bands have the same blocking scheme.
577  \ingroup rp_func
578  */
580  const te::rst::Raster& inputRaster,
581  const unsigned int inputBandIndex,
582  const unsigned int maxThreads,
583  double& meanValue );
584 
585  /*!
586  \brief Get the standard deviation of band pixel values.
587  \param inputRaster The input raster.
588  \param inputBandIndex Input band index.
589  \param maxThreads The maximum number of threads to use (0-auto, 1-single thread used).
590  \param meanValuePtr A pointer to a pre-calculated band mean value or zero if it does not exist.
591  \param stdDevValue The calculated standard deviation value.
592  \return true if OK, false on errors.
593  \note Optimized for rasters where the used bands have the same blocking scheme.
594  \ingroup rp_func
595  */
597  const te::rst::Raster& inputRaster,
598  const unsigned int inputBandIndex,
599  const unsigned int maxThreads,
600  double const * const meanValuePtr,
601  double& stdDevValue );
602 
603  /*!
604  \brief Get the covariance of band pixel values.
605  \param inputRaster1 The input raster 1.
606  \param inputBandIndex1 Input raster 1 band index.
607  \param inputRaster2 The input raster 2.
608  \param inputBandIndex2 Input raster 2 band index.
609  \param useRasterCache Enable/disable the use of raster data cache to optimize de calcule.
610  \param mean1ValuePtr A pointer to a pre-calculated band1 mean value or zero if it does not exist.
611  \param mean2ValuePtr A pointer to a pre-calculated band2 mean value or zero if it does not exist.
612  \param covarianceValue The calculated covariance value.
613  \return true if OK, false on errors.
614  \ingroup rp_func
615  */
617  const te::rst::Raster& inputRaster1,
618  const unsigned int inputBandIndex1,
619  const te::rst::Raster& inputRaster2,
620  const unsigned int inputBandIndex2,
621  const bool useRasterCache,
622  double const * const mean1ValuePtr,
623  double const * const mean2ValuePtr,
624  double& covarianceValue );
625 
626  /*!
627  \brief Generate all principal components from the given input raster.
628  \param inputRaster Input raster.
629  \param inputRasterBands Input raster bands.
630  \param pcaMatrix The matrix generated over the principal components process.
631  \param pcaRaster The pré-initiated output PCA raster (with the same dimensions of inputRaster) and double as the data type.
632  \param pcaRasterBands Output raster bands.
633  \param maxThreads The maximum number of threads to use (0-auto, 1-single thread used).
634  \return true if OK, false on errors.
635  \note Optimized for rasters where the used bands have the same blocking scheme.
636  \ingroup rp_func
637  */
639  const te::rst::Raster& inputRaster,
640  const std::vector< unsigned int >& inputRasterBands,
641  boost::numeric::ublas::matrix< double >& pcaMatrix,
642  te::rst::Raster& pcaRaster,
643  const std::vector< unsigned int >& pcaRasterBands,
644  const unsigned int maxThreads );
645 
646  /*!
647  \brief Regenerate the original raster from its principal components.
648  \param pcaRaster The principal components raster (with the same dimensions of outputRaster).
649  \param pcaMatrix The matrix generated by the direct principal components process.
650  \param outputRaster The regenerated output raster (with the same dimentions.
651  \param outputRasterBands Output raster bands.
652  \param maxThreads The maximum number of threads to use (0-auto, 1-single thread used).
653  \return true if OK, false on errors.
654  \note Optimized for rasters where the used bands have the same blocking scheme.
655  \ingroup rp_func
656  */
658  const te::rst::Raster& pcaRaster,
659  const boost::numeric::ublas::matrix< double >& pcaMatrix,
660  te::rst::Raster& outputRaster,
661  const std::vector< unsigned int >& outputRasterBands,
662  const unsigned int maxThreads );
663 
664  /*!
665  \brief Remap all pixel values using a user supplied target values (non-target values are just copied from input to output).
666  \param inputRaster Input raster.
667  \param inputRasterBandIdx Input raster band.
668  \param targetValues A vector of target values pairs in the form: std::pair< old_value, new_value >.
669  \param enableProgress Enable/disable the progress interface.
670  \param restrictionPols A vector of polygons where the remap must be executed or an empty vector indicating all pixels must be remapped.
671  \param outputRaster The pré-initiated output raster.
672  \param outputRasterBandIdx Output raster band.
673  \return true if OK, false on errors.
674  \note Optimized for rasters where the used bands have the same blocking scheme.
675  \ingroup rp_func
676  */
678  const te::rst::Raster& inputRaster,
679  const unsigned int& inputRasterBandIdx,
680  const std::vector< std::pair< double, double > >& targetValues,
681  const bool enableProgress,
682  const std::vector< te::gm::Polygon* >& restrictionPols,
683  te::rst::Raster& outputRaster,
684  const unsigned int& outputRasterBandIdx );
685 
686  /*!
687  \brief Remap pixel values using a remap function matrix.
688  \param inputRaster Input raster.
689  \param inputRasterBands Input raster bands.
690  \param remapMatrix The remap function matrix.
691  \param outputRaster The pré-initiated output raster (with the same dimentions of inputRaster).
692  \param outputRasterBands Output raster bands.
693  \param maxThreads The maximum number of threads to use (0-auto, 1-single thread used).
694  \return true if OK, false on errors.
695  \note Optimized for rasters where the used bands have the same blocking scheme.
696  \ingroup rp_func
697  */
698  TERPEXPORT bool RemapValues(
699  const te::rst::Raster& inputRaster,
700  const std::vector< unsigned int >& inputRasterBands,
701  const boost::numeric::ublas::matrix< double >& remapMatrix,
702  te::rst::Raster& outputRaster,
703  const std::vector< unsigned int >& outputRasterBands,
704  const unsigned int maxThreads );
705 
706  /*!
707  \brief Decompose a multi-band raster into a set of one-band rasters.
708  \param inputRaster Input raster.
709  \param inputRasterBands Input raster bands.
710  \param outputRastersInfos Output rasters connections infos. (one info for each decomposed band).
711  \param outputDataSourceType Output raster datasource type.
712  \param outputRastersPtrs Pointers to the generated outputs rasters.
713  \return true if OK, false on errors.
714  \ingroup rp_func
715  */
717  const te::rst::Raster& inputRaster,
718  const std::vector< unsigned int >& inputRasterBands,
719  const std::vector< std::map<std::string, std::string> > & outputRastersInfos,
720  const std::string& outputDataSourceType,
721  std::vector< boost::shared_ptr< te::rst::Raster > > & outputRastersPtrs );
722 
723  /*!
724  \brief Compose a set of bands into one multi-band raster.
725  \param feeder Input rasters feeder.
726  \param inputRasterBands Input raster bands (one band for each input raster).
727  \param interpMethod The interpolator method to use.
728  \param outputRasterInfo Output raster connection info.
729  \param outputDataSourceType Output raster datasource type.
730  \param outputRasterPtr A pointer to the generated output raster.
731  \return true if OK, false on errors.
732  \note The first raster Grid will be taken as reference for the composed raster.
733  \ingroup rp_func
734  */
735  TERPEXPORT bool ComposeBands(
737  const std::vector< unsigned int >& inputRasterBands,
738  const te::rst::Interpolator::Method& interpMethod,
739  const std::map<std::string, std::string>& outputRasterInfo,
740  const std::string& outputDataSourceType,
741  std::unique_ptr< te::rst::Raster >& outputRasterPtr );
742 
743  /*!
744  \brief Create a datailed extent from the given grid.
745  \param grid Input grid.
746  \param detailedExtent The created detailed extent.
747  \return true if ok, false on errors.
748  \ingroup rp_func
749  */
750  TERPEXPORT bool GetDetailedExtent( const te::rst::Grid& grid,
751  te::gm::LinearRing& detailedExtent );
752 
753  /*!
754  \brief Create a indexed (lines,columns) datailed extent from the given grid.
755  \param grid Input grid.
756  \param indexedDetailedExtent The created detailed extent.
757  \return true if ok, false on errors.
758  \ingroup rp_func
759  */
761  te::gm::LinearRing& indexedDetailedExtent );
762 
763  /*!
764  \brief Create a Wavele Atrous Filter.
765  \param filterType The filter type.
766  \return the created filter.
767  \ingroup rp_func
768  */
769  TERPEXPORT boost::numeric::ublas::matrix< double >
771 
772  /*!
773  \brief Generate all wavelet planes from the given input raster.
774  \param inputRaster Input raster.
775  \param inputRasterBands Input raster bands.
776  \param waveletRaster The pré-initiated output wavelet raster (with the same dimensions of inputRaster) and double as the data type.
777  \param levelsNumber The number of decomposed wavelet levels to generate for each input raster band;
778  \param filter The square filter to use.
779  \return true if OK, false on errors.
780  \note The band order of the generated wavelet levels: { [ band0-smoothed0, band0-wavelet0, ... , band0-smoothedN, band0-waveletN ], ... }
781  \note The number of bands of waveletRaster must be ( inputRasterBands.size() * 2 * levelsNumber ) at least.
782  \ingroup rp_func
783  */
785  const te::rst::Raster& inputRaster,
786  const std::vector< unsigned int >& inputRasterBands,
787  te::rst::Raster& waveletRaster,
788  const unsigned int levelsNumber,
789  const boost::numeric::ublas::matrix< double >& filter );
790 
791  /*!
792  \brief Regenerate the original raster from its wavelets planes.
793  \param waveletRaster The input wavelet raster (with the same dimensions of outputRaster).
794  \param levelsNumber The number of decomposed wavelet levels present inside the wavelet raster.
795  \param outputRaster The regenerated output raster.
796  \param outputRasterBands Output raster bands.
797  \return true if OK, false on errors.
798  \note The band order of the expected wavelet levels: { [ band0-smoothed0, band0-wavelet0, ... , band0-smoothedN, band0-waveletN ], ... }
799  \note The number of bands of waveletRaster must be ( outputRasterBands.size() * 2 * levelsNumber ) at least.
800  \note Only the wavelet bands and the last smoothed band are used.
801  \ingroup rp_func
802  */
804  const te::rst::Raster& waveletRaster,
805  const unsigned int levelsNumber,
806  te::rst::Raster& outputRaster,
807  const std::vector< unsigned int >& outputRasterBands );
808 
809  /*!
810  \brief Resample a subset of the raster, given a box.
811  \param inputRaster Input raster.
812  \param inputRasterBands Input raster bands to process.
813  \param interpMethod The method of interpolation. \sa te::rst::Interpolator
814  \param firstRow The starting row to make a subset of the image.
815  \param firstColumn The starting column to make a subset of the image.
816  \param height The height of the subset.
817  \param width The width of the subset.
818  \param newheight The resampled height of the new raster.
819  \param newwidth The resampled width of the new raster.
820  \param rinfo The parameters needed to build the output raster (see RasterFactory documentation).
821  \param dataSourceType Data source type (raster type. I.E. GDAL).
822  \param resampledRasterPtr The resampled raster pointer.
823  \return true if ok, false on errors.
824  */
826  const te::rst::Raster& inputRaster,
827  const std::vector< unsigned int >& inputRasterBands,
828  const te::rst::Interpolator::Method interpMethod,
829  const unsigned int firstRow,
830  const unsigned int firstColumn,
831  const unsigned int height,
832  const unsigned int width,
833  const unsigned int newheight,
834  const unsigned int newwidth,
835  const std::map<std::string, std::string>& rinfo,
836  const std::string& dataSourceType,
837  std::unique_ptr< te::rst::Raster >& resampledRasterPtr );
838 
839  /*!
840  \brief Returns the tie points converx hull area.
841  \param tiePoints Input tie-points (container of te::gm::GTParameters::TiePoint).
842  \param useTPSecondCoordPair If true the sencond tie-point component (te::gm::GTParameters::TiePoint::second) will be used for the area calcule, otherwize the first component will be used.
843  \return Returns the tie points converx hull area.
844  */
845  template< typename ContainerT >
846  double GetTPConvexHullArea( const ContainerT& tiePoints,
847  const bool useTPSecondCoordPair )
848  {
849  if( tiePoints.size() < 3 )
850  {
851  return 0;
852  }
853  else
854  {
856 
857  typename ContainerT::const_iterator it =
858  tiePoints.begin();
859  const typename ContainerT::const_iterator itE =
860  tiePoints.end();
861 
862  while( it != itE )
863  {
864  if( useTPSecondCoordPair )
865  points.add(new te::gm::Point(it->second.x, it->second.y));
866  else
867  points.add(new te::gm::Point(it->first.x, it->first.y));
868 
869  ++it;
870  }
871 
872  std::unique_ptr< te::gm::Geometry > convexHullPolPtr( points.convexHull() );
873 
874  if( dynamic_cast< te::gm::Surface* >( convexHullPolPtr.get() ) )
875  {
876  return ( (te::gm::Surface*)( convexHullPolPtr.get() ) )->getArea();
877  }
878  else
879  {
880  return 0.0;
881  }
882  }
883  }
884 
885  /*!
886  \brief Create a fixed step sequential color palette.
887  \param paletteSize The desired palette size.
888  \param palette The crated palette.
889  */
891  const unsigned int paletteSize,
892  const bool randomize,
893  std::vector< te::rst::BandProperty::ColorEntry >& palette );
894 
895  /*!
896  \brief Generate all wavelet planes from the given input raster.
897  \param inputRaster Input raster.
898  \param inputRasterBand Input raster band.
899  \param createPaletteRaster If true a paletted raster will be created instead of a multi-band raster..
900  \param slicesNumber The number of histogram slices to create;
901  \param eqHistogram If true, the input raster will be equalized before the slicing process.
902  \param rasterInfo The output raster info (specific driver info).
903  \param rasterType The output raster type (specific driver name - See te::rst::RasterFactory dictorary for more info).
904  \param enableProgress Enable/disable the progress interface.
905  \param palettePtr A pointer to an optional user given palette (if null, an fixed step pallete will be generated).
906  \param outRasterPtr The output sliced raster pointer.
907  \param limits slice limits values
908  \return true if OK, false on errors.
909  \ingroup rp_func
910  */
912  const te::rst::Raster& inputRaster,
913  const unsigned int inputRasterBand,
914  const bool createPaletteRaster,
915  const unsigned int slicesNumber,
916  const bool eqHistogram,
917  const std::map< std::string, std::string >& rasterInfo,
918  const std::string& rasterType,
919  const bool enableProgress,
920  std::vector< te::rst::BandProperty::ColorEntry > const * const palettePtr,
921  std::unique_ptr< te::rst::Raster >& outRasterPtr,
922  std::map< double, double > limits);
923 
924  } // end namespace rp
925 } // end namespace te
926 
927 #endif // __TERRALIB_RP_INTERNAL_FUNCTIONS_H
928 
TERPEXPORT double GetDigitalNumberBandMax(std::string bandName)
Returns the maximum digital number of a given sensor/band.
TERPEXPORT bool SelectiveReplaceValues(const te::rst::Raster &inputRaster, const unsigned int &inputRasterBandIdx, const std::vector< std::pair< double, double > > &targetValues, const bool enableProgress, const std::vector< te::gm::Polygon * > &restrictionPols, te::rst::Raster &outputRaster, const unsigned int &outputRasterBandIdx)
Remap all pixel values using a user supplied target values (non-target values are just copied from in...
Index into a lookup table.
Definition: Enums.h:57
A raster band description.
Definition: BandProperty.h:61
double GetTPConvexHullArea(const ContainerT &tiePoints, const bool useTPSecondCoordPair)
Returns the tie points converx hull area.
Definition: Functions.h:846
Spline filter type.
Definition: Functions.h:76
TERPEXPORT void SaveSensorParams(std::map< std::string, SpectralSensorParams > &)
Saves in SpectralSensor.json file the spectral sensors parameters.
TERPEXPORT bool RasterSlicing(const te::rst::Raster &inputRaster, const unsigned int inputRasterBand, const bool createPaletteRaster, const unsigned int slicesNumber, const bool eqHistogram, const std::map< std::string, std::string > &rasterInfo, const std::string &rasterType, const bool enableProgress, std::vector< te::rst::BandProperty::ColorEntry > const *const palettePtr, std::unique_ptr< te::rst::Raster > &outRasterPtr, std::map< double, double > limits)
Generate all wavelet planes from the given input raster.
Triangle filter type.
Definition: Functions.h:77
TERPEXPORT bool ConvertIHS2RGB(const te::rst::Raster &inputIHSRaster, const unsigned int intensityBandIdx, const unsigned int hueBandIdx, const unsigned int saturationBandIdx, const double rgbRangeMin, const double rgbRangeMax, te::rst::Raster &outputRGBRaster)
IHS to RGB conversion.
void TERPEXPORT GetDataTypeRange(const int dataType, double &min, double &max)
Returns the real data type range (all values that can be represented by the given data type)...
Definition: Functions.h:215
bool TERPEXPORT CreateNewMemRaster(const te::rst::Grid &rasterGrid, std::vector< te::rst::BandProperty * > bandsProperties, RasterHandler &outRasterHandler)
Create a new raster into a new memory datasource.
TERPEXPORT std::vector< std::string > GetBandNames()
Returns a vector os with band&#39;s names.
TERASTEREXPORT void GetDataTypeRanges(const int &dataType, double &min, double &max)
Return the values range of a given data type.
TERPEXPORT bool ComposeBands(te::rp::FeederConstRaster &feeder, const std::vector< unsigned int > &inputRasterBands, const te::rst::Interpolator::Method &interpMethod, const std::map< std::string, std::string > &outputRasterInfo, const std::string &outputDataSourceType, std::unique_ptr< te::rst::Raster > &outputRasterPtr)
Compose a set of bands into one multi-band raster.
TERPEXPORT std::pair< double, double > GetDigitalNumberBandInfo(std::string bandName)
Returns the maximun and minimum digital numbers of a given sensor/band.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:119
TERPEXPORT bool DirectPrincipalComponents(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, boost::numeric::ublas::matrix< double > &pcaMatrix, te::rst::Raster &pcaRaster, const std::vector< unsigned int > &pcaRasterBands, const unsigned int maxThreads)
Generate all principal components from the given input raster.
TERPEXPORT bool DecomposeBands(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const std::vector< std::map< std::string, std::string > > &outputRastersInfos, const std::string &outputDataSourceType, std::vector< boost::shared_ptr< te::rst::Raster > > &outputRastersPtrs)
Decompose a multi-band raster into a set of one-band rasters.
TERPEXPORT double GetDigitalNumberBandMin(std::string bandName)
Returns the minimum digital number of a given sensor/band.
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:92
TERPEXPORT double GetSpectralBandMax(std::string bandName)
Returns the maximum reflectance value of a given sensor/band.
TERPEXPORT bool GetMeanValue(const te::rst::Raster &inputRaster, const unsigned int inputBandIndex, const unsigned int maxThreads, double &meanValue)
Get the mean of band pixel values.
TERPEXPORT bool RemapValues(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const boost::numeric::ublas::matrix< double > &remapMatrix, te::rst::Raster &outputRaster, const std::vector< unsigned int > &outputRasterBands, const unsigned int maxThreads)
Remap pixel values using a remap function matrix.
TERPEXPORT bool ConvertRGB2IHS(const te::rst::Raster &inputRGBRaster, const unsigned int redBandIdx, const unsigned int greenBandIdx, const unsigned int blueBandIdx, const double rgbRangeMin, const double rgbRangeMax, te::rst::Raster &outputIHSRaster)
RGB to IHS conversion.
#define TERP_TRUE_OR_RETURN_FALSE(value, message)
Checks if value is true. For false values a warning message will be logged and a return of context wi...
Definition: Macros.h:185
TERPEXPORT bool ConvertHLS2RGB(const te::rst::Raster &inputHLSRaster, const unsigned int hueBandIdx, const unsigned int lightBandIdx, const unsigned int saturationBandIdx, const double rgbRangeMin, const double rgbRangeMax, te::rst::Raster &outputRGBRaster)
HLS to RGB conversion.
bool CreateRasterFileFromMatrix(const te::rp::Matrix< MatrixElementT > &matrix, const bool normalize, const std::string &fileName)
Create a tiff file from a matrix.
Definition: Functions.h:254
bool TERPEXPORT Copy2DiskRaster(const te::rst::Raster &inputRaster, const std::string &fileName)
Create a new raster into a GDAL datasource.
A LinearRing is a LineString that is both closed and simple.
Definition: LinearRing.h:53
MultiPoint is a GeometryCollection whose elements are restricted to points.
Definition: MultiPoint.h:53
TERPEXPORT std::map< std::string, SpectralSensorParams > getSensorParams()
Returns a map with spectral sensors parameters defined in SpectralSensor.json file.
A point with x and y coordinate values.
Definition: Point.h:50
TERPEXPORT bool NormalizeRaster(te::rst::Raster &inputRaster, double nmin=0.0, double nmax=255.0)
Normalizes one raster in a given interval.
An abstract class for raster data strucutures.
Definition: Raster.h:71
TERPEXPORT bool InverseWaveletAtrous(const te::rst::Raster &waveletRaster, const unsigned int levelsNumber, te::rst::Raster &outputRaster, const std::vector< unsigned int > &outputRasterBands)
Regenerate the original raster from its wavelets planes.
WaveletAtrousFilterType
Wavelet Atrous Filter types.
Definition: Functions.h:73
virtual Geometry * convexHull() const _NOEXCEPT_OP(false)
This method calculates the Convex Hull of a geometry.
TerraLib.
TERPEXPORT bool DirectWaveletAtrous(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, te::rst::Raster &waveletRaster, const unsigned int levelsNumber, const boost::numeric::ublas::matrix< double > &filter)
Generate all wavelet planes from the given input raster.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
Raster tuple.
void TERPEXPORT Convert2DoublesVector(void *inputVector, const int inputVectorDataType, unsigned int inputVectorSize, double *outputVector)
Convert vector elements.
RasterHandler.
Definition: RasterHandler.h:47
TERPEXPORT bool GetDetailedExtent(const te::rst::Grid &grid, te::gm::LinearRing &detailedExtent)
Create a datailed extent from the given grid.
Generic template matrix.
SpectralSensorParams(const int &band, const double &lower, const double &upper, const double &min, const double &max)
Definition: Functions.h:84
TERPEXPORT bool ConvertRGB2HLS(const te::rst::Raster &inputRGBRaster, const unsigned int redBandIdx, const unsigned int greenBandIdx, const unsigned int blueBandIdx, const double rgbRangeMin, const double rgbRangeMax, te::rst::Raster &outputHLSRaster)
RGB to HLS conversion.
bool TERPEXPORT CreateNewRaster(const te::rst::Grid &rasterGrid, const std::vector< te::rst::BandProperty * > &bandsProperties, const std::string &outDataSetName, const std::string &dataSourceType, RasterHandler &outRasterHandler)
Create a new raster into the givem data source.
Invalid filter type.
Definition: Functions.h:75
TERPEXPORT boost::numeric::ublas::matrix< double > CreateWaveletAtrousFilter(const WaveletAtrousFilterType &filterType)
Create a Wavele Atrous Filter.
unsigned int getLinesNumber() const
The number of current matrix lines.
Definition: Matrix.h:791
TERPEXPORT bool RasterResample(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const te::rst::Interpolator::Method interpMethod, const unsigned int firstRow, const unsigned int firstColumn, const unsigned int height, const unsigned int width, const unsigned int newheight, const unsigned int newwidth, const std::map< std::string, std::string > &rinfo, const std::string &dataSourceType, std::unique_ptr< te::rst::Raster > &resampledRasterPtr)
Resample a subset of the raster, given a box.
Configuration flags for the Raster Processing module of TerraLib.
TERPEXPORT double GetSpectralBandMin(std::string bandName)
Returns the minimum reflectance value of a given sensor/band.
TERPEXPORT bool GetCovarianceValue(const te::rst::Raster &inputRaster1, const unsigned int inputBandIndex1, const te::rst::Raster &inputRaster2, const unsigned int inputBandIndex2, const bool useRasterCache, double const *const mean1ValuePtr, double const *const mean2ValuePtr, double &covarianceValue)
Get the covariance of band pixel values.
TERPEXPORT SpectralSensorParams GetSpectralBandInfo(std::string bandName)
Returns the maximun and minimum reflectance values of a given sensor/band.
Feeder from a input rasters.
Definition: FeedersRaster.h:46
void add(Geometry *g)
It adds the geometry into the collection.
A generic template matrix.
Definition: Matrix.h:55
TERPEXPORT bool GetIndexedDetailedExtent(const te::rst::Grid &grid, te::gm::LinearRing &indexedDetailedExtent)
Create a indexed (lines,columns) datailed extent from the given grid.
TERPEXPORT bool InversePrincipalComponents(const te::rst::Raster &pcaRaster, const boost::numeric::ublas::matrix< double > &pcaMatrix, te::rst::Raster &outputRaster, const std::vector< unsigned int > &outputRasterBands, const unsigned int maxThreads)
Regenerate the original raster from its principal components.
TERPEXPORT void CreateFixedStepPalette(const unsigned int paletteSize, const bool randomize, std::vector< te::rst::BandProperty::ColorEntry > &palette)
Create a fixed step sequential color palette.
TERPEXPORT bool GetStdDevValue(const te::rst::Raster &inputRaster, const unsigned int inputBandIndex, const unsigned int maxThreads, double const *const meanValuePtr, double &stdDevValue)
Get the standard deviation of band pixel values.
bool TERPEXPORT CreateNewGdalRaster(const te::rst::Grid &rasterGrid, std::vector< te::rst::BandProperty * > bandsProperties, const std::string &fileName, RasterHandler &outRasterHandler)
Create a new raster into a GDAL datasource.
static Raster * make()
It creates and returns an empty raster with default raster driver.
Raster objects feeders.
unsigned int getColumnsNumber() const
The number of current matrix columns.
Definition: Matrix.h:798
A rectified grid is the spatial support for raster data.
Definition: Grid.h:68
TERPEXPORT std::string GetSensorFilename()
Returns a json filename with spectral sensors parameters.
void TERPEXPORT ConvertDoublesVector(double *inputVector, unsigned int inputVectorSize, const int outputVectorDataType, void *outputVector)
Convert a doubles vector.
Surface is an abstract class that represents a 2-dimensional geometric objects.
Definition: Surface.h:54