Building Imaging Applications with Java Technology: Using AWT Imaging, Java 2D, and JAI

Downloads

Required

1. All the source code organized in chapter-by-chapter fashion.
 
source.zip
source.tar.gz

2. Jar files that contain beans.
 
beans.zip
beans.tar.gz

You need these jar files to compile the source code in chapters 6 through 16.

3. Java documentation for the classes in chapters 4 through 17 and Appendixes A and C.
 
javadocs.zip
javadocs.tar.gz

Optional

4. Source code from chapter 4 through 16 reorganized to reflect the package structure. If you use an IDE, you may need source code in this form.
 
visframework.zip
visframework.tar.gz

5. Compiled classes from chapter 4 through 14.
 
classes.zip
classes.tar.gz

Useful Links


1. JDK 1.3  download:    http://java.sun.com/j2se/1.3/
    The progarms described in the book work best with JDK 1.3. Some of the classes may not compile with JDK 1.4.

2. JAI 1.0.2 download:    http://java.sun.com/products/java-media/jai/downloads/download-1_0_2.html
    You need this software for running JAI programs, which are in chapters 10 through 16. If you use JAI 1.1, some of the classes won't compile.

3. Image I/O (imageio.jar) download: http://developer.java.sun.com/developer/earlyAccess/imageio/
    To download this file, you need to  register to become a member (if you are not already) of Java Developer Connection.
    You need the imageio.jar file to compile and run some classes in chapter 6 and 17.

4. Jakarta-Tomcat download: http://jakarta.apache.org/site/binindex.html
    You need the Tomcat Servelet/JSP container to run programs developed in chapter 16.  Download both the Servlet API and Jakarta-Tomcat container.
 

Compilation

To compile most of the classes in chapters 6 thriugh 17, you need to include appropriate beans in the CLASSPATH. These beans, which are in the beans.zip file, are in the following jar files:
1. imloader.jar
    Contains the MultiImageLoader bean. Programs in chapters 6 and 7 require this bean.
2. plotterbeans.jar
   Contains MultiXYPlot, Histogram and PieChart beans. Programs in chapters 8, 9, and 14 require this bean.
3. filebrowser.jar
   Contains the FileBrowser bean. Programs in chapters 10 through 14 require this bean.
4. planarimloader.jar
   Contains the MultiPlanarImageLoader bean. Programs in chapter 11 require this bean.

Here is an example to set up your environment in Windows:

rem echo If your directories are different, change the following variables
set BOOK_HOME=c:\awl
set BOOK_CLASSES=d:\book\classes
set JDK_HOME=c:\jdk1.3\jre\bin;c:\jdk1.3\bin

rem set PATH and CLASSPATH
set PATH=%JDK_HOME%;%PATH%

set CLASSPATH=%BOOK_CLASSES%;%BOOK_CLASSES%\imloader.jar;%BOOK_CLASSES%\filebrowser.jar;%BOOK_CLASSES%\planarimloader.jar;%BOOK_CLASSES%\plotterbeans.jar;%CLASSPATH%

Here is an example for Unix korn shell:

#!/bin/ksh
#Change the variables to suit your settings
export BOOK_HOME=/home/staff/lhrodrig/awl
export BOOK_CLASSES=/home/staff/lhrodrig/book/classes
export JDK_HOME=/home/jdk1.3/jre/bin:/home/jdk1.3/bin
#Set PATH and CLASSPATH
PATH=$JDK_HOME:$PATH
export PATH
CLASSPATH=$BOOK_CLASSES:$BOOK_CLASSES/imloader.jar:$BOOK_CLASSES/filebrowser.jar:$BOOK_CLASSES/planarimloader.jar:$BOOK_CLASSES/plotterbeans.jar:$CLASSPATH
export CLASSPATH

Modify the script to suit your environment.
 

Servlets and JSP pages

To compile the servlet code in chapter 16, you need the servlet.jar file. You get this jar file when you download Tomcat (See useful links). It is in the  <Tomcat_HOME>/lib directory. Before compiling the servlet classes, put servlet.jar in the CLASSPATH. To compile beans in Chapter 16, you need JAI.

Once you compile the servlets and beans, move these classes (including beans) to the <TOMCAT_HOME>/webapps/examples/WEB-INF/classes directory. Retain the same directory structure of these classes. For example, all the beans are in the viewer package. So, the bean classes must be in the <TOMCAT_HOME>/webapps/examples/WEB-INF/classes/viewer directory.

Also, remember to move some images to the <TOMCAT_HOME>/webapps directory. Some examples need lena.gif.  You can find lena.gif in the src/chapter2/stats directory. Some examples need images in theimages3 directory.Create images3 directory under TOMCAT_HOME>/webapps and move your own images to that directory.
 

Compatibility with the Current Releases

The code in the book was written  for JDK 1.3 and JAI 1.0.2. It won't compile with the latest versions of JDK and JAI. Click here to download  the source code that can compile with  JDK 1.4 and JAI 1.1.

Note that the app.ROIAnalyzer application currently doesn't work properly with JAI 1.1. I'll keep upadating this code with fixes for JAI 1.1 and other bugs

In case you want make the changes yourself, here is the list:

JDK 1.4

If you are using JDK 1.4, the classes that use com.vistech.imageviewer.DisplayMode won't compile with JDK 1.4 due to the name conflict with the new class, java.awt.DisplayMode. To overcome this problem, you have two options:
  1. Use JDK 1.3
  2. Insert   import com.vistech.imageviewer.DisplayMode at the end of the import statements in the following classes:

  3. 1. app.ImageViewer2D (Chapter 6 )
    2. app.ImageManip2D  (Chapter 7)
    3. app.ImageEnhancer  (Chapter 8)
    4. com.vistech.roi.ROIManager (Chapter 9)
    5. com.vistech.jai.render.ImageManipulator (Chapter 12)

JAI 1.1

 Here is the list changes to be made to make the code compilable with JAI 1.1.

Errata

Visit the errata page.
 

Additional Sample Code

Download some more examples, some of which are simpler versions of the examples in the book. These examples include printing, zoom, and creating buffered image objects from an array of pixel data.

Contact

If you have questions, comments, or encounter any problems, please contact the author at larryhr2004@yahoo.com