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

FIX: now works with multi-channel psoct data #33

Merged
merged 2 commits into from
Nov 26, 2024
Merged
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
3 changes: 2 additions & 1 deletion linc_convert/modalities/psoct/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def generate_pyramid(
"dtype": omz["0"]._dtype,
"fill_value": omz["0"]._fill_value,
"compressor": omz["0"]._compressor,
"chunks": omz["0"].chunks,
}

# Select windowing function
Expand Down Expand Up @@ -190,7 +191,7 @@ def generate_pyramid(
print("Compute level", level, "with shape", shape)

allshapes.append(shape)
omz.create_dataset(str(level), shape=shape, **opt)
omz.create_dataset(str(level), shape=batch + shape, **opt)

# Iterate across `max_load` chunks
# (note that these are unrelared to underlying zarr chunks)
Expand Down
12 changes: 8 additions & 4 deletions linc_convert/modalities/psoct/multi_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ def convert(
ni = len(inp)

nblevels = min(
[int(math.ceil(math.log2(x))) for i, x in enumerate(inp_shape) if i != no_pool]
[
int(math.ceil(math.log2(x)))
for i, x in enumerate(inp_shape[-3:])
if i != no_pool
]
)
nblevels = min(nblevels, int(math.ceil(math.log2(max_load))))
nblevels = min(nblevels, max_levels)
Expand Down Expand Up @@ -291,8 +295,8 @@ def convert(
# save current chunk
omz["0"][
...,
k * inp_chunk[0] : k * inp_chunk[0] + loaded_chunk.shape[0],
j * inp_chunk[1] : j * inp_chunk[1] + loaded_chunk.shape[1],
k * inp_chunk[-3] : k * inp_chunk[-3] + loaded_chunk.shape[-2],
j * inp_chunk[-2] : j * inp_chunk[-2] + loaded_chunk.shape[-1],
i,
] = loaded_chunk

Expand All @@ -308,7 +312,7 @@ def convert(
ome_unit = to_ome_unit(unit)
write_ome_metadata(
omz,
axes=["z", "y", "x"],
axes=(["c"] if len(inp_shape) == 4 else []) + ["z", "y", "x"],
no_pool=no_pool,
space_unit=ome_unit,
space_scale=vx,
Expand Down