我有一些医学图像,它被压缩为无损图像。 这些图像只能在matlab和accusoft Java API中读取。
我们如何在java中加载这些类型的图像?
我目前的代码是:
Image img = null;
ImageInputStream iis = new FileImageInputStream(file);
for (Iterator<ImageReader> i = ImageIO.getImageReaders(iis);
img == null && i.hasNext();) {
ImageReader r = i.next();
try {
r.setInput(iis);
img = r.read(0);
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("Imagee : "+img);
但我得到例外:
javax.imageio.IIOException: Unsupported JPEG process: SOF type 0xc3
at
com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:609)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:347)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:481)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:602)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1059)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1039)
at javax.imageio.ImageReader.read(ImageReader.java:939)
at losslessimagereader.LosslessImageReader.main(LosslessImageReader.java:49)
请帮我解决这个问题。