Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends
jafar::lgl::GeoData Class Reference

Class for GDAL data handling. More...


Detailed Description

Class for GDAL data handling.

Definition at line 53 of file GeoData.hpp.

#include <GeoData.hpp>

Inheritance diagram for jafar::lgl::GeoData:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 GeoData ()
 Default Constructor with no image or data load.
 GeoData (const std::string &_dsfilename, FUSION_METHOD _fmethod=MEAN)
 Constructor used to load a map from a raster file.
 GeoData (int _xsize, int _ysize, double *_bufferedData, FUSION_METHOD _fmethod=MEAN)
 Constructor used to load a map from buffered data.
 ~GeoData ()
 Destructor.
bool loadBand (GEODATA_BAND band, const std::string &_dsfilename)
bool loadInfoBand (const std::string &_dsfilename, GEODATA_BAND aband)
bool loadLandmarkBand (const std::string &_dsfilename)
GDALDataset * getDataset () const
void getAffineTransform (double &_utmXRoot, double &_utmYRoot, double &_cellXRes, double &_cellYRes)
int getxroot () const
 Abstract methods from abstract class Raster.
int getyroot () const
int getxsize () const
int getysize () const
double getScale () const
double geoxroot () const
 Geographical X coordinate of the top left corner.
double geoyroot () const
 Geographical Y coordinate of the top left corner.
double geoxend () const
 Geographical X coordinate of the down right corner.
double geoyend () const
 Geographical Y coordinate of the down right corner.
double geoxres () const
 Geographical X resolution of raster pixels.
double geoyres () const
 Geographical Y resolution of raster pixels.
double getValueFromBand (GEODATA_BAND _aband, int index)
 Get the value loaded from the band _aband at given index.
double getValueFromBand (GEODATA_BAND _aband, int xindex, int yindex)
 Get the value loaded from the band _aband at given x and y coordinates of the top left pixel corner.
double getData (GEODATA_BAND band, const RasterCellIndex &cell) const
double getData (const RasterCellIndex &cell) const
double getData (const RasterRect &rect) const
double getData (GEODATA_BAND band, const RasterRect &rect) const
GDRasterBand< double > * getBand (GEODATA_BAND band)
double getInterpolatedValue (GEODATA_BAND _aband, double xNavLoc, double yNavLoc)
void setScale (double _scale)
 Set the GDAL dataset scale.
void setValueInBand (GEODATA_BAND _aband, int _index, double _val)
 Set/Updates the value in band _aband at index _index using _val as the new value.
void setFusingMethod (FUSION_METHOD _fmethod)
 Set the fusing method to an available fusing flag.
bool setData (double *bufferedData, double *bufferedOther, int _xsize, int _ysize, int _band=GEODATA_TFLAT_BAND)
bool setData (int at_i, int at_j, Attributes inatt, bool internalTransfer=true)
 Write attributes in cell covering position (at_i, at_j)
void setDecompositionLimit (double _dl)
 Modifies the decomposition limit on all bands.
void setDecompositionType (HOMOGENEOUS_TYPE ht_)
 Set decomposition type for all bands.
void setProbabilityLag (double probaLag_)
 Set the probability lag used when the decomposition type is NEARLY.
void setSigmaFactor (double sigmaF_)
 Set the sigmaf factor used while the decomposition type is SIGMA.
void setSimulationProbaVisionLimit (double spvl_)
 Set the simulationProbaVisionLimit factor.
bool isHomogeneous (const RasterRect &rect) const
 given a rect ((top,left),(right,bottom)), tell if this is homogeneous
bool sameValue (const RasterRect &rect)
bool sameValue (GEODATA_BAND band, const RasterRect &rect)
bool overlaps (GeoData *_toMerge)
 Verify if geodata is overlapping at least with 1 pixel with _toMerge geodata.
bool mergeStrict (GeoData *_toMerge, GEODATA_BAND _aband)
 Merge with another geodata.
void addDataset (GDALDataset *_dataset)
 Add information to the GDAL Dataset.
void fuseData (GeoData *_geodata2, GEODATA_BAND _aband, const RasterRect &innerRect, const RasterRect &fusingRect)
 Fusing information from the fusingRect region from _geodata into innerRect region of the current geodata.
double calculateBandHomogeneityPercentage (GEODATA_BAND _aband)
 Calculate bands homogeneity percentage.
void printInfo (bool verbose=true) const
 Print useful information on the loaded geo data.
bool saveData (const std::string &outfile, const char *wFormat="GTIFF")
 Saving images in GeoTif format by default.
void bufferToMem ()
 Transport info from GDAL Datasets to Bands' internal data.
void memToBuffer ()
 Transport info from Bands' internal data to GDAL Datasets.
bool saveTraversability (const std::string &outfile)
 Saving only traversability layer in a ppm file.
void resetBands ()
 Reset knowledge on all layers.
bool createNewInfoBand (GDInfoBand **thatNewBand)
 Add a new information band to the dataset.
bool initUtility ()
 Initialized or reset utility map with zeros.
bool setMap (GEODATA_INTERNAL_MAP map2set, double v1_, int x1_, int y1_, double v2_, int x2_, int y2_)
 Sets the goal reaching potential from (x1_, y1_) to (x2_, y2_)
bool buildUtility ()
 Merge potential with entropy to construct navigation utility.
void resetUtility ()
bool saveUtility (const std::string &outfile)
 Write a ppm image of the utility map : mapUtility.
bool saveEntropy (const std::string &outfile)
 Write a ppm image of the entropy map : mapH.
bool savePotential (const std::string &outfile)
 Write a ppm image of the potential map : mapPotential.
double euclideanDistance (double, double, double, double)
 Returns the planar euclidean distances between two points.
bool setUTMProjection (GDALDataset *inputDataset, int utmZone)
double getFootPrintEntropy (int, int)
 Getting mean entropy in a sensor foot print.
HOMOGENEOUS_TYPE getTraversabilityHomogeneousType ()
 Returns the decomposition type of this band.
HOMOGENEOUS_TYPE getRoughHomogeneousType ()
 Returns the decomposition type of this band.
double getTraversabilityProbabilityLag ()
 Get the probability lag used for decomposition in the traversability band.
double getRoughProbabilityLag ()
 Get the probability lag used for decomposition in the rough terrain band.
double getTraversabilitySigmaFactor ()
 Get the sigma used for decomposition in the traversability band.
double getRoughSigmaFactor ()
 Get the sigma used for decomposition in the rough terrain band.
double getSimulationProbaVisionLimit ()
 Get the simulationProbaVisionLimit factor.
bool isVisionTransparent (int atx, int aty, int atz=0)
 Tell if the land is traversable by the line of vision.
bool loadVisibility (const std::string &_visibilityFileName)
 Load the visibility Data from a file pointed by _visibilityFileName.

Static Public Member Functions

static const double DEFAULT_DATA_VALUE ()
static const double GEODATA_DEFAULT_SCALE ()

Public Attributes

int isInVirtualMemory
 Virtual file detection flag.
double * mapPotential
 Array to hold the goal reaching potential information.
double * mapH
 Array to hold the information entropy.
double * mapUtility

Private Member Functions

void info (std::ostream &info, bool verbose=true) const
 Prints information about the GDal Dataset This method is called in the redifinition of operator "<<".
bool loadData (const std::string &_dsfilename, GDALDataset *_useThisDataset=NULL)
 Method to load an image or use an existing dataset.
bool loadVisibilityData (const std::string &_visibilityFileName, GDALDataset *_useThisDataset)
 Load visibility GeoData from a file.

Private Attributes

double decompositionLimit
 Quadtree maximum cell size in meter.
std::string dsfilename
 Loaded file name.
GDALDataset * dataset
 GDALDataset of the loaded image or any other GDAL Compatible file This holds every possible information about it.
double refGeoTransform [6]
 Coefficient of affine Geo reference transformation array: [0] : X origin of left top corner of left top pixel [3] : Y origin of ...
CPLErr refGeoTransformRType
 Return type of dataset->GetGeoTransform() function that fills the refGeoTransform array.
GDInfoBandtraversabilityBand
 Main band is the combination of other information bands (like trav and landmark)
GDLandmarkBandlandmarkBand
 Landmark Band.
GDInfoBandroughTerrainBand
 Rough Terrain Band.
GDInfoBandvisibilityBand
 Visibility Band.
GDInfoBandvisibilityHeightBand
 Visibility Height Band.
FUSION_METHOD fmethod
 Seems unused for now.
double simulationProbaVisionLimit
 Limit used to evaluate intervisibility on real worlds since on simulated world everything is fully state-defined.

Friends

class NavGraph
class PositionMap
class Decomp
std::ostream & operator<< (std::ostream &out, const GeoData &gd)
 Redefinition of operator <<.

Member Function Documentation

void jafar::lgl::GeoData::addDataset ( GDALDataset *  _dataset)

Add information to the GDAL Dataset.

Parameters:
_datasetGDAL Dataset to fuse
See also:
mergeStrict()

Calculate bands homogeneity percentage.

It is the rate of pixel with differing direct-neighborhood to the total number of considered pixels (image borders are ignored).

Add a new information band to the dataset.

TODO: dynamic array of bands to extend is needed

For now prints if ading a new GDT_Float64 band is possible

void jafar::lgl::GeoData::fuseData ( GeoData _geodata2,
GEODATA_BAND  _aband,
const RasterRect innerRect,
const RasterRect fusingRect 
)

Fusing information from the fusingRect region from _geodata into innerRect region of the current geodata.

In this method we consider that the fusingRect is always strictly included in the boundaries of the current GeoData and is equal in real geographic region to the one defined by innerRect

Parameters:
_geodataGeoData to fuse with.
_abandBand number to fuse.
innerRectZone in which data have to be fused
fusingRectZone from which data will be fused
bool jafar::lgl::GeoData::isVisionTransparent ( int  atx,
int  aty,
int  atz = 0 
)

Tell if the land is traversable by the line of vision.

See also:
simulationProbaVisionLimit
bool jafar::lgl::GeoData::loadData ( const std::string &  _dsfilename,
GDALDataset *  _useThisDataset = NULL 
) [private]

Method to load an image or use an existing dataset.

When loading GeoData from a file the file should at least contains one band of information or contain 3 channels.

  • 8-Bit One band images are greyscale images: The band is used as the traversability band and obstacle value is completarily deducted.
  • RGB images : Red channel is not used Green Channel is used for flat terrain probability (traversabilityBand) Blue Channel is used of rough terrain probability (roughTerrainBand) The obstacle probability is then complementarily deducted.
Parameters:
_dsfilenameFile path of the file to open
_useThisDatasetIf not NULL Take precedence on _dsfilename
Returns:
true When the file could be processed (else false).
bool jafar::lgl::GeoData::loadVisibility ( const std::string &  _visibilityFileName)

Load the visibility Data from a file pointed by _visibilityFileName.

Parameters:
_dsfilenameFile Path to open ; it has to be a visibility map
bool jafar::lgl::GeoData::loadVisibilityData ( const std::string &  _visibilityFileName,
GDALDataset *  _useThisDataset 
) [private]

Load visibility GeoData from a file.

Parameters:
_visibilityFileNameFile path of the file to open
Returns:
true When the file could be processed (else false).
bool jafar::lgl::GeoData::mergeStrict ( GeoData _toMerge,
GEODATA_BAND  _aband 
)

Merge with another geodata.

The Common overlapping region is calculated and the fusing method is called on this region. The data is fused in "this" and its size is not changed so there is merging only if "this" overlaps with "_toMerge". Fusion is made according to the choosen fusion method (fmethod)

Parameters:
_toMergeGeoData to merge with the current data
_abandThe band that is to be merged
See also:
fmethod
bool jafar::lgl::GeoData::overlaps ( GeoData _toMerge)

Verify if geodata is overlapping at least with 1 pixel with _toMerge geodata.

Returns:
true if overlapping
bool jafar::lgl::GeoData::setData ( int  at_i,
int  at_j,
Attributes  inatt,
bool  internalTransfer = true 
)

Write attributes in cell covering position (at_i, at_j)

It can be called with internalTransfer = false in order to avoid multiple calls of memToBuffer in case setData is used in a loop. This greatly fasten the process.

Parameters:
at_ii coordinate of the set pixel.
at_jj coordinate of the set pixel.
inattAttributes, information input to set.
internalTransferDefault is true to enable the memToBuffer transfer.
void jafar::lgl::GeoData::setFusingMethod ( FUSION_METHOD  _fmethod)

Set the fusing method to an available fusing flag.

See also:
fmethod
bool jafar::lgl::GeoData::setMap ( GEODATA_INTERNAL_MAP  map2set,
double  v1_,
int  x1_,
int  y1_,
double  v2_,
int  x2_,
int  y2_ 
)

Sets the goal reaching potential from (x1_, y1_) to (x2_, y2_)

Data is interpolated and stored in the corresponding map for all points between (x1_, y1) and (x2_, y2_)

Parameters:
v1_goal reaching potential value of closest-to-the-goal node
x1_x coord of node with potential v1_
y1_y coord of node with potential v1_
v2_goal reaching potential value of previous node in potential path
x2_x coord of node with potential v2_
y2_y coord of node with potential v2_
See also:
buildUtility() initUtility()

Member Data Documentation

FUSION_METHOD jafar::lgl::GeoData::fmethod [private]

Seems unused for now.

Should be the fusion methods between bands. Used to produce the main band. The are defined in RasterBand.hpp

Definition at line 392 of file GeoData.hpp.

Virtual file detection flag.

This option is used to enable detection of virtual memory Dataset on which FlushCache is impossible.

0 - classical opening of a file on a hard memory device 1 - file created from a buffer with a file created on the virtual memory

Definition at line 87 of file GeoData.hpp.

Coefficient of affine Geo reference transformation array: [0] : X origin of left top corner of left top pixel [3] : Y origin of ...

[1] : Width in meters of this pixel [5] : Height in meters of this pixel [2] : Lines offset/shifts/drift [4] : Columns offset/shifts/drift

Definition at line 364 of file GeoData.hpp.

Limit used to evaluate intervisibility on real worlds since on simulated world everything is fully state-defined.

Terrain with a sum of P(all-traversable-classes) < simulationProbaVisionLimit are not transparent to vision.

Definition at line 400 of file GeoData.hpp.

Main band is the combination of other information bands (like trav and landmark)

Traversability Band

Definition at line 377 of file GeoData.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:41 for Jafar by doxygen 1.7.6.1
LAAS-CNRS