Skip to content

Commit

Permalink
add center calculation to segmentation workflow
Browse files Browse the repository at this point in the history
when the segmentation mask is written to the spatialdata object the centers file for that mask is also generated. This not only tracks unique cell_ids but also their location for easier visualization

see #42
  • Loading branch information
sophiamaedler committed Feb 10, 2025
1 parent 6d16ccf commit 9524a0d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/scportrait/pipeline/segmentation/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,14 @@ def _save_segmentation_sdata(self, labels, classes, masks=None):
self.filehandler._write_segmentation_sdata(
labels[ix], self.nuc_seg_name, classes=classes, overwrite=self.overwrite
)
self.filehandler._add_centers(self.nuc_seg_name, overwrite=self.overwrite)

if "cytosol" in masks:
ix = masks.index("cytosol")
self.filehandler._write_segmentation_sdata(
labels[ix], self.cyto_seg_name, classes=classes, overwrite=self.overwrite
)
self.filehandler._add_centers(self.cyto_seg_name, overwrite=self.overwrite)

def save_map(self, map_name):
"""Saves newly computed map.
Expand Down

0 comments on commit 9524a0d

Please sign in to comment.