Sure, here is the traceback. It matches up with [this code] which uses the i/o you’ve linked. (spatialdata-io/src/spatialdata_io/readers/xenium.py at main · scverse/spatialdata-io · GitHub).
MemoryError Traceback (most recent call last)
Cell In[81], line 1
----> 1 sdata = xenium(xenium_path)
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\spatialdata_io\_utils.py:47, in deprecation_alias.<locals>.deprecation_decorator.<locals>.wrapper(*args, **kwargs)
45 class_name = f.__qualname__
46 rename_kwargs(f.__name__, kwargs, aliases, class_name)
---> 47 return f(*args, **kwargs)
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\spatialdata_io\readers\xenium.py:219, in xenium(path, cells_boundaries, nucleus_boundaries, cells_as_circles, cells_labels, nucleus_labels, transcripts, morphology_mip, morphology_focus, aligned_images, cells_table, n_jobs, imread_kwargs, image_models_kwargs, labels_models_kwargs)
212 # From the public release notes here:
213 # https://www.10xgenomics.com/support/software/xenium-onboard-analysis/latest/release-notes/release-notes-for-xoa
214 # we see that for distinguishing between the nuclei of polinucleated cells, the `label_id` column is used.
215 # This column is currently not found in the preview data, while I think it is needed in order to unambiguously match
216 # nuclei to cells. Therefore for the moment we only link the table to the cell labels, and not to the nucleus
217 # labels.
218 if nucleus_labels:
--> 219 labels["nucleus_labels"], _ = _get_labels_and_indices_mapping(
220 path,
221 XeniumKeys.CELLS_ZARR,
222 specs,
223 mask_index=0,
224 labels_name="nucleus_labels",
225 labels_models_kwargs=labels_models_kwargs,
226 )
227 if cells_labels:
228 labels["cell_labels"], cell_labels_indices_mapping = _get_labels_and_indices_mapping(
229 path,
230 XeniumKeys.CELLS_ZARR,
(...)
234 labels_models_kwargs=labels_models_kwargs,
235 )
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\spatialdata_io\readers\xenium.py:420, in _get_labels_and_indices_mapping(path, file, specs, mask_index, labels_name, labels_models_kwargs)
416 zip_ref.extractall(tmpdir)
418 with zarr.open(str(tmpdir), mode="r") as z:
419 # get the labels
--> 420 masks = z["masks"][f"{mask_index}"][...]
421 labels = Labels2DModel.parse(
422 masks, dims=("y", "x"), transformations={"global": Identity()}, **labels_models_kwargs
423 )
425 # build the matching table
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\zarr\core.py:798, in Array.__getitem__(self, selection)
796 result = self.get_orthogonal_selection(pure_selection, fields=fields)
797 else:
--> 798 result = self.get_basic_selection(pure_selection, fields=fields)
799 return result
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\zarr\core.py:924, in Array.get_basic_selection(self, selection, out, fields)
922 return self._get_basic_selection_zd(selection=selection, out=out, fields=fields)
923 else:
--> 924 return self._get_basic_selection_nd(selection=selection, out=out, fields=fields)
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\zarr\core.py:966, in Array._get_basic_selection_nd(self, selection, out, fields)
960 def _get_basic_selection_nd(self, selection, out=None, fields=None):
961 # implementation of basic selection for array with at least one dimension
962
963 # setup indexer
964 indexer = BasicIndexer(selection, self)
--> 966 return self._get_selection(indexer=indexer, out=out, fields=fields)
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\zarr\core.py:1330, in Array._get_selection(self, indexer, out, fields)
1328 # setup output array
1329 if out is None:
-> 1330 out = np.empty_like(
1331 self._meta_array, shape=out_shape, dtype=out_dtype, order=self._order
1332 )
1333 else:
1334 check_array_shape("out", out, out_shape)
MemoryError: Unable to allocate 21.2 GiB for an array with shape (105309, 54075) and data type uint32