Commit 748a2c3e authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[app][ows_to_script] Add arguments to dataset

parent 7c71a7eb
......@@ -65,17 +65,45 @@ def _dump_executable_script_section():
if __name__ == '__main__':
import argparse
import sys
import os
from darfix.core.dataset import Dataset
from silx.gui import qt
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
'file_directory',
help='Directory containing images')
'-fd',
'--file_directory',
help='Directory containing images',
type=str,
default=None)
parser.add_argument(
'-ff',
'--first_filename',
help='Filename to the first file of the stack',
type=str,
default=None)
parser.add_argument(
'-fs',
'--filenames',
help='List of filenames to read',
type=str,
default=None)
options = parser.parse_args(sys.argv[1:])
dataset = Dataset(options.file_directory)
main(input_data=(dataset, None, None, None), channel='dataset')
if not (options.file_directory or options.first_filename or options.filenames):
parser.error('Please enter the file directory, first filename or list of filenames')
else:
_dir = options.file_directory
if options.first_filename:
_dir = _dir if _dir != None else os.path.dirname(options.first_filename)
else:
_dir = _dir if _dir != None else os.path.dirname(options.filenames[0])
dataset = Dataset(_dir=_dir,
first_filename=options.first_filename,
filenames=options.filenames,
copy_files=True)
main(input_data=(dataset, None, None, None), channel='dataset')
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment