clabtoolkit 0.3.2a1__tar.gz → 0.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clabtoolkit-0.3.3/MANIFEST.in +22 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/PKG-INFO +28 -27
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/__init__.py +1 -1
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/bidstools.py +75 -50
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/config/config.json +11 -11
- clabtoolkit-0.3.3/clabtoolkit/config/viz_views.json +268 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/dicomtools.py +46 -3
- clabtoolkit-0.3.3/clabtoolkit/dwitools.py +1999 -0
- clabtoolkit-0.3.3/clabtoolkit/freesurfertools.py +5378 -0
- clabtoolkit-0.3.3/clabtoolkit/imagetools.py +2734 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/misctools.py +1663 -126
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/morphometrytools.py +49 -9
- clabtoolkit-0.3.3/clabtoolkit/networktools.py +351 -0
- clabtoolkit-0.3.3/clabtoolkit/parcellationtools.py +3239 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/pipelinetools.py +109 -10
- clabtoolkit-0.3.3/clabtoolkit/plottools.py +682 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/qcqatools.py +501 -313
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/segmentationtools.py +111 -191
- clabtoolkit-0.3.3/clabtoolkit/surfacetools.py +2785 -0
- clabtoolkit-0.3.3/clabtoolkit/visualizationtools.py +5575 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit.egg-info/PKG-INFO +28 -27
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit.egg-info/SOURCES.txt +21 -13
- clabtoolkit-0.3.3/clabtoolkit.egg-info/requires.txt +34 -0
- clabtoolkit-0.3.3/docs/clabtoolkit.rst +141 -0
- clabtoolkit-0.3.3/docs/modules.rst +7 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/docs/source/conf.py +4 -2
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/docs/source/index.rst +9 -3
- clabtoolkit-0.3.3/docs/source/modules/bidstools.rst +50 -0
- clabtoolkit-0.3.3/docs/source/modules/connectivitytools.rst +26 -0
- clabtoolkit-0.3.3/docs/source/modules/dicomtools.rst +87 -0
- clabtoolkit-0.3.3/docs/source/modules/dwitools.rst +90 -0
- clabtoolkit-0.3.3/docs/source/modules/freesurfertools.rst +61 -0
- clabtoolkit-0.3.3/docs/source/modules/imagetools.rst +78 -0
- clabtoolkit-0.3.3/docs/source/modules/misctools.rst +81 -0
- clabtoolkit-0.3.3/docs/source/modules/morphometrytools.rst +96 -0
- clabtoolkit-0.3.3/docs/source/modules/networktools.rst +69 -0
- clabtoolkit-0.3.3/docs/source/modules/parcellationtools.rst +71 -0
- clabtoolkit-0.3.3/docs/source/modules/pipelinetools.rst +86 -0
- clabtoolkit-0.3.3/docs/source/modules/plottools.rst +79 -0
- clabtoolkit-0.3.3/docs/source/modules/qcqatools.rst +71 -0
- clabtoolkit-0.3.3/docs/source/modules/segmentationtools.rst +53 -0
- clabtoolkit-0.3.3/docs/source/modules/surfacetools.rst +71 -0
- clabtoolkit-0.3.3/docs/source/modules/visualizationtools.rst +82 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/pyproject.toml +33 -23
- clabtoolkit-0.3.3/setup.cfg +4 -0
- clabtoolkit-0.3.2a1/MANIFEST.in +0 -16
- clabtoolkit-0.3.2a1/clabtoolkit/dwitools.py +0 -682
- clabtoolkit-0.3.2a1/clabtoolkit/freesurfertools.py +0 -3256
- clabtoolkit-0.3.2a1/clabtoolkit/imagetools.py +0 -642
- clabtoolkit-0.3.2a1/clabtoolkit/parcellationtools.py +0 -1960
- clabtoolkit-0.3.2a1/clabtoolkit/surfacetools.py +0 -1227
- clabtoolkit-0.3.2a1/clabtoolkit/visualizationtools.py +0 -817
- clabtoolkit-0.3.2a1/clabtoolkit.egg-info/not-zip-safe +0 -1
- clabtoolkit-0.3.2a1/clabtoolkit.egg-info/requires.txt +0 -27
- clabtoolkit-0.3.2a1/setup.cfg +0 -23
- clabtoolkit-0.3.2a1/setup.py +0 -46
- clabtoolkit-0.3.2a1/tests/__init__.py +0 -1
- clabtoolkit-0.3.2a1/tests/conftest.py +0 -75
- clabtoolkit-0.3.2a1/tests/test_clabtoolkit.py +0 -21
- clabtoolkit-0.3.2a1/tests/test_extract_bids_entities_to_dataframe.py +0 -609
- clabtoolkit-0.3.2a1/tests/test_extract_string_values.py +0 -529
- clabtoolkit-0.3.2a1/tests/test_freesurfer_parsers.py +0 -635
- clabtoolkit-0.3.2a1/tests/test_get_units.py +0 -435
- clabtoolkit-0.3.2a1/tests/test_parcellationtools-Parcellation-replace_values.py +0 -78
- clabtoolkit-0.3.2a1/tests/test_parse_freesurfer_cortex_stats.py +0 -758
- clabtoolkit-0.3.2a1/tests/test_stats_from_vector.py +0 -378
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/AUTHORS.rst +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/CONTRIBUTING.rst +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/HISTORY.rst +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/LICENSE +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/README.rst +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/config/bids.json +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/config/lobes.json +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/config/stats_mapping.json +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit/connectivitytools.py +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit.egg-info/dependency_links.txt +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/clabtoolkit.egg-info/top_level.txt +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/docs/Makefile +0 -0
- {clabtoolkit-0.3.2a1 → clabtoolkit-0.3.3}/docs/make.bat +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
include AUTHORS.rst
|
|
2
|
+
include CONTRIBUTING.rst
|
|
3
|
+
include HISTORY.rst
|
|
4
|
+
include LICENSE
|
|
5
|
+
include README.rst
|
|
6
|
+
include pyproject.toml
|
|
7
|
+
|
|
8
|
+
# Include package source code
|
|
9
|
+
recursive-include clabtoolkit *.py
|
|
10
|
+
recursive-include clabtoolkit/config *.json
|
|
11
|
+
|
|
12
|
+
# Include documentation
|
|
13
|
+
recursive-include docs *.rst *.py *.bat *.png
|
|
14
|
+
recursive-include docs Makefile
|
|
15
|
+
include docs/make.bat
|
|
16
|
+
|
|
17
|
+
# EXCLUDE tests data completely
|
|
18
|
+
prune tests
|
|
19
|
+
|
|
20
|
+
# Exclude unwanted files (only those that exist)
|
|
21
|
+
recursive-exclude * __pycache__
|
|
22
|
+
recursive-exclude * *.py[co]
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clabtoolkit
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: A comprehensive toolkit for neuroimaging data processing and analysis
|
|
5
|
-
Home-page: https://github.com/connectomicslab/clabtoolkit
|
|
6
|
-
Author: Yasser Alemán-Gómez
|
|
7
5
|
Author-email: Yasser Alemán-Gómez <yasseraleman@protonmail.com>
|
|
8
6
|
Maintainer-email: Yasser Alemán-Gómez <yasseraleman@protonmail.com>
|
|
9
|
-
License: Apache-2.0
|
|
7
|
+
License-Expression: Apache-2.0
|
|
10
8
|
Project-URL: Homepage, https://github.com/connectomicslab/clabtoolkit
|
|
11
9
|
Project-URL: Repository, https://github.com/connectomicslab/clabtoolkit
|
|
12
10
|
Project-URL: Documentation, https://clabtoolkit.readthedocs.io
|
|
@@ -15,7 +13,6 @@ Keywords: neuroimaging,image-processing,bids,freesurfer,connectivity
|
|
|
15
13
|
Classifier: Development Status :: 4 - Beta
|
|
16
14
|
Classifier: Intended Audience :: Science/Research
|
|
17
15
|
Classifier: Intended Audience :: Developers
|
|
18
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
19
16
|
Classifier: Natural Language :: English
|
|
20
17
|
Classifier: Operating System :: OS Independent
|
|
21
18
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -25,38 +22,42 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
25
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
26
23
|
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
27
24
|
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
28
|
-
Requires-Python: >=3.
|
|
25
|
+
Requires-Python: >=3.9
|
|
29
26
|
Description-Content-Type: text/x-rst
|
|
30
27
|
License-File: LICENSE
|
|
31
28
|
License-File: AUTHORS.rst
|
|
32
29
|
Requires-Dist: nibabel>=5.3.2
|
|
33
30
|
Requires-Dist: numpy>=1.23.5
|
|
34
|
-
Requires-Dist: pandas>=2.
|
|
31
|
+
Requires-Dist: pandas>=2.3.1
|
|
35
32
|
Requires-Dist: pydicom>=3.0.1
|
|
36
|
-
Requires-Dist: rich>=
|
|
37
|
-
Requires-Dist: scipy>=1.
|
|
38
|
-
Requires-Dist: setuptools>=
|
|
39
|
-
Requires-Dist: scikit-image>=0.
|
|
33
|
+
Requires-Dist: rich>=14.1.0
|
|
34
|
+
Requires-Dist: scipy>=1.16.0
|
|
35
|
+
Requires-Dist: setuptools>=80.9.0
|
|
36
|
+
Requires-Dist: scikit-image>=0.25.2
|
|
37
|
+
Requires-Dist: h5py>=3.14.0
|
|
38
|
+
Requires-Dist: matplotlib>=3.10.3
|
|
39
|
+
Requires-Dist: pyvista>=0.45.3
|
|
40
|
+
Requires-Dist: nilearn>=0.12.0
|
|
41
|
+
Requires-Dist: joblib>=1.5.1
|
|
40
42
|
Provides-Extra: dev
|
|
41
|
-
Requires-Dist: pytest>=
|
|
42
|
-
Requires-Dist: pytest-cov>=
|
|
43
|
-
Requires-Dist: black>=
|
|
44
|
-
Requires-Dist: ruff>=0.
|
|
45
|
-
Requires-Dist: mypy>=1.
|
|
46
|
-
Requires-Dist: pre-commit>=
|
|
47
|
-
Requires-Dist: tox>=4.
|
|
43
|
+
Requires-Dist: pytest>=8.4.1; extra == "dev"
|
|
44
|
+
Requires-Dist: pytest-cov>=6.2.1; extra == "dev"
|
|
45
|
+
Requires-Dist: black>=25.1.0; extra == "dev"
|
|
46
|
+
Requires-Dist: ruff>=0.12.5; extra == "dev"
|
|
47
|
+
Requires-Dist: mypy>=1.17.0; extra == "dev"
|
|
48
|
+
Requires-Dist: pre-commit>=4.2.0; extra == "dev"
|
|
49
|
+
Requires-Dist: tox>=4.28.1; extra == "dev"
|
|
50
|
+
Requires-Dist: termcolor>=3.1.0; extra == "dev"
|
|
51
|
+
Requires-Dist: tabulate>=0.9.0; extra == "dev"
|
|
48
52
|
Provides-Extra: docs
|
|
49
|
-
Requires-Dist: sphinx>=
|
|
50
|
-
Requires-Dist: sphinx-rtd-theme>=
|
|
51
|
-
Requires-Dist: myst-parser>=
|
|
53
|
+
Requires-Dist: sphinx>=8.2.3; extra == "docs"
|
|
54
|
+
Requires-Dist: sphinx-rtd-theme>=3.0.2; extra == "docs"
|
|
55
|
+
Requires-Dist: myst-parser>=4.0.1; extra == "docs"
|
|
52
56
|
Provides-Extra: test
|
|
53
|
-
Requires-Dist: pytest>=
|
|
54
|
-
Requires-Dist: pytest-cov>=
|
|
55
|
-
Requires-Dist: pytest-xdist>=3.
|
|
56
|
-
Dynamic: author
|
|
57
|
-
Dynamic: home-page
|
|
57
|
+
Requires-Dist: pytest>=8.4.1; extra == "test"
|
|
58
|
+
Requires-Dist: pytest-cov>=6.2.1; extra == "test"
|
|
59
|
+
Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
|
|
58
60
|
Dynamic: license-file
|
|
59
|
-
Dynamic: requires-python
|
|
60
61
|
|
|
61
62
|
========================
|
|
62
63
|
Connectomics Lab Toolkit
|
|
@@ -28,49 +28,11 @@ from rich.panel import Panel
|
|
|
28
28
|
from . import misctools as cltmisc
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
# Loading the JSON file containing the BIDs configuration file. It includes the entities and suffixes
|
|
32
|
-
# of the BIDs dataset.
|
|
33
|
-
def load_bids_json(bids_json: str = None):
|
|
34
|
-
"""
|
|
35
|
-
Load the JSON file containing the BIDs configuration file.
|
|
36
|
-
|
|
37
|
-
Parameters:
|
|
38
|
-
----------
|
|
39
|
-
bids_json : str
|
|
40
|
-
JSON file containing the BIDs configuration.
|
|
41
|
-
|
|
42
|
-
Returns:
|
|
43
|
-
--------
|
|
44
|
-
config_dict : dict
|
|
45
|
-
Dictionary containing the default .
|
|
46
|
-
|
|
47
|
-
"""
|
|
48
|
-
|
|
49
|
-
# Get the absolute of this file
|
|
50
|
-
if bids_json is None:
|
|
51
|
-
cwd = os.path.dirname(os.path.abspath(__file__))
|
|
52
|
-
bids_json = os.path.join(cwd, "config", "bids.json")
|
|
53
|
-
else:
|
|
54
|
-
if not os.path.isfile(bids_json):
|
|
55
|
-
raise ValueError(
|
|
56
|
-
"Please, provide a valid JSON file containing the BIDs configuration dictionary."
|
|
57
|
-
)
|
|
58
|
-
try:
|
|
59
|
-
with open(bids_json) as f:
|
|
60
|
-
config_dict = json.load(f)
|
|
61
|
-
except FileNotFoundError:
|
|
62
|
-
raise FileNotFoundError(f"Default configuration file not found at: {bids_json}")
|
|
63
|
-
except json.JSONDecodeError:
|
|
64
|
-
raise ValueError(f"Error parsing the default configuration file: {bids_json}")
|
|
65
|
-
|
|
66
|
-
return config_dict
|
|
67
|
-
|
|
68
|
-
|
|
69
31
|
####################################################################################################
|
|
70
32
|
####################################################################################################
|
|
71
33
|
############ ############
|
|
72
34
|
############ ############
|
|
73
|
-
############
|
|
35
|
+
############ Section 1: Methods dedicated to work with BIDs naming conventions ############
|
|
74
36
|
############ ############
|
|
75
37
|
############ ############
|
|
76
38
|
####################################################################################################
|
|
@@ -462,7 +424,7 @@ def recursively_replace_entity_value(
|
|
|
462
424
|
"""
|
|
463
425
|
This method replaces the values of certain entities in all the files and folders of a BIDs dataset.
|
|
464
426
|
|
|
465
|
-
Parameters
|
|
427
|
+
Parameters
|
|
466
428
|
----------
|
|
467
429
|
root_dir: str
|
|
468
430
|
Root directory of the BIDs dataset
|
|
@@ -1158,6 +1120,10 @@ def entities_to_table(
|
|
|
1158
1120
|
temp = os.path.splitext(filename)[0]
|
|
1159
1121
|
result_df.insert(0, "Participant", temp)
|
|
1160
1122
|
|
|
1123
|
+
# Declaring all the columns as string type
|
|
1124
|
+
for col in result_df.columns:
|
|
1125
|
+
result_df[col] = result_df[col].astype(str)
|
|
1126
|
+
|
|
1161
1127
|
return result_df
|
|
1162
1128
|
|
|
1163
1129
|
|
|
@@ -1165,13 +1131,11 @@ def entities_to_table(
|
|
|
1165
1131
|
####################################################################################################
|
|
1166
1132
|
############ ############
|
|
1167
1133
|
############ ############
|
|
1168
|
-
############
|
|
1134
|
+
############ Section 2: Methods dedicated to work with BIDs file organization ############
|
|
1169
1135
|
############ ############
|
|
1170
1136
|
############ ############
|
|
1171
1137
|
####################################################################################################
|
|
1172
1138
|
####################################################################################################
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
1139
|
def get_subjects(bids_dir: str) -> list:
|
|
1176
1140
|
"""
|
|
1177
1141
|
Get a list of all subjects in the BIDs directory.
|
|
@@ -1762,8 +1726,6 @@ def get_bids_database_table(
|
|
|
1762
1726
|
|
|
1763
1727
|
|
|
1764
1728
|
####################################################################################################
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
1729
|
def get_derivatives_folders(
|
|
1768
1730
|
deriv_dir: str,
|
|
1769
1731
|
) -> list:
|
|
@@ -1826,7 +1788,7 @@ def is_bids_filename(filename: str) -> bool:
|
|
|
1826
1788
|
Args:
|
|
1827
1789
|
filename (str): The filename to validate.
|
|
1828
1790
|
|
|
1829
|
-
Returns
|
|
1791
|
+
Returns
|
|
1830
1792
|
bool: True if valid BIDS filename, False otherwise.
|
|
1831
1793
|
"""
|
|
1832
1794
|
# Remove extension if present
|
|
@@ -1858,7 +1820,7 @@ def get_individual_files_and_folders(
|
|
|
1858
1820
|
"""
|
|
1859
1821
|
This function detects all the files or folders inside a folder and its subfolders containing the strings supplied by the variable cad4query.
|
|
1860
1822
|
|
|
1861
|
-
Parameters
|
|
1823
|
+
Parameters
|
|
1862
1824
|
----------
|
|
1863
1825
|
input_folder : str
|
|
1864
1826
|
Path to the input folder.
|
|
@@ -1866,12 +1828,12 @@ def get_individual_files_and_folders(
|
|
|
1866
1828
|
cad4query : str, list, or dict
|
|
1867
1829
|
String or list of strings to filter the files and folders. If a dictionary is provided, it should contain key-value pairs where the key is the string before '-' and the value is the string after '-'.
|
|
1868
1830
|
|
|
1869
|
-
Returns
|
|
1831
|
+
Returns
|
|
1870
1832
|
-------
|
|
1871
1833
|
list
|
|
1872
1834
|
List of files or folders that match the query.
|
|
1873
1835
|
|
|
1874
|
-
Raises
|
|
1836
|
+
Raises
|
|
1875
1837
|
------
|
|
1876
1838
|
ValueError
|
|
1877
1839
|
If the input folder does not exist.
|
|
@@ -1879,7 +1841,7 @@ def get_individual_files_and_folders(
|
|
|
1879
1841
|
TypeError
|
|
1880
1842
|
If the input folder is not a string.
|
|
1881
1843
|
|
|
1882
|
-
Examples
|
|
1844
|
+
Examples
|
|
1883
1845
|
--------
|
|
1884
1846
|
>>> input_folder = "/path/to/input/folder"
|
|
1885
1847
|
>>> cad4query = "sub-01"
|
|
@@ -1945,15 +1907,19 @@ def generate_bids_tree(
|
|
|
1945
1907
|
----------
|
|
1946
1908
|
bids_root : str
|
|
1947
1909
|
Path to the BIDS root directory.
|
|
1910
|
+
|
|
1948
1911
|
max_depth : int, optional
|
|
1949
1912
|
Maximum depth to traverse. If None (default), traverses entire directory
|
|
1950
1913
|
structure without depth limitation.
|
|
1914
|
+
|
|
1951
1915
|
show_hidden : bool, optional
|
|
1952
1916
|
Whether to show hidden files and folders (starting with '.').
|
|
1953
1917
|
Default is False.
|
|
1918
|
+
|
|
1954
1919
|
exclude_patterns : set of str, optional
|
|
1955
1920
|
Set of file/folder name patterns to exclude from the tree. If None,
|
|
1956
1921
|
defaults to {'.git', '__pycache__', '.DS_Store', 'Thumbs.db'}.
|
|
1922
|
+
|
|
1957
1923
|
save_to_file : str, optional
|
|
1958
1924
|
Path to save the tree output as a text file. If None, only returns
|
|
1959
1925
|
the string without saving.
|
|
@@ -1968,11 +1934,14 @@ def generate_bids_tree(
|
|
|
1968
1934
|
------
|
|
1969
1935
|
FileNotFoundError
|
|
1970
1936
|
If the specified bids_root path does not exist.
|
|
1937
|
+
|
|
1971
1938
|
NotADirectoryError
|
|
1972
1939
|
If the specified bids_root path is not a directory.
|
|
1940
|
+
|
|
1973
1941
|
PermissionError
|
|
1974
1942
|
If there are insufficient permissions to read certain directories.
|
|
1975
1943
|
Individual permission errors are handled gracefully and noted in output.
|
|
1944
|
+
|
|
1976
1945
|
OSError
|
|
1977
1946
|
If there are file system related errors during tree generation or
|
|
1978
1947
|
file saving operations.
|
|
@@ -2094,6 +2063,7 @@ def generate_bids_tree(
|
|
|
2094
2063
|
return tree_output
|
|
2095
2064
|
|
|
2096
2065
|
|
|
2066
|
+
####################################################################################################
|
|
2097
2067
|
def generate_bids_tree_with_stats(bids_root: str, **kwargs) -> str:
|
|
2098
2068
|
"""
|
|
2099
2069
|
Generate a BIDS tree with additional statistics.
|
|
@@ -2102,6 +2072,7 @@ def generate_bids_tree_with_stats(bids_root: str, **kwargs) -> str:
|
|
|
2102
2072
|
----------
|
|
2103
2073
|
bids_root : str
|
|
2104
2074
|
Path to the BIDS root directory.
|
|
2075
|
+
|
|
2105
2076
|
**kwargs
|
|
2106
2077
|
Additional keyword arguments passed to generate_bids_tree().
|
|
2107
2078
|
See generate_bids_tree() documentation for available parameters.
|
|
@@ -2115,10 +2086,13 @@ def generate_bids_tree_with_stats(bids_root: str, **kwargs) -> str:
|
|
|
2115
2086
|
------
|
|
2116
2087
|
FileNotFoundError
|
|
2117
2088
|
If the specified bids_root path does not exist.
|
|
2089
|
+
|
|
2118
2090
|
NotADirectoryError
|
|
2119
2091
|
If the specified bids_root path is not a directory.
|
|
2092
|
+
|
|
2120
2093
|
PermissionError
|
|
2121
2094
|
If there are insufficient permissions to read directories.
|
|
2095
|
+
|
|
2122
2096
|
OSError
|
|
2123
2097
|
If there are file system related errors.
|
|
2124
2098
|
|
|
@@ -2164,6 +2138,7 @@ def generate_bids_tree_with_stats(bids_root: str, **kwargs) -> str:
|
|
|
2164
2138
|
return tree + stats
|
|
2165
2139
|
|
|
2166
2140
|
|
|
2141
|
+
####################################################################################################
|
|
2167
2142
|
def validate_bids_structure(bids_root: str) -> List[str]:
|
|
2168
2143
|
"""
|
|
2169
2144
|
Basic validation of BIDS structure and return warnings.
|
|
@@ -2233,3 +2208,53 @@ def validate_bids_structure(bids_root: str) -> List[str]:
|
|
|
2233
2208
|
warnings.append("Derivatives directory found")
|
|
2234
2209
|
|
|
2235
2210
|
return warnings
|
|
2211
|
+
|
|
2212
|
+
|
|
2213
|
+
####################################################################################################
|
|
2214
|
+
####################################################################################################
|
|
2215
|
+
############ ############
|
|
2216
|
+
############ ############
|
|
2217
|
+
############ Section 3: Useful methods for BIDs file organization ############
|
|
2218
|
+
############ ############
|
|
2219
|
+
############ ############
|
|
2220
|
+
####################################################################################################
|
|
2221
|
+
####################################################################################################
|
|
2222
|
+
|
|
2223
|
+
|
|
2224
|
+
# Loading the JSON file containing the BIDs configuration file. It includes the entities and suffixes
|
|
2225
|
+
# of the BIDs dataset.
|
|
2226
|
+
####################################################################################################
|
|
2227
|
+
def load_bids_json(bids_json: str = None):
|
|
2228
|
+
"""
|
|
2229
|
+
Load the JSON file containing the BIDs configuration file.
|
|
2230
|
+
|
|
2231
|
+
Parameters
|
|
2232
|
+
----------
|
|
2233
|
+
bids_json : str
|
|
2234
|
+
JSON file containing the BIDs configuration.
|
|
2235
|
+
|
|
2236
|
+
Returns
|
|
2237
|
+
--------
|
|
2238
|
+
config_dict : dict
|
|
2239
|
+
Dictionary containing the default .
|
|
2240
|
+
|
|
2241
|
+
"""
|
|
2242
|
+
|
|
2243
|
+
# Get the absolute of this file
|
|
2244
|
+
if bids_json is None:
|
|
2245
|
+
cwd = os.path.dirname(os.path.abspath(__file__))
|
|
2246
|
+
bids_json = os.path.join(cwd, "config", "bids.json")
|
|
2247
|
+
else:
|
|
2248
|
+
if not os.path.isfile(bids_json):
|
|
2249
|
+
raise ValueError(
|
|
2250
|
+
"Please, provide a valid JSON file containing the BIDs configuration dictionary."
|
|
2251
|
+
)
|
|
2252
|
+
try:
|
|
2253
|
+
with open(bids_json) as f:
|
|
2254
|
+
config_dict = json.load(f)
|
|
2255
|
+
except FileNotFoundError:
|
|
2256
|
+
raise FileNotFoundError(f"Default configuration file not found at: {bids_json}")
|
|
2257
|
+
except json.JSONDecodeError:
|
|
2258
|
+
raise ValueError(f"Error parsing the default configuration file: {bids_json}")
|
|
2259
|
+
|
|
2260
|
+
return config_dict
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metrics_units": {
|
|
3
3
|
"thickness": "mm",
|
|
4
|
-
"area": "
|
|
5
|
-
"volume": "
|
|
6
|
-
"curv": "mm
|
|
4
|
+
"area": "cm2",
|
|
5
|
+
"volume": "cm3",
|
|
6
|
+
"curv": "mm-1",
|
|
7
7
|
"sulc": "au",
|
|
8
8
|
"lgi": "au",
|
|
9
9
|
"euler": "au",
|
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
"fold_opening": "mm",
|
|
13
13
|
"sulcal_length": "mm",
|
|
14
14
|
"fa": "au",
|
|
15
|
-
"md": "
|
|
15
|
+
"md": "mm2/s",
|
|
16
16
|
"cs": "au",
|
|
17
17
|
"cp": "au",
|
|
18
18
|
"cl": "au",
|
|
19
|
-
"trace": "
|
|
20
|
-
"ad": "
|
|
21
|
-
"rd": "
|
|
19
|
+
"trace": "mm2/s",
|
|
20
|
+
"ad": "mm2/s",
|
|
21
|
+
"rd": "mm2/s",
|
|
22
22
|
"fwfa": "au",
|
|
23
|
-
"fwmd": "
|
|
23
|
+
"fwmd": "mm2/s",
|
|
24
24
|
"fwvf": "au",
|
|
25
25
|
"gfa": "au",
|
|
26
26
|
"rtop": "au",
|
|
27
27
|
"rtpp": "au",
|
|
28
28
|
"rtap": "au",
|
|
29
|
-
"msd": "
|
|
29
|
+
"msd": "mm2/s",
|
|
30
30
|
"icvf": "au",
|
|
31
31
|
"ecvf": "au",
|
|
32
32
|
"isovf": "au",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"axon_diameter": "μm",
|
|
45
45
|
"mvf": "au",
|
|
46
46
|
"charm_fraction": "au",
|
|
47
|
-
"charm_dpar": "
|
|
48
|
-
"charm_dperp": "mm
|
|
47
|
+
"charm_dpar": "mm2/s",
|
|
48
|
+
"charm_dperp": "mm^2/s",
|
|
49
49
|
"wmti_fraction_restricted": "au",
|
|
50
50
|
"wmti_fraction_hindered": "au",
|
|
51
51
|
"wmti_fraction_free": "au",
|