next up previous 231
Next: Accessing foreign data formats
Up: USING THE NDF LIBRARY TO DO MORE
Previous: USING THE NDF LIBRARY TO DO MORE


Using regions and slices of images

The NDF library allows you to specify that a rectangular region or slice of an image should be used, rather than the whole. You identify the part you want by appending a comma separated list of ranges, in parentheses, to the name of the image. For instance if you wanted to access a square region of an image, you might use (the program running here is the mean example from §[*]):
 % mean
   IN - Input image > image(100:200,100:200)
and the square that covers the region from 100 to 200 pixels in both dimensions will be used. The rest of the image is ignored. Another way that you could get a similar effect would be to use:
 % mean
   IN - Input image > image(155~100,375~100)
which selects a square of side 100 centred on 155,375.

Missing out a ``range'' results in the whole of that dimension being used:

 % mean
   IN - Input image > image(,100:200)
This uses a rectangle that extends from 100 to 200 in the second dimension and that spans the whole of the first dimension.

If you had a data cube and you wanted to process a plane from it, you might use:

   IN - Input image > cube(,,10)
This would use the 2-D image stored in the tenth plane of the cube.

If the region of the image that you specify doesn't exist, then the program will still be supplied with an image array of the requested size, but the ``non-existent'' parts will be set to the bad value (see elsewhere). A complete description of how to use image ``sections'' (as they are called by the NDF library) is given in SUN/33.



next up previous 231
Next: Accessing foreign data formats
Up: USING THE NDF LIBRARY TO DO MORE
Previous: USING THE NDF LIBRARY TO DO MORE

IMG Simple Image Data Access
Starlink User Note 160
P.W. Draper
R.F. Warren-Smith
3 March 2003
E-mail:P.W.Draper@durham.ac.uk

Copyright © 2000-2003 Council for the Central Laboratory of the Research Councils