Export Bitmasks, produced images etc.

Hey everyone,

 

I am looking for a way to export my produced bitmasks, composed images etc. from different parts of the workflow from KNIME. The exported image should be the same I see when I select the Image Viewer. In this menu is an export function, but this is taking a kind of screenshot of the complete menu.

I found some nodes (Labeling to PNG images, Labeling to image), which in my opinion should help. Using the first one, I get the error message: "Labeling and image are incompatible, different dimension count! Missing cell has been inserted". Using the second node, I get: "Pixeltype BitType can't be written in the selected Format.". Are there some special options I have to adjust to make it work?

It would be great, if someone could help me with this :-)

Best regards,

Björn

Hi Björn,

I think what you want to do is to use the "Labeling to RGB" node in combination with the `Image Writer'. Did you try this?

Cheers,


Christian

Hi Björn,

To use the Labeling to Image node, configure the node and set the output type to BYTETYPE. Then you can write it with the Image Writer node as PNG without any problems.

When using the Labeling to PNG Images node, make sure you have selected the correct columns in the Column Selection tab. Otherwise you will get errors like the one you posted.

best,

Gabriel

PS: I attached a workflow that shows both examples

Hey,

thanks for the explanations and the sample workflow. This worked for some cases, but unfortunately not for all. One problem occurs, when I want to export an image I see in the "Interactive Segmentation View" node. There, a produced bitmask and the original image are combined, so that the viewer can compare the produced bitmask and the original image (both images are superposed). When I try to export this view with the different image writer nodes, I always get error messages (as I stated at the top of this discussion). I tried different combinations of nodes, I even used a Label resizer node, to force the bitmask length and width to the same size as the original image, but it won't work.

Any suggestions how I could solve this? Thanks in advance!

Best regards,

Björn

Hi Björn,

The node you should use to create such a  composed views is Labeling to RGB Image. You might need to look at the settings in the  Background Image tab, maybe the wrong image is selected there? Obviously this only works with images that have the same size as the labeling. If you are still having issues I can also take a look at your workflow to what is going wrong.

Gabriel (or anyone else)

 

It looks like Labeling to PNG is broken. The labeling is converted but the merge with the background image does not seem to work. The column creates a text string (shown below). I see this in the test workflow as well as my own.

 

Andrew

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

Hi Andries,

can you post a small example workflow to reproduce the problem? I'll take care then!

Best,

Christian

 

PS: Just figured, Gabriel already posted one. Question: Which version of KNIP are you using? Nightly?

Thank Christian,

 

I am using the workflow that Gabriel posted. 

I am using the nightly build. I have not updated in the past 2 weeks because I'm in the middle of project.

An added note: I have been able to combine labels with the groupby node and export PNG files using  the labeling to RGBimg node. Unfortunately, I have not been able to figure out how to get the labels to be exported in color. If "compose labeling" is used in the Groupby node then the labels are combined but keep their individuality (hence you can see randomized color in the interactive segment view) but the "Labeling to RGB Img" node and subsequent "Image writer" generates a greyscale image. Setting the Groupby node to "compose image" creates  black and white image which is non-transparent and can't be used on overlay. Any suggestions?

 

Andries

Hi Andries

This is unfortunately a documented Image Writer Bug (https://github.com/knime-ip/knip/issues/446). The correct way would be "Labeling to RGB Img" and then write it to disk. I tried to find a workaround but was not able to come up with one.

 

Tim

Thanks Tim

 

That's very unfortunate. The images look great in the viewer but the screen shots are too low quality for publication.

Andries

 

Hi Andries, 

Maybe you can simply use the ImgPlus to PNG Image node and then use KNIME's image writer as a workaround?

Best

Christian

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.