Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions synapse_net/tools/postprocessing_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ def __init__(self):

# Second postprocessing option: intersect with boundary of the mask.
self.button2 = QPushButton("Intersect with Boundary")
self.button2.clicked.connect(self.on_intersect)
self.button2.clicked.connect(self.on_intersect_boundary)
layout.addWidget(self.button2)

# Third postprocessing option: intersect with the mask.
self.button3 = QPushButton("Intersect")
self.button3.clicked.connect(self.on_intersect)
layout.addWidget(self.button3)

# Add the widgets to the layout.
self.setLayout(layout)

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

def on_intersect(self):
def on_intersect_boundary(self):
if not self._conditions_met():
return
segmentation, mask = self._get_segmentation_and_mask()
boundary = find_boundaries(mask)
segmentation = np.logical_and(segmentation > 0, boundary).astype(segmentation.dtype)
self._write_pp(segmentation)

def on_intersect(self):
if not self._conditions_met():
return
segmentation, mask = self._get_segmentation_and_mask()
segmentation = np.logical_and(segmentation > 0, mask > 0).astype(segmentation.dtype)
self._write_pp(segmentation)
Loading