Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaMarconato committed Jan 2, 2025
1 parent c9616e3 commit 75e41e2
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/spatialdata_io/readers/visium_hd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
Sequence,
set_transformation,
)
from spatialdata.models._utils import _get_uint_dtype
from xarray import DataArray

from spatialdata_io._constants._constants import VisiumHDKeys
Expand Down Expand Up @@ -474,19 +475,3 @@ def _get_transform_matrices(metadata: dict[str, Any], hd_layout: dict[str, Any])
transform_matrices[key.value] = _get_affine(data)

return transform_matrices


def _get_uint_dtype(value: int) -> str:
max_uint64 = np.iinfo(np.uint64).max
max_uint32 = np.iinfo(np.uint32).max
max_uint16 = np.iinfo(np.uint16).max

if max_uint16 >= value:
dtype = "uint16"
elif max_uint32 >= value:
dtype = "uint32"
elif max_uint64 >= value:
dtype = "uint64"
else:
raise ValueError(f"Maximum cell number is {value}. Values higher than {max_uint64} are not supported.")
return dtype

0 comments on commit 75e41e2

Please sign in to comment.