Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Xenium cell segmentation mask export requires coordinate flipping among y-axis

未关闭
#240 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
28/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python

调研方向

使用 Xenium breast dataset、来自 sd.read_zarr 的 spatialdata 对象、rasterio.transform.from_bounds、rasterize 和 tiff.imwrite 重现报告的导出结果。比较坐标约定并确定 y 轴反转发生的位置;当导出的掩码与表达结果对齐,且不存在无法解释的手动翻转时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

I have a script that pulls the cell segmentation mask from a spatialdata io object from Xenium and exports it as a tiff for our visualization software. The data are taken from this publicly available breast dataset:

sdata = sd.read_zarr(zarr_path)

cells = sdata.shapes['cell_boundaries']

x_min, y_min = np.min((adata.obsm['spatial']), axis=0)
x_max, y_max = np.max((adata.obsm['spatial']), axis=0)


transform = rasterio.transform.from_bounds(x_min, y_min, x_max,
                                           y_max, int(x_max - x_min), int(y_max - y_min))

shapes = [(geom, idx) for idx, geom in enumerate(cells.geometry)]

mask = rasterize(shapes=shapes, out_shape=(int(y_max - y_min), int(x_max - x_min)),
                 transform=transform, dtype='int32')

tiff.imwrite(f"mask.tiff", mask)

However, upon exporting the mask to tiff format, the coordinates in the y-axis are flipped:

Image

If I flip the mask array among the y-axis prior to export, the mask now aligns with the expression results:

tiff.imwrite(f"mask.tiff", np.flip(mask, axis=0))

Image

主要语言
Python
星标
107
派生
65
平均合并
10 天 10 小时
30 天内合并 PR
1

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

scverse/spatialdata-io 的其他 Issue

查看 scverse/spatialdata-io 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。