Hi all
I am dealing with a satellite image which has N bands, each band of size row x col. Is there any way to read one column of a certain band or all the bands of a certain point? I only found G_get_raster_row which works for row.
Thanks,
Peng
Hi all
I am dealing with a satellite image which has N bands, each band of size row x col. Is there any way to read one column of a certain band or all the bands of a certain point? I only found G_get_raster_row which works for row.
Thanks,
Peng
Peng Du wrote:
I am dealing with a satellite image which has N bands, each band of size
row x col. Is there any way to read one column of a certain band or all
the bands of a certain point? I only found G_get_raster_row which works
for row.
You can use G_set_window() (Rast_set_window() in 7.0) to control which
samples are returned for each row. E.g. for column "n":
struct Cell_head cellhd;
...
G_get_set_window(&cellhd);
cellhd.west += cellhd.ew_res * n;
cellhd.east = cellhd.west + cellhd.ew_res;
G_set_window(&cellhd);
Then, each call to G_get_raster_row() etc will store a single value in
the buffer.
However, reducing the number of columns won't have any noticeable
effect upon speed, as the library reads and decompresses entire rows.
If you want to process maps in column-major order, you should create a
transposed copy in a temporary file or in memory.
--
Glynn Clements <glynn@gclements.plus.com>