Segment cropper corrupts images for python nodes

Hi,
I am regularly using python nodes to process images within knime.
I found out that if I use the segment cropper node to crop a ROI of a larger image, then I cannot load this cropped image in the python node ! It throws :
“Could not serialize image. Possible reasons: Unsupported image type, dimensionality of the image,…”

I tried converting the image with the image converter and different configuration for the background parameter of the cropper but it does not solve the problem.
I also tried different images and format and I have the same issue, while if I skip the cropper node the python node manages to load the input data.

Here is the workflow, the top python node should be able to load the input table, while the bottom one fails.
Bug_CropperPython.knwf (16.4 KB)

Hi Thomas,

this seems to be a bug in the KNIP Python Bindings Extension.

I think the problem is that it can not serialize images with non zero offsets. But I will investigate that further and open an issue.

I created a wrapped metanode which sets the offset to zero as a workaround: Bug_CropperPython.knwf (22.6 KB)

I hope this is a sufficient solution for you.

Benny

2 Likes

Regarding this ZeroMin metanode, see also this GitHub issue and the related discussion:

1 Like

Thanks for the answer, definitly helps.
As a side note from your workflow, I just understood that providing an offset value to the set metadata actually adds the provided value to the existing offset and do not replace it as one could expect, right ?

Yes. That’s a bit annoying. There is a GitHub Issue regarding this:

1 Like

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