@@ -18,9 +18,9 @@ def main(
1818 output_dir : str = None ,
1919 input_key : str = "setup0/timepoint0/s0" ,
2020 output_key : Optional [str ] = None ,
21- resolution : Optional [ float ] = 0.38 ,
21+ resolution : float = 0.38 ,
2222 roi_halo : List [int ] = [128 , 128 , 64 ],
23- tif : Optional [ bool ] = False ,
23+ tif : bool = False ,
2424 s3 : Optional [bool ] = False ,
2525 s3_credentials : Optional [str ] = None ,
2626 s3_bucket_name : Optional [str ] = None ,
@@ -52,7 +52,14 @@ def main(
5252 input_content = list (filter (None , input_path .split ("/" )))
5353
5454 if s3 :
55- basename = input_content [0 ] + "_" + input_content [- 1 ].split ("." )[0 ]
55+ image_name = input_content [- 1 ].split ("." )[0 ]
56+ if len (image_name .split ("_" )) > 1 :
57+ resized_suffix = "_resized"
58+ image_prefix = image_name .split ("_" )[0 ]
59+ else :
60+ resized_suffix = ""
61+ image_prefix = image_name
62+ basename = input_content [0 ] + resized_suffix
5663 else :
5764 basename = "" .join (input_content [- 1 ].split ("." )[:- 1 ])
5865
@@ -64,9 +71,11 @@ def main(
6471
6572 if tif :
6673 if output_key is None :
67- output_file = os . path . join ( output_dir , basename + "_crop_" + coord_string + ".tif" )
74+ output_name = basename + "_crop_" + coord_string + "_" + image_prefix + " .tif"
6875 else :
69- output_file = os .path .join (output_dir , basename + "_crop_" + coord_string + "_" + output_key + ".tif" )
76+ output_name = basename + "_" + image_prefix + "_crop_" + coord_string + "_" + output_key + ".tif"
77+
78+ output_file = os .path .join (output_dir , output_name )
7079 else :
7180 output_key = "raw" if output_key is None else output_key
7281 output_file = os .path .join (output_dir , basename + "_crop_" + coord_string + ".n5" )
@@ -89,7 +98,7 @@ def main(
8998 raw = f [input_key ][roi ]
9099
91100 if tif :
92- imageio .imwrite (output_file , raw )
101+ imageio .imwrite (output_file , raw , compression = "zlib" )
93102 else :
94103 with zarr .open (output_file , mode = "w" ) as f_out :
95104 f_out .create_dataset (output_key , data = raw , compression = "gzip" )
0 commit comments