You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
generatedby= [{"Name":"BIDScoin", 'Version':__version__, 'Description:':'A flexible GUI application suite that converts source datasets to BIDS', 'CodeURL':'https://github.com/Donders-Institute/bidscoin'}]
60
+
generatedby= [{'Name': 'BIDScoin',
61
+
'Version': __version__,
62
+
'Description:': 'A versatile GUI application suite that converts source datasets to BIDS',
dataset_description= {'Name': 'REQUIRED. Name of the dataset',
64
67
'GeneratedBy': generatedby,
65
-
'BIDSVersion': str(bidsversion()),
68
+
'BIDSVersion': bidsversion(),
66
69
'DatasetType': 'raw',
67
70
'License': 'RECOMMENDED. The license for the dataset. The use of license name abbreviations is RECOMMENDED for specifying a license. The corresponding full license text MAY be specified in an additional LICENSE file',
68
71
'Authors': ['OPTIONAL. List of individuals who contributed to the creation/curation of the dataset'],
outputdir=bidsfolder/subid/sesid# TODO: Support DICOMDIR with multiple subjects (as in PYDICOMDIR)
282
285
ifnotforceandoutputdir.is_dir():
283
286
datatypes=set()
284
-
fordatatypein [dtypefordtypeinlsdirs(outputdir) ifnext(dtype.iterdir(), None)]: # See what non-empty datatypes we already have in the bids session-folder
285
-
ifdatatype.nameinbidsmap.dataformat(datasource.dataformat).datatypes: # See if the plugin may add data for this datatype
287
+
fordatatypein [dtypefordtypeinlsdirs(outputdir) ifnext(dtype.iterdir(), None)]: # See what non-empty datatypes we already have in the bids session-folder
288
+
ifdatatype.nameinbidsmap.dataformat(datasource.dataformat).datatypes: # See if the plugin may add data for this datatype
286
289
datatypes.add(datatype.name)
287
290
ifdatatypesandnotany(issubclass(cls, EventsParser) for_,clsininspect.getmembers(plugin, inspect.isclass)): # Always allow events plugins to add data
288
291
LOGGER.info(f">>> Skipping {name} processing: {outputdir} already contains {datatypes} data. Use the -f option to force processing if needed.")
parser.add_argument('sourcefolder', help='The study root folder containing the raw source data folders')
26
26
parser.add_argument('bidsfolder', help='The destination/output folder with the bids data')
27
-
parser.add_argument('-k','--keys', help="Space separated list of the participants.tsv columns. Default: 'session_id' 'age' 'sex' 'size' 'weight'", nargs='+', default=['age', 'sex', 'size', 'weight'], metavar='KEY') # NB: session_id is default
28
27
parser.add_argument('-d','--dryrun', help='Do not save anything, only print the participants info on screen', action='store_true')
29
28
parser.add_argument('-b','--bidsmap', help='The study bidsmap file with the mapping heuristics. If the bidsmap filename is just the base name (i.e. no "/" in the name) then it is assumed to be located in the current directory or in bidsfolder/code/bidscoin. Default: bidsmap.yaml', metavar='NAME', default='bidsmap.yaml')
Main function that processes all the subjects and session in the sourcefolder to (re)generate the participants.tsv file in the BIDS folder.
21
21
22
22
:param sourcefolder: The root folder-name of the sub/ses/data/file tree containing the source data files
23
23
:param bidsfolder: The name of the BIDS root folder
24
-
:param keys: The keys that are extracted from the source data when populating the participants.tsv file
25
24
:param bidsmap: The name of the bidsmap YAML-file. If the bidsmap pathname is just the base name (i.e. no "/" in the name) then it is assumed to be located in the current directory or in bidsfolder/code/bidscoin
26
25
:param dryrun: Boolean to just display the participants info
Copy file name to clipboardExpand all lines: docs/plugins.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ The plugin programming interface
34
34
35
35
This paragraph describes the requirements and structure of plugins in order to allow users and developers to write their own plugin and extent or customize BIDScoin to their needs.
36
36
37
-
The main task of a plugin is to perform the actual conversion of the source data into a format that is part of the BIDS standard. BIDScoin offers the Python library module named ``bids`` to interact with bidsmaps and to provide the intended output names and metadata. Notably, the bids library contains a class named ``BidsMap()`` that provides various methods and other useful classes for building and interacting with bidsmap data. Bidsmap objects provide consecutive access to ``DataFormat()``, ``Datatype()``, ``RunItem()``, ``DataSource()`` and ``EventsParser`` objects, each of which comes with methods to interact with the corresponding sections of the bidsmap data. The RunItem objects can be used to obtain the mapping to the BIDS output names, and the DataSource object can read the source data attributes and properties. The DataSource object transparently handles dynamic values (including regular expressions) as well as the extended source data attributes. In addition, a plugin can implement a class named ``[DataFormat]Events()`` to read and convert stimulus presentation log data to task events files. This class inherits from the ``bidscoin.plugins.EventsParser`` abstract base class, and is required to make an initial parsing of the source data to a Pandas DataFrame (table).
37
+
The main task of a plugin is to perform the actual conversion of the source data into a format that is part of the BIDS standard. BIDScoin offers the Python library module named ``bids`` to interact with bidsmaps and to provide the intended output names and metadata. Notably, the bids library contains a class named ``BidsMap()`` that provides various methods and other useful classes for building and interacting with bidsmap data. Bidsmap objects provide access (hierarchically) to ``DataFormat()``, ``Datatype()``, ``RunItem()``, ``DataSource()`` and ``EventsParser`` objects, each of which comes with methods to interact with the corresponding sections of the bidsmap data. The RunItem objects can be used to obtain the mapping to the BIDS output names, and the DataSource object can read the source data attributes and properties. The DataSource object transparently handles dynamic values (including regular expressions) as well as the extended source data attributes. In addition, a plugin can implement a class named ``[DataFormat]Events()`` to read and convert stimulus presentation log data to task events files. This class inherits from the ``bidscoin.plugins.EventsParser`` abstract base class, and is required to make an initial parsing of the source data to a Pandas DataFrame (table).
38
38
39
39
In short, the purpose of the plugin is to interact with the data, by providing methods from the abstract base classes ``bidscoin.plugins.PluginInterface`` and, optionally, ``bidscoin.plugins.EventsParser``. Most notably, plugins can implement the following methods:
Copy file name to clipboardExpand all lines: docs/tutorial.rst
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,12 +14,11 @@ The tutorial below was written with the DCCN user in mind that wants to convert
14
14
1. Setting up the environment
15
15
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16
16
17
-
Depending on how BIDScoin was installed, you may have to set your Python environment settings before you can run BIDScoin commands from your command-line interface/shell. This is already done for you when you run a `BIDScoin play <./play.html>`__ instance in the cloud. In the DCCN compute cluster example below it is assumed that an `environment module <https://modules.sourceforge.net/>`__ is used to load your Linux Anaconda Python installation and that BIDScoin is installed in a `conda environment <https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands>`__ named "bidscoin". Run or adjust these commands to your computer system if needed:
17
+
Depending on how BIDScoin was installed, you may have to set your Python environment settings before you can run BIDScoin commands from your command-line interface/shell. This is already done for you when you run a `BIDScoin play <./play.html>`__ instance in the cloud. In the DCCN, you can load a BIDScoin `environment module <https://modules.sourceforge.net/>`__ that manages the settings for you. External users may have to activate their `conda <https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands>`__ or `virtual environment <https://docs.python.org/3/tutorial/venv.html>`__.
18
18
19
19
.. code-block:: console
20
20
21
-
$ module add bidscoin # Load the DCCN bidscoin module with the PATH settings and Anaconda environment
22
-
$ source activate /opt/bidscoin # Activate the Python virtual environment with the BIDScoin Python packages
21
+
$ module load bidscoin # Load the DCCN PATH settings and Python environment (else activate your virtual enviroment)
23
22
24
23
Now you should be able to execute BIDScoin commands. Test this by running ``bidscoin`` to get a general workflow overview. Can you generate a list of all BIDScoin tools? What about the plugins? Test the bidscoin installation and make sure everything is OK
25
24
@@ -30,8 +29,8 @@ Create a tutorial playground folder by executing these shell commands:
30
29
31
30
.. code-block:: console
32
31
33
-
$ bidscoin --download . # Download the tutorial data (use a "." for the current folder or a pathname of choice to save it elsewhere)
34
-
$ cd ./bidscointutorial # Go to the downloaded data (replace "." with the full pathname if your data was saved elsewhere)
32
+
$ bidscoin --download . # Download the tutorial data (use a "." for the current folder or a pathname of choice to save it elsewhere)
33
+
$ cd ./bidscointutorial # Go to the downloaded data (replace "." with the full pathname if your data was saved elsewhere)
35
34
36
35
The new ``bidscointutorial`` folder contains a ``raw`` source-data folder and a ``bids_ref`` reference BIDS folder, i.e. the intended end product of this tutorial. In the raw folder you will find these DICOM Series folders (aka "runs")::
0 commit comments