diff --git a/workflow/scripts/ome_zarr_to_nii.py b/workflow/scripts/ome_zarr_to_nii.py index 679e106..5217330 100644 --- a/workflow/scripts/ome_zarr_to_nii.py +++ b/workflow/scripts/ome_zarr_to_nii.py @@ -10,7 +10,7 @@ zi = zarr.open(in_zarr) -attrs=zi['fused'].attrs.asdict() +attrs=zi['/'].attrs.asdict() level=int(snakemake.wildcards.level) @@ -25,7 +25,7 @@ affine[1,1]=-transforms[0]['scale'][1] #y affine[2,2]=-transforms[0]['scale'][0] #x -darr = da.from_zarr(in_zarr,component=f'fused/{level}') +darr = da.from_zarr(in_zarr,component=f'/{level}') #input array axes are ZYX #writing to nifti we want XYZ diff --git a/workflow/scripts/resample_labels_to_zarr.py b/workflow/scripts/resample_labels_to_zarr.py index bffb457..d91a193 100644 --- a/workflow/scripts/resample_labels_to_zarr.py +++ b/workflow/scripts/resample_labels_to_zarr.py @@ -12,8 +12,10 @@ in_template_dseg=snakemake.input.dseg out_zarr=snakemake.output.zarr +level=0 + #load dask array from zarr reference image -darr = da.from_zarr(in_zarr,component='fused/0') +darr = da.from_zarr(in_zarr,component=f'/{level}') #load template dseg dseg_nib = nib.load(in_template_dseg) @@ -30,7 +32,7 @@ #read coordinate transform from ome-zarr zi = zarr.open(in_zarr) -attrs=zi['fused'].attrs.asdict() +attrs=zi['/'].attrs.asdict() level=0 transforms = attrs['multiscales'][0]['datasets'][level]['coordinateTransformations'] diff --git a/workflow/scripts/zarr_to_ome_zarr.py b/workflow/scripts/zarr_to_ome_zarr.py index eb449b9..0aed302 100644 --- a/workflow/scripts/zarr_to_ome_zarr.py +++ b/workflow/scripts/zarr_to_ome_zarr.py @@ -2,6 +2,7 @@ import zarr import dask.array as da from ome_zarr.writer import write_image +from ome_zarr.format import format_from_version from ome_zarr.scale import Scaler from dask.diagnostics import ProgressBar @@ -45,7 +46,7 @@ store = zarr.DirectoryStore(out_zarr) -root = zarr.group(store,path='/fused',overwrite=True) +root = zarr.group(store,path='/',overwrite=True) scaler = Scaler(max_layer=max_layer,method=scaling_method) @@ -55,6 +56,8 @@ group=root, scaler=scaler, coordinate_transformations=coordinate_transformations, + #fmt=format_from_version(0.1), +# fmt=format_from_version(0.4), axes=axes)