All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
KernelFunctions.cpp
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/sa/core/KernelFunctions.cpp
22 
23  \brief This file contains a functions used by the kernel operation.
24 
25  \reference Adapted from TerraLib4.
26 */
27 
28 #define M_PI 3.14159265358979323846
29 
30 //TerraLib
31 #include "../../common/Exception.h"
32 #include "../../common/Translator.h"
33 #include "../../common/progress/TaskProgress.h"
34 #include "../../memory/DataSet.h"
35 #include "../../raster/Grid.h"
36 #include "../../raster/Raster.h"
37 #include "KernelFunctions.h"
38 #include "StatisticsFunctions.h"
39 #include "Utils.h"
40 
42 {
43  assert(params);
44  assert(raster);
45 
46  double totKernel = 0.;
47 
48  //create task
50 
51  task.setTotalSteps(raster->getNumberOfRows());
52  task.setMessage(TE_TR("Calculating Kernel."));
53 
54  //fill raster
55  for(unsigned int i = 0; i < raster->getNumberOfRows(); ++i)
56  {
57  for(unsigned int j = 0; j < raster->getNumberOfColumns(); ++j)
58  {
59  te::gm::Coord2D coord = raster->getGrid()->gridToGeo(j, i);
60 
61  //calculate box to search
62  te::gm::Envelope ext(coord.x, coord.y, coord.x, coord.y);
63 
64  ext.m_llx -= radius;
65  ext.m_lly -= radius;
66  ext.m_urx += radius;
67  ext.m_ury += radius;
68 
69  //get all elements
70  if(params->m_functionType == te::sa::Normal)
71  {
72  ext = kTree.getMBR();
73  }
74 
75  //search
76  std::vector<int> results;
77  kTree.search(ext, results);
78 
79  //calculate kernel value
80  double val = KernelValue(params, kMap, radius, coord, results);
81 
82  totKernel += val;
83 
84  //set value
85  raster->setValue(j, i, val, 0);
86  }
87 
88  if(!task.isActive())
89  {
90  throw te::common::Exception(TE_TR("Operation canceled by the user."));
91  }
92 
93  task.pulse();
94  }
95 
96  //normalize output raster
97  GridKernelNormalize(params, kMap, raster, totKernel);
98 }
99 
101 {
102  assert(params);
103  assert(raster);
104 
105  //Evaluate kernel with a fixed radius, based on formula...
106  double radius = 0.68*pow((double)kMap.size(),-0.2)*sqrt(kTree.getMBR().getArea());
107  double sqArea = sqrt(kTree.getMBR().getArea());
108 
109  te::sa::GridStatRadiusKernel(params, kTree, kMap, raster, radius);
110 
111  //Evaluate geometric mean of kernel values, to adjust radius
112  double meanKernel = KernelGeometricMean(kMap);
113 
114  if(meanKernel <= 0.)
115  throw;
116 
117  //create task
119 
120  task.setTotalSteps(raster->getNumberOfRows());
121  task.setMessage(TE_TR("Calculating Adaptative Kernel."));
122 
123  //Reassign radius, evaluating final value for kernel
124  double totKernel = 0.;
125 
126  for(unsigned int i = 0; i < raster->getNumberOfRows(); ++i)
127  {
128  for(unsigned int j = 0; j < raster->getNumberOfColumns(); ++j)
129  {
130  te::gm::Coord2D coord = raster->getGrid()->gridToGeo(j, i);
131 
132  //calculate box to search
133  te::gm::Envelope ext(coord.x, coord.y, coord.x, coord.y);
134 
135  ext.m_llx -= radius;
136  ext.m_lly -= radius;
137  ext.m_urx += radius;
138  ext.m_ury += radius;
139 
140  //get all elements
141  if(params->m_functionType == te::sa::Normal)
142  {
143  ext = kTree.getMBR();
144  }
145 
146  //search
147  std::vector<int> results;
148  kTree.search(ext, results);
149 
150  //calculate new kernel valeu from old kernel value
151  double newKernel = 0.;
152  double prevKernel;
153  raster->getValue(j, i, prevKernel);
154 
155  if(prevKernel > 0.)
156  {
157  //set new radius value
158  double newRadius = radius * pow((meanKernel / prevKernel), 0.5);
159 
160  //limit the radius
161  if(newRadius > sqArea / 4.)
162  newRadius = sqArea / 4.;
163 
164  //calculate kernel value
165  newKernel = KernelValue(params, kMap, newRadius, coord, results);
166  }
167 
168  totKernel += newKernel;
169 
170  //set value
171  raster->setValue(j, i, newKernel, 0);
172  }
173 
174  if(!task.isActive())
175  {
176  throw te::common::Exception(TE_TR("Operation canceled by the user."));
177  }
178 
179  task.pulse();
180  }
181 
182  //normalize output raster
183  GridKernelNormalize(params, kMap, raster, totKernel);
184 }
185 
187 {
188  double area = rasterOut->getResolutionX() * rasterOut->getResolutionY();
189 
190  //create task
192 
193  task.setTotalSteps(rasterOut->getNumberOfRows());
194  task.setMessage(TE_TR("Calculating Kernel Ratio."));
195 
196  for(unsigned int i = 0; i < rasterOut->getNumberOfRows(); ++i)
197  {
198  for(unsigned int j = 0; j < rasterOut->getNumberOfColumns(); ++j)
199  {
200  double kernelValue = 0.;
201 
202  double kernelA = 0.;
203  rasterA->getValue(j, i, kernelA);
204 
205  double kernelB = 0.;
206  rasterB->getValue(j, i, kernelB);
207 
208  //calculate kernel ratio value
209  kernelValue = KernelRatioValue(params, area, kernelA, kernelB);
210 
211  rasterOut->setValue(j, i, kernelValue);
212  }
213 
214  if(!task.isActive())
215  {
216  throw te::common::Exception(TE_TR("Operation canceled by the user."));
217  }
218 
219  task.pulse();
220  }
221 }
222 
223 void te::sa::DataSetStatRadiusKernel(te::sa::KernelInputParams* params, te::sa::KernelTree& kTree, te::sa::KernelMap& kMap, te::mem::DataSet* ds, int kernelIdx, int geomIdx, double radius)
224 {
225  assert(params);
226  assert(ds);
227 
228  double totKernel = 0.;
229 
230  //create task
232 
233  task.setTotalSteps(ds->size());
234  task.setMessage(TE_TR("Calculating Kernel."));
235 
236  //calculate kernel attribute value
237  ds->moveBeforeFirst();
238 
239  while(ds->moveNext())
240  {
241  std::auto_ptr<te::gm::Geometry> geom = ds->getGeometry(geomIdx);
242 
243  te::gm::Coord2D coord = te::sa::GetCentroidCoord(geom.get());
244 
245  //calculate box to search
246  te::gm::Envelope ext(coord.x, coord.y, coord.x, coord.y);
247 
248  ext.m_llx -= radius;
249  ext.m_lly -= radius;
250  ext.m_urx += radius;
251  ext.m_ury += radius;
252 
253  //get all elements
254  if(params->m_functionType == te::sa::Normal)
255  {
256  ext = kTree.getMBR();
257  }
258 
259  //search
260  std::vector<int> results;
261  kTree.search(ext, results);
262 
263  //calculate kernel value
264  double val = KernelValue(params, kMap, radius, coord, results);
265 
266  totKernel += val;
267 
268  //set value
269  ds->setDouble(kernelIdx, val);
270 
271  if(!task.isActive())
272  {
273  throw te::common::Exception(TE_TR("Operation canceled by the user."));
274  }
275 
276  task.pulse();
277  }
278 
279  //normalize output raster
280  DataSetKernelNormalize(params, kMap, ds, kernelIdx, geomIdx, totKernel);
281 }
282 
284 {
285  assert(params);
286  assert(ds);
287 
288  //Evaluate kernel with a fixed radius, based on formula...
289  double radius = 0.68*pow((double)kMap.size(),-0.2)*sqrt(kTree.getMBR().getArea());
290  double sqArea = sqrt(kTree.getMBR().getArea());
291 
292  te::sa::DataSetStatRadiusKernel(params, kTree, kMap, ds, kernelIdx, geomIdx, radius);
293 
294  //Evaluate geometric mean of kernel values, to adjust radius
295  double meanKernel = KernelGeometricMean(kMap);
296 
297  if(meanKernel <= 0.)
298  throw;
299 
300  //create task
302 
303  task.setTotalSteps(ds->size());
304  task.setMessage(TE_TR("Calculating Adaptative Kernel."));
305 
306  //Reassign radius, evaluating final value for kernel
307  double totKernel = 0.;
308 
309  ds->moveBeforeFirst();
310 
311  while(ds->moveNext())
312  {
313  std::auto_ptr<te::gm::Geometry> geom = ds->getGeometry(geomIdx);
314 
315  te::gm::Coord2D coord = te::sa::GetCentroidCoord(geom.get());
316 
317  //calculate box to search
318  te::gm::Envelope ext(coord.x, coord.y, coord.x, coord.y);
319 
320  ext.m_llx -= radius;
321  ext.m_lly -= radius;
322  ext.m_urx += radius;
323  ext.m_ury += radius;
324 
325  //get all elements
326  if(params->m_functionType == te::sa::Normal)
327  {
328  ext = kTree.getMBR();
329  }
330 
331  //search
332  std::vector<int> results;
333  kTree.search(ext, results);
334 
335  //calculate new kernel valeu from old kernel value
336  double newKernel = 0.;
337  double prevKernel = ds->getDouble(kernelIdx);
338 
339  if(prevKernel > 0.)
340  {
341  //set new radius value
342  double newRadius = radius * pow((meanKernel / prevKernel), 0.5);
343 
344  //limit the radius
345  if(newRadius > sqArea / 4.)
346  newRadius = sqArea / 4.;
347 
348  //calculate kernel value
349  newKernel = KernelValue(params, kMap, newRadius, coord, results);
350  }
351 
352  totKernel += newKernel;
353 
354  //set value
355  ds->setDouble(kernelIdx, newKernel);
356 
357  if(!task.isActive())
358  {
359  throw te::common::Exception(TE_TR("Operation canceled by the user."));
360  }
361 
362  task.pulse();
363  }
364 
365  //normalize output raster
366  DataSetKernelNormalize(params, kMap, ds, kernelIdx, geomIdx, totKernel);
367 }
368 
370 {
371  dsA->moveBeforeFirst();
372  dsB->moveBeforeFirst();
373  dsOut->moveBeforeFirst();
374 
375  //create task
377 
378  task.setTotalSteps(dsA->size());
379  task.setMessage(TE_TR("Calculating Kernel Ratio."));
380 
381  while(dsA->moveNext() && dsB->moveNext() && dsOut->moveNext())
382  {
383  double kernelValue = 0.;
384  double kernelA = dsA->getDouble(kernelIdx);
385  double kernelB = dsB->getDouble(kernelIdx);
386 
387  std::auto_ptr<te::gm::Geometry> geom = dsOut->getGeometry(geomIdx);
388 
389  double area = te::sa::GetArea(geom.get());
390 
391  //calculate kernel ratio value
392  kernelValue = KernelRatioValue(params, area, kernelA, kernelB);
393 
394  dsOut->setDouble(kernelIdx, kernelValue);
395 
396  if(!task.isActive())
397  {
398  throw te::common::Exception(TE_TR("Operation canceled by the user."));
399  }
400 
401  task.pulse();
402  }
403 }
404 
406 {
407  assert(params);
408  assert(raster);
409 
411 
412  double normFactor = te::sa::Sum(kMap);
413 
414  double area = raster->getResolutionX() * raster->getResolutionY();
415 
416  //create task
418 
419  task.setTotalSteps(raster->getNumberOfRows());
420  task.setMessage(TE_TR("Calculating Kernel Normalization."));
421 
422  for(unsigned int i = 0; i < raster->getNumberOfRows(); ++i)
423  {
424  for(unsigned int j = 0; j < raster->getNumberOfColumns(); ++j)
425  {
426  double kernel = 0.;
427 
428  raster->getValue(j, i, kernel);
429 
430  double normKernel = 0.;
431 
432  switch(type)
433  {
435  normKernel = (kernel * normFactor) / totKernel;
436  break;
437 
438  case te::sa::Density:
439  normKernel = ((kernel * normFactor) / totKernel) / area;
440  break;
441 
442  case te::sa::Probability:
443  normKernel = kernel / totKernel;
444  break;
445  }
446 
447  raster->setValue(j, i, normKernel);
448  }
449 
450  if(!task.isActive())
451  {
452  throw te::common::Exception(TE_TR("Operation canceled by the user."));
453  }
454 
455  task.pulse();
456  }
457 }
458 
459 void te::sa::DataSetKernelNormalize(te::sa::KernelInputParams* params, te::sa::KernelMap& kMap, te::mem::DataSet* ds, int kernelIdx, int geomIdx, double totKernel)
460 {
461  assert(params);
462  assert(ds);
463 
465 
466  double normFactor = te::sa::Sum(kMap);
467 
468  //create task
470 
471  task.setTotalSteps(ds->size());
472  task.setMessage(TE_TR("Calculating Kernel Normalization."));
473 
474  //normalize kernel attribute values
475  ds->moveBeforeFirst();
476 
477  while(ds->moveNext())
478  {
479  std::auto_ptr<te::gm::Geometry> geom = ds->getGeometry(geomIdx);
480 
481  double area = te::sa::GetArea(geom.get());
482 
483  double kernel = ds->getDouble(kernelIdx);
484 
485  double normKernel = 0.;
486 
487  switch(type)
488  {
490  normKernel = (kernel * normFactor) / totKernel;
491  break;
492 
493  case te::sa::Density:
494  normKernel = ((kernel * normFactor) / totKernel) / area;
495  break;
496 
497  case te::sa::Probability:
498  normKernel = kernel / totKernel;
499  break;
500  }
501 
502  ds->setDouble(kernelIdx, normKernel);
503 
504  if(!task.isActive())
505  {
506  throw te::common::Exception(TE_TR("Operation canceled by the user."));
507  }
508 
509  task.pulse();
510  }
511 }
512 
513 double te::sa::KernelValue(te::sa::KernelInputParams* params, te::sa::KernelMap& kMap, double radius, te::gm::Coord2D& coord, std::vector<int> idxVec)
514 {
515  double kernelValue = 0.;
516 
517  for(std::size_t t = 0; t < idxVec.size(); ++t)
518  {
519  int id = idxVec[t];
520 
521  te::gm::Geometry* g = kMap[id].first;
522 
523  double intensity = kMap[id].second;
524 
525  double distance = te::sa::CalculateDistance(g, coord);
526 
527  //calculate kernel value for this element
528  double localK = 0.;
529 
530  switch(params->m_functionType)
531  {
532  case te::sa::Quartic:
533  localK = KernelQuartic(radius, distance, intensity);
534  break;
535  case te::sa::Normal:
536  localK = KernelNormal(radius, distance, intensity);
537  break;
538  case te::sa::Triangular:
539  localK = KernelTriangular(radius, distance, intensity);
540  break;
542  localK = KernelNegExponential(radius, distance, intensity);
543  break;
544  case te::sa::Uniform:
545  localK = KernelUniform(radius, distance, intensity);
546  break;
547  }
548 
549  kernelValue += localK;
550  }
551 
552  return kernelValue;
553 }
554 
555 double te::sa::KernelRatioValue(te::sa::KernelOutputParams* params, double area, double kernelA, double kernelB)
556 {
557  double kernelValue = 0.;
558 
559  switch(params->m_combinationType)
560  {
561  case te::sa::Ratio:
562 
563  if (kernelB == 0.)
564  kernelValue = 0.;
565  else
566  kernelValue = kernelA/kernelB;
567 
568  break;
569 
570  case te::sa::Log_Ratio:
571 
572  if (kernelB == 0.)
573  kernelValue = 0.;
574  else
575  kernelValue = log(kernelA/kernelB);
576 
577  break;
578 
580 
581  kernelValue = kernelA - kernelB;
582 
583  break;
584 
586 
587  kernelValue = (kernelA - kernelB) * area;
588 
589  break;
590 
591  case te::sa::Abs_Sum:
592 
593  kernelValue = kernelA + kernelB;
594 
595  break;
596 
598 
599  kernelValue = (kernelA + kernelB) * area;
600 
601  break;
602  }
603 
604  return kernelValue;
605 }
606 
607 double te::sa::KernelQuartic(double tau, double distance, double intensity)
608 {
609  if (distance > tau)
610  return 0.0;
611 
612  return intensity * (3.0 / (tau * tau * M_PI)) *
613  pow(1 - ((distance * distance)/ (tau * tau)),2.0);
614 }
615 
616 double te::sa::KernelNormal(double tau, double distance, double intensity)
617 {
618  return intensity * (1.0 / (tau * tau * 2 * M_PI)) *
619  exp(-1.0 * (distance * distance)/ (2 * tau * tau));
620 }
621 
622 double te::sa::KernelUniform(double tau, double distance, double intensity)
623 {
624  if (distance > tau)
625  return 0.0;
626 
627  return intensity;
628 }
629 
630 double te::sa::KernelTriangular(double tau, double distance, double intensity)
631 {
632  if (distance > tau)
633  return 0.0;
634 
635  return intensity * (1.0 - 1.0/tau) * distance;
636 }
637 
638 double te::sa::KernelNegExponential(double tau, double distance, double intensity)
639 {
640  if (distance > tau)
641  return 0.0;
642 
643  return intensity * exp(-3.0 * distance);
644 }
645 
647 {
648  te::sa::KernelMap::iterator it = kMap.begin();
649 
650  double meanMTmp = 0.;
651  int meanETmp = 0;
652 
653  while(it != kMap.end())
654  {
655  double intensity = it->second.second;
656 
657  if(intensity > 0.)
658  {
659  int exp;
660  double mantissa = frexp(intensity, &exp);
661 
662  meanMTmp += log(mantissa);
663  meanETmp += exp;
664  }
665 
666  ++it;
667  }
668 
669  double meanM = (meanMTmp + (meanETmp * log(2.))) / kMap.size();
670  meanM = exp(meanM);
671 
672  return meanM;
673 }
TESAEXPORT void GridRatioKernel(te::sa::KernelOutputParams *params, te::rst::Raster *rasterA, te::rst::Raster *rasterB, te::rst::Raster *rasterOut)
Evaluates kernel ratio value using a raster as output data.
std::size_t size() const
It returns the collection size, if it is known.
Definition: DataSet.cpp:311
virtual void setValue(unsigned int c, unsigned int r, const double value, std::size_t b=0)
Sets the attribute value in a band of a cell.
Definition: Raster.cpp:233
TESAEXPORT void DataSetRatioKernel(te::sa::KernelOutputParams *params, te::mem::DataSet *dsA, te::mem::DataSet *dsB, te::mem::DataSet *dsOut, int kernelIdx, int geomIdx)
Evaluates kernel ratio value using a dataset as output data.
std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const
Method for retrieving a geometric attribute value.
Definition: DataSet.cpp:537
void setMessage(const std::string &message)
Set the task message.
TESAEXPORT void GridAdaptRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::rst::Raster *raster)
Evaluates kernel value using a raster as output data and a adaptative value for radius.
Functions used in statistics operations.
double y
y-coordinate.
Definition: Coord2D.h:114
Class that represents the kernel input parameters.
Definition: KernelParams.h:54
TESAEXPORT void GridKernelNormalize(te::sa::KernelInputParams *params, te::sa::KernelMap &kMap, te::rst::Raster *raster, double totKernel)
Normalizes kernel values based on type of estimation.
TESAEXPORT void GridStatRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::rst::Raster *raster, double radius)
Evaluates kernel value using a raster as output data and a fixed value for radius.
double x
x-coordinate.
Definition: Coord2D.h:113
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
Definition: Raster.cpp:213
KernelEstimationType
Definition: Enums.h:77
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
TESAEXPORT double KernelQuartic(double tau, double distance, double intensity)
Kernel functions for Quartic type.
std::map< int, std::pair< te::gm::Geometry *, double > > KernelMap
double m_urx
Upper right corner x-coordinate.
Definition: Envelope.h:346
TESAEXPORT te::gm::Coord2D GetCentroidCoord(te::gm::Geometry *geom)
Function used to get centroid coord of a geometry.
Definition: Utils.cpp:243
TESAEXPORT double KernelUniform(double tau, double distance, double intensity)
Kernel functions for Uniform type.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
This file contains a functions used by the kernel operation.
TESAEXPORT double KernelValue(te::sa::KernelInputParams *params, te::sa::KernelMap &kMap, double radius, te::gm::Coord2D &coord, std::vector< int > idxVec)
Evaluates kernel value of events with intensity.
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:347
Utilitary function for spatial analysis module.
Class that represents the kernel output parameters.
Definition: KernelParams.h:95
bool isActive() const
Verify if the task is active.
TESAEXPORT void DataSetAdaptRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::mem::DataSet *ds, int kernelIdx, int geomIdx)
Evaluates kernel value using a dataset as output data and a adaptative value for radius.
void setTotalSteps(int value)
Set the task total stepes.
TESAEXPORT double GetArea(te::gm::Geometry *geom)
Function used to get area of a geometry.
Definition: Utils.cpp:278
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
Definition: DataSet.h:65
double m_llx
Lower left corner x-coordinate.
Definition: Envelope.h:344
TESAEXPORT double Sum(te::sa::GeneralizedProximityMatrix *gpm, int attrIdx)
Function used to calculate sum of a specific attribute from a gpm.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
An abstract class for raster data strucutures.
Definition: Raster.h:71
TESAEXPORT double KernelRatioValue(te::sa::KernelOutputParams *params, double area, double kernelA, double kernelB)
Evaluates kernel ratio value.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
Definition: Raster.cpp:208
te::sa::KernelFunctionType m_functionType
Kernel function type.
Definition: KernelParams.h:80
double getResolutionX() const
Returns the raster horizontal (x-axis) resolution.
Definition: Raster.cpp:218
double getArea() const
It returns the area of this envelope as measured in the spatial reference system of it...
Definition: Envelope.h:453
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
int search(const te::gm::Envelope &mbr, std::vector< DATATYPE > &report) const
Range search query.
Definition: Index.h:326
TESAEXPORT double KernelTriangular(double tau, double distance, double intensity)
Kernel functions for Triangular type.
Grid * getGrid()
It returns the raster grid.
Definition: Raster.cpp:94
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Definition: Exception.h:58
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
te::sa::KernelCombinationType m_combinationType
Kernel combination type (used by ratio kernel)
Definition: KernelParams.h:118
TESAEXPORT void DataSetKernelNormalize(te::sa::KernelInputParams *params, te::sa::KernelMap &kMap, te::mem::DataSet *ds, int kernelIdx, int geomIdx, double totKernel)
Normalizes kernel values based on type of estimation.
virtual void getValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the attribute value of a band of a cell.
Definition: Raster.cpp:228
double m_lly
Lower left corner y-coordinate.
Definition: Envelope.h:345
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection.
Definition: DataSet.cpp:328
bool moveNext()
It moves the internal pointer to the next item of the collection.
Definition: DataSet.cpp:316
const te::gm::Envelope & getMBR(void) const
It returns the bounding box of all elements in the tree.
Definition: Index.h:343
double getDouble(std::size_t i) const
Method for retrieving a double attribute value.
Definition: DataSet.cpp:477
double m_ury
Upper right corner y-coordinate.
Definition: Envelope.h:347
te::sa::KernelEstimationType m_estimationType
Kernel estimation type.
Definition: KernelParams.h:81
void gridToGeo(const double &col, const double &row, double &x, double &y) const
Get the spatial location of a grid point.
Definition: Grid.cpp:301
double getResolutionY() const
Returns the raster vertical (y-axis) resolution.
Definition: Raster.cpp:223
TESAEXPORT double CalculateDistance(te::gm::Geometry *geom, te::gm::Coord2D &coord)
Function used to calculate the distance from a coord to the center of a geometry. ...
Definition: Utils.cpp:209
#define M_PI
TESAEXPORT void DataSetStatRadiusKernel(te::sa::KernelInputParams *params, te::sa::KernelTree &kTree, te::sa::KernelMap &kMap, te::mem::DataSet *ds, int kernelIdx, int geomIdx, double radius)
Evaluates kernel value using a dataset as output data and a fixed value for radius.
void setDouble(std::size_t i, double value)
Definition: DataSet.cpp:482
TESAEXPORT double KernelNegExponential(double tau, double distance, double intensity)
Kernel functions for Negative Exponential type.
TESAEXPORT double KernelNormal(double tau, double distance, double intensity)
Kernel functions for Normal type.
TESAEXPORT double KernelGeometricMean(te::sa::KernelMap &kMap)
Calculates the geometric mean from kernel map (intensity value) using log.