NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
I said: > and that can use the rectangle bounds to construct > a new Gridded2DSet for the image region of interest, Or even simpler, construct a Linear2DSet from the rectangle bounds. Modifying the CellImpl in the main() method of visad/bom/RubberBandBoxRendererJ3D.java, the code might look something like: final FlatField image = ... // your original image final int size = ... // desired number of lines and // elements in sub_image CellImpl cell = new CellImpl() { public void doAction() throws VisADException, RemoteException { Set set = (Set) ref.getData(); float[][] samples = set.getSamples(); if (samples != null) { Linear2DSet sub_set new Linear2DSet(set.getType(), samples[0][0], samples[0][1], size, samples[1][0], samples[1][1], size); FlatField sub_image = image.resample(sub_set); // now sub_image contains the user-selected rectangular // image region, resampled to (size x size) pixels } } }; cell.addReference(ref); If you want sub_image to contain exactly those pixels of image within the region (i.e., no interpolation), then you'll need to construct sub_set as those samples in image.getDomainSet() that lie inside: (samples[0][0], samples[0][1]) x (samples[1][0], samples[1][1]) If image.getDomainSet() is a Linear2DSet that won't be too difficult, but if its a general Gridded2DSet or Irregular2DSet, then that will be a bit complex. 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
visad
archives: