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/RubberBandBoxRendererJ3D.java 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.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


  • 2000 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: