@@ -112,7 +112,7 @@ def __init__(
112112 shapes : dict [str , GeoDataFrame ] | None = None ,
113113 table : AnnData | None = None ,
114114 ) -> None :
115- self .path = None
115+ self ._path : Path | None = None
116116
117117 self ._shared_keys : set [str | None ] = set ()
118118 self ._images : Images = Images (shared_keys = self ._shared_keys )
@@ -253,24 +253,13 @@ def _validate_unique_element_names(element_names: list[str]) -> None:
253253
254254 def is_backed (self ) -> bool :
255255 """Check if the data is backed by a Zarr storage or if it is in-memory."""
256- return self .path is not None
256+ return self ._path is not None
257257
258258 @property
259259 def path (self ) -> Path | None :
260260 """Path to the Zarr storage."""
261261 return self ._path
262262
263- @path .setter
264- def path (self , path : Path | str | None ) -> None :
265- """Set the path to the Zarr storage."""
266- if path is not None :
267- path = Path (path )
268- if not path .is_dir ():
269- raise ValueError (f"Path { path } is not a directory." )
270- if not path .exists ():
271- raise ValueError (f"Path { path } does not exist." )
272- self ._path = path
273-
274263 # TODO: from a commennt from Giovanni: consolite somewhere in
275264 # a future PR (luca: also _init_add_element could be cleaned)
276265 def _get_group_for_element (self , name : str , element_type : str ) -> zarr .Group :
@@ -631,14 +620,13 @@ def write(
631620 # self.path = str(file_path)
632621 # else:
633622 # self.path = str(tmp_zarr_file)
634- self .path = Path (file_path )
623+ self ._path = Path (file_path )
635624 try :
636625 if len (self .images ):
637626 root .create_group (name = "images" )
638627 # add_image_in_memory will delete and replace the same key in self.images,
639628 # so we need to make a copy of the keys. Same for the other elements
640629 keys = self .images .keys ()
641- from spatialdata ._io .io_raster import _read_multiscale
642630
643631 for name in keys :
644632 elem_group = self ._init_add_element (name = name , element_type = "images" , overwrite = overwrite )
@@ -649,16 +637,16 @@ def write(
649637 storage_options = storage_options ,
650638 )
651639
640+ # TODO(giovp): fix or remove
652641 # reload the image from the Zarr storage so that now the element is lazy loaded,
653642 # and most importantly, from the correct storage
654- element_path = Path (self .path ) / "images" / name
655- _read_multiscale (element_path , raster_type = "image" )
643+ # element_path = Path(self.path) / "images" / name
644+ # _read_multiscale(element_path, raster_type="image")
656645
657646 if len (self .labels ):
658647 root .create_group (name = "labels" )
659648 # keys = list(self.labels.keys())
660649 keys = self .labels .keys ()
661- from spatialdata ._io .io_raster import _read_multiscale
662650
663651 for name in keys :
664652 elem_group = self ._init_add_element (name = name , element_type = "labels" , overwrite = overwrite )
@@ -669,16 +657,16 @@ def write(
669657 storage_options = storage_options ,
670658 )
671659
660+ # TODO(giovp): fix or remove
672661 # reload the labels from the Zarr storage so that now the element is lazy loaded,
673662 # and most importantly, from the correct storage
674- element_path = Path (self .path ) / "labels" / name
675- _read_multiscale (element_path , raster_type = "labels" )
663+ # element_path = Path(self.path) / "labels" / name
664+ # _read_multiscale(element_path, raster_type="labels")
676665
677666 if len (self .points ):
678667 root .create_group (name = "points" )
679668 # keys = list(self.points.keys())
680669 keys = self .points .keys ()
681- from spatialdata ._io .io_points import _read_points
682670
683671 for name in keys :
684672 elem_group = self ._init_add_element (name = name , element_type = "points" , overwrite = overwrite )
@@ -687,11 +675,12 @@ def write(
687675 group = elem_group ,
688676 name = name ,
689677 )
690- element_path = Path (self .path ) / "points" / name
678+ # TODO(giovp): fix or remove
679+ # element_path = Path(self.path) / "points" / name
691680
692- # reload the points from the Zarr storage so that the element is lazy loaded,
693- # and most importantly, from the correct storage
694- _read_points (element_path )
681+ # # reload the points from the Zarr storage so that the element is lazy loaded,
682+ # # and most importantly, from the correct storage
683+ # _read_points(element_path)
695684
696685 if len (self .shapes ):
697686 root .create_group (name = "shapes" )
@@ -710,7 +699,7 @@ def write(
710699 write_table (table = self .table , group = elem_group , name = "table" )
711700
712701 except Exception as e : # noqa: B902
713- self .path = None
702+ self ._path = None
714703 raise e
715704
716705 if consolidate_metadata :
0 commit comments