IP Howto?

Hi all,


I'm struggling to write a node which uses the IP framework, all the images come out "greyed" rather than the colour PNG data which is obtained via web services. Does anyone have a howto which you can use to author IP nodes?


thanks in advance,

Hi acassin,

could you please provide some more details? E.g. which node do you use to get your images into KNIME? The "Read PNG Images"-node from the IO-category (this node is not compatible to the nodes of the community contributed KNIME-IP-Nodes from the "Community Nodes"-category)? What node are you intented to write?

To use the community contributed nodes (http://tech.knime.org/community-image) there are two ways to read images so far: the Image Reader (images from files), OmeroDBConnection (get images from an Omero database). Unfortunately, there is no node to get images from an arbitrary (web)-url, yet.

If you need some help with the community contributes ip-nodes, just let me know.




I am writing  my own KNIME node to use org.knime.ip classes (stable release) to load pictures from www.ebi.ac.uk web services (eg. interproscan) so I'm not loading the images from IP nodes, but rather my own with the http SOAP responses. 

However, the PNG images from EBI are coloured by the algorithm(s) which produced results. But after creating a table with an RealImageCell with the following fragment during execute():

	    final ImageReference ref = new ImageReference(filename, "", filename);
    Image<? extends RealType> img = is.getImage(ref, m_sel.createSubset(image_source.getDimensions(ref)));
    DataCell png_cell = new RealImageCell(img);
    container.addRowToTable(new DefaultRow(outstanding_jobs.get(key), new StringCell(key), xml, png_cell));
// create image cell using fname as a reference
    final ImageReference ref = new ImageReference(fname, "", fname);
    Image<? extends RealType> img = is.getImage(ref, m_sel.createSubset(is.getDimensions(ref)));
    DataCell png_cell = new RealImageCell(img);
     container.addRowToTable(new DefaultRow(outstanding_jobs.get(key), new StringCell(key), xml, png_cell));

The image cells are not in colour, but greyed out. I thought it might that only a single plane was being loaded, but I dont understand how the API works to use it effectively. I guess I am not quite sure where to begin.

thanks for your help,

Hi acassin,

your provided code suggests that you have implemented the ImageSource interface. You can do so, but it is not necessarily essential, except you want to use the ImageReferenceCell (which only keeps image references, instead of the images itself, and loads the images on demand from the associated image source).

Anyway, the actual logic, how you retrieve and create the image object is probably implemented in these ImageSource object "is". The code you posted seems not to be the problem.

So I would suggest that you send me the whole so far existing code of the node you want to implement (including your ImageSource implementation) by mail (mailto:martin.horn@uni-konstanz.de) which makes it a lot easier to give you some start-up aid.



Hi all,

Turns out EBI deliver png data with an alpha channel, which IP does not currently support. There are two alternatives to workaround this:

1) use PNGImageContent which is part of the KNIME core distribution (ah... eclipse code-completion didn't find it for me so I didn't know it was there) to display the data. This can be found in the org.knime.core.data.image.png package

2) use the IP framework in your node (which requires the extension be installed into the KNIME instance). In this case the solution is to ignore the alpha channel. Martin suggested something like:

final ImageReference ref = new ImageReference(filename, "", filename);
int[] imgDims = is.getDimensions(ref); //holds the dimension sizes of the image in the order: XYZCT
imgDims[3] = 3; // trim fourth channel
Image<? extends RealType> img = is.getImage(ref, new Subset(imgDims));

which works just fine. The two approaches are similar for memory usage and both should scale to thousands of images.