Labelfilter

Hi again!

I would like to filter a label in a way that only the label that covers the biggest area (highest number of pixels) is kept. I used the segment feature, sorter and row filter nodes to identify the largest label and exclude all the others. So what I get is a table that contains the row ID, the bitmask image, the label, the source labeling and the num pix. Now I can use the "Image to labeling" node on the bitmask image of the largest label to create a new label that contains only the one I wanted. The problem is  that this labeling doesn't have the same dimensions as the original label I started with. (it's of course smaller since it was created from the bitmask image). Since I would like to use this filtered label to do some labeling arithmetic with yet another label that has the same dimensions as the original one it would be cool if there is a way to solve this problem. I dont know if you understand what I mean so I attached a few pictures.

Best
Christian

Hi Christian,

this is easily done with the "Image GroupBy" node. Well, to be honest, the configuration of that node is not that easy, therefor I appended an example workflow. But as short explanation: put a the "Image GroupBy" node after the Row Filter and choose as group column "Source Labeling", then select in the "Labeling Compose Options"-tab as "Interval" "Source labeling" as well (determines the dimensions of the resulting labeling) and select in the "Options"-tab the "Bitmask"-column and choose "Compose Labeling" as aggregation operation. This means in short: take all the bitmasks, which stem from the same labeling (source labeling) and but them into another labeling, whose size is determined by the "Source Labeling". Of course, you can also select other grouping- and aggregation-options. You could also use the "GroupBy"-node, but there you can not determine the size of the resulting labeling (it will have the minimum size such that all grouped bitmasks fit into it).

Hope that works for you ...

Cheers,

Martin

 

Hi Martin,

Just tried and it works perfectly fine. Thank's for your help!

Have a nice day!

Christian