Skip to content

Commit

Permalink
fix: account for num_channels in downsample mip calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed May 20, 2024
1 parent 538e63c commit 7e047ed
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions igneous/task_creation/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ def on_finish(self):

return TouchTaskIterator(bounds, shape)

def num_mips_from_memory_target(memory_target, dtype, chunk_size, factor):
num_voxels = memory_target / np.dtype(dtype).itemsize
def num_mips_from_memory_target(
memory_target:int, dtype, chunk_size,
num_channels:int, factor
) -> int:
num_voxels = memory_target / np.dtype(dtype).itemsize / num_channels
num_chunks = num_voxels // reduce(operator.mul, chunk_size)

total_factor = reduce(operator.mul, factor)
Expand Down Expand Up @@ -248,7 +251,7 @@ def ds_shape(mip, chunk_size=None, factor=None):
factor = downsample_scales.axis_to_factor(axis)

viable_mips = num_mips_from_memory_target(
memory_target, vol.dtype, shape, factor
memory_target, vol.dtype, shape, vol.num_channels, factor
)

if num_mips is None:
Expand Down

0 comments on commit 7e047ed

Please sign in to comment.