Computed geometric features differ between nodes

Dear Knime,

I was trying to extract simple geometric features from binary images.
My impression is that the results are not consistent between nodes. I also compared the results with the imageJ1 feature extraction.

The original image is a binary with a circle (top, label1) a C (bottom, label3) and the convex-hull of the C (middle, label2)
test_image_label_features|nullxnull

I tried the Image Segment Features, Segment Features, Feature Calculator (BETA) . Image Segment Features and Segment Features give the same results.

Here are the results for convexity and area

Convexity
Image_segment_features Feature_extract_beta ImageJ (solidity)
Label1 0.993 0.954 0.986
Label2 0.99 0.957 0.984
Label3 0.978 0.77 0.745
#pixels
Image_segment_features Feature_extract_beta ImageJ
Label1 9001 8850 9001
Label2 7706 7557 7706
Label3 5770 5586 5770

For area I do expect to get the same value in all nodes. The Feature extract beta does not seem to be consistent. For convexity depending on the formula used and how the convex-hull is calculated one could have different values. However, label3 is clearly less convex then the rest and this is not reflected in the convexity computed from Image Segment Features.

Thank you for your help

Antonio

test_segment_features.knwf (11.3 KB)

The upload of the image does not seem to work.
Here is a link to the test image

https://owncloud.gwdg.de/index.php/s/dJ0sLZ2stEUwbsx

Hi @apoliti,
thanks for submitting this, especially with the test image. I won’t have time to look at it this week, but will do so on Monday.
best,
Gabriel

Hello Gabriel,
could you indicate me where the source code for the feature extraction is. I could check this problem myself and maybe I understand where the difference come from.
Greetings

Antonio

Hi @apoliti,

The source code for the image features and segment features node can be found here:

The code for the feature calculator node (beta) is here :

best,
Gabriel

Thanks

Hello Gabriel,
it is not easy to figure out code from someone else.
I write you some of my guesses, but I think you should look into it. In particular for the Image_segment_features.

From Geometric2DFeatureSet.java (beta feature node) my guess is that the size of the labelled image is not what one expects due to the usage of polygon2D. The labelled image is transformed to a polygon2D and this may give a different total size? But why the size is so much smaller? Is this a known behavior from img2 ROIs? I will check this in plain ImageJ and let you know.

The beta feature convexity uses ops. The definition is perimeter of convex_hull to original object perimeter. One gets what is expected.

For the image_segment_features (knip/SegmentFeatureSet.java) I don’ t see how the convexity is calculated. I think the returned parameter is m_solidity which seems the ratio of area/area_convexHull. Could it be that the way knime computes convex_area is different from the other nodes?

This worries me a little as one expect rather similar results for such simple operations.

Greetings

Hi Gabriel @gab1one,
any news on this issue? I would really like to use knime but first I need to be sure that the obtained values are correct. A 5%-10% difference in area measurement given a binary image is not what I would expect.

Greetings
Antonio