Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Extracting pixel values from large image using RasterIterator
I often have the problem of extracting a large number of pixel values from an image, given each point's real world coordinate (in geographic, utm, albers, etc). Normally I accomplish this by reading in the image (usually a tif) and the associated geotiff, calculating the row and column indices and then using a simple lookup to extract each pixel value at once (e.g image(column_index,row_index)). I've written a program to automate this simple task. My problem now is that I have very large files (>5gb) and I don't want to keep them around in uncompressed form nor do I want to load them into memory. Fortunately, these files are mostly background values and compress well. So, storage is no longer the problem- accessing them is. It would seem that raster iterator would do the trick- read in one tile at a time, check for an intersection of points with the tile and extract the relevant data. I haven't found a packaged version of this type of routine, but perhaps someone has solved this problem? Or is there a problem here that I am not seeing? M
Re: Extracting pixel values from large image using RasterIterator
lefsky@gmail.com writes: > > I often have the problem of extracting a large number of pixel values from an image, given each point's real world coordinate (in geographic, utm, albers, etc). Normally I accomplish this by reading in the image (usually a tif) and the associated geotiff, calculating the row and column indices and then using a simple lookup to extract each pixel value at once (e.g image(column_index,row_index)). I've written a program to automate this simple task. > > My problem now is that I have very large files (>5gb) and I don't want to keep them around in uncompressed form nor do I want to load them into memory. Fortunately, these files are mostly background values and compress well. So, storage is no longer the problem- accessing them is. > > It would seem that raster iterator would do the trick- read in one tile at a time, check for an intersection of points with the tile and extract the relevant data. > > I haven't found a packaged version of this type of routine, but perhaps someone has solved this problem? Or is there a problem here that I am not seeing? I've never tried this, and don't have any idea if it would be faster or not, but what about using the SUB_RECT keyword to READ_TIFF to read individual pixel values out of the file? I suppose it depends on how this functionality is implemented internally as to whether you will gain speed or not. Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.idlcoyote.com/ Sepore ma de ni thue. ("Perhaps thou speakest truth.")