pyLQT 1.0.dev7__tar.gz → 1.0.dev8__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.
- {pylqt-1.0.dev7/src/pyLQT.egg-info → pylqt-1.0.dev8}/PKG-INFO +1 -1
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/pyproject.toml +1 -1
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/cli.py +2 -1
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/grey_matter/metrics.py +3 -6
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/white_matter/metrics.py +15 -33
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/pipeline.py +19 -11
- {pylqt-1.0.dev7 → pylqt-1.0.dev8/src/pyLQT.egg-info}/PKG-INFO +1 -1
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/LICENSE +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/README.md +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/setup.cfg +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/__init__.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/__init__.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/grey_matter/__init__.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/grey_matter/utils.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/network/__init__.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/network/metrics.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/network/utils.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/utils/__init__.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/utils/configs.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/utils/downloads.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/utils/registration.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/white_matter/__init__.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT/lesion_metrics/white_matter/utils.py +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT.egg-info/SOURCES.txt +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT.egg-info/dependency_links.txt +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT.egg-info/entry_points.txt +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT.egg-info/requires.txt +0 -0
- {pylqt-1.0.dev7 → pylqt-1.0.dev8}/src/pyLQT.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyLQT
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.dev8
|
|
4
4
|
Summary: Python version of LQT from Griffis et al. 2021 (https://www.sciencedirect.com/science/article/pii/S2213158221000838)
|
|
5
5
|
Author-email: Antonin HUDRY <hudryantoninm@gmail.com>
|
|
6
6
|
License-Expression: GPL-3.0-only
|
|
@@ -43,7 +43,7 @@ def main():
|
|
|
43
43
|
)
|
|
44
44
|
|
|
45
45
|
parser.add_argument(
|
|
46
|
-
"--
|
|
46
|
+
"--sc_distance_threshold",
|
|
47
47
|
default=5.0,
|
|
48
48
|
help='[float (0,inf), default=5.0] Defines threshold for distance filtering of tracts endpoints in structural connectivity computation.'
|
|
49
49
|
)
|
|
@@ -68,6 +68,7 @@ def main():
|
|
|
68
68
|
tracts_cfg=args.tracts_cfg,
|
|
69
69
|
out_folder=args.out_folder,
|
|
70
70
|
registration_type=args.registration_type,
|
|
71
|
+
sc_distance_threshold=args.sc_distance_threshold,
|
|
71
72
|
spared_threshold=args.spared_threshold,
|
|
72
73
|
delete_tmp=args.delete_tmp,
|
|
73
74
|
)
|
|
@@ -44,14 +44,11 @@ def get_parcel_damage(
|
|
|
44
44
|
Returns
|
|
45
45
|
-------
|
|
46
46
|
pandas.DataFrame
|
|
47
|
-
Copy of ``atlas_labels`` with an additional ``out_col``
|
|
48
|
-
|
|
49
|
-
lesion.
|
|
47
|
+
Copy of ``atlas_labels`` with an additional column, defined by ``out_col``
|
|
48
|
+
containing the proportion of each parcel affected by the lesion.
|
|
50
49
|
"""
|
|
51
50
|
|
|
52
|
-
lesion_resampled = resample_from_to(lesion,
|
|
53
|
-
atlas,
|
|
54
|
-
order=1)
|
|
51
|
+
lesion_resampled = resample_from_to(lesion, atlas, order=1)
|
|
55
52
|
|
|
56
53
|
lesion_volume = lesion_resampled.get_fdata()
|
|
57
54
|
atlas_volume = atlas.get_fdata().astype(np.int32)
|
|
@@ -3,7 +3,7 @@ import pandas as pd
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
5
|
from nibabel.processing import resample_from_to
|
|
6
|
-
from .utils import get_tract,
|
|
6
|
+
from .utils import get_tract, get_streamlines_disconnection
|
|
7
7
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
|
|
@@ -100,8 +100,8 @@ def get_tracts_disconnections_severity(
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
def get_tracts_disconnections_map(
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
tdi,
|
|
104
|
+
tdi_disconnected,
|
|
105
105
|
out_path = None
|
|
106
106
|
):
|
|
107
107
|
"""Compute a voxel-wise tracts disconnection map.
|
|
@@ -112,49 +112,31 @@ def get_tracts_disconnections_map(
|
|
|
112
112
|
|
|
113
113
|
Parameters
|
|
114
114
|
----------
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
tdi : nibabel.Nifti1Image
|
|
116
|
+
Tract density image of the tractogram.
|
|
117
|
+
tdi_disconnected : nibabel.Nifti1Image
|
|
118
|
+
Tract density image of the disconnected tractogram
|
|
119
119
|
out_path : pathlib.Path | None, optional
|
|
120
120
|
Directory where the TDI images and disconnection map are saved.
|
|
121
121
|
If None, no files are saved.
|
|
122
122
|
|
|
123
123
|
Returns
|
|
124
124
|
-------
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- disconnections_map : nibabel.Nifti1Image
|
|
129
|
-
Voxel-wise ratio of disconnected to total streamline density.
|
|
130
|
-
- tdi_aggregated : nibabel.Nifti1Image
|
|
131
|
-
Track density image of all streamlines.
|
|
132
|
-
- tdi_disconnected : nibabel.Nifti1Image
|
|
133
|
-
Track density image of disconnected streamlines.
|
|
125
|
+
nibabel.Nifti1Image
|
|
126
|
+
Voxel-wise ratio of disconnected to total streamline density.
|
|
134
127
|
"""
|
|
135
128
|
|
|
136
|
-
|
|
137
|
-
if out_path:
|
|
138
|
-
out_path.mkdir(parents=True, exist_ok=True)
|
|
139
|
-
tdi_path = out_path / "tdi.nii.gz"
|
|
140
|
-
tdi_disconnected_path = out_path / "tdi_disconnected.nii.gz"
|
|
141
|
-
else:
|
|
142
|
-
tdi_path = None
|
|
143
|
-
tdi_disconnected_path = None
|
|
144
|
-
|
|
145
|
-
tdi_aggregated = get_tdi(tracts, out_path=tdi_path)
|
|
146
|
-
tdi_disconnected = get_tdi(tracts_disconnected, out_path=tdi_disconnected_path)
|
|
147
|
-
|
|
148
129
|
disconnections_map = np.divide(
|
|
149
130
|
tdi_disconnected.get_fdata(),
|
|
150
|
-
|
|
151
|
-
out=np.zeros_like(
|
|
152
|
-
where=
|
|
131
|
+
tdi.get_fdata(),
|
|
132
|
+
out=np.zeros_like(tdi.get_fdata(), dtype=float),
|
|
133
|
+
where=tdi.get_fdata() != 0
|
|
153
134
|
)
|
|
154
135
|
|
|
155
|
-
disconnections_map = nib.Nifti1Image(disconnections_map,
|
|
136
|
+
disconnections_map = nib.Nifti1Image(disconnections_map, tdi.affine, tdi.header)
|
|
156
137
|
|
|
157
138
|
if out_path:
|
|
139
|
+
out_path.mkdir(parents=True, exist_ok=True)
|
|
158
140
|
nib.nifti1.save(disconnections_map, (out_path / "disconnections_map.nii.gz"))
|
|
159
141
|
|
|
160
|
-
return disconnections_map
|
|
142
|
+
return disconnections_map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from pyLQT.lesion_metrics.white_matter.metrics import get_tracts_disconnections_severity, get_tracts_disconnections_map
|
|
2
|
-
from pyLQT.lesion_metrics.white_matter.utils import get_streamlines_disconnection, get_aggregated_tracts, clip_tractogram_to_grid
|
|
2
|
+
from pyLQT.lesion_metrics.white_matter.utils import get_streamlines_disconnection, get_aggregated_tracts, clip_tractogram_to_grid, get_tdi
|
|
3
3
|
from pyLQT.lesion_metrics.network.metrics import get_sspl_increase, get_parcel_wise_disconnection_severity
|
|
4
4
|
from pyLQT.lesion_metrics.network.utils import create_structural_connectivity
|
|
5
5
|
from pyLQT.lesion_metrics.grey_matter.metrics import get_parcel_damage
|
|
@@ -8,7 +8,6 @@ from pyLQT.lesion_metrics.utils.downloads import default_tracts_download, defaul
|
|
|
8
8
|
from pyLQT.lesion_metrics.utils.registration import register_affine, register_syn
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
|
|
11
|
-
import numpy as np
|
|
12
11
|
import nibabel as nib
|
|
13
12
|
import shutil
|
|
14
13
|
import tempfile
|
|
@@ -111,7 +110,7 @@ def run_pyLQT(
|
|
|
111
110
|
tracts_pathlist = []
|
|
112
111
|
for tract_path in tracts_pathlist_gz:
|
|
113
112
|
relative_path = tract_path.relative_to(tracts_folder)
|
|
114
|
-
out_path = tmp_folder / relative_path.with_suffix("")
|
|
113
|
+
out_path = tmp_folder / f"{tracts_name}_uncompressed" / relative_path.with_suffix("")
|
|
115
114
|
out_path.parent.mkdir(parents=True, exist_ok=True)
|
|
116
115
|
|
|
117
116
|
tracts_pathlist.append(uncompress_trk_gz(tract_path, out_path))
|
|
@@ -125,9 +124,13 @@ def run_pyLQT(
|
|
|
125
124
|
structural_connectivity_aggregated = create_structural_connectivity(
|
|
126
125
|
tract=aggregated_tracts,
|
|
127
126
|
atlas_resampled=atlas_trans,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
threshold=sc_distance_threshold,
|
|
128
|
+
out_path=out_folder / f"{tracts_name}_structural_connectivity.npy"
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
tdi_aggregated_path = out_folder / f"{tracts_name}_tdi_aggregated.nii.gz"
|
|
132
|
+
tdi_aggregated = get_tdi(aggregated_tracts, out_path=tdi_aggregated_path)
|
|
133
|
+
|
|
131
134
|
|
|
132
135
|
for lesion_path in lesion_folder.glob("*.nii*"):
|
|
133
136
|
lesion_name = lesion_path.name.removesuffix(".nii.gz").removesuffix(".nii")
|
|
@@ -153,13 +156,18 @@ def run_pyLQT(
|
|
|
153
156
|
out_path=aggregated_tracts_disconnected_path,
|
|
154
157
|
)
|
|
155
158
|
aggregated_tracts_disconnected = clip_tractogram_to_grid(aggregated_tracts_disconnected)
|
|
159
|
+
|
|
160
|
+
(out_dir / "parcel_wise_disconnection_severity").mkdir(parents=True, exist_ok=True)
|
|
156
161
|
structural_connectivity_disconnected = create_structural_connectivity(
|
|
157
162
|
tract=aggregated_tracts_disconnected,
|
|
158
163
|
atlas_resampled=atlas_trans,
|
|
159
|
-
|
|
164
|
+
threshold=sc_distance_threshold,
|
|
165
|
+
out_path=out_dir / "parcel_wise_disconnection_severity" / "structural_connectivity_disconnected.npy"
|
|
160
166
|
)
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
|
|
168
|
+
(out_dir / "wm_disconnections_map").mkdir(parents=True, exist_ok=True)
|
|
169
|
+
tdi_aggregated_disconnected_path = out_dir / "wm_disconnections_map" / f"{tracts_name}_tdi_disconnected.nii.gz"
|
|
170
|
+
tdi_aggregated_disconnected = get_tdi(aggregated_tracts_disconnected, out_path=tdi_aggregated_disconnected_path)
|
|
163
171
|
|
|
164
172
|
get_parcel_damage(
|
|
165
173
|
lesion=lesion_trans,
|
|
@@ -178,8 +186,8 @@ def run_pyLQT(
|
|
|
178
186
|
)
|
|
179
187
|
|
|
180
188
|
get_tracts_disconnections_map(
|
|
181
|
-
|
|
182
|
-
|
|
189
|
+
tdi=tdi_aggregated,
|
|
190
|
+
tdi_disconnected=tdi_aggregated_disconnected,
|
|
183
191
|
out_path=out_dir / "wm_disconnections_map",
|
|
184
192
|
)
|
|
185
193
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyLQT
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.dev8
|
|
4
4
|
Summary: Python version of LQT from Griffis et al. 2021 (https://www.sciencedirect.com/science/article/pii/S2213158221000838)
|
|
5
5
|
Author-email: Antonin HUDRY <hudryantoninm@gmail.com>
|
|
6
6
|
License-Expression: GPL-3.0-only
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|