LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   dcm4che: No Image Reader of class com.sun.media.imageioimpl.plugins.jpeg2000.J2KIm... (http://www.linuxquestions.org/questions/programming-9/dcm4che-no-image-reader-of-class-com-sun-media-imageioimpl-plugins-jpeg2000-j2kim-4175433732/)

eantoranz 10-23-2012 03:40 PM

dcm4che: No Image Reader of class com.sun.media.imageioimpl.plugins.jpeg2000.J2KIm...
 
Hi!

I'm trying to get a servlet to parse a DICOM image. On the console I'm able to do it without a problem but when I try to do it on apache it's failed miserably for other things.

I'm asking ImageIO to search for plugins:

Code:

1427 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  - Supported Formats:
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      raw
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      jpeg
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      tif
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      WBMP
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      PNM
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      JPG
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      wbmp
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      DICOM
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      JPEG
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      PNG
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      dicom
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      jpeg 2000
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      tiff
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      BMP
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      JPEG2000
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      RAW
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      jpeg2000
1428 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      GIF
1429 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      TIF
1429 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      TIFF
1429 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      jpg
1429 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      bmp
1429 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      pnm
1429 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      png
1429 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      JPEG 2000
1429 [localhost-startStop-1] INFO la.cps.shl7.server.servlet.HL7StartupServlet  -      gif

Great.... now I ask for a Reader that can take care of the DicomImage, no problem, just like in the terminal but when I ask the reader to read the first (and only image):

Code:

org.dcm4che2.data.ConfigurationError: No Image Reader of class com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderCodecLib available for format:jpeg2000
That class is included in a jar that is in tomcat's lib dir:

Code:

$ unzip -l /home/antoranz/Descargas/java/apache-tomcat-7.0.28/lib/jai_imageio.jar | grep J2KImageReaderCodecLib.class
    8468  2004-11-22 14:48  com/sun/media/imageioimpl/plugins/jpeg2000/J2KImageReaderCodecLib.class

Why the hell can't it decode it?

eantoranz 10-23-2012 03:43 PM

Well... I think it's a tomcat problem (somewhere) because wee what happens when I ask the class to be loaded manually with Class.forName():

Code:

java.lang.ClassNotFoundException: class com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderCodecLib
How about that? Let's see what's going on. I'll tell you what's going on later on.

eantoranz 10-23-2012 03:51 PM

Ok.... so instead of ln the jar I physically copied it into lib (as if that was going to change something... I knew it would make no difference but). I still can't load the class (I placed the forName() before the ImageIO stuff and it still fails to see the class).

Is there a simple explanation for this behavior? Cause I don't have one.

eantoranz 10-23-2012 04:02 PM

Ok.... about the forClass(), I had misnamed the class. Now I'm able to load the class with a Class.forName() (I do it after ImageIO.getPlugin()) but then we're back into problems decoding the image because of the missing codec class:

Code:

java.io.IOException: Error processing DICOM Object
        at la.cps.shl7.entities.PACS.getImages(PACS.java:140)
        at la.cps.shl7.server.servlet.test.GetImages.doPost(GetImages.java:64)
        at la.cps.shl7.server.servlet.HL7Servlet.doPost(HL7Servlet.java:94)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.dcm4che2.data.ConfigurationError: No Image Reader of class com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderCodecLib available for format:jpeg2000
        at org.dcm4che2.imageio.ImageReaderFactory.getReaderForTransferSyntax(ImageReaderFactory.java:99)
        at org.dcm4che2.imageioimpl.plugins.dcm.DicomImageReader.initCompressedImageReader(DicomImageReader.java:351)
        at org.dcm4che2.imageioimpl.plugins.dcm.DicomImageReader.initImageReader(DicomImageReader.java:336)
        at org.dcm4che2.imageioimpl.plugins.dcm.DicomImageReader.read(DicomImageReader.java:576)
        at javax.imageio.ImageReader.read(ImageReader.java:940)
        at la.cps.shl7.entities.PACS.getImages(PACS.java:126)

So... what am I missing about dcm4che/jai/imageio?

eantoranz 10-23-2012 04:21 PM

Ok.... got it. There's a shared object in jai_image (libclib_jiio.so) that has to be accessible as well. I put it in JDK's jre/lib/i386/ directory.


All times are GMT -5. The time now is 09:17 AM.