20000925: slicer available?

>From: Mathias =?iso-8859-1?Q?St=FCmpert?= <AtzeS@xxxxxx>
>Organization: 
>Keywords: 200009251222.e8PCMTb01493

Hi Mathias-

>I need a possibility to extract slices out of my 3D-Dataset. I think of
>a layer whose edges can be dragged along the axes. Is there an easy way
>to do this with VisAD?

We do this with some special classes that we created, but it can be
done with straight VisAD as well.  Basically, you need to grab the
Altitude value that you want to resample your 3D FlatField on and
create a new sample domain that is all the lat/lon points and that
altitude.  Then call FlatField.resample().

>My MathType looks like this:
>((latitude, longitude, altitude) -> (pressure, temperature, ...))

What you need is a data reference with a DirectManipulationRenderer
attached to it.  You'd probably want your point along the Altitude
axis.  If you look at Test00, you can see how to do this.   Essentially,
create a Real whose value is some initial starting point along
the Z (Altitude axis):


     double initialValue = 8000.0    // set to 8000 m
     Real slider = new Real(RealType.Altitude, initialValue);
     DataReference sliderRef = new DataReferenceImpl("slider");
     ConstantMap[] constants = new ConstantMap[5];
     constants[0] map = new ConstantMap(0.0, Display.Red);   // make a blue
     constants[1] map = new ConstantMap(0.0, Display.Green); // point
     constants[2] map = new ConstantMap(1.0, Display.Blue);  //
     constants[3] map = new ConstantMap(5.0, Display.PointSize); // make big
     constants[4] map = new ConstantMap(-1.0, Display.XAxis);// sets point
     constants[5] map = new ConstantMap(-1.0, Display.YAxis);// along left axis
     display.addReferences(new DirectManipulationRendererJ3D(),
                           slider, constants);

This will give you a point on the Z Axis (you'll need to have
ScalarMaps that map RealType.(X,Y,Z)Axis to Display.(X,Y,Z)Axis
respectively and set the ranges to (-1.0,1.0) for each so the
constant maps will work.

Then add a CellImpl to listen for changes in the data:

    CellImpl cell = new CellImpl() {
        public void doAction() 
            throws VisADException, RemoteException
        {
            Real value = (Real) sliderRef.getData();
            // Create a set that you want to evaluate on
            Gridded3DSet sampleSet = 
                new Gridded3DSet(RealTupleType.LatitudeLongitudeAltitude,
                         new float[][] { lats, lons, new float[] {value}},
                         numlats, numlons, 1);
            FlatField slice = 3Dfield.resample(sampleSet);
        }
    }
    cell.addReference(sliderRef);

where lats is the lat points of your domain, lons is the longitude
points of your domain. The slice should be a new FlatField of values
on that sample set (i.e., at that altitude). As you manipulate the
point with MB3, the point will move up and down the Z axis and you will
sample. You could change the resampling to something other than nearest
neighbor if you want. You also might want to check to see how much
different the new altitude value is from the old so you don't sample
unnecessarily.

I haven't tried this code, but the basic idea is there.

You can search the VisAD-list archives using "slice" or "resample" 
as a keyword to find other messages on this topic at:

http://www.unidata.ucar.edu/staff/russ/visad/

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
*************************************************************
Unidata WWW Server               http://www.unidata.ucar.edu/
McIDAS Demonstration Machine  http://mcdemo.unidata.ucar.edu/
*************************************************************


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