Re: Using ASSOC function [message #12226 is a reply to message #12132] |
Fri, 03 July 1998 00:00   |
menakkis
Messages: 37 Registered: June 1998
|
Member |
|
|
Bernard Puc (puc@gsfc.nasa.gov) wrote:
> Using ASSOC, I can access an image array stored in a datafile. Is it
> possible to instead select a subimage of that array? I'm looking to
> optimize the file access speed by not having to read the entire file or
> array into a variable. Thanks in advance.
If your image array is stored simply then you can do this (to some extent) by
setting up your ASSOC with a "tile" instead of a complete image. My meanings
here are that "simply" means that there's no header information in between
the images and the images are rectangular, and that a "tile" is a
physically-contiguous subset of a complete image.
If you do this, you will of course have to keep track of tiles rather than
images when working with your ASSOC "variable".
e.g., Suppose that you had a band-sequential array of 100 byte images, each
640 pixels wide and 512 deep. No header info - nothing but the images.
("Band sequential" means that image 0 is stored first, completely, then image
1, then 2, etc, and that each image is stored "across" first, then "down".)
Then: OPENU,lun,image_filename,/get_lun image_width=640 ;we *have to*
match this in our tile tile_lines=32 ;our tile will be a chunk 640 pixels
wide, 32 deep tile=assoc(lun,bytarr(image_width,tile_lines)) This will let
you get at your images 32 (complete) lines at a time. There will be 16 tiles
to each image (16*32 == 512); e.g., tile(16) will give you the first 32
lines of the second image.
You can make other tiling arrangements, of course. Just remember that the
tile must match the way that the data is stored. e.g., a tile of
BYTARR(320,32) will NOT give you coherent half-lines in the above example.
Also, the tile size should divide evenly into the size of one image.
Cheers
Peter Mason
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
|
|
|