Skip to content

Commit

Permalink
[FIX] add center calculation to reading segmentation masks from spati…
Browse files Browse the repository at this point in the history
…aldata
  • Loading branch information
sophiamaedler committed Feb 10, 2025
1 parent 6299cc4 commit 6d16ccf
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/scportrait/pipeline/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ def load_input_from_sdata(
self._check_chunk_size(mask, chunk_size=self.DEFAULT_CHUNK_SIZE_2D) # ensure chunking is correct

self.filehandler._write_segmentation_object_sdata(mask, self.nuc_seg_name)
self.filehandler._add_centers(segmentation_label=self.nuc_seg_name)

# check if a cytosol segmentation exists and if so add it to the sdata object
if cytosol_segmentation_name is not None:
Expand All @@ -960,6 +961,7 @@ def load_input_from_sdata(
self._check_chunk_size(mask, chunk_size=self.DEFAULT_CHUNK_SIZE_2D) # ensure chunking is correct

self.filehandler._write_segmentation_object_sdata(mask, self.cyto_seg_name)
self.filehandler._add_centers(segmentation_label=self.cyto_seg_name)

self.get_project_status()

Expand Down Expand Up @@ -1001,12 +1003,6 @@ def load_input_from_sdata(
else:
self.log(f"No region annotation found for the nucleus segmentation {nucleus_segmentation_name}.")

# add centers of cells for available nucleus map
centroids = calculate_centroids(self.sdata.labels[region_name], coordinate_system="global")
self.filehandler._write_points_object_sdata(centroids, self.DEFAULT_CENTERS_NAME)

self.centers_status = True

# add cytosol segmentations if available
if self.cyto_seg_status:
if cytosol_segmentation_name in region_annotation.keys():
Expand Down

0 comments on commit 6d16ccf

Please sign in to comment.