Re: Thnak you for helping us to understand the volume rendering of ir

  • To: "Liu, Jyhcheng" <jliu@xxxxxxx>
  • Subject: Re: Thnak you for helping us to understand the volume rendering of ir
  • From: Curtis Rueden <ctrueden@xxxxxxxx>
  • Date: Fri, 18 Jun 2004 13:56:23 -0500
Hi Tom,

First of all, please send questions to the VisAD mailing list
(visad@xxxxxxxxxxxxxxxx) instead of just to me, since there are many
qualified VisAD developers there who can be of assistance, and your
question will become part of the archives so that others can benefit.
Instructions on how to subscribe can be found at:

I do not see any blue highlighting, but I will explain the portions
of code you included below.

The first part, populating the samples array, is simply creating a
series of random sample points in 3D. The samples array of an
irregular set identifies the domain of the data points (i.e., their
location in 3D) but not their range values (i.e., their intensity
or other parameter values).

The second part, populating the values array, is filling in the
range values. In this case, I filled them in so that the closer the
point is to the center of the cube, the brighter it is (measured as
the sum of the X, Y and Z distances, not the straight-line
distance, which is why the shape appears like a polyhedron instead
of a sphere). Later in the code, I map brightness to pseudocolor
with alpha (i.e., Display.RGBA).

In short, the Irregular3DSet just encapsulates an unordered bag of
sample positions in 3D. The FlatField represents a mapping of those
samples to a collection of range values.

In a real application, you'd populate the samples array with actual
sample locations, not random ones, and the values array with the
samples' intensity or other parameter values (probably not a simple
distance function like I used, but rather data collected by some
sort of instrument).

Good luck,

At 08:41 AM 6/18/2004, Liu, Jyhcheng wrote:
>Hi, Curtis,
>Thnak you for helping us to understand the volume rendering of irregualr
>data set.
>I have read your example -
>could you explain the code segment hightlighted blue in the following?
>Is this a normalization to make field like a Ball?
>Thank you very much.
>Tom from Brookhaven Team
> // generate some irregular (random) samples
>    int count = 512;
>    float[][] samples = new float[3][count];
>    for (int i=0; i<count; i++) for (int j=0; j<3; j++) {
>      samples[j][i] = (float) (1000 * Math.random());
>    }
>       Irregular3DSet iset = new Irregular3DSet(xyz, samples, null, null,
>null, null, false);
>    // build field
>    FunctionType ftype = new FunctionType(xyz, value);
>    FlatField field = new FlatField(ftype, iset);
>    float[][] values = new float[1][count];
>    for (int i=0; i<count; i++) {
>      values[0][i] = 1500 - (Math.abs(samples[0][i] - 500) +
>        Math.abs(samples[1][i] - 500) + Math.abs(samples[2][i] - 500));
>    }