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 Dataset & | dataset () const |
Get the dataset containing the raster. | |
Dataset & | dataset () |
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::ProjectionBase * | getProjection () 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 |
Wrapper for GDALRasterBand representing a single raster.
|
inline |
Open an existing file containing a single raster band as a GDAL raster.
[in] | path | File path |
[in] | access | Access mode |
|
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.
[in] | dataset | HDF5 dataset |
[in] | access | Access mode |
|
inline |
Open an existing file as a GDAL dataset and fetch the specified raster band.
[in] | path | File path |
[in] | band | Raster band index (1-based) |
[in] | access | Access mode |
|
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.
[in] | dataset | HDF5 dataset |
[in] | band | Raster band index (1-based) |
[in] | access | Access mode |
|
inline |
Create a new GDAL dataset containing a single raster band.
[in] | path | File path |
[in] | width | Number of columns |
[in] | length | Number of rows |
[in] | datatype | Data type identifier |
[in] | driver | GDAL driver name |
|
inline |
Create a read-only raster describing an existing in-memory array.
The data layout is assumed to be in row major format.
[in] | data | Pointer to first pixel |
[in] | width | Number of columns |
[in] | length | Number of rows |
|
inline |
Create a raster describing an existing in-memory array.
The data layout is assumed to be in row major format.
[in] | data | Pointer to first pixel |
[in] | width | Number of columns |
[in] | length | Number of rows |
[in] | access | Access mode |
|
inline |
Create a read-only raster describing an existing in-memory array.
[in] | data | Pointer to first pixel |
[in] | width | Number of columns |
[in] | length | Number of rows |
[in] | colstride | Stride in bytes between the start of adjacent columns |
[in] | rowstride | Stride in bytes between the start of adjacent rows |
|
inline |
Create a raster describing an existing in-memory array.
[in] | data | Pointer to first pixel |
[in] | width | Number of columns |
[in] | length | Number of rows |
[in] | colstride | Stride in bytes between the start of adjacent columns |
[in] | rowstride | Stride in bytes between the start of adjacent rows |
[in] | access | Access mode |
|
inline |
Get transform from raster coordinates (pixel, line) to projected coordinates (x, y)
If no transform is found, the default (identity) transform is used.
|
inline |
Get spatial reference system.
isce3::except::GDALError | if the spatial reference system is unavailable |
|
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.
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.
isce3::except::RuntimeError | if the requested type does not match the underlying raster datatype |
|
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.
[out] | dst | Destination buffer |
|
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.
[out] | dst | Destination buffer |
[in] | first_col | Index of first column |
[in] | first_row | Index of first row |
[in] | num_cols | Number of columns |
[in] | num_rows | Number of rows |
|
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.
[out] | dst | Destination buffer |
[in] | row | Row index |
|
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.
[out] | dst | Destination buffer |
[in] | first_row | Index of first row |
[in] | num_rows | Number of rows |
|
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.
[out] | dst | Destination buffer |
[in] | col | Column index |
[in] | row | Row index |
|
inline |
Set geotransform.
isce3::except::GDALError | if the format does not support this operation |
|
inline |
Set spatial reference system.
isce3::except::GDALError | if the format does not support this operation |
|
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.
[in] | src | Source values |
|
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.
[in] | src | Source values |
[in] | first_col | Index of first column |
[in] | first_row | Index of first row |
[in] | num_cols | Number of columns |
[in] | num_rows | Number of rows |
|
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.
[in] | src | Source values |
[in] | row | Row index |
|
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.
[in] | src | Source values |
[in] | first_row | Index of first row |
[in] | num_rows | Number of rows |
|
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.
[in] | src | Source value |
[in] | col | Column index |
[in] | row | Row index |