Skip to content

Commit

Permalink
change chunksize in bdv (32x32x32 instead of default 1x4096x4096)
Browse files Browse the repository at this point in the history
also set dtype to int16 (in case it is related to the black bars bug)
  • Loading branch information
akhanf committed Sep 3, 2024
1 parent 787daf6 commit 960a367
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions workflow/rules/bigstitcher.smk
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ rule zarr_to_bdv:
)
/ "dataset.xml"
),
chunks=(1,1,32,32,32)
output:
bdv_n5=temp(
directory(
Expand Down
6 changes: 3 additions & 3 deletions workflow/scripts/zarr_to_n5_bdv.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def update_xml_h5_to_n5(in_xml,out_xml,in_n5):
max_downsampling_layers=snakemake.params.max_downsampling_layers

#load data (tiles,chans,zslices,x,y)
darr = da.from_zarr(in_zarr)
darr = da.from_zarr(in_zarr,chunks=snakemake.params.chunks).astype(np.int16)

(n_tiles,n_chans,n_z,n_x,n_y) = darr.shape

Expand All @@ -52,7 +52,7 @@ def update_xml_h5_to_n5(in_xml,out_xml,in_n5):
overwrite=True,
nchannels=len(metadata['channels']),
ntiles=len(metadata['tiles_x'])*len(metadata['tiles_y']),
blockdim=((1,256,256),))
blockdim=(snakemake.params.chunks[2:]))

bdv_writer.set_attribute_labels('channel', metadata['channels'])

Expand Down Expand Up @@ -110,6 +110,6 @@ def update_xml_h5_to_n5(in_xml,out_xml,in_n5):
#add attributes for downsampling as a list, and datatype to the setup# level
g = zarr.open_group(store=n5_store,path=f'setup{setup_i}',mode='r+')
g.attrs['downsamplingFactors']=ds_list
g.attrs['dataType']='uint16'
g.attrs['dataType']='int16'


0 comments on commit 960a367

Please sign in to comment.