Loading...
Searching...
No Matches
ComposerRuleValidNeighborhood.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#ifndef __TERRALIB_RP_INTERNAL_COMPOSER_RULE_VALID_NEIGHBORHOOD_H
21#define __TERRALIB_RP_INTERNAL_COMPOSER_RULE_VALID_NEIGHBORHOOD_H
22
23#include "ComposerRule.h"
24#include "../srs/Converter.h"
25
26#include <memory>
27
28namespace te
29{
30 namespace rp
31 {
32 /*!
33 \class ComposerRuleValidNeighborhood A basic composer rule capable of choosing the valid pixels (all bands with no no-data values).
34 \brief A basic composer rule capable of choosing the valid pixels (all bands with no no-data values).
35 \ingroup rp_optical
36 */
38 {
39 public:
40
42
44
45 /*!
46 \brief Set the valid values ranges.
47 \param ranges1 Raster 1 values ranges.
48 \param ranges2 Raster 2 values ranges.
49 \note Valid values ranges for each band (first=min, second=max).
50 \note Ranges min and max are considered valid values.
51 */
53 const std::vector< std::pair< double, double > >& ranges1,
54 const std::vector< std::pair< double, double > >& ranges2 );
55
56 /*!
57 \brief Get the valid values ranges.
58 \param ranges1 Raster 1 values ranges.
59 \param ranges2 Raster 2 values ranges.
60 */
62 std::vector< std::pair< double, double > >& ranges1,
63 std::vector< std::pair< double, double > >& ranges2 ) const;
64
65 /*!
66 \brief Set the valid values neighbors window radius.
67 \param newRadius New radius.
68 \note All pixels within the radius must be valid for the center pixel be considered valid.
69 */
70 void setWindowRadius( const unsigned int newRadius );
71
72 /*!
73 \brief Get the valid values neighbors window radius.
74 \return Get the valid values neighbors window radius.
75 */
76 unsigned int getWindowRadius() const;
77
78 /*!
79 \brief Set the mimimum percentual of valid pixels considering the entire neighborhood for a center pixel to be considered valid.
80 \param newPercent New value (Range 0 -> 100).
81 */
82 void setNeiborMinValidPercent( const double newPercent );
83
84 /*!
85 \brief Get the mimimum percentual of valid pixels considering the entire neighborhood for a center pixel to be considered valid.
86 \return Get the mimimum percentual of valid pixels considering the entire neighborhood for a center pixel to be considered valid.
87 */
89
90 protected:
91
92 // overload
93 void getComposedValues( const double& line, const double& col,
94 double* const composedValuesPtr ) const;
95
96 // overload
98
99 // overload
101 const te::rst::Raster& raster1,
102 const std::vector< unsigned int >& raster1Bands,
103 const te::rst::Raster& raster2,
104 const std::vector< unsigned int >& raster2Bands,
105 te::rst::Raster& raster3,
106 const std::vector< unsigned int >& raster3Bands,
107 const te::rst::Interpolator::Method& interpMethod1,
108 const te::rst::Interpolator::Method& interpMethod2,
109 const double& noDataValue,
110 const bool forceRaster1NoDataValue,
111 const bool forceRaster2NoDataValue,
112 const std::vector< double >& pixelOffsets1,
113 const std::vector< double >& pixelScales1,
114 const std::vector< double >& pixelOffsets2,
115 const std::vector< double >& pixelScales2 );
116
117 private :
118
119 te::srs::Converter m_converter1; //<! Raster 1 converter.
120
121 te::srs::Converter m_converter2; //<! Raster 2 converter.
122
123 std::vector< double > m_raster1NoDataValues; //!< Raster 1 no-data values (on value per band).
124
125 std::vector< double > m_raster2NoDataValues; //!< Raster 2 no-data values (on value per band).
126
127 /*!
128 \brief Valid pixels windows radius.
129 */
131
132 /*!
133 \brief Maximum number of pixels in a window (center included)
134 */
136
137 double m_neiborMinValidPercent; //>! Mimimum percentual of valid pixels considering the entire neighborhood.
138
139 /*!
140 \brief Valid values ranges for each raster 1 band (first=min, second=max).
141 */
142 std::vector< std::pair< double, double > > m_ranges1;
143
144 /*!
145 \brief Valid values ranges for each raster 1 band (first=min, second=max).
146 */
147 std::vector< std::pair< double, double > > m_ranges2;
148
149 unsigned int m_NBands; //<! Rasters bands number.
150
151 long int m_r1NRows; //<! Raster 1 rows number.
152
153 long int m_r1NCols; //<! Raster 1 columns number.
154
155 long int m_r2NRows; //<! Raster 2 rows number.
156
157 long int m_r2NCols; //<! Raster 2 columns number.
158
159 // variables used by getComposedValues method
168 mutable long int m_getComposedValues_row;
169 mutable long int m_getComposedValues_col;
170 mutable unsigned int m_getComposedValues_bandIdx;
181
183
185
186 void initState();
187
188 void clear();
189
190 };
191
192 } // end namespace rp
193} // end namespace te
194
195#endif
196
A basic composer rule capable of choosing the valid pixels (all bands with no no-data values).
long int m_windowRadius
Valid pixels windows radius.
void getValidValuesRanges(std::vector< std::pair< double, double > > &ranges1, std::vector< std::pair< double, double > > &ranges2) const
Get the valid values ranges.
unsigned int getWindowRadius() const
Get the valid values neighbors window radius.
ComposerRule * clone() const
Create a clone of this instance.
double getNeiborMinValidPercent() const
Get the mimimum percentual of valid pixels considering the entire neighborhood for a center pixel to ...
void getComposedValues(const double &line, const double &col, double *const composedValuesPtr) const
Compose a pixel value using the current parameters.
long int m_windowMaxNPixels
Maximum number of pixels in a window (center included)
std::vector< double > m_raster1NoDataValues
Raster 1 no-data values (on value per band).
void setValidValuesRanges(const std::vector< std::pair< double, double > > &ranges1, const std::vector< std::pair< double, double > > &ranges2)
Set the valid values ranges.
std::vector< double > m_raster2NoDataValues
Raster 2 no-data values (on value per band).
bool initialize(const te::rst::Raster &raster1, const std::vector< unsigned int > &raster1Bands, const te::rst::Raster &raster2, const std::vector< unsigned int > &raster2Bands, te::rst::Raster &raster3, const std::vector< unsigned int > &raster3Bands, const te::rst::Interpolator::Method &interpMethod1, const te::rst::Interpolator::Method &interpMethod2, const double &noDataValue, const bool forceRaster1NoDataValue, const bool forceRaster2NoDataValue, const std::vector< double > &pixelOffsets1, const std::vector< double > &pixelScales1, const std::vector< double > &pixelOffsets2, const std::vector< double > &pixelScales2)
Inititate the instance.
void setNeiborMinValidPercent(const double newPercent)
Set the mimimum percentual of valid pixels considering the entire neighborhood for a center pixel to ...
ComposerRuleValidNeighborhood(const ComposerRuleValidNeighborhood &other)
std::vector< std::pair< double, double > > m_ranges2
Valid values ranges for each raster 1 band (first=min, second=max).
void setWindowRadius(const unsigned int newRadius)
Set the valid values neighbors window radius.
const ComposerRuleValidNeighborhood & operator=(const ComposerRuleValidNeighborhood &other)
std::vector< std::pair< double, double > > m_ranges1
Valid values ranges for each raster 1 band (first=min, second=max).
An abstract class for raster data strucutures.
Definition: Raster.h:72
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS...
Definition: Converter.h:54
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:93
TerraLib.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139