Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bugraoezdemir committed Jul 11, 2023
1 parent df9b2ee commit dc76ffd
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 154 deletions.
Binary file added __pycache__/__init__.cpython-39.pyc
Binary file not shown.
27 changes: 20 additions & 7 deletions examples.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from src.OMEZarr import OMEZarr
from src.core import utils
from OME_Zarr.src.OMEZarr import OMEZarr
from OME_Zarr.src.core import utils
import numpy as np
import dask.array as da
import os
import numcodecs
import zarr
import zarr, napari

basepath = 'data/filament.zarr'
basepath = 'OME_Zarr/data/filament.zarr'

oz = OMEZarr(basepath)

Expand All @@ -18,15 +18,28 @@
oz.labelobj.image_labels['original'].typeobj
oz.labelobj.image_labels['original'].dtype('0')

newdir = 'data/filament_ex.zarr'
newdir = 'OME_Zarr/data/filament_ex.zarr'
oz.baseobj.extract(newdir = newdir, paths = ['0', '1'])

noz = OMEZarr(newdir)
noz.baseobj.typeobj
noz.baseobj.path_order
noz.baseobj.chunks('0')

noz.baseobj.chunks()
noz.baseobj.rechunk((10, 70, 70))
noz.baseobj.chunks('0')
noz.baseobj.chunks()

noz.baseobj.get_scale('0')
noz.baseobj.get_scale('1')

noz.baseobj.asflat()
noz.baseobj.asnested()

noz.baseobj.dtype('0')
noz.baseobj.astype(np.float32)
noz.baseobj.dtype('0')

napari.view_path(noz.baseobj.basepath)



12 changes: 8 additions & 4 deletions src/OMEZarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class BaseReader(Collection, ZarrayManipulations): # TODO: Add s3fs stuff here.
def __init__(self,
basepath
basepath: str
):
Collection.__init__(self, basepath)
if self.is_multiscales:
Expand Down Expand Up @@ -33,8 +33,9 @@ def __init__(self):

class OMEZarrObject(BaseReader, _MultiSeries, _Labels):
def __init__(self,
basepath
basepath: str
):
""" The main reader class """
BaseReader.__init__(self, basepath)
if self.is_labels:
_Labels.__init__(self)
Expand All @@ -55,11 +56,14 @@ def __getitem__(self, item):
raise Exception('Data is neither multiseries nor labels.')

class OMEZarr:
def __init__(self, directory):
def __init__(self,
directory: str
):
""" A class that classifies OME-Zarr data as image and label objects. """
self.baseobj = None
self.labelobj = None
self.unstructured_collections = {}
self.collection_paths, self.array_paths = utils.get_collection_paths(directory, return_arraypaths = True)
self.collection_paths, self.multiscales_paths, self.array_paths = utils.get_collection_paths(directory, return_all = True)
for fpath in self.collection_paths:
obj = OMEZarrObject(fpath)
if fpath == directory:
Expand Down
Binary file modified src/__pycache__/OMEZarr.cpython-39.pyc
Binary file not shown.
Binary file modified src/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Loading

0 comments on commit dc76ffd

Please sign in to comment.