Knime cellpose missing file name

Dear Community,

I am using the Cellpose node in Knime for segmentation of difficult-to-segment images. So far so good. The labeling image looks good and then I apply the labels to another channel of the same data set to measure features like intensity and size via the “Image Segment Features” and “Feature Calculator (BETA)” nodes. I get numbers which is great.

However, somewhere along the way, the file name gets lost:

The workflow is below:

On another workflow, using connected component analysis to create the labels, I get the name of the original file in the Source labeling column following “name”:

I would like the file name to be available to cross reference the results with the respective processed files. Or if the file name cannot be retrieved, now can I access the group ID to add a name column so that I can identify different files in the result table entries.?

I haven’t quite conquered looping over individual files yet which might(?) help naming things. And I do not fancy processing one file at a time - or in fact recommending that to our user…

Any advice would be much appreciated.

Best regards,

Marie

Hi Marie,

Great to see this being used!

Yes, the Cellpose segmentation node simply takes the label images from the Python node and transforms them to labelings. The name metadata get lost at the Python script node.
In theory, we could use the Transfer Image Metadata node to keep these metadata in the result. If you want to play with it: unlink the component node and then Ctrl-double-click the node to edit its contents :slight_smile:

But there are of course other ways of keeping track of the filename:

  • Use the RowID in the Joiner node to join with the original input image (you seem to be doing this already in your workflow)
  • Using the Image Properties node, extract the filename from the input image into a new column
  • Downstream of the (Image) Segment Features or Feature Calculator nodes, use “Source Labeling” as a matching criterion in the Joiner to join with the input table. Note that the “Source Labeling” column is still of type ‘Labeling’ (i.e. ‘Seg’ in the column header), it’s just not displayed as an image, but it’s still a reference to the original label image.

Alternatively, you can also:

  • use the RowID node to make a new column from the Row ID, then
  • split at the occurrence of # separate the original Row ID from the label number, then
  • merge using the original Row ID.

As you see, there are tons of ways to reach the goal, and it’s sometimes hard to choose the most efficient one…

Hope that helps.

2 Likes

Hi Jan,

Thank you very much for the comprehensive answer. I have finally gotten around to play through the different scenarios.

Yes, I am using this successfully to join the data.

I used the node to get the name and it disappears after the “Image Segment Features” and “Feature Calculator (Beta)” nodes

The Feature Calculator node does not output a s"Source Labeling" column - unless there is a configuration setting that I have overlooked - so cannot use those as a matching criterion.

This is what I have now successfully implemented. Thank you so very much, this has helped a lot. Now I am happy with passing the workflow on to a user :smile:

I guess this was a classic case of trying to use a new software and not being aware of all the things the nodes can do.

Best wishes,

Marie

Hi Marie,

great to hear you were successful!

Just for completeness:

It should add a Source Labeling when Append segment information is checked in the options.

1 Like

Yes, it does.

Thanks!

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