Python scripting node - converting Image to Labeling Column Type

Hi all,
I am working on a task where I need to find and label connected components in an image. I am using Python script (1=>1) node and I wanted to convert output (column type: Image) to Labeling type. Could you please advise if I have done this correctly because I am having issue where only one from two images I loaded using Image reader node is successfully converted to labeling type.

Here is my workflow: Python_ConnectedComponentsLabeling.knwf (58.4 KB)

Thank you in advance

Hi,
Welcome to the KNIME Forum! The GroupBy node aggregates all rows into one, this is not what you want. I think you need the Image to Labeling node.
Kind regards,
Alexander

2 Likes

Thank you very much for your reply @AlexanderFillbrunn
I wasn’t sure about that node because it basically does what I wrote in python script (assigns label/color), right? So it didn’t make sense for me to use that node. But if there are no other options I will use Image to labeling node.

Hi,
Your Python script returns another image, while the Image to Labeling node produces a Segmentation. You can see the difference in the icon in the column header, where it says IMG for images and SEG for segmentations.
Kind regards,
Alexander

2 Likes

Hi @zerina,

Just to add a little more detail: The Image to Labeling node takes a “regular” input image and assigns all pixels with the same pixel value to the same segment and assigns the pixel value as label to each segment. Hence, it can wrap “labeling” images from as generated by other tools, like Python, into Labeling Images (as denoted by the different icon in the column header).

Best,
Stefan

2 Likes

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