We finally choose to use JAI to open the huge image file, tile-based,
read the necessary tiles into memory and then set the image field of
the Background node in the 3D scene graph, and let Java3D render in the
correct order: 3D shapes on top of 2D graphics and texts, on top of
2D background image.

PlanarImage img = JAI.create("fileload", imageName); // codec
WritableRaster buffer = new WritableRaster(sampleModel, null, rectangle, origin);

// for all tiles overlaping with screen area
        Raster tile = img.getTile(ti, tj); // read tile blocks from disk
        // Resample and copy tile pixels into buffer pixels.

ImageComponent2D comp = new ImageComponent2D(format, buffer);
// *** copy once more inside of ImageComponent2D().

Background bg = new Background();
bg.setImage(comp);                              // set image field of background
BranchGroup objRoot = new BranchGroup();
objRoot.add(bg);                                        // add bg node to 3D scene 
graph
objRoot.compile();
// *** copy to hardware buffer of graphics card.

>From above, it seems there are at least 3 copy operations instead of 1,
in ImageComponent2D() and in BranchGroup.compile(), thus slow.
A better integration between Java3D and JAI would allow direct
copying (after resampling or format conversion) of the tiles into the
rectangular area of the hardware buffer of the graphics card, 1 single
copy and the fastest, but dependent on graphics hardware and library.
This can be done with native interface, using Direct3D, OpenGL, QuickDraw3D,
or XGL.

Or at least, a copy operation can be saved in ImageComponent if there
is no change in SampleModel or image format.

Aside from 3 copies instead of 1 to re-draw the screen, when panning
on a large image, we currently must copy and re-draw all tiles
in the screen region to update the background node,
instead of only the tiles that come in or go out of the window.
One more reason to push the tile-based methodology from JAI into Java3D.

Many of you may have gone through the above path, or have similar needs.
Can we join your inner circle of developers working on JAI and Java3D,
have access to the un-released source, to work on this integration issue?
Comment on this topic is appreciated.

Van-Duc Nguyen
GE Corporate R&D
[EMAIL PROTECTED]


-----Original Message-----
From: Lincoln Perry [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 10, 1999 5:41 PM
To: [EMAIL PROTECTED]
Subject: Re: [JAI] display onto same window with JAI & J3D together?


Hi Van-Duc:


  As things stand now, you need to perform a getAsBufferedImage(), or
  separately wrap each tile (Raster) up as a BufferedImage in order
  to render onto a Canvas3D. This obviously isn't acceptable for large images.

  Better integration with Java3D is definitely something we are looking
  at for a future release. Both JAI and Java3D would benefit by being able
  to use each other's data structures.

Link Perry

>
>I am new to your efforts and so pointers are greatly appreciated.
>I have installed Java2, JAI, J3D, JMF, compiled, ran, browsed the examples and
demos.
>
>Our application is to extract 3D models and changes from images, for example
curved shapes
>in X-ray, MR images, polygonal buildings in huge satellite/aerial images. We
would like
>to use JAI to enhance (sharpen) and display large images (25Kx25K) onto the
window,
>and J3D to render 3D shapes with textures to this same window.
>
>I saw the followings are possible:
>
>1. Put image into Background or Raster node in Java3D, but image can only be a
BufferedImage
>I need the speed of large tile image and the image processing functionality in
JAI to sharpen,
>high-pass filter, do step & peak edge detection on these background images.
>
>2. Use GraphicsJAI to display large images onto a window area.
>Can I have Canvas3D sharing this same physical window? How and where do I
control
>the order of rendering, drawing image first, then 3D objects, then 2D graphics
& texts.
>
>3. Canvas3D and CanvasJAI both extend Canvas, which extends AWT Component.
>I thought about having both of them attached to the same window area, and using
them
>independently to display 3D and images, but then zooming and panning (not
rotation)
>have to be synchronized.
>
>In case you have encountered and solved above scenario, I appreciate if you can
send me
>code snipets to try out and build upon. Thanks.
>

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

===========================================================================
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