dmri-commit 2.4.1__tar.gz → 2.4.2__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.
- {dmri_commit-2.4.1/dmri_commit.egg-info → dmri_commit-2.4.2}/PKG-INFO +2 -2
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/core.pyx +24 -9
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/trk2dictionary/trk2dictionary.pyx +2 -1
- {dmri_commit-2.4.1 → dmri_commit-2.4.2/dmri_commit.egg-info}/PKG-INFO +2 -2
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/dmri_commit.egg-info/requires.txt +1 -1
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/pyproject.toml +3 -3
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/tests/test_demo.py +22 -20
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/LICENSE +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/MANIFEST.in +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/README.md +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/__init__.py +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/models.pyx +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/operator/__init__.py +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/operator/operator.pyx +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/operator/operator_c.c +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/proximals.pyx +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/solvers.py +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/trk2dictionary/ProgressBar.h +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/trk2dictionary/Vector.h +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/commit/trk2dictionary/trk2dictionary_c.cpp +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/dmri_commit.egg-info/SOURCES.txt +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/dmri_commit.egg-info/dependency_links.txt +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/dmri_commit.egg-info/top_level.txt +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/setup.cfg +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/setup.py +0 -0
- {dmri_commit-2.4.1 → dmri_commit-2.4.2}/setup_operator.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dmri-commit
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.2
|
|
4
4
|
Summary: Convex Optimization Modeling for Microstructure Informed Tractography (COMMIT)
|
|
5
5
|
Author-email: Alessandro Daducci <alessandro.daducci@univr.it>
|
|
6
6
|
Maintainer-email: DICE lab <DICE_lab@strutture.univr.it>
|
|
@@ -106,7 +106,7 @@ Description-Content-Type: text/markdown
|
|
|
106
106
|
License-File: LICENSE
|
|
107
107
|
Requires-Dist: dmri-amico>=2.0.1
|
|
108
108
|
Requires-Dist: dmri-dicelib>=1.1.0
|
|
109
|
-
Requires-Dist: numpy
|
|
109
|
+
Requires-Dist: numpy>=1.24.4
|
|
110
110
|
Requires-Dist: scipy>=1.10.1
|
|
111
111
|
Dynamic: license-file
|
|
112
112
|
|
|
@@ -796,10 +796,10 @@ cdef class Evaluation :
|
|
|
796
796
|
if self.A is None :
|
|
797
797
|
logger.error( 'Operator not built; call "build_operator()" first' )
|
|
798
798
|
|
|
799
|
-
if self.DICTIONARY['IC']['
|
|
799
|
+
if self.DICTIONARY['IC']['nSTR'] <= 0 :
|
|
800
800
|
logger.error( 'No streamline found in the dictionary; check your data' )
|
|
801
801
|
|
|
802
|
-
if int( self.DICTIONARY['
|
|
802
|
+
if int( self.DICTIONARY['ISO']['n'] * self.KERNELS['iso'].shape[0] ) == 0 :
|
|
803
803
|
logger.error( 'Unable to set regularisation because no isotropic compartment found in the dictionary.' )
|
|
804
804
|
|
|
805
805
|
# load image and check it
|
|
@@ -827,7 +827,8 @@ cdef class Evaluation :
|
|
|
827
827
|
|
|
828
828
|
# compute array of weights from image
|
|
829
829
|
array_weights = weights_img[ self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz'] ].flatten().astype(np.float32)
|
|
830
|
-
|
|
830
|
+
array_weights = array_weights[self.DICTIONARY['ISO']['vox']]
|
|
831
|
+
if array_weights.size != self.DICTIONARY['ISO']['n']:
|
|
831
832
|
logger.error( 'Number of voxels in the weights image does not match the number of voxels in the dictionary' )
|
|
832
833
|
if np.any(array_weights < 1):
|
|
833
834
|
logger.error('All weights must be greater or equal to 1')
|
|
@@ -910,15 +911,16 @@ cdef class Evaluation :
|
|
|
910
911
|
Available options:
|
|
911
912
|
'group_idx' - np.array(np.int32) :
|
|
912
913
|
group indices for the IC compartment (not implemented for EC and ISO).
|
|
913
|
-
|
|
914
|
+
NB: Each element of the array corresponds to a group and contains the indices of the streamlines
|
|
915
|
+
belonging to that group. All streamlines must belong to at least one group.
|
|
916
|
+
NB: This field is necessary only if regularisers[0] is 'group_lasso' or 'sparse_group_lasso'.
|
|
914
917
|
Example:
|
|
915
|
-
|
|
918
|
+
group_idx = np.array([[0,2,5],[1,3,4],[0,1,2,3,4,5],[6]], dtype=np.object_)
|
|
916
919
|
that is equivalent to
|
|
917
920
|
[0,1,2,3,4,5] [6]
|
|
918
921
|
/ \
|
|
919
922
|
[0,2,5] [1,3,4]
|
|
920
|
-
which has two non-overlapping groups, one of which is the union
|
|
921
|
-
of two other non-overlapping groups.
|
|
923
|
+
which has two non-overlapping groups, one of which is the union of two other non-overlapping groups.
|
|
922
924
|
Group weights computation (if regularisers[0] is 'group_lasso' or 'sparse_group_lasso'):
|
|
923
925
|
w[k] = ( 1 * sqrt(|g[k]|) * group_weights_extra[k] ) / ( ||x_nnls[g[k]]||_2 )
|
|
924
926
|
where:
|
|
@@ -942,7 +944,7 @@ cdef class Evaluation :
|
|
|
942
944
|
This field can be specified only if regularisers[0] is 'group_lasso' or 'sparse_group_lasso'.
|
|
943
945
|
NB: this array must have the same size as the number of groups in the IC compartment and contain only non-negative values.
|
|
944
946
|
'coeff_weights' - np.array(np.float64) :
|
|
945
|
-
weights associated to each individual element of the compartment (for the moment implemented only for IC
|
|
947
|
+
weights associated to each individual element of the compartment (for the moment implemented only for IC and ISO compartments).
|
|
946
948
|
This field can be specified only if the chosen regulariser is 'lasso' or 'sparse_group_lasso'.
|
|
947
949
|
NB: this array must have the same size as the number of elements in the compartment and contain only non-negative values.
|
|
948
950
|
|
|
@@ -1114,10 +1116,23 @@ cdef class Evaluation :
|
|
|
1114
1116
|
# check if group_idx contains all the indices of the input streamlines
|
|
1115
1117
|
if regularisation['regIC'] == 'group_lasso' or regularisation['regIC'] == 'sparse_group_lasso':
|
|
1116
1118
|
all_idx_in = np.sort(np.unique(np.concatenate(dictIC_params['group_idx'])))
|
|
1117
|
-
all_idx = np.arange(self.DICTIONARY['
|
|
1119
|
+
all_idx = np.arange(self.DICTIONARY['TRK']['kept'].size, dtype=np.int32)
|
|
1118
1120
|
if np.any(all_idx_in != all_idx):
|
|
1119
1121
|
logger.error('Group indices must contain all the indices of the input streamlines')
|
|
1120
1122
|
|
|
1123
|
+
# check if in the provided group indices there is at least one empty group and remove it
|
|
1124
|
+
if regularisation['regIC'] == 'group_lasso' or regularisation['regIC'] == 'sparse_group_lasso':
|
|
1125
|
+
count_empty_groups = 0
|
|
1126
|
+
list_non_empty_groups = []
|
|
1127
|
+
for g in dictIC_params['group_idx']:
|
|
1128
|
+
if g.size == 0:
|
|
1129
|
+
count_empty_groups += 1
|
|
1130
|
+
else:
|
|
1131
|
+
list_non_empty_groups.append(g)
|
|
1132
|
+
if count_empty_groups > 0:
|
|
1133
|
+
logger.warning('At least one of the provided groups is empty; removing it from the group structure')
|
|
1134
|
+
dictIC_params['group_idx'] = np.array(list_non_empty_groups, dtype=np.object_)
|
|
1135
|
+
|
|
1121
1136
|
# check if group_weights_extra is consistent with the number of groups
|
|
1122
1137
|
if (regularisation['regIC'] == 'group_lasso' or regularisation['regIC'] == 'sparse_group_lasso') and 'group_weights_extra' in dictIC_params:
|
|
1123
1138
|
if type(dictIC_params['group_weights_extra']) not in [list, np.ndarray]:
|
|
@@ -410,7 +410,8 @@ cpdef run( filename_tractogram=None, path_out=None, filename_peaks=None, filenam
|
|
|
410
410
|
cdef float* ptrToVOXMM
|
|
411
411
|
if extension == ".tck":
|
|
412
412
|
M = _get_affine( niiREF ).copy()
|
|
413
|
-
|
|
413
|
+
# float64 conversion added to comply with the new cast policy of numpy v2
|
|
414
|
+
M[:3, :3] = M[:3, :3].dot( np.diag([np.float64(1)/Px,np.float64(1)/Py,np.float64(1)/Pz]) )
|
|
414
415
|
toVOXMM = np.ravel(np.linalg.inv(M)).astype('<f4')
|
|
415
416
|
ptrToVOXMM = &toVOXMM[0]
|
|
416
417
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dmri-commit
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.2
|
|
4
4
|
Summary: Convex Optimization Modeling for Microstructure Informed Tractography (COMMIT)
|
|
5
5
|
Author-email: Alessandro Daducci <alessandro.daducci@univr.it>
|
|
6
6
|
Maintainer-email: DICE lab <DICE_lab@strutture.univr.it>
|
|
@@ -106,7 +106,7 @@ Description-Content-Type: text/markdown
|
|
|
106
106
|
License-File: LICENSE
|
|
107
107
|
Requires-Dist: dmri-amico>=2.0.1
|
|
108
108
|
Requires-Dist: dmri-dicelib>=1.1.0
|
|
109
|
-
Requires-Dist: numpy
|
|
109
|
+
Requires-Dist: numpy>=1.24.4
|
|
110
110
|
Requires-Dist: scipy>=1.10.1
|
|
111
111
|
Dynamic: license-file
|
|
112
112
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
requires = [
|
|
3
3
|
"cython>=3.0.10",
|
|
4
|
-
"numpy>=1.24.4
|
|
4
|
+
"numpy>=1.24.4",
|
|
5
5
|
"setuptools>=69.2.0"
|
|
6
6
|
]
|
|
7
7
|
build-backend = "setuptools.build_meta"
|
|
8
8
|
|
|
9
9
|
[project]
|
|
10
10
|
name = "dmri-commit"
|
|
11
|
-
version = "2.4.
|
|
11
|
+
version = "2.4.2"
|
|
12
12
|
dependencies = [
|
|
13
13
|
"dmri-amico>=2.0.1",
|
|
14
14
|
"dmri-dicelib>=1.1.0",
|
|
15
|
-
"numpy>=1.24.4
|
|
15
|
+
"numpy>=1.24.4",
|
|
16
16
|
"scipy>=1.10.1"
|
|
17
17
|
]
|
|
18
18
|
requires-python = ">=3.8"
|
|
@@ -19,23 +19,23 @@ def run_commit_StickZeppelinBall(local_path):
|
|
|
19
19
|
trk2dictionary.run(
|
|
20
20
|
filename_tractogram=os.path.join(local_path, 'demo01_fibers.tck'),
|
|
21
21
|
filename_peaks=os.path.join(local_path, 'peaks.nii.gz'),
|
|
22
|
-
filename_mask=os.path.join(local_path, 'WM.nii.gz'),
|
|
22
|
+
filename_mask=os.path.join(local_path, 'WM.nii.gz'),
|
|
23
23
|
fiber_shift=0.5,
|
|
24
24
|
peaks_use_affine=True
|
|
25
25
|
)
|
|
26
26
|
|
|
27
|
-
amico.util.fsl2scheme(os.path.join(local_path, 'bvals.txt'),
|
|
28
|
-
|
|
27
|
+
amico.util.fsl2scheme(os.path.join(local_path, 'bvals.txt'),
|
|
28
|
+
os.path.join(local_path, 'bvecs.txt'),
|
|
29
|
+
os.path.join(local_path, 'DWI.scheme'))
|
|
29
30
|
|
|
30
31
|
mit = commit.Evaluation(local_path, '.')
|
|
31
32
|
mit.load_data(os.path.join(local_path, 'DWI.nii.gz'),
|
|
32
33
|
os.path.join(local_path, 'DWI.scheme'))
|
|
33
34
|
|
|
34
35
|
mit.set_model('StickZeppelinBall')
|
|
35
|
-
d_par
|
|
36
|
-
d_perps = [0.51E-3]
|
|
37
|
-
|
|
38
|
-
d_isos = [1.7E-3, 3.0E-3] # Isotropic diffusivity(s) [mm^2/s]
|
|
36
|
+
d_par = 1.7E-3 # Parallel diffusivity [mm^2/s]
|
|
37
|
+
d_perps = [0.51E-3] # Perpendicular diffusivity(s) [mm^2/s]
|
|
38
|
+
d_isos = [1.7E-3, 3.0E-3] # Isotropic diffusivity(s) [mm^2/s]
|
|
39
39
|
mit.model.set(d_par, d_perps, d_isos)
|
|
40
40
|
mit.generate_kernels(regenerate=True)
|
|
41
41
|
mit.load_kernels()
|
|
@@ -53,22 +53,23 @@ def run_commit_BallandStick(local_path):
|
|
|
53
53
|
trk2dictionary.run(
|
|
54
54
|
filename_tractogram=os.path.join(local_path, 'demo01_fibers.tck'),
|
|
55
55
|
filename_peaks=os.path.join(local_path, 'peaks.nii.gz'),
|
|
56
|
-
filename_mask=os.path.join(local_path, 'WM.nii.gz'),
|
|
56
|
+
filename_mask=os.path.join(local_path, 'WM.nii.gz'),
|
|
57
57
|
fiber_shift=0.5,
|
|
58
58
|
peaks_use_affine=True
|
|
59
59
|
)
|
|
60
60
|
|
|
61
|
-
amico.util.fsl2scheme(os.path.join(local_path, 'bvals.txt'),
|
|
62
|
-
|
|
61
|
+
amico.util.fsl2scheme(os.path.join(local_path, 'bvals.txt'),
|
|
62
|
+
os.path.join(local_path, 'bvecs.txt'),
|
|
63
|
+
os.path.join(local_path, 'DWI.scheme'))
|
|
63
64
|
|
|
64
65
|
mit = commit.Evaluation(local_path, '.')
|
|
65
66
|
mit.load_data(os.path.join(local_path, 'DWI.nii.gz'),
|
|
66
67
|
os.path.join(local_path, 'DWI.scheme'))
|
|
67
68
|
|
|
68
69
|
mit.set_model('StickZeppelinBall')
|
|
69
|
-
d_par
|
|
70
|
-
d_perps = []
|
|
71
|
-
d_isos
|
|
70
|
+
d_par = 1.7E-3 # Parallel diffusivity [mm^2/s]
|
|
71
|
+
d_perps = [] # Perpendicular diffusivity(s) [mm^2/s]
|
|
72
|
+
d_isos = [1.7E-3, 3.0E-3] # Isotropic diffusivity(s) [mm^2/s]
|
|
72
73
|
mit.model.set(d_par, d_perps, d_isos)
|
|
73
74
|
mit.generate_kernels(regenerate=True)
|
|
74
75
|
mit.load_kernels()
|
|
@@ -86,22 +87,23 @@ def run_commit_VolumeFractions(local_path):
|
|
|
86
87
|
trk2dictionary.run(
|
|
87
88
|
filename_tractogram=os.path.join(local_path, 'demo01_fibers.tck'),
|
|
88
89
|
filename_peaks=os.path.join(local_path, 'peaks.nii.gz'),
|
|
89
|
-
filename_mask=os.path.join(local_path, 'WM.nii.gz'),
|
|
90
|
+
filename_mask=os.path.join(local_path, 'WM.nii.gz'),
|
|
90
91
|
fiber_shift=0.5,
|
|
91
92
|
peaks_use_affine=True
|
|
92
93
|
)
|
|
93
94
|
|
|
94
|
-
amico.util.fsl2scheme(os.path.join(local_path, 'bvals.txt'),
|
|
95
|
-
|
|
95
|
+
amico.util.fsl2scheme(os.path.join(local_path, 'bvals.txt'),
|
|
96
|
+
os.path.join(local_path, 'bvecs.txt'),
|
|
97
|
+
os.path.join(local_path, 'DWI.scheme'))
|
|
96
98
|
|
|
97
99
|
mit = commit.Evaluation(local_path, '.')
|
|
98
100
|
mit.load_data(os.path.join(local_path, 'DWI.nii.gz'),
|
|
99
101
|
os.path.join(local_path, 'DWI.scheme'))
|
|
100
102
|
|
|
101
103
|
mit.set_model('StickZeppelinBall')
|
|
102
|
-
d_par
|
|
103
|
-
d_perps = []
|
|
104
|
-
d_isos
|
|
104
|
+
d_par = 1.7E-3 # Parallel diffusivity [mm^2/s]
|
|
105
|
+
d_perps = [] # Perpendicular diffusivity(s) [mm^2/s]
|
|
106
|
+
d_isos = [1.7E-3, 3.0E-3] # Isotropic diffusivity(s) [mm^2/s]
|
|
105
107
|
mit.model.set(d_par, d_perps, d_isos)
|
|
106
108
|
mit.generate_kernels(regenerate=True)
|
|
107
109
|
mit.load_kernels()
|
|
@@ -131,7 +133,7 @@ def check_results(pickle_result, ref_pickle):
|
|
|
131
133
|
assert abs(result_optimization["fit_details"]["abs_cost"] - ref_optimization["fit_details"]["abs_cost"]) < 1e-4
|
|
132
134
|
assert abs(result_optimization["fit_details"]["rel_cost"] - ref_optimization["fit_details"]["rel_cost"]) < 1e-4
|
|
133
135
|
assert abs(result_optimization["fit_details"]["abs_x"] - ref_optimization["fit_details"]["abs_x"]) < 1e-4
|
|
134
|
-
assert abs(result_optimization["fit_details"]["rel_x"] - ref_optimization["fit_details"]["
|
|
136
|
+
assert abs(result_optimization["fit_details"]["rel_x"] - ref_optimization["fit_details"]["rel_x"]) < 1e-4
|
|
135
137
|
assert result_optimization["fit_details"]["iterations"] == ref_optimization["fit_details"]["iterations"]
|
|
136
138
|
|
|
137
139
|
except AssertionError:
|
|
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
|