Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

78 improvements to vesicle pool assignment widget #81

Merged

Conversation

lufre1
Copy link
Contributor

@lufre1 lufre1 commented Dec 10, 2024

…d overwrite intersecting vesicle pools with new ones
…es they are based upon and started adding second distance input layer for vesicle pool widget
@lufre1 lufre1 linked an issue Dec 10, 2024 that may be closed by this pull request
Copy link
Contributor

@constantinpape constantinpape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good overall, only a few minor comments.

Also, I suggest we remove the "-segmentation" from the name here: https://github.com/computational-cell-analytics/synapse-net/blob/main/synapse_net/tools/segmentation_widget.py#L119

Otherwise the name of the distance layer would get quite long.

# Add distances2 if present.
if distances2 is not None:
distance_ids = distances2.get("label", [])
if set(distance_ids) != set(morphology_ids):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might not have the morphology ids here, since I made the morphology optional. You can use merged_df.label instead.

return
distances2 = pd.DataFrame(distances2).drop(columns=["index"])
merged_df = merged_df.merge(distances2, left_on="label", right_on="label", suffixes=("", "2"))
print(merged_df)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove print, this would confuse users.

@@ -87,7 +87,8 @@ def on_measure_seg_to_object(self):
seg_ids=seg_ids,
)
table_data = self._to_table_data(distances, seg_ids, endpoints1, endpoints2)
self._add_lines_and_table(lines, table_data, name="distances")
structure_layer_name = self._get_layer_selector_layer(self.image_selector_name2).name
self._add_lines_and_table(lines, table_data, name="distances-to-" + structure_layer_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's shorten the structure_layer_name in the segmentation widget to avoid too long names here, see general comment.

@@ -68,6 +72,8 @@ def on_pool_vesicles(self):

distance_layer = self._get_layer_selector_layer(self.dist_selector_name1)
distances = None if distance_layer is None else distance_layer.properties
distance_layer2 = self._get_layer_selector_layer(self.dist_selector_name2)
distances2 = None if distance_layer2 is None else distance_layer2.properties
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also set distances2 to None if it is the same selected layer as distances. I think this will be the default napari behavior, because the selector will always select a shape layer if it's there, so even if we only have one distance it will be selected.

…viour for selected structure2 in vesicle_pool_widget to ignore structure2 if its the same as structure1
@lufre1
Copy link
Contributor Author

lufre1 commented Dec 10, 2024

@constantinpape

@constantinpape constantinpape merged commit 458ec90 into main Dec 10, 2024
1 check failed
@constantinpape constantinpape deleted the 78-improvements-to-vesicle-pool-assignment-widget branch December 10, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improvements to vesicle pool assignment widget
2 participants