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.

neophyte question about constructing a Set & Field

Hello to the VisAD mailing list,

i have a (another beginner) question about constructing a Set and
corresponding Field.  i'm trying to render isosurfaces of a medical data
set, a CAT scan of a cadaver hear.  The data set is regularly spaced,
single variate (i.e. density i believe) samplings in 3 dimensions: X,Y,Z
and it is only sampled at 1 time (i.e. no additional time dimension in
this data set).  Right now, i am not even trying to read in actual data
(see code), just throwing a few test numbers to see if i can get some
output.  Here is what i have so far:

<PRE>
        RealType[] types3D = { RealType.XAxis,
                               RealType.YAxis, 
                               RealType.ZAxis };

        RealTupleType headLocation3D = new RealTupleType(types3D);
        RealType density = new RealType("density", null, null);
        FunctionType grid_tuple = new FunctionType(headLocation3D, density);

        float[][] data = new float[1][3 * 3 * 3];

        for (int i = 0; i < 27; i++) {
            data[0][i] = i/(float)10;
            System.out.println("data[0][i]=" + data[0][i]);
        }
        Gridded3DSet griddedSet = null;
        try {
            griddedSet = new Gridded3DSet(density, data, 3, 3, 3);
        } catch (VisADException visade) {
            System.out.println("How do I handle this?");
        }

        /* Trying to set up a function like:
         * Real: ((x,y,z) -> density)
         */
        FunctionType grid_tuple = new FunctionType(headLocation3D, density); 
        
        display.addMap(new ScalarMap(RealType.YAxis, Display.YAxis));
        display.addMap(new ScalarMap(RealType.XAxis, Display.XAxis));
        display.addMap(new ScalarMap(RealType.ZAxis, Display.ZAxis));
        display.addMap(new ConstantMap(0.5,    Display.Green));
        display.addMap(new ConstantMap(0.5, Display.Blue));
        display.addMap(new ConstantMap(0.5, Display.Red));

        ScalarMap map1contour = new ScalarMap(density,Display.IsoContour);
        display.addMap(map1contour);
        
        DataReferenceImpl ref_grid3D = new DataReferenceImpl("ref_grid3D");
        ref_grid3D.setData(griddedSet);
        display.addReference(ref_grid3D, null);
</PRE>

i'm having trouble setting up the Gridded3DSet.  i can see that it is
throwing an exception, and on page 42 of the VisAD Developers Guide it
says, "If the manifold dimension is less that the domain dimension [which
mine is i believe] or any of the grid sizes is 1, then the valueToIndex
and valueToInterp methods will throw an Exception."

Now i don't know how to construct the Set or how i should handle the
exception.  Any help would be greatly appreciated.  My poor old Master's
thesis is on the line here. :)  Thanks ahead of time.

-cheers, bob

PS Thanks to Bill Hibbard and Erik Paulson for answering my last question.

Robert S Laramee        tel:    (603) 868-1361 (new as of 19 Jan '00)
9 Woodman Ave, #316     office: (603) 862-0350
Durham, NH 03828        URL:   http://www.cs.unh.edu/~rlaramee


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