There is a new KNIME forum. You can still browse and read content from our old forum but if you want to create new posts or join ongoing discussions, please visit our new KNIME forum: https://forum.knime.com

# Selection of central segment

Hi all,

I have images with several segments, as extracted in the segmentation. The Feature Calculation nodes calculates features of all of them. Indeed, I'm only interested in the features of the central segment. Is there any way to exclude the others?

Best,

Assindia

Comments
Wed, 01/10/2018 - 02:53

#### Member for

7 years 5 months

COS_HD1

Hi Assindia,

you could use the values for the X and Y centroids (provided by the segment features node) to calculate for each segment its (euclidian) distance to the center of your image. You could use the Math Formula node for that. Then you can use the sorter node and the row filter node to find the segment that has the smallest distance from the center. That should be the segment you want. To get the center point of your image is easy if your images always have the same size (in that case you would just use the fixed x and y dimensions (e.g. 512x512px -> center point is at (256,256)). If the size of the images you want to analyze changes you could use the image properties node to read out the x and y dimensions, convert them into flow variables and calculate the center point for each image automatically (again using a math formula node).

Best

Christian

Fri, 01/12/2018 - 05:08

#### Member for

2 years 3 months

Assindia

Hi Christian,

Thanks for your helpful solution, works really well!

My database right now is the central segment with the features, calculated in the same step as the centroid locations.

I'm wondering whether it's possible to select the central segment at first and calculate the features afterwards, but just for this single segment, to reduce running time. Do you have any ideas concerning this optimation?

Best,

Assindia

Mon, 01/15/2018 - 08:33

#### Member for

7 years 5 months

COS_HD1

Hi Assindia,

I think to find the central segment you have to at least calculate the x and y centroids for each segment. I don't think that you can avoid that step. In best case you can first calculate only the centroids for all segments (if you use the segment features node for that and you only select to calculate the centroids here it should be fairly fast). Then you do the filtering to only keep the central segment and in a second step (in the feature calculator node) you calculate all the features that you really need only for your central segment.

Hope that helps,

Christian