Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chunking for fusion #51

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion workflow/rules/bigstitcher.smk
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,21 @@ rule fuse_dataset_spark:
suffix="bigstitcher.xml",
),
ijm=Path(workflow.basedir) / "macros" / "FuseImageMacroZarr.ijm",
params:
channel=lambda wildcards: "--channelId={channel}".format(
channel=get_stains(wildcards).index(wildcards.stain)
),
block_size="--blockSize={bsx},{bsy},{bsz}".format(
bsx=config["bigstitcher"]["fuse_dataset"]["block_size_x"],
bsy=config["bigstitcher"]["fuse_dataset"]["block_size_y"],
bsz=config["bigstitcher"]["fuse_dataset"]["block_size_z"],
),
block_size_factor="--blockScale={bsfx},{bsfy},{bsfz}".format(
bsfx=config["bigstitcher"]["fuse_dataset"]["block_size_factor_x"],
bsfy=config["bigstitcher"]["fuse_dataset"]["block_size_factor_y"],
bsfz=config["bigstitcher"]["fuse_dataset"]["block_size_factor_z"],
),
mem_gb=lambda wikdcards, resources: '{mem_gb}'.format(mem_gb=int(resources.mem_mb/1000))
output:
zarr=temp(
directory(
Expand Down Expand Up @@ -315,4 +330,7 @@ rule fuse_dataset_spark:
group:
"preproc"
shell:
"affine-fusion ..."
"affine-fusion {params.mem_gb} {threads} --preserveAnisotropy -x {input.dataset_xml} "
" -o {output.zarr} -d /fused/s0 -s ZARR "
" --UINT16 --minIntensity 0 --maxIntensity 65535 "
"{params.block_size} {params.block_size_factor} {params.channel}"
2 changes: 1 addition & 1 deletion workflow/scripts/zarr_to_n5_bdv.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def update_xml_h5_to_n5(in_xml,out_xml,in_n5):
ds_list=[] #for setup-level attrs
for ds in range(max_downsampling_layers):
step=2**ds #1,2,4,8..
zstack = da.squeeze(darr[tile_i,chan_i,:,::step,::step]).astype(np.int16)
zstack = da.squeeze(darr[tile_i,chan_i,:,::step,::step])
print(f'writing to setup{setup_i}/timepoint0/s{ds}')
with ProgressBar():
zstack.to_zarr(n5_store,component=f'setup{setup_i}/timepoint0/s{ds}',overwrite=True,compute=True)
Expand Down
Loading