@@ -650,9 +650,9 @@ def ImageShardDownsampleTask(
650650 )
651651 chunk_size = src_vol .meta .chunk_size (mip )
652652
653- wide_bbox = Bbox (offset , offset + shape )
654- wide_bbox = Bbox .clamp (wide_bbox , src_vol .meta .bounds (mip ))
655- wide_bbox = wide_bbox .expand_to_chunk_size (
653+ bbox = Bbox (offset , offset + shape )
654+ bbox = Bbox .clamp (bbox , src_vol .meta .bounds (mip ))
655+ bbox = bbox .expand_to_chunk_size (
656656 chunk_size , offset = src_vol .meta .voxel_offset (mip )
657657 )
658658
@@ -677,17 +677,19 @@ def shard_shapefn(mip):
677677 output_shards_by_mip .append (defaultdict (dict ))
678678
679679 cz = chunk_size .z * factor [2 ]
680- nz = int (math .ceil (wide_bbox .dz / cz ))
680+ nz = int (math .ceil (bbox .dz / cz ))
681681
682682 dsfn = downsample_method_to_fn (method , sparse , src_vol )
683683
684- zbox = wide_bbox .clone ()
684+ zbox = bbox .clone ()
685685 zbox .maxpt .z = zbox .minpt .z + cz
686686
687687 for z in range (nz ):
688688 zbox = Bbox .clamp (zbox , src_vol .meta .bounds (mip ))
689689 img = src_vol .download (
690- zbox , agglomerate = agglomerate , timestamp = timestamp
690+ zbox ,
691+ agglomerate = agglomerate ,
692+ timestamp = timestamp ,
691693 )
692694 ds_imgs = dsfn (img , factor , num_mips = num_mips , sparse = sparse )
693695 del img
@@ -713,6 +715,7 @@ def shard_shapefn(mip):
713715 xoff :int (xoff + shard_shape [0 ]),
714716 yoff :int (yoff + shard_shape [1 ])
715717 ]
718+
716719 shard_z_bbox = zbox .clone ()
717720 shard_z_bbox .minpt [:2 ] //= (2 ** (i + 1 ))
718721 shard_z_bbox .maxpt [:2 ] //= (2 ** (i + 1 ))
@@ -729,7 +732,7 @@ def shard_shapefn(mip):
729732 for i in range (num_mips ):
730733 shard_shape = shard_shapefn (mip + i + 1 )
731734 for (shard_x , shard_y ), chunk_dict in output_shards_by_mip [i ].items ():
732- minpt = np .array ([ shard_x * shard_shape [0 ], shard_y * shard_shape [1 ], wide_bbox .minpt .z ])
735+ minpt = np .array ([ shard_x * shard_shape [0 ], shard_y * shard_shape [1 ], bbox .minpt .z ])
733736 shard_bbox = Bbox (minpt , minpt + shard_shape )
734737 shard_bbox += src_vol .meta .voxel_offset (mip + i + 1 )
735738 (filename , shard ) = src_vol .image .make_shard (
0 commit comments