diff --git a/qim3d/io/convert.py b/qim3d/io/convert.py index afa07e942147e21644036fc5c209a3b7ccfa47d3..09694d7822f63cfc10a85bec9ca58cbb59ce6b40 100644 --- a/qim3d/io/convert.py +++ b/qim3d/io/convert.py @@ -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) diff --git a/qim3d/utils/cli.py b/qim3d/utils/cli.py index 0e783c6dfcc5cc95c18bdf2ba0d1cc1bb2e03e25..c22d6b134095b604da8df073fd70aa5b2ff373f3 100644 --- a/qim3d/utils/cli.py +++ b/qim3d/utils/cli.py @@ -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__":