Convert columns with IMG images to PNG or save as excel with embedded images

Dear all,

I am reading images with the image writer node and process these images with various other nodes. Neither after the image reader node nor after processing I am able to save the table with images (IMG columns) as an excel file with embedded images. This works fine with png images that I created in another knime workflow. Therefore I tried to convert the IMG column to PNG but this failed as well.

Conversion to png reveals only a string such as:

[org.knime.core.data.image.png.PNGImageContent@ed5fc431]

 

If I save the table as excel, than the excel cells only contain strings such as:

Image[
name=Imaging 20x 02_008.tif;
source=C:\Users\sscholz\Documents\Projekte\2016 Thyroid disruption screen\2016_03_16_15_48_24--Phloroglucinol1002\Sequence_001\Imaging 20x 02_008.tif;
dimensions=1096,587 (X,Y);
min=0,0;
pixel type=UnsignedShortType)]

		<p>&nbsp;</p>

		<p>The problem might be associated with the pixel type. Therefore, I tried to use the image converter node and also changed the pixel type for the output of the image reader (tried all different options), without success.</p>

		<p>Maybe this information is useful: During the image reading there was the following warning message in the console:</p>

		<p>WARN&nbsp; Image Reader (Table) 0:19&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Expected positive value for PhysicalSizeY; got -1.96586E9</p>

		<p>Any idea? Thanks in advance. Stefan</p>
		</td>
	</tr>
</tbody>

Hi Stefan,

can you use the "Renderer to Image" node to try to render the PNG Value to an Image? This is actually a bit of a workaround but might help you for now. 

If you could províde a small example workflow demonstrating the problem, I will try to find a more general solution.

 

Hope this helps,

Christian

 

Hi Christian,

I tried to render as suggested - without success. I also converted the tiff image to jpg and load the jpg to the workflow - no success with png conversion as well.

I have attached a little workflow and an example image (jpg conversion since upload of tif is not allowed; however the tif image should be included in the workflow.

Kind regards

Stefan

Hi Stefan,

I took a look at your workflow and  was able to create png images out of the ImgPlus cells and also add them to a xls sheet using the XLS Writer node.

All you need is the ImgPlus to PNG Images node followed by a Split Collection Column node. This will create one column for each image in the collection.

The ImgPlus to PNG Images node creates a collection column out of the input, to allow converting image stacks and time series.

More information about collection cells can be found here: https://www.knime.org/blog/collection-cookbook

This should solve your problem.

best regards

Gabriel

1 Like

Hi Gabriel,

I do not really understand the concept of the collection columns at present, but your suggestion worked perfectly. Thanks a lot for the quck response and support.

Stefan