27 #include "../geometry/GeometricTransformation.h" 
   28 #include "../geometry/GTFactory.h" 
   29 #include "../geometry/Envelope.h" 
   30 #include "../raster/RasterFactory.h" 
   31 #include "../raster/Band.h" 
   32 #include "../raster/BandProperty.h" 
   33 #include "../raster/Grid.h" 
   34 #include "../raster/Utils.h" 
   64       m_inputRasterBands.clear();
 
   67       m_outputResolutionX = 1.0;
 
   68       m_outputResolutionY = 1.0;
 
   71       m_geomTransfName = 
"Affine";
 
  117       m_outputRasterPtr.reset();
 
  146       throw( te::rp::Exception )
 
  156       std::auto_ptr< te::gm::GeometricTransformation > transformationPtr;
 
  164           "Geometric transformation instatiation error" );        
 
  166           "Geometric transformation parameters calcule error" );
 
  171       double lowerLeftX = DBL_MAX;
 
  172       double lowerLeftY = DBL_MAX;
 
  173       double upperRightX = -1.0 * DBL_MAX;
 
  174       double upperRightY = -1.0 * DBL_MAX;     
 
  180         transformationPtr->directMap( -0.5, -0.5, mappedX, mappedY );
 
  181         lowerLeftX = std::min( lowerLeftX, mappedX );
 
  182         lowerLeftY = std::min( lowerLeftY, mappedY );
 
  183         upperRightX = std::max( upperRightX, mappedX );
 
  184         upperRightY = std::max( upperRightY, mappedY );        
 
  186         transformationPtr->directMap( 
 
  188           -0.5, mappedX, mappedY );
 
  189         lowerLeftX = std::min( lowerLeftX, mappedX );
 
  190         lowerLeftY = std::min( lowerLeftY, mappedY );
 
  191         upperRightX = std::max( upperRightX, mappedX );
 
  192         upperRightY = std::max( upperRightY, mappedY );
 
  194         transformationPtr->directMap( 
 
  198         lowerLeftX = std::min( lowerLeftX, mappedX );
 
  199         lowerLeftY = std::min( lowerLeftY, mappedY );
 
  200         upperRightX = std::max( upperRightX, mappedX );
 
  201         upperRightY = std::max( upperRightY, mappedY );
 
  203         transformationPtr->directMap( 
 
  207         lowerLeftX = std::min( lowerLeftX, mappedX );
 
  208         lowerLeftY = std::min( lowerLeftY, mappedY );
 
  209         upperRightX = std::max( upperRightX, mappedX );
 
  210         upperRightY = std::max( upperRightY, mappedY );          
 
  216         std::vector< te::rst::BandProperty* > bandsProperties;
 
  217         for( 
unsigned int inputRasterBandsIdx = 0 ; inputRasterBandsIdx <
 
  227         gridMbr->
m_llx = lowerLeftX;
 
  228         gridMbr->
m_lly = lowerLeftY;
 
  229         gridMbr->
m_urx = upperRightX;
 
  230         gridMbr->
m_ury = upperRightY;
 
  243           "Output raster creation error" );
 
  255       unsigned int outRow = 0;
 
  256       unsigned int outCol = 0;
 
  261       std::complex< double > cValue;
 
  263       for( 
unsigned int inputRasterBandsIdx = 0 ; inputRasterBandsIdx <
 
  270         double outputBandRangeMin = 0;
 
  271         double outputBandRangeMax = 0;
 
  273           outputBandRangeMin, outputBandRangeMax );        
 
  275         for( outRow = 0 ; outRow < nRows ; ++outRow )
 
  277           for( outCol = 0 ; outCol < nCols ; ++outCol )
 
  279             outputGrid.
gridToGeo( (
double)outCol, (
double)outRow, outX, outY );
 
  281             geomTransf.
inverseMap(  outX, outY, inCol, inRow );
 
  283             interpInstance.
getValue( inCol, inRow, cValue, inputBandIdx );
 
  285             if( cValue.real() == inputBandNoDataValue )
 
  291               outputBand.
setValue( outCol, outRow, std::max( outputBandRangeMin, 
 
  292                 std::min( outputBandRangeMax, cValue.real() ) ) );
 
  309       throw( te::rp::Exception )
 
  322         "Invalid m_inputRasterPtr" )
 
  329         "Invalid raster bands number" );
 
  331       for( 
unsigned int inRasterBandsIdx = 0 ; inRasterBandsIdx < 
 
  337           "Invalid raster bands" );
 
  342       std::auto_ptr< te::gm::GeometricTransformation > transformationPtr( 
 
  345         "Geometric transformation instatiation error" );
 
  348         transformationPtr->getMinRequiredTiePoints(),
 
  349         "Invalid tie-points number" )
 
  354         "Invalid m_outputSRID" )
 
  357         "Invalid m_outputResolutionX" )        
 
  360         "Invalid m_outputResolutionY" )        
 
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor). 
 
std::string m_geomTransfName
The name of the geometric transformation used (see each te::gm::GTFactory inherited classes to find e...
 
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ). 
 
unsigned int getNumberOfRows() const 
Returns the raster number of rows. 
 
const InputParameters & operator=(const InputParameters ¶ms)
 
double m_noDataValue
The pixel value used where no raster data is avaliable (defaul:0). 
 
Grid * getGrid()
It returns the raster grid. 
 
te::rst::Raster const * m_inputRasterPtr
Input raster. 
 
static Raster * make()
It creates and returns an empty raster with default raster driver. 
 
const OutputParameters & operator=(const OutputParameters ¶ms)
 
void reset()
Clear all internal allocated objects and reset the algorithm to its initial state. 
 
void getValue(const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
Get the interpolated value at specific band. 
 
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster. 
 
It interpolates one pixel based on a selected algorithm. Methods currently available are Nearest Neig...
 
static GeometricTransformation * make(const std::string &factoryKey)
It creates an object with the appropriated factory. 
 
std::vector< te::gm::GTParameters::TiePoint > m_tiePoints
Tie-points between each raster point (te::gm::GTParameters::TiePoint::first are raster lines/columns ...
 
AbstractParameters * clone() const 
Create a clone copy of this instance. 
 
#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...
 
int m_type
The data type of the elements in the band. 
 
Performs raster data registering into a SRS using a set of tie points. 
 
Abstract parameters base interface. 
 
std::vector< TiePoint > m_tiePoints
Tie points. 
 
Register output parameters. 
 
A raster band description. 
 
A rectified grid is the spatial support for raster data. 
 
double m_lly
Lower left corner y-coordinate. 
 
virtual void setValue(unsigned int c, unsigned int r, const double value)=0
Sets the cell attribute value. 
 
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
 
AbstractParameters * clone() const 
Create a clone copy of this instance. 
 
double m_ury
Upper right corner y-coordinate. 
 
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory). 
 
Register input parameters. 
 
double m_urx
Upper right corner x-coordinate. 
 
double m_outputResolutionY
The output raster Y axis resolution (default:1). 
 
double m_outputResolutionX
The output raster X axis resolution (default:1). 
 
unsigned int getNumberOfColumns() const 
Returns the raster number of columns. 
 
const Algorithm & operator=(const Algorithm &)
 
A raster band description. 
 
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits<double>::max(). 
 
Register::InputParameters m_inputParameters
Input execution parameters. 
 
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution. 
 
2D Geometric transformation base class. 
 
void gridToGeo(const double &col, const double &row, double &x, double &y) const 
Get the spatial location of a grid point. 
 
#define TERP_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not. 
 
Raster Processing algorithm output parameters base interface. 
 
double m_llx
Lower left corner x-coordinate. 
 
An abstract class for raster data strucutures. 
 
BandProperty * getProperty()
Returns the band property. 
 
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band. 
 
bool isInitialized() const 
Returns true if the algorithm instance is initialized and ready for execution. 
 
int m_outputSRID
The output raster SRID (default:0). 
 
2D Geometric transformation parameters. 
 
std::vector< unsigned int > m_inputRasterBands
Bands to process from the input raster. 
 
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters. 
 
An Envelope defines a 2D rectangular region. 
 
bool m_isInitialized
Tells if this instance is initialized. 
 
Near neighborhood interpolation method. 
 
TERASTEREXPORT void GetDataTypeRanges(const int &dataType, double &min, double &max)
Return the values range of a given data type. 
 
std::auto_ptr< te::rst::Raster > m_outputRasterPtr
The generated output registered raster. 
 
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
 
te::common::AccessPolicy getAccessPolicy() const 
Returns the raster access policy. 
 
virtual void inverseMap(const GTParameters ¶ms, const double &pt2X, const double &pt2Y, double &pt1X, double &pt1Y) const =0
Inverse mapping (from pt2 space into pt1 space). 
 
Raster Processing algorithm input parameters base interface.