Skip to content

Commit dbde7da

Browse files
committed
More flexible block extraction with JSON file
1 parent bf0f4a1 commit dbde7da

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

reproducibility/block_extraction/repro_block_extraction.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ def repro_block_extraction(
2323

2424
for dic in param_dicts:
2525
if "image_channel" in dic:
26-
input_path = os.path.join(dic["cochlea"], "images", "ome-zarr", dic["image_channel"] + ".ome.zarr")
27-
roi_halo = dic["halo_size"]
28-
crop_centers = dic["crop_centers"]
29-
for coord in crop_centers:
30-
extract_block(input_path, coord, output_dir, input_key=input_key, roi_halo=roi_halo, tif=tif_flag,
31-
s3=s3_flag, s3_credentials=s3_credentials, s3_bucket_name=s3_bucket_name,
32-
s3_service_endpoint=s3_service_endpoint)
26+
image_channels = dic["image_channel"] if isinstance(dic["image_channel"], list) else [dic["image_channel"]]
27+
for image_channel in image_channels:
28+
input_path = os.path.join(dic["cochlea"], "images", "ome-zarr", image_channel + ".ome.zarr")
29+
roi_halo = dic["halo_size"]
30+
crop_centers = dic["crop_centers"]
31+
for coord in crop_centers:
32+
extract_block(input_path, coord, output_dir, input_key=input_key, roi_halo=roi_halo, tif=tif_flag,
33+
s3=s3_flag, s3_credentials=s3_credentials, s3_bucket_name=s3_bucket_name,
34+
s3_service_endpoint=s3_service_endpoint)
3335

3436

3537
def main():

0 commit comments

Comments
 (0)