Labeling arithmetic

Hello KNIME-team!

I would like to combine two labels. The idea is to include only those labels of label1 that are covered by label2. That is just a simple AND operation and it works well using the Labeling Arithmetic Node. The problem is that this method always removes parts of the labels of label1 that are only partially covered by label2 and I would like to have those labels completely included in the resulting label. I wonder if there is a way to do this. I attached a picture to demonstrate what I mean (it's only in 2D but I would like to do it in 3D). So what you get with AND in LA-node is shown in (3) and what I would like to get is (4).

Thanks,

Christian

Hi Christian,

just a quick idea. If you need more details or an example workflow, just let me know.

First convert your labeling into a table by using the "Segment Features"-node. This node needs to be configured such that all checkboxes in the "ROI Settings"-tab are activated. This appends to every segment (i.e. a row in the resulting table) the labels of the segments they overlap with. Now you can filter out (Row Filter) all the rows, that do not overlap with a segment with certain label. Finally, the "GroupBy"-node ("Compose Labeling"-aggregation operator on the bitmask-column) allows you to compose again a labeling from the filtered segment table.

Does this work for you?

Best,

Martin

 

Hi Martin,

thanks for your help. I think what you suggested doesn't work in my case or maybe I didn't fully understand how to do it. I create based on the same image stack two different labelings. One contains many small segments and the second just one big one (like it is shown in the picture of my first post). But these are two different labelings. I can transform the first labeling into a table with all the ROI options checked but it doesn't help much since this labeling doesn't contain the segment I want to find the overlap with (it can be found only in the second labeling). To do your trick I would need a labeling that fully contains all the segments of label1 and the one big segment of label2 and I dont really know how to do this. I hope you can understand what I mean.

Best,

Christian

 

Hi Christian,

oh, sorry, I missed this important detail that you haven't merged the two labelings.

So, there is still a quite simple solution:

1. convert both labelings into a data table ("Segment Cropper" or "Segment Features") and than

2. use the "Compare Segments" node to identify the segments that overlap with the reference segment and

3. filter them according to the "maxmum relative pixel agreement" bigger than 0

4. group the resulting table back to labeling as described in the last post.

Hope that helps ...

Martin

just for curiosity: can't you use the Labeling Arithmetic Nodes with the "merge" option to create one labeling containing all labels?

 

Greetings,

Christian

Thanks guys! I just tried Christians suggestion and if I first merge both labelings with the LA-node I can do what you suggested yesterday Martin. I will also try what you suggested today but I'm sure it also works.

Thanks again!

Christian

Hi all,

I would also like to do the same thing like Christian :-). Could some one please give me an example workflow how to manage that?

 

Kind regards,

Flo

Hi Flo,

maybe this can help. The file contains workflow and test image.

Best

Christian

Hi Christian,

you helped me a lot thank you :-)

 

Kind regards,

Flo