|
| 1 | +Usage |
| 2 | +===== |
| 3 | + |
| 4 | +You can use bids2openminds as both a command line tool and a python library. |
| 5 | + |
| 6 | +Usage as Python library |
| 7 | +======================= |
| 8 | + |
| 9 | +Overview |
| 10 | +######## |
| 11 | +The ``convert`` function processes a Brain Imaging Data Structure (BIDS) directory, converts its contents into OpenMINDS format, and optionally saves the output. It handles BIDS layout, extracts relevant information, and creates a dataset description based on BIDS data using OpenMINDS templates. |
| 12 | + |
| 13 | + |
| 14 | +Function Signature |
| 15 | +################## |
| 16 | +>>> def convert(input_path, save_output=False, output_path=None, multiple_files=False, include_empty_properties=False, quiet=False): |
| 17 | + |
| 18 | +Parameters |
| 19 | +########## |
| 20 | +- ``input_path`` (str): Path to the BIDS directory. This is required and must be a valid directory. |
| 21 | +- ``save_output`` (bool, default=False): If True, the converted OpenMINDS data will be saved to the specified output_path. |
| 22 | +- ``output_path`` (str, default=None): The path where the OpenMINDS data should be saved. If not specified, defaults to [``input_path``]/openminds.jsonld (single file mode) or [``input_path``]/openminds/ (multiple files mode). |
| 23 | +- ``multiple_files`` (bool, default=False): If True, the OpenMINDS data will be saved into multiple files within the specified output_path. |
| 24 | +- ``include_empty_properties`` (bool, default=False): If True, includes all the openMINDS properties with empty values in the final output. Otherwise includes only properties that have a non `None` value. |
| 25 | +- ``quiet`` (bool, default=False): If True, suppresses warnings and the final report output. Only prints success messages. |
| 26 | + |
| 27 | +Returns |
| 28 | +####### |
| 29 | +- ``collection`` (openminds.Collection): The OpenMINDS collection object representing the converted dataset. For more information on OpenMINDS collection please refer to `openMINDS readthedocs <https://openminds-documentation.readthedocs.io/en/latest/shared/getting_started/openMINDS_collections.html>`_. |
| 30 | + |
| 31 | +Example Usage |
| 32 | +############# |
| 33 | +>>> import bids2openminds.converter as converter |
| 34 | +>>> input_path = "/path/to/BIDS/dataset" |
| 35 | +>>> collection = converter.convert(input_path, save_output=True, output_path="/path/to/output", multiple_files=False, include_empty_properties=False, quiet=False) |
| 36 | + |
| 37 | +Or one can chose the default parmetrs as following: |
| 38 | + |
| 39 | +>>> import bids2openminds.converter as converter |
| 40 | +>>> collection = converter.convert("/path/to/BIDS/dataset") |
| 41 | + |
| 42 | + |
| 43 | +Command-Line Interface (CLI) |
| 44 | +============================ |
| 45 | +This function is also accessible via a command-line interface using the `click` library. |
| 46 | + |
| 47 | +.. code-block:: console |
| 48 | +
|
| 49 | + Usage: script.py [OPTIONS] INPUT_PATH |
| 50 | +
|
| 51 | + Arguments: |
| 52 | + input-path Path to the BIDS directory. |
| 53 | +
|
| 54 | + Options: |
| 55 | + -o, --output-path TEXT The output path or filename for OpenMINDS file/files. |
| 56 | + --single-file Save the entire collection into a single file (default). |
| 57 | + --multiple-files Save each node into a separate file within the specified directory. |
| 58 | + -e, --include-empty-properties |
| 59 | + Include empty properties in the final file. |
| 60 | + -q, --quiet Suppress warnings and reports. |
| 61 | +
|
0 commit comments