Skip to content
Snippets Groups Projects
Commit 3af993b1 authored by Christian Kento Rasmussen's avatar Christian Kento Rasmussen
Browse files

Fixed error when converting zarr files

parent 5828cda7
Branches
No related tags found
4 merge requests!102Conv zarr tiff folders,!100Conv zarr nifti,!99Zarr cli,!96Zarr loading and converting
......@@ -23,20 +23,22 @@ class Convert:
def convert(self, input_path, output_path):
# Stringify path in case it is not already a string
input_path = stringify_path(input_path)
input_ext = os.path.splitext(input_path)[1]
output_ext = os.path.splitext(output_path)[1]
output_path = stringify_path(output_path)
if os.path.isfile(input_path):
input_ext = os.path.splitext(input_path)[1]
output_ext = os.path.splitext(output_path)[1]
match input_ext, output_ext:
case (".tif", ".zarr"):
return self.convert_tif_to_zarr(input_path, output_path)
case (".zarr", ".tif"):
return self.convert_zarr_to_tif(input_path, output_path)
case _:
raise ValueError("Unsupported file format")
# Load a directory
elif os.path.isdir(input_path):
match input_ext, output_ext:
case (".zarr", ".tif"):
return self.convert_zarr_to_tif(input_path, output_path)
case _:
raise ValueError("Unsupported file format")
# Fail
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment