Skip to content

Commit 71a0343

Browse files
Add mask intersection post-processing (#115)
1 parent ba00244 commit 71a0343

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

synapse_net/tools/postprocessing_widget.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@ def __init__(self):
4646

4747
# Second postprocessing option: intersect with boundary of the mask.
4848
self.button2 = QPushButton("Intersect with Boundary")
49-
self.button2.clicked.connect(self.on_intersect)
49+
self.button2.clicked.connect(self.on_intersect_boundary)
5050
layout.addWidget(self.button2)
5151

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+
5257
# Add the widgets to the layout.
5358
self.setLayout(layout)
5459

@@ -82,10 +87,17 @@ def on_filter(self):
8287
segmentation[np.isin(segmentation, filter_ids)] = 0
8388
self._write_pp(segmentation)
8489

85-
def on_intersect(self):
90+
def on_intersect_boundary(self):
8691
if not self._conditions_met():
8792
return
8893
segmentation, mask = self._get_segmentation_and_mask()
8994
boundary = find_boundaries(mask)
9095
segmentation = np.logical_and(segmentation > 0, boundary).astype(segmentation.dtype)
9196
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

Comments
 (0)