Skip to content

Commit 951fe24

Browse files
committed
changes names fo distance layers to be more associated with layer names they are based upon and started adding second distance input layer for vesicle pool widget
1 parent ba06a14 commit 951fe24

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

synapse_net/tools/distance_measure_widget.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ def on_measure_seg_to_object(self):
8787
seg_ids=seg_ids,
8888
)
8989
table_data = self._to_table_data(distances, seg_ids, endpoints1, endpoints2)
90-
self._add_lines_and_table(lines, table_data, name="distances")
90+
structure_layer_name = self._get_layer_selector_layer(self.image_selector_name2).name
91+
self._add_lines_and_table(lines, table_data, name="distances-to-" + structure_layer_name)
9192

9293
def on_measure_pairwise(self):
9394
segmentation = self._get_layer_selector_data(self.image_selector_name1)

synapse_net/tools/vesicle_pool_widget.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ def __init__(self):
3030
# 2. Selector for a distance layer.
3131
self.dist_selector_name1 = "Distances to Structure"
3232
self.dist_selector_widget1 = self._create_layer_selector(self.dist_selector_name1, layer_type="Shapes")
33+
# 3. Selector for a second distance layer (optional).
34+
self.dist_selector_name2 = "Distances to Structure 2"
35+
self.dist_selector_widget2 = self._create_layer_selector(self.dist_selector_name2, layer_type="Shapes")
3336

3437
# Add the selector widgets to the layout.
3538
layout.addWidget(self.vesicle_selector_widget)
3639
layout.addWidget(self.dist_selector_widget1)
40+
layout.addWidget(self.dist_selector_widget2)
3741

3842
# Create the UI elements for defining the vesicle pools:
3943
# The name of the output name, the name of the vesicle pool, and the criterion for the pool.
@@ -68,6 +72,8 @@ def on_pool_vesicles(self):
6872

6973
distance_layer = self._get_layer_selector_layer(self.dist_selector_name1)
7074
distances = None if distance_layer is None else distance_layer.properties
75+
distance_layer2 = self._get_layer_selector_layer(self.dist_selector_name2)
76+
distances2 = None if distance_layer2 is None else distance_layer2.properties
7177

7278
if segmentation is None:
7379
show_info("INFO: Please choose a segmentation.")
@@ -87,7 +93,9 @@ def on_pool_vesicles(self):
8793
pool_name = self.pool_name_param.text()
8894

8995
pool_color = self.pool_color_param.text()
90-
self._compute_vesicle_pool(segmentation, distances, morphology, pool_layer_name, pool_name, query, pool_color)
96+
self._compute_vesicle_pool(
97+
segmentation, distances, morphology, pool_layer_name, pool_name, query, pool_color, distances2
98+
)
9199

92100
def _update_pool_colors(self, pool_name, pool_color):
93101
if pool_color == "":
@@ -107,6 +115,7 @@ def _compute_vesicle_pool(
107115
pool_name: str,
108116
query: str,
109117
pool_color: str,
118+
distances2: Dict = None
110119
):
111120
"""Compute a vesicle pool based on the provided query parameters.
112121
@@ -118,6 +127,7 @@ def _compute_vesicle_pool(
118127
pool_name: Name for the pooled group to be assigned.
119128
query: Query parameters.
120129
pool_color: Optional color for the vesicle pool.
130+
distances2: Properties from the second distances layer (optional).
121131
"""
122132
# Check which of the properties are present and construct the combined properties based on this.
123133
if distances is None and morphology is None: # No properties were given -> we can't do anything.

0 commit comments

Comments
 (0)