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

added convert options to command line

parent 160662cc
No related branches found
No related tags found
1 merge request!102Conv zarr tiff folders
......@@ -184,13 +184,14 @@ class Convert:
save(nifti_path, z, compression=compression)
def convert(input_path: str, output_path: str, chunk_shape: tuple = (64, 64, 64)):
def convert(input_path: str, output_path: str, chunk_shape: tuple = (64, 64, 64), base_name: str = None):
"""Convert a file to another format without loading the entire file into memory
Args:
input_path (str): path to the input file
output_path (str): path to the output file
chunk_shape (tuple, optional): chunk size for the zarr file. Defaults to (64, 64, 64).
base_name (str, optional): base name for the tiff stack. Defaults to None.
"""
converter = Convert(chunk_shape=chunk_shape)
converter = Convert(chunk_shape=chunk_shape,base_name=base_name)
converter.convert(input_path, output_path)
......@@ -84,6 +84,8 @@ def main():
preview_parser = subparsers.add_parser('convert', help= 'Convert files to different formats without loading the entire file into memory')
preview_parser.add_argument('input_path',type = str, metavar = 'Input path', help = 'Path to image that will be converted')
preview_parser.add_argument('output_path',type = str, metavar = 'Output path', help = 'Path to save converted image')
preview_parser.add_argument('chunk_shape',type = tuple, metavar = 'Chunk shape', help = 'Chunk size for the zarr file', default = (64,64,64))
preview_parser.add_argument('base_name',type = str, metavar = 'Base name', help = 'Base name for the zarr file', default = None)
args = parser.parse_args()
......@@ -171,7 +173,7 @@ def main():
print("\n")
elif args.subcommand == 'convert':
qim3d.io.convert(args.input_path, args.output_path)
qim3d.io.convert(args.input_path, args.output_path, args.chunk_shape, args.base_name)
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment