Re: extracting data from image

Hi Ken,

>               I would like to be able to use the mouse to extract a 
> rectangular area
> from a displayed image, then either save the data in that area to a file
> or perform calculations on the data.  Could you give me an idea of how i
> might accomplish this.  thanks.

You can use visad/bom/ to
let users select a rectangular area - see the main() method
in that class to see how to use it.  Try running it, click
the right mouse button, drag the box, then release the
mouse button.  When the user releases the right mouse button,
it puts a Set of two points into its DataReference - the two
opposite points of the rectangle.  This can trigger the
doAction() method of a CellImpl, as in the main() method
example, and that can use the rectangle bounds to construct
a new Gridded2DSet for the image region of interest, then
pass that Set to the image's resample() method the image
(the image should be a FlatField).  The resample() method
will return a FlatField for the image region.

Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738