Skip to content

Commit

Permalink
FIX: now works with multi-channel psoct data
Browse files Browse the repository at this point in the history
  • Loading branch information
balbasty committed Nov 22, 2024
1 parent 1339981 commit 16f910a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
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
8 changes: 4 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,7 @@ 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 +291,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 +308,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

0 comments on commit 16f910a

Please sign in to comment.