| pktools 2.6.7 Processing Kernel for geospatial data

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ImgUpdaterGdal Class Reference
Inheritance diagram for ImgUpdaterGdal:
[legend]
Collaboration diagram for ImgUpdaterGdal:
[legend]

## Public Member Functions
| ImgUpdaterGdal (const std::string &filename)
void | open (const std::string &filename)
void | close (void)
| Close the image. More...
| ImgUpdaterGdal (void)
| default constructor. Image needs to be opened later with one of the open methods.
| ImgUpdaterGdal (const std::string &filename, const GDALAccess &readMode=GA_Update)
| constructor opening an image in update mode (read and write). More...
| ~ImgUpdaterGdal (void)
| destructor
void | open (const std::string &filename, const GDALAccess &readMode=GA_Update)
| Open an image in update mode (read and write). More...
void | close (void)
| close the image More...
Public Member Functions inherited from ImgReaderGdal
| ImgReaderGdal (void)
| default constructor. Image needs to be opened later with one of the open methods. More...
| ImgReaderGdal (const std::string &filename, const GDALAccess &readMode=GA_ReadOnly)
| constructor opening an image. Set memory (in MB) to cache a number of rows in memory More...
| ~ImgReaderGdal (void)
| destructor More...
void | open (const std::string &filename, const GDALAccess &readMode=GA_ReadOnly)
| Open an image. More...
void | close (void)
| Set the memory (in MB) to cache a number of rows in memory. More...
template<typename T >
void | readData (T &value, int col, int row, int band=0)
| Read a single pixel cell value at a specific column and row for a specific band (all indices start counting from 0) More...
template<typename T >
void | readData (std::vector< T > &buffer, int minCol, int maxCol, int row, int band=0)
| Read pixel cell values for a range of columns for a specific row and band (all indices start counting from 0) More...
template<typename T >
void | readData (std::vector< T > &buffer, int minCol, int maxCol, double row, int band=0, RESAMPLE resample=NEAR)
| Read pixel cell values for a range of columns for a specific row and band (all indices start counting from 0). The row counter can be floating, in which case a resampling is applied at the row level. You still must apply the resampling at column level. This function will be deprecated, as the GDAL API now supports rasterIO resampling (see http://www.gdal.org/structGDALRasterIOExtraArg.html) More...
template<typename T >
void | readDataBlock (Vector2d< T > &buffer2d, int minCol, int maxCol, int minRow, int maxRow, int band=0)
| Read pixel cell values for a range of columns and rows for a specific band (all indices start counting from 0). The buffer is a two dimensional vector (stl vector of stl vector) representing [row][col]. More...
template<typename T >
void | readDataBlock (std::vector< T > &buffer, int minCol, int maxCol, int minRow, int maxRow, int band=0)
| Read pixel cell values for a range of columns and rows for a specific band (all indices start counting from 0). The buffer is a one dimensional stl vector representing all pixel values read starting from upper left to lower right. More...
template<typename T >
void | readData (std::vector< T > &buffer, int row, int band=0)
| Read pixel cell values for an entire row for a specific band (all indices start counting from 0) More...
template<typename T >
void | readData (std::vector< T > &buffer, double row, int band=0, RESAMPLE resample=NEAR)
| Read pixel cell values for an entire row for a specific band (all indices start counting from 0). The row counter can be floating, in which case a resampling is applied at the row level. You still must apply the resampling at column level. This function will be deprecated, as the GDAL API now supports rasterIO resampling (see http://www.gdal.org/structGDALRasterIOExtraArg.html) More...
void | getMinMax (int startCol, int endCol, int startRow, int endRow, int band, double &minValue, double &maxValue)
| Get the minimum and maximum cell values for a specific band in a region of interest defined by startCol, endCol, startRow and endRow (all indices start counting from 0). More...
void | getMinMax (double &minValue, double &maxValue, int band=0)
| Get the minimum and maximum cell values for a specific band (all indices start counting from 0). More...
double | getMin (int &col, int &row, int band=0)
| Get the minimum cell values for a specific band and report the column and row in which the minimum value was found (all indices start counting from 0). More...
double | getMax (int &col, int &row, int band=0)
| Get the maximum cell values for a specific band and report the column and row in which the maximum value was found (all indices start counting from 0). More...
double | getHistogram (std::vector< double > &histvector, double &min, double &max, unsigned int &nbin, int theBand=0, bool kde=false)
| Calculate the image histogram for a specific band using a defined number of bins and constrained by a minimum and maximum value. A kernel density function can also be applied (default is false). More...
void | getRefPix (double &refX, double &refY, int band=0)
| Calculate the reference pixel as the centre of gravity pixel (weighted average of all values not taking into account no data values) for a specific band (start counting from 0). More...
void | getRange (std::vector< short > &range, int Band=0)
| Calculate the range of cell values in the image for a specific band (start counting from 0). More...
unsigned long int | getNvalid (int band)
| Calculate the number of valid pixels (with a value not defined as no data). More...
Public Member Functions inherited from ImgRasterGdal
| ImgRasterGdal (void)
| default constructor More...
virtual | ~ImgRasterGdal (void)
| destructor More...
void | setScale (double theScale, int band=0)
| Set scale for a specific band when writing the raster data values. The scaling and offset are applied on a per band basis. You need to set the scale for each band. More...
void | setOffset (double theOffset, int band=0)
| Set offset for a specific band when writing the raster data values. The scaling and offset are applied on a per band basis. You need to set the offset for each band. More...
virtual void | close (void)
| Close the image. More...
std::string | getFileName () const
| Get the filename of this dataset. More...
int | nrOfCol (void) const
| Get the number of columns of this dataset. More...
int | nrOfRow (void) const
| Get the number of rows of this dataset. More...
int | nrOfBand (void) const
| Get the number of bands of this dataset. More...
bool | isGeoRef () const
| Is this dataset georeferenced (pixel size in y must be negative) ? More...
std::string | getProjection (void) const
| Get the projection string (deprecated, use getProjectionRef instead) More...
std::string | getProjectionRef (void) const
| Get the projection reference. More...
std::string | getGeoTransform () const
| Get the geotransform data for this dataset as a string. More...
void | getGeoTransform (double *gt) const
| Get the geotransform data for this dataset. More...
CPLErr | setGeoTransform (double *gt)
| Set the geotransform data for this dataset. More...
void | copyGeoTransform (const ImgRasterGdal &imgSrc)
| Copy geotransform information from another georeferenced image. More...
CPLErr | setProjection (const std::string &projection)
| Set the projection for this dataset in well known text (wkt) format. More...
CPLErr | setProjectionProj4 (const std::string &projection)
| Set the projection for this dataset from user input (supports epsg:<number> format) More...
bool | getBoundingBox (double &ulx, double &uly, double &lrx, double &lry) const
| Get the bounding box of this dataset in georeferenced coordinates. More...
bool | getCenterPos (double &x, double &y) const
| Get the center position of this dataset in georeferenced coordinates. More...
double | getUlx () const
| Get the upper left corner x (georeferenced) coordinate of this dataset. More...
double | getUly () const
| Get the upper left corner y (georeferenced) coordinate of this dataset. More...
double | getLrx () const
| Get the lower right corner x (georeferenced) coordinate of this dataset. More...
double | getLry () const
| Get the lower right corner y (georeferenced) coordinate of this dataset. More...
int | getNoDataValues (std::vector< double > &noDataValues) const
| Get the no data values of this dataset as a standard template library (stl) vector. More...
bool | isNoData (double value) const
| Check if value is nodata in this dataset. More...
int | pushNoDataValue (double noDataValue)
| Push a no data value for this dataset. More...
int | setNoData (const std::vector< double > nodata)
| Set the no data values of this dataset using a standard template library (stl) vector as input. More...
CPLErr | GDALSetNoDataValue (double noDataValue, int band=0)
| Set the GDAL (internal) no data value for this data set. Only a single no data value per band is supported. More...
bool | covers (double x, double y) const
| Check if a geolocation is covered by this dataset. Only the bounding box is checked, irrespective of no data values. More...
bool | covers (double ulx, double uly, double lrx, double lry) const
| Check if a region of interest is (partially) covered by this dataset. Only the bounding box is checked, irrespective of no data values. More...
bool | geo2image (double x, double y, double &i, double &j) const
| Convert georeferenced coordinates (x and y) to image coordinates (column and row) More...
bool | image2geo (double i, double j, double &x, double &y) const
| Convert image coordinates (column and row) to georeferenced coordinates (x and y) More...
double | getDeltaX (void) const
| Get the pixel cell spacing in x. More...
double | getDeltaY (void) const
| Get the pixel cell spacing in y. More...
GDALDataType | getDataType (int band=0) const
| Get the GDAL datatype for this dataset. More...
GDALRasterBand * | getRasterBand (int band=0) const
| Get the GDAL rasterband for this dataset. More...
GDALColorTable * | getColorTable (int band=0) const
| Get the GDAL color table for this dataset as an instance of the GDALColorTable class. More...
std::string | getDriverDescription () const
| Get the GDAL driver description of this dataset. More...
std::string | getImageType () const
| Get the image type (implemented as the driver description) More...
std::string | getInterleave () const
| Get the band coding (interleave) More...
std::string | getCompression () const
| Get the compression from the metadata of this dataset. More...
GDALDataset * | getDataset ()
char ** | getMetadata ()
| Get the metadata of this dataset. More...
char ** | getMetadata () const
| Get the metadata of this dataset (const version) More...
void | getMetadata (std::list< std::string > &metadata) const
| Get the metadata of this dataset in the form of a list of strings (const version) More...
std::string | getDescription () const
| Get the image description from the driver of this dataset. More...
std::string | getMetadataItem () const
| Get metadata item of this dataset. More...
std::string | getImageDescription () const
| Get the image description from the metadata of this dataset. More...
int | nrOfBlockX (int band=0)
int | nrOfBlockY (int band=0)
Public Member Functions inherited from ImgWriterGdal
| ImgWriterGdal (void)
| default constructor. Image needs to be opened later with one of the open methods. More...
| ImgWriterGdal (const std::string &filename, const ImgReaderGdal &imgSrc, const std::vector< std::string > &options=std::vector< std::string >())
| constructor opening an image for writing, copying image attributes from a source image. Image is directly writen to file. More...
| ImgWriterGdal (const std::string &filename, int ncol, int nrow, int nband, const GDALDataType &dataType, const std::string &imageType, const std::vector< std::string > &options=std::vector< std::string >())
| constructor opening an image for writing, defining all image attributes. Image is directly written to file. More...
| ~ImgWriterGdal (void)
| destructor More...
void | open (const std::string &filename, const ImgReaderGdal &imgSrc, const std::vector< std::string > &options=std::vector< std::string >())
| Open an image for writing, copying image attributes from a source image. Image is directly written to file. More...
void | open (const std::string &filename, int ncol, int nrow, int nband, const GDALDataType &dataType, const std::string &imageType, const std::vector< std::string > &options=std::vector< std::string >())
| Open an image for writing, defining all image attributes. Image is directly written to file. More...
void | close (void)
| Close the image. More...
void | setImageDescription (const std::string &imageDescription)
| Set the image description (only for GeoTiff format: TIFFTAG_IMAGEDESCRIPTION) More...
template<typename T >
bool | writeData (T &value, int col, int row, int band=0)
| Write a single pixel cell value at a specific column and row for a specific band (all indices start counting from 0) More...
template<typename T >
bool | writeData (std::vector< T > &buffer, int minCol, int maxCol, int row, int band=0)
| Write pixel cell values for a range of columns for a specific row and band (all indices start counting from 0) More...
template<typename T >
bool | writeData (std::vector< T > &buffer, int row, int band=0)
| Write pixel cell values for an entire row for a specific band (all indices start counting from 0) More...
template<typename T >
bool | writeDataBlock (Vector2d< T > &buffer2d, int minCol, int maxCol, int minRow, int maxRow, int band=0)
| Write pixel cell values for a range of columns and rows for a specific band (all indices start counting from 0). The buffer is a two dimensional vector (stl vector of stl vector) representing [row][col]. More...
void | setColorTable (const std::string &filename, int band=0)
| Set the color table using an (ASCII) file with 5 columns (value R G B alpha) More...
void | setColorTable (GDALColorTable *colorTable, int band=0)
| Set the color table using the GDAL class GDALColorTable. More...
void | setMetadata (char **metadata)
| Set specific metadata (driver specific) More...
void | rasterizeOgr (ImgReaderOgr &ogrReader, const std::vector< double > &burnValues, const std::vector< std::string > &controlOptions=std::vector< std::string >(), const std::vector< std::string > &layernames=std::vector< std::string >())
| Rasterize an OGR vector dataset using the gdal algorithm "GDALRasterizeLayers". More...
void | rasterizeBuf (ImgReaderOgr &ogrReader, const std::vector< double > &burnValues, const std::vector< std::string > &controlOptions=std::vector< std::string >(), const std::vector< std::string > &layernames=std::vector< std::string >())
| Rasterize an OGR vector dataset in memory using the gdal algorithm "GDALRasterizeLayersBuf".

## Protected Member Functions
void | setCodec ()
Protected Member Functions inherited from ImgReaderGdal
void | setCodec (const GDALAccess &readMode=GA_ReadOnly)
| Set GDAL dataset number of columns, rows, bands and geotransform. More...
Protected Member Functions inherited from ImgWriterGdal
virtual void | setCodec (const std::string &imageType)
| Register GDAL driver, setting the datatype, imagetype and some metadata. More...
virtual void | setCodec (const ImgReaderGdal &ImgSrc)
| Register GDAL driver, setting the datatype, imagetype and some metadata. More...

## Protected Attributes
std::string | m_filename
GDALDataset * | m_gds
int | m_ncol
int | m_nrow
int | m_nband
double | m_gt [6]
std::vector< double > | m_noDataValues
std::vector< double > | m_scale
std::vector< double > | m_offset
Protected Attributes inherited from ImgRasterGdal
std::string | m_filename
| filename of this dataset More...
GDALDataset * | m_gds
| instance of the GDAL dataset of this dataset More...
int | m_ncol
| number of columns in this dataset More...
int | m_nrow
| number of rows in this dataset More...
int | m_nband
| number of bands in this dataset More...
GDALDataType | m_dataType
| GDAL data type for this dataset. More...
double | m_gt [6]
| geotransform information of this dataset More...
std::string | m_projection
std::vector< double > | m_noDataValues
| no data values for this dataset More...
std::vector< double > | m_scale
| Vector containing the scale factor to be applied (one scale value for each band) More...
std::vector< double > | m_offset
| Vector containing the offset factor to be applied (one offset value for each band) More...
Protected Attributes inherited from ImgWriterGdal
std::vector< std::string > | m_options

## Detailed Description

Definition at line 27 of file ImgGdal.h.

## Constructor & Destructor Documentation

## ◆ ImgUpdaterGdal() [1/3]

ImgUpdaterGdal::ImgUpdaterGdal | ( | void |  | ) |

Definition at line 23 of file ImgUpdaterGdal.cc.

23{};

## ◆ ImgUpdaterGdal() [2/3]

ImgUpdaterGdal::ImgUpdaterGdal | ( | const std::string & | filename | ) |
| inline

Definition at line 31 of file ImgGdal.h.

31{open(filename);};

## ◆ ~ImgUpdaterGdal()

ImgUpdaterGdal::~ImgUpdaterGdal | ( | void |  | ) |

Definition at line 33 of file ImgUpdaterGdal.cc.

34{
35 // delete m_gds;
36// GDALDumpOpenDatasets(stderr);
37// GDALDestroyDriverManager();//could be used by other objects...
38}

## ◆ ImgUpdaterGdal() [3/3]

ImgUpdaterGdal::ImgUpdaterGdal | ( | const std::string & | filename,
|  | const GDALAccess & | readMode = `GA_Update`
| ) |  |

constructor opening an image in update mode (read and write).

Parameters

  filename | Open a raster dataset with this filename
  readMode | Open dataset in ReadOnly or Update mode

Definition at line 29 of file ImgUpdaterGdal.cc.

29 {
30 open(filename,readMode);
31}

## Member Function Documentation

## ◆ close() [1/2]

void ImgUpdaterGdal::close | ( | void |  | ) |
| virtual

Close the image.

Reimplemented from ImgRasterGdal.

Definition at line 51 of file ImgUpdaterGdal.cc.

52{
53 ImgRasterGdal::close();
54}
ImgRasterGdal::close
virtual void close(void)
Close the image.
Definition: ImgRasterGdal.cc:32

## ◆ close() [2/2]

void ImgUpdaterGdal::close | ( | void |  | ) |
| virtual

close the image

Reimplemented from ImgReaderGdal.

## ◆ open()

void ImgUpdaterGdal::open | ( | const std::string & | filename,
|  | const GDALAccess & | readMode = `GA_Update`
| ) |  |

Open an image in update mode (read and write).

Parameters

  filename | Open a raster dataset with this filename
  readMode | Open dataset in ReadOnly or Update mode

Definition at line 46 of file ImgUpdaterGdal.cc.

47{
48 ImgReaderGdal::open(filename,readMode);
49}
ImgReaderGdal::open
void open(const std::string &filename, const GDALAccess &readMode=GA_ReadOnly)
Open an image.
Definition: ImgReaderGdal.cc:36

## Member Data Documentation

## ◆ m_filename

std::string ImgUpdaterGdal::m_filename
| protected

Definition at line 39 of file ImgGdal.h.

## ◆ m_gds

GDALDataset* ImgUpdaterGdal::m_gds
| protected

Definition at line 40 of file ImgGdal.h.

## ◆ m_gt

double ImgUpdaterGdal::m_gt[6]
| protected

Definition at line 44 of file ImgGdal.h.

## ◆ m_nband

int ImgUpdaterGdal::m_nband
| protected

Definition at line 43 of file ImgGdal.h.

## ◆ m_ncol

int ImgUpdaterGdal::m_ncol
| protected

Definition at line 41 of file ImgGdal.h.

## ◆ m_noDataValues

std::vector<double> ImgUpdaterGdal::m_noDataValues
| protected

Definition at line 45 of file ImgGdal.h.

## ◆ m_nrow

int ImgUpdaterGdal::m_nrow
| protected

Definition at line 42 of file ImgGdal.h.

## ◆ m_offset

std::vector<double> ImgUpdaterGdal::m_offset
| protected

Definition at line 47 of file ImgGdal.h.

## ◆ m_scale

std::vector<double> ImgUpdaterGdal::m_scale
| protected

Definition at line 46 of file ImgGdal.h.

The documentation for this class was generated from the following files:

- /tmp/slackdce/slackrepo.NvCr9x/build_pktools/PKTOOLS-2.6.7.6/src/imageclasses/ImgGdal.h
- /tmp/slackdce/slackrepo.NvCr9x/build_pktools/PKTOOLS-2.6.7.6/src/imageclasses/ImgUpdaterGdal.h
- /tmp/slackdce/slackrepo.NvCr9x/build_pktools/PKTOOLS-2.6.7.6/src/imageclasses/ImgUpdaterGdal.cc