problems reading images

I have been having some problems with the image processing

1) if there is an error reading an image file, the file is not closed so therefore cannot be deleted (on Windows at least) until one exits KNIME.  This is annoying since the files can't then be re-written to address the problem without restarting KNIME.

2) it seems problematic to read  jpg images directly from URL's  (using the table reader). The documentation suggests that I can do this, but I get errors. Even writing the images to a file, then reading the file is problematic.

These are straightforward JPG images that display fine in the browser, and by image-viewing tools when saved as files.  The log tracebacks are attached.  The actual JPG image associated with the traceback is also attached.

Hi Matthew,

Thanks for your post. 

Regarding (1): We hoped to have this fixed with our latest KNIME Image Processing release. Which version of KNIME Image Processing are you running?

Regarding (2): Yes, reading from URLs is supported for FTP, KNIME and HTTP. Which kind of error are you experiencing? Can you post the error message and maybe the KNIME log?

Best,

Christian

Hi,  I had put the log files in the "log file" window below the comment window when I submitted the bug - where did that part of the submission go?  I am using Knime 3.3.2: 

KNIME Analytics Platform    3.3.2.v201704061137    org.knime.product.desktop    null

KNIME Image Processing    1.5.4.201704081950    org.knime.knip.feature.feature.group    University of Konstanz / KNIME

error reading image from http.  This happens and no images are read.

2017-05-15 14:33:38,492 : WARN  : KNIME-Worker-5 : ImgReaderTableNodeModel : Image Reader (Table) : 0:110:110 : Encountered exception while reading image: http://mycompany.com/content/object/id/2.0-S0730725X7300140-gr3_lrg.jpg?apiKey=833dc5c207d3787646949d91! view log for more info.
2017-05-15 14:33:38,492 : DEBUG : KNIME-Worker-5 : ImgReaderTableNodeModel : Image Reader (Table) : 0:110:110 : Encountered exception while reading image:
java.lang.NullPointerException
    at io.scif.formats.NRRDFormat$Reader.openPlane(NRRDFormat.java:473)
    at io.scif.formats.NRRDFormat$Reader.openPlane(NRRDFormat.java:422)
    at io.scif.AbstractReader.openPlane(AbstractReader.java:167)
    at io.scif.filters.ChannelFiller.openPlane(ChannelFiller.java:171)
    at io.scif.filters.ChannelFiller.openPlane(ChannelFiller.java:151)
    at io.scif.filters.PlaneSeparator.openPlane(PlaneSeparator.java:305)
    at io.scif.filters.PlaneSeparator.openPlane(PlaneSeparator.java:208)
    at io.scif.filters.AbstractReaderFilter.openPlane(AbstractReaderFilter.java:225)
    at io.scif.filters.AbstractReaderFilter.openPlane(AbstractReaderFilter.java:191)
    at io.scif.img.ImgOpener.read(ImgOpener.java:832)
    at io.scif.img.ImgOpener.read(ImgOpener.java:798)
    at io.scif.img.ImgOpener.readPlanes(ImgOpener.java:785)
    at io.scif.img.ImgOpener.openImgs(ImgOpener.java:383)
    at io.scif.img.ImgOpener.openImg(ImgOpener.java:529)
    at org.knime.knip.io.ScifioImgSource.getImg(ScifioImgSource.java:297)
    at org.knime.knip.io.nodes.imgreader2.AbstractReadImgFunction.readImageAndMetadata(AbstractReadImgFunction.java:138)
    at org.knime.knip.io.nodes.imgreader2.readfrominput.ReadImgTableFunction.lambda$0(ReadImgTableFunction.java:101)
    at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
    at java.util.stream.IntPipeline$Head.forEachOrdered(IntPipeline.java:567)
    at org.knime.knip.io.nodes.imgreader2.readfrominput.ReadImgTableFunction.apply(ReadImgTableFunction.java:95)
    at org.knime.knip.io.nodes.imgreader2.readfrominput.ImgReaderTableNodeModel.execute(ImgReaderTableNodeModel.java:154)

 

Error reading a saved jpg from a file (this error occurs about 20% of the time. All of the images are displayed correctly in a browser, like the attached image)

2017-05-15 14:36:33,646 : WARN  : KNIME-Worker-9 : ImgReaderTableNodeModel : Image Reader (Table) : 0:110:67 : Encountered exception while reading image: file:/C:/temp/images/file_35.jpg! view log for more info.
2017-05-15 14:36:33,646 : DEBUG : KNIME-Worker-9 : ImgReaderTableNodeModel : Image Reader (Table) : 0:110:67 : Encountered exception while reading image:
java.lang.IllegalArgumentException: Numbers of source Raster bands and source color space components do not match
    at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:482)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.acceptPixels(JPEGImageReader.java:1268)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1236)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1039)
    at javax.imageio.ImageIO.read(ImageIO.java:1448)
    at javax.imageio.ImageIO.read(ImageIO.java:1352)
    at io.scif.formats.ImageIOFormat$Parser.typedParse(ImageIOFormat.java:131)
    at io.scif.formats.JPEGFormat$Parser.typedParse(JPEGFormat.java:162)
    at io.scif.formats.JPEGFormat$Parser.typedParse(JPEGFormat.java:150)
    at io.scif.AbstractParser.parse(AbstractParser.java:253)
    at io.scif.AbstractParser.parse(AbstractParser.java:220)
    at io.scif.AbstractParser.parse(AbstractParser.java:317)
    at io.scif.AbstractParser.parse(AbstractParser.java:52)
    at org.knime.knip.io.ScifioImgSource.getReader(ScifioImgSource.java:486)
    at org.knime.knip.io.ScifioImgSource.getSeriesCount(ScifioImgSource.java:217)
    at org.knime.knip.io.nodes.imgreader2.readfrominput.ReadImgTableFunction.apply(ReadImgTableFunction.java:82)
    at org.knime.knip.io.nodes.imgreader2.readfrominput.ImgReaderTableNodeModel.execute(ImgReaderTableNodeModel.java:154)
    at org.knime.core.node.NodeModel.execute(NodeModel.java:732)
    at org.knime.core.node.NodeModel.executeModel(NodeModel.java:566)
    at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1128)
    at org.knime.core.node.Node.execute(Node.java:915)

 

 

 

 

Hi Matthew,

I managed to locate a source for your first problem, it requires a fix in an external library so it will take a while until it lands in KNIME, you can see the progress on that front here:  (https://github.com/scifio/scifio/pull/351).

The image you supplied seems to cause problems with the JPEG reader shiped with java. I will investigate further how and why this is happening.

best,

Gabriel

Hi,

The issue may be that the jpg files are grayscale and the reader doesn't anticipate that.

Matt

Hi,

The issue may be that the jpg files are grayscale and the reader doesn't anticipate that.  I appears to try to read the r/g/b/ planes but the grayscale images don't have 3 planes.

Matt