72   value = std::complex<double>(vr, vi);
 
   77   setValue(c, r, value.real());
 
   79   setIValue(c, r, value.imag());
 
   84   std::complex<double> pixel;
 
   85   double min_img = std::numeric_limits<double>::max();
 
   86   double min_real = std::numeric_limits<double>::max();
 
   87   double no_data = getProperty()->m_noDataValue;
 
   89   if ((rf == cf) && (rf == 0))
 
   91     rf = getRaster()->getNumberOfRows() - 1;
 
   92     cf = getRaster()->getNumberOfColumns() - 1;
 
   95     const unsigned int maxInputPoints = 1000;
 
   96     if (readall == 
false && (rf * cf) > maxInputPoints)
 
  101       while (pit != pitend)
 
  106         if(pixel.real() == no_data)
 
  109         if (pixel.real() < min_real)
 
  110           min_real = pixel.real();
 
  112         if (pixel.imag() < min_img)
 
  113           min_img = pixel.imag();
 
  116       return std::complex<double>(min_real, min_img);
 
  121   for (
unsigned r = rs; r <= rf; r++)
 
  122     for (
unsigned c = cs; c <= cf; c++)
 
  124       getValue(c, r, pixel);
 
  126       if(pixel.real() == no_data)
 
  129       if (pixel.real() < min_real)
 
  130         min_real = pixel.real();
 
  132       if (pixel.imag() < min_img)
 
  133         min_img = pixel.imag();
 
  136   return std::complex<double>(min_real, min_img);
 
  141   std::complex<double> pixel;
 
  142   double max_img = std::numeric_limits<double>::min();
 
  143   double max_real = std::numeric_limits<double>::min();
 
  144   double no_data = getProperty()->m_noDataValue;
 
  146   if ((rf == cf) && (rf == 0))
 
  148     rf = getRaster()->getNumberOfRows() - 1;
 
  149     cf = getRaster()->getNumberOfColumns() - 1;
 
  152     const unsigned int maxInputPoints = 1000;
 
  153     if (readall == 
false && (rf * cf) > maxInputPoints)
 
  158       while (pit != pitend)
 
  163         if(pixel.real() == no_data)
 
  166         if (pixel.real() > max_real)
 
  167           max_real = pixel.real();
 
  169         if (pixel.imag() > max_img)
 
  170           max_img = pixel.imag();
 
  173       return std::complex<double>(max_real, max_img);
 
  178   for (
unsigned r = rs; r <= rf; r++)
 
  179     for (
unsigned c = cs; c <= cf; c++)
 
  181       getValue(c, r, pixel);
 
  183       if(pixel.real() == no_data)
 
  186       if (pixel.real() > max_real)
 
  187         max_real = pixel.real();
 
  189       if (pixel.imag() > max_img)
 
  190         max_img = pixel.imag();
 
  193   return std::complex<double>(max_real, max_img);
 
  198   if ((rf == cf) && (rf  == 0))
 
  200     rf = getRaster()->getNumberOfRows() - 1;
 
  202     cf = getRaster()->getNumberOfColumns() - 1;
 
  205   std::complex<double> pixel;
 
  207   std::complex<double> mean = getMeanValue(rs, cs, rf, cf);
 
  209   std::complex<double> diff;
 
  211   std::complex<double> sumDiffs(0.0, 0.0);
 
  213   unsigned n = (rf-rs+1) * (cf-cs+1) - 1;
 
  216     return std::complex<double> (1.0, 1.0);
 
  218   for (
unsigned r = rs; r <= rf; r++)
 
  219     for (
unsigned c = cs; c <= cf; c++)
 
  221       getValue(c, r, pixel);
 
  225       sumDiffs += diff * diff;
 
  228   return std::complex<double> (std::sqrt(sumDiffs.real() / n), std::sqrt(sumDiffs.imag() / n));
 
  233   if ((rf == cf) && (rf  == 0))
 
  235     rf = getRaster()->getNumberOfRows() - 1;
 
  237     cf = getRaster()->getNumberOfColumns() - 1;
 
  240   std::complex<double> pixel;
 
  242   std::complex<double> sumValue(0.0, 0.0);
 
  244   unsigned int n = (rf-rs+1) * (cf-cs+1);
 
  246   for (
unsigned r = rs; r <= rf; r++)
 
  247     for (
unsigned c = cs; c <= cf; c++)
 
  249       getValue(c, r, pixel);
 
  255     return std::complex<double> (0.0, 0.0);
 
  257   return std::complex<double> (sumValue.real() / n, sumValue.imag() / n);
 
  262   if ((rf == cf) && (rf  == 0))
 
  264     rf = getRaster()->getNumberOfRows() - 1;
 
  266     cf = getRaster()->getNumberOfColumns() - 1;
 
  269   std::map<double, unsigned> hist;
 
  274     for (
unsigned r = rs; r <= rf; r++)
 
  275       for (
unsigned c = cs; c <= cf; c++)
 
  277         getValue(c, r, pixel);
 
  284     double pmin = std::numeric_limits<double>::max();
 
  285     double pmax = -1.0 * std::numeric_limits<double>::max();
 
  287     for (
unsigned r = rs; r <= rf; r++)
 
  288       for (
unsigned c = cs; c <= cf; c++)
 
  290         getValue(c, r, pixel);
 
  300     double delta = (pmax * 1.000001 - pmin) / b;
 
  302     std::map<std::size_t, double> binsLocations;
 
  304     std::size_t location = 0;
 
  306     for (
double bins = pmin; bins < pmax; bins += delta)
 
  310       binsLocations[location++] = bins;
 
  314     for (
unsigned r = rs; r <= rf; r++)
 
  315       for (
unsigned c = cs; c <= cf; c++)
 
  317         getValue(c, r, pixel);
 
  319         location = (std::size_t) ((pixel - pmin) / delta);
 
  321         hist[binsLocations[location]]++;
 
  325     for (
double bins = pmin; bins < pmax; bins += delta)
 
  336   if ((rf == cf) && (rf  == 0))
 
  338     rf = getRaster()->getNumberOfRows() - 1;
 
  340     cf = getRaster()->getNumberOfColumns() - 1;
 
  343   std::map<double, unsigned> hist;
 
  348     for (
unsigned r = rs; r <= rf; r++)
 
  349       for (
unsigned c = cs; c <= cf; c++)
 
  351         getIValue(c, r, pixel);
 
  358     double pmin = std::numeric_limits<double>::max();
 
  359     double pmax = -1.0 * std::numeric_limits<double>::max();
 
  361     for (
unsigned r = rs; r <= rf; r++)
 
  362       for (
unsigned c = cs; c <= cf; c++)
 
  364         getIValue(c, r, pixel);
 
  374     double delta = (pmax * 1.000001 - pmin) / b;
 
  376     std::map<std::size_t, double> binsLocations;
 
  378     std::size_t location = 0;
 
  380     for (
double bins = pmin; bins < pmax; bins += delta)
 
  384       binsLocations[location++] = bins;
 
  388     for (
unsigned r = rs; r <= rf; r++)
 
  389       for (
unsigned c = cs; c <= cf; c++)
 
  391         getIValue(c, r, pixel);
 
  393         location = (std::size_t) ((pixel - pmin) / delta);
 
  395         hist[binsLocations[location]]++;
 
  399     for (
double bins = pmin; bins < pmax; bins += delta)
 
  410   return m_property->m_valuesScale;
 
  415   m_property->m_valuesScale = s;
 
  420   return m_property->m_valuesOffset;
 
  425   m_property->m_valuesOffset = o;
 
  444   std::complex<double> lhsv, rhsv;
 
  446   std::vector<std::pair<unsigned, unsigned> > rcStPos, rcFPos;
 
  450   for (
unsigned x = 0; x < (unsigned) getProperty()->m_nblocksx; x++)
 
  452     for (
unsigned y = 0; y < (unsigned) getProperty()->m_nblocksy; y++)
 
  454       rcStPos.push_back(std::pair<unsigned, unsigned> (y * getProperty()->m_blkh, x * getProperty()->m_blkw));
 
  455       last_y = (y + 1) * getProperty()->m_blkh;
 
  456       last_x = (x + 1) * getProperty()->m_blkw;
 
  457       if (last_y > getRaster()->getNumberOfRows())
 
  458         last_y = getRaster()->getNumberOfRows();
 
  459       if (last_x > getRaster()->getNumberOfColumns())
 
  460         last_x = getRaster()->getNumberOfColumns();
 
  461       rcFPos.push_back(std::pair<unsigned, unsigned> (last_y, last_x));
 
  466   if (getProperty()->m_noDataValue == std::numeric_limits<double>::max())
 
  468     for (
unsigned i = 0; i < rcStPos.size(); i++)
 
  470       for (
unsigned r = rcStPos[i].first; r < rcFPos[i].first; r++)
 
  471         for (
unsigned c = rcStPos[i].second; c < rcFPos[i].second; c++)
 
  473           getValue(c, r, lhsv);
 
  476           lhsv = f(lhsv, rhsv);
 
  477           setValue(c, r, lhsv);
 
  484     for (
unsigned i = 0; i < rcStPos.size(); i++)
 
  486       for (
unsigned r = rcStPos[i].first; r < rcFPos[i].first; r++)
 
  487         for (
unsigned c = rcStPos[i].second; c < rcFPos[i].second; c++)
 
  490           getValue(c, r, lhsv);
 
  491           if (lhsv.real() == getProperty()->m_noDataValue)
 
  499           lhsv = f(lhsv, rhsv);
 
  500           setValue(c, r, lhsv);
 
  512   std::complex<double> lhsv;
 
  514   std::vector<std::pair<unsigned, unsigned> > rcStPos, rcFPos;
 
  518   for (
unsigned x = 0; x < (unsigned) getProperty()->m_nblocksx; x++)
 
  520     for (
unsigned y = 0; y < (unsigned) getProperty()->m_nblocksy; y++)
 
  522       rcStPos.push_back(std::pair<unsigned, unsigned> (y * getProperty()->m_blkh, x * getProperty()->m_blkw));
 
  523       last_y = (y + 1) * getProperty()->m_blkh;
 
  524       last_x = (x + 1) * getProperty()->m_blkw;
 
  525       if (last_y > getRaster()->getNumberOfRows())
 
  526         last_y = getRaster()->getNumberOfRows();
 
  527       if (last_x > getRaster()->getNumberOfColumns())
 
  528         last_x = getRaster()->getNumberOfColumns();
 
  529       rcFPos.push_back(std::pair<unsigned, unsigned> (last_y, last_x));
 
  534   if (getProperty()->m_noDataValue == std::numeric_limits<double>::max())
 
  536     for (
unsigned i = 0; i < rcStPos.size(); i++)
 
  538       for (
unsigned r = rcStPos[i].first; r < rcFPos[i].first; r++)
 
  539         for (
unsigned c = rcStPos[i].second; c < rcFPos[i].second; c++)
 
  541           getValue(c, r, lhsv);
 
  543           lhsv = f(lhsv, cvalue);
 
  544           setValue(c, r, lhsv);
 
  551     for (
unsigned i = 0; i < rcStPos.size(); i++)
 
  553       for (
unsigned r = rcStPos[i].first; r < rcFPos[i].first; r++)
 
  554         for (
unsigned c = rcStPos[i].second; c < rcFPos[i].second; c++)
 
  557           getValue(c, r, lhsv);
 
  558           if (lhsv.real() == getProperty()->m_noDataValue)
 
  561           lhsv = f(lhsv, cvalue);
 
  562           setValue(c, r, lhsv);
 
  570 std::complex<double> 
plus(std::complex<double> lhs, std::complex<double> rhs)
 
  575 std::complex<double> 
minus(std::complex<double> lhs, std::complex<double> rhs)
 
  580 std::complex<double> 
times(std::complex<double> lhs, std::complex<double> rhs)
 
  585 std::complex<double> 
divide(std::complex<double> lhs, std::complex<double> rhs)
 
  592   return callOperator(
plus, rhs);
 
  597   return callOperator(
plus, cvalue);
 
  602   return callOperator(
minus, rhs);
 
  607   return callOperator(
minus, cvalue);
 
  612   return callOperator(
times, cvalue);
 
  617   return callOperator(
times, rhs);
 
  622   return callOperator(
divide, rhs);
 
  627   return callOperator(
divide, cvalue);
 
  632   int blkw = m_property->m_blkw;
 
  634   int blkh = m_property->m_blkh;
 
  638   int blksize = blkw * blkh * pxlsize;
 
Band(BandProperty *p, std::size_t idx)
Constructor. 
 
It describes one band (or dimension) of a raster. 
 
virtual void getValue(unsigned int c, unsigned int r, double &value) const =0
Returns the cell attribute value. 
 
std::complex< double > getOffsetValue() const 
It returns the offset values (real and imaginary) to be applied to the band. 
 
A raster band description. 
 
std::complex< double > times(std::complex< double > lhs, std::complex< double > rhs)
 
unsigned int getNumberOfColumns() const 
Returns the raster number of columns. 
 
virtual Band & operator*=(Band &rhs)
It returns the band product (pixel by pixel). 
 
virtual Band & operator=(const Band &rhs)
Assignment operator. 
 
std::complex< double > divide(std::complex< double > lhs, std::complex< double > rhs)
 
unsigned int getColumn() const 
Returns the current column in iterator. 
 
static PointSetIterator end(const te::rst::Raster *r, const std::vector< te::gm::Point * > p)
Returns an iterator referring to after the end of the iterator. 
 
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits::max(). 
 
void setScaleValue(const std::complex< double > s)
Sets the scale values (real and imaginary) to be applied to the band. 
 
void setOffsetValue(const std::complex< double > o)
Sets the offset values (real and imaginary) to be applied to the band. 
 
virtual std::map< double, unsigned > getHistogramR(unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0, unsigned int b=0) const 
It computes and returns the histogram occurring values (real part) in a window of the band...
 
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
 
virtual Band & operator+=(Band &rhs)
It returns the band sum (pixel by pixel). 
 
Band & callOperator(std::complex< double >(*f)(std::complex< double >, std::complex< double >), Band &rhs)
It calls a parameter function f to apply in all pixels from two bands, e.g. pixel = f(lhs...
 
std::complex< double > plus(std::complex< double > lhs, std::complex< double > rhs)
 
virtual std::map< double, unsigned > getHistogramI(unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0, unsigned int b=0) const 
It computes and returns the histogram occurring values (imaginary part) in a window of the band...
 
virtual std::complex< double > getMaxValue(bool readall=false, unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const 
It computes and returns the maximum occurring value in a window of the band. 
 
virtual std::complex< double > getStdValue(unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const 
It computes and returns the standard deviation of the occurring values in a window of the band...
 
unsigned int getNumberOfRows() const 
Returns the raster number of rows. 
 
BandProperty * getProperty()
Returns the band property. 
 
Utility functions for the raster module. 
 
virtual Raster * getRaster() const =0
Returns the associated raster. 
 
virtual Band & operator-=(Band &rhs)
It returns the band subtraction (pixel by pixel). 
 
It gives access to values in one band (dimension) of a raster. 
 
A raster band description. 
 
std::complex< double > getScaleValue() const 
It returns the scale values (real and imaginary) to be applied to the band. 
 
TERASTEREXPORT int GetPixelSize(int datatype)
Returns the byte size of a given datatype. 
 
std::complex< double > minus(std::complex< double > lhs, std::complex< double > rhs)
 
virtual void setValue(unsigned int c, unsigned int r, const double value)=0
Sets the cell attribute value. 
 
virtual Band & operator/=(Band &rhs)
It returns the band division (pixel by pixel). 
 
virtual std::complex< double > getMinValue(bool readall=false, unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const 
It computes and returns the minimum occurring value in a window of the band. 
 
virtual std::complex< double > getMeanValue(unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const 
It computes and returns the mean of the occurring values in a window of the band. ...
 
TERASTEREXPORT std::vector< te::gm::Point * > GetRandomPointsInRaster(const te::rst::Raster &inputRaster, unsigned int numberOfPoints=1000)
Creates a vector of random positions (points) inside the raster. 
 
std::size_t m_idx
The band index. 
 
virtual int getBlockSize() const 
It returns the number of bytes ocuppied by a data block. 
 
unsigned int getRow() const 
Returns the current row in iterator. 
 
virtual ~Band()
Virtual destructor. 
 
static PointSetIterator begin(const te::rst::Raster *r, const std::vector< te::gm::Point * > p)
Returns an iterator referring to the first value of the band. 
 
BandProperty * m_property
The band information.