70   value = std::complex<double>(vr, vi);
 
   75   setValue(c, r, value.real());
 
   77   setIValue(c, r, value.imag());
 
   82   if ((rf == cf) && (rf  == 0))
 
   84     rf = getRaster()->getNumberOfRows() - 1;
 
   86     cf = getRaster()->getNumberOfColumns() - 1;
 
   89   std::complex<double> pixel;
 
   91   double min_img = std::numeric_limits<double>::max();
 
   92   double min_real = std::numeric_limits<double>::max();
 
   94   for (
unsigned r = rs; r <= rf; r++)
 
   95     for (
unsigned c = cs; c <= cf; c++)
 
   97       getValue(c, r, pixel);
 
   99       if (pixel.real() < min_real)
 
  100         min_real = pixel.real();
 
  102       if (pixel.imag() < min_img)
 
  103         min_img = pixel.imag();
 
  106   return std::complex<double>(min_real, min_img);
 
  111   if ((rf == cf) && (rf  == 0))
 
  113     rf = getRaster()->getNumberOfRows() - 1;
 
  115     cf = getRaster()->getNumberOfColumns() - 1;
 
  118   std::complex<double> pixel;
 
  120   double max_img = -1.0 * std::numeric_limits<double>::max();
 
  121   double max_real = -1.0 * std::numeric_limits<double>::max();
 
  123   for (
unsigned r = rs; r <= rf; r++)
 
  124     for (
unsigned c = cs; c <= cf; c++)
 
  126       getValue(c, r, pixel);
 
  128       if (pixel.real() > max_real)
 
  129         max_real = pixel.real();
 
  131       if (pixel.imag() > max_img)
 
  132         max_img = pixel.imag();
 
  135   return std::complex<double>(max_real, max_img);
 
  140   if ((rf == cf) && (rf  == 0))
 
  142     rf = getRaster()->getNumberOfRows() - 1;
 
  144     cf = getRaster()->getNumberOfColumns() - 1;
 
  147   std::complex<double> pixel;
 
  149   std::complex<double> mean = getMeanValue(rs, cs, rf, cf);
 
  151   std::complex<double> diff;
 
  153   std::complex<double> sumDiffs(0.0, 0.0);
 
  155   unsigned n = (rf-rs+1) * (cf-cs+1) - 1;
 
  158     return std::complex<double> (1.0, 1.0);
 
  160   for (
unsigned r = rs; r <= rf; r++)
 
  161     for (
unsigned c = cs; c <= cf; c++)
 
  163       getValue(c, r, pixel);
 
  167       sumDiffs += diff * diff;
 
  170   return std::complex<double> (std::sqrt(sumDiffs.real() / n), std::sqrt(sumDiffs.imag() / n));
 
  175   if ((rf == cf) && (rf  == 0))
 
  177     rf = getRaster()->getNumberOfRows() - 1;
 
  179     cf = getRaster()->getNumberOfColumns() - 1;
 
  182   std::complex<double> pixel;
 
  184   std::complex<double> sumValue(0.0, 0.0);
 
  186   unsigned int n = (rf-rs+1) * (cf-cs+1);
 
  188   for (
unsigned r = rs; r <= rf; r++)
 
  189     for (
unsigned c = cs; c <= cf; c++)
 
  191       getValue(c, r, pixel);
 
  197     return std::complex<double> (0.0, 0.0);
 
  199   return std::complex<double> (sumValue.real() / n, sumValue.imag() / n);
 
  204   if ((rf == cf) && (rf  == 0))
 
  206     rf = getRaster()->getNumberOfRows() - 1;
 
  208     cf = getRaster()->getNumberOfColumns() - 1;
 
  211   std::map<double, unsigned> hist;
 
  216     for (
unsigned r = rs; r <= rf; r++)
 
  217       for (
unsigned c = cs; c <= cf; c++)
 
  219         getValue(c, r, pixel);
 
  226     double pmin = std::numeric_limits<double>::max();
 
  227     double pmax = -1.0 * std::numeric_limits<double>::max();
 
  229     for (
unsigned r = rs; r <= rf; r++)
 
  230       for (
unsigned c = cs; c <= cf; c++)
 
  232         getValue(c, r, pixel);
 
  242     double delta = (pmax * 1.000001 - pmin) / b;
 
  244     std::map<std::size_t, double> binsLocations;
 
  246     std::size_t location = 0;
 
  248     for (
double bins = pmin; bins < pmax; bins += delta)
 
  252       binsLocations[location++] = bins;
 
  256     for (
unsigned r = rs; r <= rf; r++)
 
  257       for (
unsigned c = cs; c <= cf; c++)
 
  259         getValue(c, r, pixel);
 
  261         location = (std::size_t) ((pixel - pmin) / delta);
 
  263         hist[binsLocations[location]]++;
 
  267     for (
double bins = pmin; bins < pmax; bins += delta)
 
  278   if ((rf == cf) && (rf  == 0))
 
  280     rf = getRaster()->getNumberOfRows() - 1;
 
  282     cf = getRaster()->getNumberOfColumns() - 1;
 
  285   std::map<double, unsigned> hist;
 
  290     for (
unsigned r = rs; r <= rf; r++)
 
  291       for (
unsigned c = cs; c <= cf; c++)
 
  293         getIValue(c, r, pixel);
 
  300     double pmin = std::numeric_limits<double>::max();
 
  301     double pmax = -1.0 * std::numeric_limits<double>::max();
 
  303     for (
unsigned r = rs; r <= rf; r++)
 
  304       for (
unsigned c = cs; c <= cf; c++)
 
  306         getIValue(c, r, pixel);
 
  316     double delta = (pmax * 1.000001 - pmin) / b;
 
  318     std::map<std::size_t, double> binsLocations;
 
  320     std::size_t location = 0;
 
  322     for (
double bins = pmin; bins < pmax; bins += delta)
 
  326       binsLocations[location++] = bins;
 
  330     for (
unsigned r = rs; r <= rf; r++)
 
  331       for (
unsigned c = cs; c <= cf; c++)
 
  333         getIValue(c, r, pixel);
 
  335         location = (std::size_t) ((pixel - pmin) / delta);
 
  337         hist[binsLocations[location]]++;
 
  341     for (
double bins = pmin; bins < pmax; bins += delta)
 
  352   return m_property->m_valuesScale;
 
  357   m_property->m_valuesScale = s;
 
  362   return m_property->m_valuesOffset;
 
  367   m_property->m_valuesOffset = o;
 
  386   std::complex<double> lhsv, rhsv;
 
  388   std::vector<std::pair<unsigned, unsigned> > rcStPos, rcFPos;
 
  392   for (
unsigned x = 0; x < (unsigned) getProperty()->m_nblocksx; x++)
 
  394     for (
unsigned y = 0; y < (unsigned) getProperty()->m_nblocksy; y++)
 
  396       rcStPos.push_back(std::pair<unsigned, unsigned> (y * getProperty()->m_blkh, x * getProperty()->m_blkw));
 
  397       last_y = (y + 1) * getProperty()->m_blkh;
 
  398       last_x = (x + 1) * getProperty()->m_blkw;
 
  399       if (last_y > getRaster()->getNumberOfRows())
 
  400         last_y = getRaster()->getNumberOfRows();
 
  401       if (last_x > getRaster()->getNumberOfColumns())
 
  402         last_x = getRaster()->getNumberOfColumns();
 
  403       rcFPos.push_back(std::pair<unsigned, unsigned> (last_y, last_x));
 
  408   if (getProperty()->m_noDataValue == std::numeric_limits<double>::max())
 
  410     for (
unsigned i = 0; i < rcStPos.size(); i++)
 
  412       for (
unsigned r = rcStPos[i].first; r < rcFPos[i].first; r++)
 
  413         for (
unsigned c = rcStPos[i].second; c < rcFPos[i].second; c++)
 
  415           getValue(c, r, lhsv);
 
  418           lhsv = f(lhsv, rhsv);
 
  419           setValue(c, r, lhsv);
 
  426     for (
unsigned i = 0; i < rcStPos.size(); i++)
 
  428       for (
unsigned r = rcStPos[i].first; r < rcFPos[i].first; r++)
 
  429         for (
unsigned c = rcStPos[i].second; c < rcFPos[i].second; c++)
 
  432           getValue(c, r, lhsv);
 
  433           if (lhsv.real() == getProperty()->m_noDataValue)
 
  441           lhsv = f(lhsv, rhsv);
 
  442           setValue(c, r, lhsv);
 
  454   std::complex<double> lhsv;
 
  456   std::vector<std::pair<unsigned, unsigned> > rcStPos, rcFPos;
 
  460   for (
unsigned x = 0; x < (unsigned) getProperty()->m_nblocksx; x++)
 
  462     for (
unsigned y = 0; y < (unsigned) getProperty()->m_nblocksy; y++)
 
  464       rcStPos.push_back(std::pair<unsigned, unsigned> (y * getProperty()->m_blkh, x * getProperty()->m_blkw));
 
  465       last_y = (y + 1) * getProperty()->m_blkh;
 
  466       last_x = (x + 1) * getProperty()->m_blkw;
 
  467       if (last_y > getRaster()->getNumberOfRows())
 
  468         last_y = getRaster()->getNumberOfRows();
 
  469       if (last_x > getRaster()->getNumberOfColumns())
 
  470         last_x = getRaster()->getNumberOfColumns();
 
  471       rcFPos.push_back(std::pair<unsigned, unsigned> (last_y, last_x));
 
  476   if (getProperty()->m_noDataValue == std::numeric_limits<double>::max())
 
  478     for (
unsigned i = 0; i < rcStPos.size(); i++)
 
  480       for (
unsigned r = rcStPos[i].first; r < rcFPos[i].first; r++)
 
  481         for (
unsigned c = rcStPos[i].second; c < rcFPos[i].second; c++)
 
  483           getValue(c, r, lhsv);
 
  485           lhsv = f(lhsv, cvalue);
 
  486           setValue(c, r, lhsv);
 
  493     for (
unsigned i = 0; i < rcStPos.size(); i++)
 
  495       for (
unsigned r = rcStPos[i].first; r < rcFPos[i].first; r++)
 
  496         for (
unsigned c = rcStPos[i].second; c < rcFPos[i].second; c++)
 
  499           getValue(c, r, lhsv);
 
  500           if (lhsv.real() == getProperty()->m_noDataValue)
 
  503           lhsv = f(lhsv, cvalue);
 
  504           setValue(c, r, lhsv);
 
  512 std::complex<double> 
plus(std::complex<double> lhs, std::complex<double> rhs)
 
  517 std::complex<double> 
minus(std::complex<double> lhs, std::complex<double> rhs)
 
  522 std::complex<double> 
times(std::complex<double> lhs, std::complex<double> rhs)
 
  527 std::complex<double> 
divide(std::complex<double> lhs, std::complex<double> rhs)
 
  534   return callOperator(
plus, rhs);
 
  539   return callOperator(
plus, cvalue);
 
  544   return callOperator(
minus, rhs);
 
  549   return callOperator(
minus, cvalue);
 
  554   return callOperator(
times, cvalue);
 
  559   return callOperator(
times, rhs);
 
  564   return callOperator(
divide, rhs);
 
  569   return callOperator(
divide, cvalue);
 
  574   int blkw = m_property->m_blkw;
 
  576   int blkh = m_property->m_blkh;
 
  580   int blksize = blkw * blkh * pxlsize;
 
Band(BandProperty *p, std::size_t idx)
Constructor. 
 
virtual std::complex< double > getMinValue(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. 
 
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)
 
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...
 
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 > 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). 
 
virtual std::complex< double > getMaxValue(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. 
 
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 > 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. ...
 
std::size_t m_idx
The band index. 
 
virtual int getBlockSize() const 
It returns the number of bytes ocuppied by a data block. 
 
virtual ~Band()
Virtual destructor. 
 
BandProperty * m_property
The band information.