imagej applet

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

imagej applet

vmunukutla
Hi,

My requirement is to read images from database and show in imagej.
For that I am reading image from database and writing the image data to the
output stream.

my html file to view the applet is :

applet.html


<html>
<head>
<title>ImageJA Applet</title>
</head>
<body bgcolor=gray>

ImageJ embedded in a website


<applet codebase="." code="ij.ImageJApplet.class" archive="ij.jar" width=750 height=550 security="all-permissions">
<param name = url1 value = "http://localhost:8888/getImage.jsp">
</applet>

</body>
</html>

code written in getImage.jsp is :
FYI. for this example I am accessing a file form local file system

<%@ page import="java.io.*,javax.servlet.*"%>
<%  
try{
        File myDicomFile = new File("D:\\image.jpg");              
        FileInputStream fin = new FileInputStream(myDicomFile);
        byte [] imageBytes = new byte[ (int) myDicomFile.length () ];
        System.out.println(" imageBytes "+imageBytes.length);
        ServletOutputStream servletOutputStream = response
                .getOutputStream ();
        while(fin.available() != 0){
                int b = fin.read();
                servletOutputStream.write(b);
        }
}catch(Exception e){
        e.printStackTrace();
}
%>

In this process the sysout in getImage.jsp is printing 3 times on the server console.
I tried to debug the imagej source, but could find the reason.
Pls help me.

Thanks in advance.

Regards,
Phanikanth