Skip to content

Commit

Permalink
Fix radius
Browse files Browse the repository at this point in the history
  • Loading branch information
LLehner committed Aug 7, 2023
1 parent 8a61442 commit 790ac13
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/spatialdata_io/_constants/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class StereoseqKeys(ModeEnum):
EXPRESSION = "expression"
EXON = "exon"
# cells
CELL_AREA = "area"
CELL_ID = "id"
GENECOUNT = "geneCount"
DNBCOUNT = "dnbCount"
Expand Down
4 changes: 3 additions & 1 deletion src/spatialdata_io/readers/stereoseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,11 @@ def stereoseq(
region_key=StereoseqKeys.REGION_KEY,
instance_key=StereoseqKeys.INSTANCE_KEY,
)

radii = np.sqrt(adata.obs[StereoseqKeys.CELL_AREA].to_numpy() / np.pi)
shapes = {
StereoseqKeys.REGION_KEY: ShapesModel.parse(
adata.obsm[StereoseqKeys.SPATIAL_KEY], geometry=0, radius=1, index=adata.obs[StereoseqKeys.INSTANCE_KEY]
adata.obsm[StereoseqKeys.SPATIAL_KEY], geometry=0, radius=radii, index=adata.obs[StereoseqKeys.INSTANCE_KEY]
)
}
sdata = SpatialData(images=images, labels=labels, table=table, points=points, shapes=shapes)
Expand Down

0 comments on commit 790ac13

Please sign in to comment.