> From: Johhny S <[EMAIL PROTECTED]>
>
>        I am working on volume rendering. I started
> with extracting 2D slices from a dataset 0f 512
> slices. Now I want to render the dataset into 3D
> image. I wanted to use texture mapping to do this.

There is an example of how to do this at

http://www.j3d.org/tutorials/quick_fix/volume.html


> All
> my 2D slices are in .pgm format.

The demo uses it's own file format, .vol.  This is simple file format
which puts the stack of textures into a file as intensity values.  You could
write a .pgm to .vol translator and use the classes in the demo as a starting
point.

> I converted all the
> images to GIF's to use in texture mapping.

This makes it simpler to load your images, but it also converts your intensity
(greyscale) images to RGBA and may introduce some compression errors.

> Now, I want
> to make all the black colored part of all my images
> transparent and other part as opaque.

To do this you'll need to modify the alpha plane for the GIFa images.  This is a
single bit, so the texels will either be completely opaque or completely
transparent.  You may find it better to load the .pgm images and do the grescale
to RGBA translation yourself.

> After doing this
> I want to load all the slices and place then one after
> the other. So, finally I could get a 3-D image.

This is what the demo does.

>   Am I going in a right way to render the dataset into
> a 3-D image?

This is a good approach for many kinds of volume visualization.

> How to make some parts of my images
> transparent and keep other parts opaque?

This depends on your intensity -> RGBA translation.  The demo does this the
simple mapping  R=I, G=I, B=I, A=I, so that the color and transparency are
linked.  It also includes an example of using a lookup table to map intensity
values to RGBA values.

> Is there any
> way to directly use my
> 2-D .pgm format images and use them to render into a
> 3-D image?

.pgm looks like a fairly simple file format, you could write a loader.  See:
http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/PGM.txt.  There may even be PGM file
loaders written for Java already.

Doug Gehringer
Sun Microsystems

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to