isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Static Public Member Functions | Friends | List of all members
isce3::io::gdal::Raster Class Reference

Wrapper for GDALRasterBand representing a single raster. More...

#include <Raster.h>

Public Member Functions

 Raster (const std::string &path, GDALAccess access=GA_ReadOnly)
 Open an existing file containing a single raster band as a GDAL raster. More...
 
 Raster (const isce3::io::IDataSet &dataset, GDALAccess access=GA_ReadOnly)
 Open an HDF5 dataset containing a single raster band as a GDAL raster. More...
 
 Raster (const std::string &path, int band, GDALAccess access=GA_ReadOnly)
 Open an existing file as a GDAL dataset and fetch the specified raster band. More...
 
 Raster (const isce3::io::IDataSet &dataset, int band, GDALAccess access=GA_ReadOnly)
 Open an HDF5 dataset as a GDAL dataset and fetch the specified raster band. More...
 
 Raster (const std::string &path, int width, int length, GDALDataType datatype, const std::string &driver=defaultDriver())
 Create a new GDAL dataset containing a single raster band. More...
 
template<typename T >
 Raster (const T *data, int width, int length)
 Create a read-only raster describing an existing in-memory array. More...
 
template<typename T >
 Raster (T *data, int width, int length, GDALAccess access=GA_Update)
 Create a raster describing an existing in-memory array. More...
 
template<typename T >
 Raster (const T *data, int width, int length, std::size_t colstride, std::size_t rowstride)
 Create a read-only raster describing an existing in-memory array. More...
 
template<typename T >
 Raster (T *data, int width, int length, std::size_t colstride, std::size_t rowstride, GDALAccess access=GA_Update)
 Create a raster describing an existing in-memory array. More...
 
const Datasetdataset () const
 Get the dataset containing the raster.
 
Datasetdataset ()
 Get the dataset containing the raster.
 
int band () const
 Band index (1-based)
 
GDALDataType datatype () const
 Datatype identifier.
 
GDALAccess access () const
 Access mode.
 
int width () const
 Number of columns.
 
int length () const
 Number of rows.
 
std::string driver () const
 Driver name.
 
GeoTransform getGeoTransform () const
 Get transform from raster coordinates (pixel, line) to projected coordinates (x, y) More...
 
void setGeoTransform (const GeoTransform &transform)
 Set geotransform. More...
 
isce3::core::ProjectionBasegetProjection () const
 Get spatial reference system. More...
 
void setProjection (const isce3::core::ProjectionBase *proj)
 Set spatial reference system. More...
 
double x0 () const
 Left edge of left-most pixel in projection coordinates.
 
double y0 () const
 Upper edge of upper-most line in projection coordinates.
 
double dx () const
 Pixel width in projection coordinates.
 
double dy () const
 Line height in projection coordinates.
 
template<typename T >
void readPixel (T *dst, int col, int row) const
 Read a single pixel value from the raster. More...
 
template<typename T >
void writePixel (const T *src, int col, int row)
 Write a single pixel value to the raster. More...
 
template<typename T >
void readLine (T *dst, int row) const
 Read a line of pixel data from the raster. More...
 
template<typename T >
void writeLine (const T *src, int row)
 Write a line of pixel data to the raster. More...
 
template<typename T >
void readLines (T *dst, int first_row, int num_rows) const
 Read one or more lines of pixel data from the raster. More...
 
template<typename T >
void writeLines (const T *src, int first_row, int num_rows)
 Write one or more lines of pixel data to the raster. More...
 
template<typename T >
void readBlock (T *dst, int first_col, int first_row, int num_cols, int num_rows) const
 Read a block of pixel data from the raster. More...
 
template<typename T >
void writeBlock (const T *src, int first_col, int first_row, int num_cols, int num_rows)
 Write a block of pixel data to the raster. More...
 
template<typename T >
void readAll (T *dst) const
 Read all pixel data from the raster. More...
 
template<typename T >
void writeAll (const T *src)
 Write all pixel data to the raster. More...
 
GDALRasterBand * get ()
 Get the underlying GDALRasterBand pointer.
 
const GDALRasterBand * get () const
 Get the underlying GDALRasterBand pointer.
 
Buffer memmap ()
 Create a virtual memory mapping of the raster. More...
 
template<typename T >
TypedBuffer< T > memmap ()
 Create a virtual memory mapping of the raster. More...
 

Static Public Member Functions

static std::string defaultDriver ()
 Default GDAL driver for raster creation.
 

Friends

class Dataset
 

Detailed Description

Wrapper for GDALRasterBand representing a single raster.

Constructor & Destructor Documentation

isce3::io::gdal::Raster::Raster ( const std::string &  path,
GDALAccess  access = GA_ReadOnly 
)
inline

Open an existing file containing a single raster band as a GDAL raster.

Parameters
[in]pathFile path
[in]accessAccess mode
isce3::io::gdal::Raster::Raster ( const isce3::io::IDataSet dataset,
GDALAccess  access = GA_ReadOnly 
)
inline

Open an HDF5 dataset containing a single raster band as a GDAL raster.

The resulting raster is invalidated if the HDF5 file is closed.

Parameters
[in]datasetHDF5 dataset
[in]accessAccess mode
isce3::io::gdal::Raster::Raster ( const std::string &  path,
int  band,
GDALAccess  access = GA_ReadOnly 
)
inline

Open an existing file as a GDAL dataset and fetch the specified raster band.

Parameters
[in]pathFile path
[in]bandRaster band index (1-based)
[in]accessAccess mode
isce3::io::gdal::Raster::Raster ( const isce3::io::IDataSet dataset,
int  band,
GDALAccess  access = GA_ReadOnly 
)
inline

Open an HDF5 dataset as a GDAL dataset and fetch the specified raster band.

The resulting raster is invalidated if the HDF5 file is closed.

Parameters
[in]datasetHDF5 dataset
[in]bandRaster band index (1-based)
[in]accessAccess mode
isce3::io::gdal::Raster::Raster ( const std::string &  path,
int  width,
int  length,
GDALDataType  datatype,
const std::string &  driver = defaultDriver() 
)
inline

Create a new GDAL dataset containing a single raster band.

Parameters
[in]pathFile path
[in]widthNumber of columns
[in]lengthNumber of rows
[in]datatypeData type identifier
[in]driverGDAL driver name
template<typename T >
isce3::io::gdal::Raster::Raster ( const T *  data,
int  width,
int  length 
)
inline

Create a read-only raster describing an existing in-memory array.

The data layout is assumed to be in row major format.

Parameters
[in]dataPointer to first pixel
[in]widthNumber of columns
[in]lengthNumber of rows
template<typename T >
isce3::io::gdal::Raster::Raster ( T *  data,
int  width,
int  length,
GDALAccess  access = GA_Update 
)
inline

Create a raster describing an existing in-memory array.

The data layout is assumed to be in row major format.

Parameters
[in]dataPointer to first pixel
[in]widthNumber of columns
[in]lengthNumber of rows
[in]accessAccess mode
template<typename T >
isce3::io::gdal::Raster::Raster ( const T *  data,
int  width,
int  length,
std::size_t  colstride,
std::size_t  rowstride 
)
inline

Create a read-only raster describing an existing in-memory array.

Parameters
[in]dataPointer to first pixel
[in]widthNumber of columns
[in]lengthNumber of rows
[in]colstrideStride in bytes between the start of adjacent columns
[in]rowstrideStride in bytes between the start of adjacent rows
template<typename T >
isce3::io::gdal::Raster::Raster ( T *  data,
int  width,
int  length,
std::size_t  colstride,
std::size_t  rowstride,
GDALAccess  access = GA_Update 
)
inline

Create a raster describing an existing in-memory array.

Parameters
[in]dataPointer to first pixel
[in]widthNumber of columns
[in]lengthNumber of rows
[in]colstrideStride in bytes between the start of adjacent columns
[in]rowstrideStride in bytes between the start of adjacent rows
[in]accessAccess mode

Member Function Documentation

GeoTransform isce3::io::gdal::Raster::getGeoTransform ( ) const
inline

Get transform from raster coordinates (pixel, line) to projected coordinates (x, y)

If no transform is found, the default (identity) transform is used.

isce3::core::ProjectionBase* isce3::io::gdal::Raster::getProjection ( ) const
inline

Get spatial reference system.

Exceptions
isce3::except::GDALErrorif the spatial reference system is unavailable
TypedBuffer< T > isce3::io::gdal::Raster::memmap ( )
inline

Create a virtual memory mapping of the raster.

The memory map is internally managed and is valid only during the lifetime of the raster object.

Returns
A buffer object describing the virtual memory mapping
template<typename T >
TypedBuffer<T> isce3::io::gdal::Raster::memmap ( )

Create a virtual memory mapping of the raster.

The memory map is internally managed and is valid only during the lifetime of the raster object.

Exceptions
isce3::except::RuntimeErrorif the requested type does not match the underlying raster datatype
Returns
A buffer object describing the virtual memory mapping
template<typename T >
void isce3::io::gdal::Raster::readAll ( T *  dst) const
inline

Read all pixel data from the raster.

The data will be converted to the requested type if different than the native datatype. If T is void, no conversion is performed.

Parameters
[out]dstDestination buffer
template<typename T >
void isce3::io::gdal::Raster::readBlock ( T *  dst,
int  first_col,
int  first_row,
int  num_cols,
int  num_rows 
) const
inline

Read a block of pixel data from the raster.

The data will be converted to the requested type if different than the native datatype. If T is void, no conversion is performed.

Parameters
[out]dstDestination buffer
[in]first_colIndex of first column
[in]first_rowIndex of first row
[in]num_colsNumber of columns
[in]num_rowsNumber of rows
template<typename T >
void isce3::io::gdal::Raster::readLine ( T *  dst,
int  row 
) const
inline

Read a line of pixel data from the raster.

The data will be converted to the requested type if different than the native datatype. If T is void, no conversion is performed.

Parameters
[out]dstDestination buffer
[in]rowRow index
template<typename T >
void isce3::io::gdal::Raster::readLines ( T *  dst,
int  first_row,
int  num_rows 
) const
inline

Read one or more lines of pixel data from the raster.

The data will be converted to the requested type if different than the native datatype. If T is void, no conversion is performed.

Parameters
[out]dstDestination buffer
[in]first_rowIndex of first row
[in]num_rowsNumber of rows
template<typename T >
void isce3::io::gdal::Raster::readPixel ( T *  dst,
int  col,
int  row 
) const
inline

Read a single pixel value from the raster.

The data will be converted to the requested type if different than the native datatype. If T is void, no conversion is performed.

Parameters
[out]dstDestination buffer
[in]colColumn index
[in]rowRow index
void isce3::io::gdal::Raster::setGeoTransform ( const GeoTransform transform)
inline

Set geotransform.

Exceptions
isce3::except::GDALErrorif the format does not support this operation
void isce3::io::gdal::Raster::setProjection ( const isce3::core::ProjectionBase proj)
inline

Set spatial reference system.

Exceptions
isce3::except::GDALErrorif the format does not support this operation
template<typename T >
void isce3::io::gdal::Raster::writeAll ( const T *  src)
inline

Write all pixel data to the raster.

The data will be converted from the input type if different than the native datatype. If T is void, no conversion is performed.

Parameters
[in]srcSource values
template<typename T >
void isce3::io::gdal::Raster::writeBlock ( const T *  src,
int  first_col,
int  first_row,
int  num_cols,
int  num_rows 
)
inline

Write a block of pixel data to the raster.

The data will be converted from the input type if different than the native datatype. If T is void, no conversion is performed.

Parameters
[in]srcSource values
[in]first_colIndex of first column
[in]first_rowIndex of first row
[in]num_colsNumber of columns
[in]num_rowsNumber of rows
template<typename T >
void isce3::io::gdal::Raster::writeLine ( const T *  src,
int  row 
)
inline

Write a line of pixel data to the raster.

The data will be converted from the input type if different than the native datatype. If T is void, no conversion is performed.

Parameters
[in]srcSource values
[in]rowRow index
template<typename T >
void isce3::io::gdal::Raster::writeLines ( const T *  src,
int  first_row,
int  num_rows 
)
inline

Write one or more lines of pixel data to the raster.

The data will be converted from the input type if different than the native datatype. If T is void, no conversion is performed.

Parameters
[in]srcSource values
[in]first_rowIndex of first row
[in]num_rowsNumber of rows
template<typename T >
void isce3::io::gdal::Raster::writePixel ( const T *  src,
int  col,
int  row 
)
inline

Write a single pixel value to the raster.

The data will be converted from the input type if different than the native datatype. If T is void, no conversion is performed.

Parameters
[in]srcSource value
[in]colColumn index
[in]rowRow index

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

Generated for ISCE3.0 by doxygen 1.8.5.