@@ -46,9 +46,14 @@ def __init__(self):
46
46
47
47
# Second postprocessing option: intersect with boundary of the mask.
48
48
self .button2 = QPushButton ("Intersect with Boundary" )
49
- self .button2 .clicked .connect (self .on_intersect )
49
+ self .button2 .clicked .connect (self .on_intersect_boundary )
50
50
layout .addWidget (self .button2 )
51
51
52
+ # Third postprocessing option: intersect with the mask.
53
+ self .button3 = QPushButton ("Intersect" )
54
+ self .button3 .clicked .connect (self .on_intersect )
55
+ layout .addWidget (self .button3 )
56
+
52
57
# Add the widgets to the layout.
53
58
self .setLayout (layout )
54
59
@@ -82,10 +87,17 @@ def on_filter(self):
82
87
segmentation [np .isin (segmentation , filter_ids )] = 0
83
88
self ._write_pp (segmentation )
84
89
85
- def on_intersect (self ):
90
+ def on_intersect_boundary (self ):
86
91
if not self ._conditions_met ():
87
92
return
88
93
segmentation , mask = self ._get_segmentation_and_mask ()
89
94
boundary = find_boundaries (mask )
90
95
segmentation = np .logical_and (segmentation > 0 , boundary ).astype (segmentation .dtype )
91
96
self ._write_pp (segmentation )
97
+
98
+ def on_intersect (self ):
99
+ if not self ._conditions_met ():
100
+ return
101
+ segmentation , mask = self ._get_segmentation_and_mask ()
102
+ segmentation = np .logical_and (segmentation > 0 , mask > 0 ).astype (segmentation .dtype )
103
+ self ._write_pp (segmentation )
0 commit comments