From f1366bdcea69fc604fcb21bc11684bdcf5f43027 Mon Sep 17 00:00:00 2001 From: Liripo <54770415+Liripo@users.noreply.github.com> Date: Thu, 4 Sep 2025 16:06:09 +0800 Subject: [PATCH 1/3] Update legacy_anndata.py rgb format --- src/spatialdata_io/converters/legacy_anndata.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/spatialdata_io/converters/legacy_anndata.py b/src/spatialdata_io/converters/legacy_anndata.py index 3dcf05ee..a1b27de4 100644 --- a/src/spatialdata_io/converters/legacy_anndata.py +++ b/src/spatialdata_io/converters/legacy_anndata.py @@ -293,7 +293,8 @@ def from_legacy_anndata(adata: AnnData) -> SpatialData: "tissue_hires_scalef is required when an the hires image is present" ) hires_image = Image2DModel.parse( - hires, dims=("y", "x", "c"), transformations={f"{dataset_id}_downscaled_hires": Identity()} + hires, dims=("y", "x", "c"), transformations={f"{dataset_id}_downscaled_hires": Identity()}, + rgb=None, ) images[f"{dataset_id}_hires_image"] = hires_image @@ -306,7 +307,8 @@ def from_legacy_anndata(adata: AnnData) -> SpatialData: "tissue_lowres_scalef is required when an the lowres image is present" ) lowres_image = Image2DModel.parse( - lowres, dims=("y", "x", "c"), transformations={f"{dataset_id}_downscaled_lowres": Identity()} + lowres, dims=("y", "x", "c"), transformations={f"{dataset_id}_downscaled_lowres": Identity()}, + rgb=None, ) images[f"{dataset_id}_lowres_image"] = lowres_image From 5aa46dfb0b8e97c7b25ea59acf6b740aae9d5f44 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 08:13:19 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/spatialdata_io/converters/legacy_anndata.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/spatialdata_io/converters/legacy_anndata.py b/src/spatialdata_io/converters/legacy_anndata.py index a1b27de4..e98742a0 100644 --- a/src/spatialdata_io/converters/legacy_anndata.py +++ b/src/spatialdata_io/converters/legacy_anndata.py @@ -293,7 +293,9 @@ def from_legacy_anndata(adata: AnnData) -> SpatialData: "tissue_hires_scalef is required when an the hires image is present" ) hires_image = Image2DModel.parse( - hires, dims=("y", "x", "c"), transformations={f"{dataset_id}_downscaled_hires": Identity()}, + hires, + dims=("y", "x", "c"), + transformations={f"{dataset_id}_downscaled_hires": Identity()}, rgb=None, ) images[f"{dataset_id}_hires_image"] = hires_image @@ -307,7 +309,9 @@ def from_legacy_anndata(adata: AnnData) -> SpatialData: "tissue_lowres_scalef is required when an the lowres image is present" ) lowres_image = Image2DModel.parse( - lowres, dims=("y", "x", "c"), transformations={f"{dataset_id}_downscaled_lowres": Identity()}, + lowres, + dims=("y", "x", "c"), + transformations={f"{dataset_id}_downscaled_lowres": Identity()}, rgb=None, ) images[f"{dataset_id}_lowres_image"] = lowres_image From ff938906f5b3b4b896153c9a752f7084c976f34d Mon Sep 17 00:00:00 2001 From: Luca Marconato Date: Mon, 12 Jan 2026 16:23:41 +0100 Subject: [PATCH 3/3] fix docs --- src/spatialdata_io/converters/legacy_anndata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spatialdata_io/converters/legacy_anndata.py b/src/spatialdata_io/converters/legacy_anndata.py index 5cc45266..fbf32aa1 100644 --- a/src/spatialdata_io/converters/legacy_anndata.py +++ b/src/spatialdata_io/converters/legacy_anndata.py @@ -232,7 +232,7 @@ def from_legacy_anndata(adata: AnnData, rgb: bool | None = None) -> SpatialData: adata (legacy) spatial AnnData object rgb - Argument passed to :func:`spatialdata.models.Image2DModel.parse`. If `None`, + Argument passed to `spatialdata.models.Image2DModel.parse()`. If `None`, 3-(4) channels images will be interpreted as RGB(A). Returns