dmri-commit 2.4.2__tar.gz → 2.4.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.
- {dmri_commit-2.4.2/dmri_commit.egg-info → dmri_commit-2.4.3}/PKG-INFO +2 -2
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/core.pyx +73 -104
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/operator/operator.pyx +6 -6
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/operator/operator_c.c +855 -855
- {dmri_commit-2.4.2 → dmri_commit-2.4.3/dmri_commit.egg-info}/PKG-INFO +2 -2
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/dmri_commit.egg-info/requires.txt +1 -1
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/pyproject.toml +3 -3
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/setup_operator.py +23 -23
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/LICENSE +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/MANIFEST.in +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/README.md +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/__init__.py +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/models.pyx +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/operator/__init__.py +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/proximals.pyx +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/solvers.py +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/trk2dictionary/ProgressBar.h +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/trk2dictionary/Vector.h +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/trk2dictionary/trk2dictionary.pyx +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/commit/trk2dictionary/trk2dictionary_c.cpp +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/dmri_commit.egg-info/SOURCES.txt +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/dmri_commit.egg-info/dependency_links.txt +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/dmri_commit.egg-info/top_level.txt +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/setup.cfg +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/setup.py +0 -0
- {dmri_commit-2.4.2 → dmri_commit-2.4.3}/tests/test_demo.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.3
|
|
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>
|
|
@@ -105,7 +105,7 @@ Requires-Python: >=3.8
|
|
|
105
105
|
Description-Content-Type: text/markdown
|
|
106
106
|
License-File: LICENSE
|
|
107
107
|
Requires-Dist: dmri-amico>=2.0.1
|
|
108
|
-
Requires-Dist: dmri-dicelib
|
|
108
|
+
Requires-Dist: dmri-dicelib<1.4.0,>=1.3.0
|
|
109
109
|
Requires-Dist: numpy>=1.24.4
|
|
110
110
|
Requires-Dist: scipy>=1.10.1
|
|
111
111
|
Dynamic: license-file
|
|
@@ -76,7 +76,6 @@ cdef class Evaluation :
|
|
|
76
76
|
cdef public CONFIG
|
|
77
77
|
cdef public temp_data
|
|
78
78
|
cdef public confidence_map_img
|
|
79
|
-
cdef public debias_mask
|
|
80
79
|
cdef public verbose
|
|
81
80
|
|
|
82
81
|
def __init__( self, study_path='.', subject='.', dictionary_path='COMMIT'):
|
|
@@ -102,7 +101,6 @@ cdef class Evaluation :
|
|
|
102
101
|
self.regularisation_params = None # set by "set_regularisation" method
|
|
103
102
|
self.x = None # set by "fit" method
|
|
104
103
|
self.confidence_map_img = None # set by "fit" method
|
|
105
|
-
self.debias_mask = None # set by "fit" method
|
|
106
104
|
self.x_nnls = None # set by "fit" method (coefficients of IC compartment estimated without regularization)
|
|
107
105
|
self.verbose = 3
|
|
108
106
|
|
|
@@ -651,7 +649,7 @@ cdef class Evaluation :
|
|
|
651
649
|
self.THREADS['EC'][i] = np.searchsorted( self.DICTIONARY['EC']['vox'], self.DICTIONARY['IC']['vox'][ self.THREADS['IC'][i] ] )
|
|
652
650
|
self.THREADS['EC'][n] = self.DICTIONARY['EC']['n']
|
|
653
651
|
|
|
654
|
-
# check if some threads are not assigned any segment
|
|
652
|
+
# check if some threads are not assigned any segment # TODO: check if this is really needed (EC is treated like ISO, but in that case this check is not needed)
|
|
655
653
|
if np.count_nonzero( np.diff( self.THREADS['EC'].astype(np.int32) ) <= 0 ) :
|
|
656
654
|
self.THREADS = None
|
|
657
655
|
logger.error( 'Too many threads for the EC compartments to evaluate; try decreasing the number' )
|
|
@@ -708,25 +706,29 @@ cdef class Evaluation :
|
|
|
708
706
|
|
|
709
707
|
if self.DICTIONARY['ISO']['n'] > 0 :
|
|
710
708
|
self.THREADS['ISOt'] = np.zeros( n+1, dtype=np.uint32 )
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
self.THREADS['ISOt'][
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
self.THREADS =
|
|
720
|
-
logger.error( 'Too many threads for the ISO compartments to evaluate; try decreasing the number' )
|
|
709
|
+
if self.DICTIONARY['ISO']['n'] < n:
|
|
710
|
+
n_iso = self.DICTIONARY['ISO']['n']
|
|
711
|
+
self.THREADS['ISOt'][:n_iso+1] = np.arange( n_iso+1 )
|
|
712
|
+
self.THREADS['ISOt'][n_iso+1:] = n_iso
|
|
713
|
+
else:
|
|
714
|
+
N = np.floor( self.DICTIONARY['ISO']['n']/n )
|
|
715
|
+
for i in xrange(1,n) :
|
|
716
|
+
self.THREADS['ISOt'][i] = self.THREADS['ISOt'][i-1] + N
|
|
717
|
+
self.THREADS['ISOt'][n] = self.DICTIONARY['ISO']['n']
|
|
721
718
|
else :
|
|
722
719
|
self.THREADS['ISOt'] = None
|
|
723
720
|
|
|
724
721
|
logger.info( f'[ {format_time(time.time() - tic)} ]' )
|
|
725
722
|
|
|
726
723
|
|
|
727
|
-
def build_operator( self ) :
|
|
724
|
+
def build_operator( self, ic_debias_mask=None ) :
|
|
728
725
|
"""Build the operator for computing the matrix-vector multiplications by A and A'
|
|
729
726
|
using the informations from self.DICTIONARY, self.KERNELS and self.THREADS.
|
|
727
|
+
|
|
728
|
+
Parameters
|
|
729
|
+
----------
|
|
730
|
+
ic_debias_mask : np.array
|
|
731
|
+
Binary mask to restrict the evaluation on a subset of columns of the IC compartment.
|
|
730
732
|
"""
|
|
731
733
|
if self.DICTIONARY is None :
|
|
732
734
|
logger.error( 'Dictionary not loaded; call "load_dictionary()" first' )
|
|
@@ -743,7 +745,10 @@ cdef class Evaluation :
|
|
|
743
745
|
tic = time.time()
|
|
744
746
|
logger.subinfo('')
|
|
745
747
|
logger.info( 'Building linear operator A' )
|
|
746
|
-
|
|
748
|
+
if ic_debias_mask is not None:
|
|
749
|
+
self.DICTIONARY['IC']['debias_mask'] = ic_debias_mask
|
|
750
|
+
else:
|
|
751
|
+
self.DICTIONARY['IC']['debias_mask'] = np.ones( int(self.DICTIONARY['IC']['nSTR'] * self.KERNELS['wmr'].shape[0]), dtype=np.uint32)
|
|
747
752
|
self.A = operator.LinearOperator( self.DICTIONARY, self.KERNELS, self.THREADS, True if hasattr(self.model, 'nolut') else False )
|
|
748
753
|
logger.info( f'[ {format_time(time.time() - tic)} ]' )
|
|
749
754
|
|
|
@@ -760,9 +765,6 @@ cdef class Evaluation :
|
|
|
760
765
|
|
|
761
766
|
y = self.niiDWI_img[ self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz'], : ].flatten().astype(np.float64)
|
|
762
767
|
|
|
763
|
-
if self.debias_mask is not None :
|
|
764
|
-
y *= self.debias_mask
|
|
765
|
-
|
|
766
768
|
return y
|
|
767
769
|
|
|
768
770
|
def set_wLasso_ISO(self, img_weights_filename, lambda_perc_iso):
|
|
@@ -1117,6 +1119,8 @@ cdef class Evaluation :
|
|
|
1117
1119
|
if regularisation['regIC'] == 'group_lasso' or regularisation['regIC'] == 'sparse_group_lasso':
|
|
1118
1120
|
all_idx_in = np.sort(np.unique(np.concatenate(dictIC_params['group_idx'])))
|
|
1119
1121
|
all_idx = np.arange(self.DICTIONARY['TRK']['kept'].size, dtype=np.int32)
|
|
1122
|
+
if all_idx_in.size != all_idx.size:
|
|
1123
|
+
logger.error(f'Group indices must contain all the indices of the input streamlines. Got {all_idx_in.size} unique streamline indices from the groups, but {all_idx.size} expected.')
|
|
1120
1124
|
if np.any(all_idx_in != all_idx):
|
|
1121
1125
|
logger.error('Group indices must contain all the indices of the input streamlines')
|
|
1122
1126
|
|
|
@@ -1350,7 +1354,7 @@ cdef class Evaluation :
|
|
|
1350
1354
|
logger.info( f'[ {format_time(time.time() - tr)} ]' )
|
|
1351
1355
|
|
|
1352
1356
|
|
|
1353
|
-
def fit( self, tol_fun=1e-3, tol_x=1e-6, max_iter=100, x0=None, confidence_map_filename=None, confidence_map_rescale=False, debias=False )
|
|
1357
|
+
def fit( self, tol_fun=1e-3, tol_x=1e-6, max_iter=100, x0=None, confidence_map_filename=None, confidence_map_rescale=False, debias=False, debias_thr=0.0 ):
|
|
1354
1358
|
"""Fit the model to the data.
|
|
1355
1359
|
|
|
1356
1360
|
Parameters
|
|
@@ -1371,6 +1375,15 @@ cdef class Evaluation :
|
|
|
1371
1375
|
If true, the values of the confidence map will be rescaled to the
|
|
1372
1376
|
range [0.0,1.0]. Only the voxels considered in the mask will be affected.
|
|
1373
1377
|
(default : False)
|
|
1378
|
+
debias : boolean
|
|
1379
|
+
If true, a debiasing step will be performed after the main fitting
|
|
1380
|
+
procedure. Highly suggested when using a regularisation. (default : False)
|
|
1381
|
+
debias_thr : float
|
|
1382
|
+
Threshold used to select the coefficients to be debiased.
|
|
1383
|
+
A second fit (without regularisation) will be performed on the reduced
|
|
1384
|
+
problem defined by as a subset of the original linear operator. This is obtained
|
|
1385
|
+
by selecting only the columns corresponding to estimated coefficients greater
|
|
1386
|
+
than debias_thr in the main fitting procedure. (default : 0.0)
|
|
1374
1387
|
"""
|
|
1375
1388
|
if self.niiDWI is None :
|
|
1376
1389
|
logger.error( 'Data not loaded; call "load_data()" first' )
|
|
@@ -1380,9 +1393,11 @@ cdef class Evaluation :
|
|
|
1380
1393
|
logger.error( 'Response functions not generated; call "generate_kernels()" and "load_kernels()" first' )
|
|
1381
1394
|
if self.THREADS is None :
|
|
1382
1395
|
logger.error( 'Threads not set; call "set_threads()" first' )
|
|
1383
|
-
if self.A is None :
|
|
1384
|
-
logger.error( 'Operator not built; call "build_operator()" first' )
|
|
1385
1396
|
|
|
1397
|
+
# Build operator
|
|
1398
|
+
self.build_operator()
|
|
1399
|
+
|
|
1400
|
+
# Set default regularisation parameters if not set by the user
|
|
1386
1401
|
if self.regularisation_params is None:
|
|
1387
1402
|
self.set_regularisation()
|
|
1388
1403
|
|
|
@@ -1473,39 +1488,31 @@ cdef class Evaluation :
|
|
|
1473
1488
|
logger.subinfo(f'Stopped after {opt_details["iterations"]} iterations', indent_lvl=1, indent_char='*', with_progress=True)
|
|
1474
1489
|
logger.subinfo(f'Stopping condition: \"{opt_details["stopping_criterion"]}\"', indent_lvl=1, indent_char='*')
|
|
1475
1490
|
|
|
1491
|
+
# DEBIAS
|
|
1476
1492
|
if (self.regularisation_params['regIC']!=None or self.regularisation_params['regEC']!= None or self.regularisation_params['regISO']!= None) and debias:
|
|
1477
|
-
from commit.operator import operator
|
|
1478
1493
|
temp_verb = self.verbose
|
|
1479
|
-
logger.
|
|
1494
|
+
logger.subinfo('')
|
|
1495
|
+
logger.info( f'Running debias' )
|
|
1496
|
+
logger.subinfo( f'Keeping columns in the IC compartment whose corresponding coefficient is greater than {debias_thr}', indent_lvl=1, indent_char='*' )
|
|
1480
1497
|
self.set_verbose(0)
|
|
1481
1498
|
|
|
1482
1499
|
offset = self.DICTIONARY['IC']['nSTR'] * self.KERNELS['wmr'].shape[0]
|
|
1483
1500
|
xic = self.x[:offset]
|
|
1484
1501
|
mask = np.ones(offset, dtype=np.uint32)
|
|
1485
|
-
mask[xic
|
|
1486
|
-
|
|
1487
|
-
self.DICTIONARY["IC"]["eval"] = mask
|
|
1488
|
-
|
|
1489
|
-
self.A = operator.LinearOperator( self.DICTIONARY, self.KERNELS, self.THREADS, nolut=True if hasattr(self.model, 'nolut') else False )
|
|
1490
|
-
|
|
1491
|
-
self.set_regularisation()
|
|
1492
|
-
self.set_verbose(temp_verb)
|
|
1493
|
-
|
|
1494
|
-
logger.subinfo('Recomputing coefficients', indent_lvl=1, indent_char='*', with_progress=True)
|
|
1502
|
+
mask[xic<=debias_thr] = 0
|
|
1495
1503
|
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
self.x, opt_details = commit.solvers.solve(self.get_y(), self.A, self.A.T, tol_fun=tol_fun, tol_x=tol_x, max_iter=max_iter, verbose=self.verbose, x0=x0, regularisation=self.regularisation_params, confidence_array=confidence_array)
|
|
1504
|
+
if np.sum(mask)==0:
|
|
1505
|
+
self.set_verbose(temp_verb)
|
|
1506
|
+
logger.warning('All coefficients of the IC compartment are below the debias threshold. The debias step will not be performed. Note: consider softening the regularisation by decreasing the lambda value(s).')
|
|
1507
|
+
else:
|
|
1508
|
+
# update the operator with the new mask for the IC compartment
|
|
1509
|
+
self.build_operator(ic_debias_mask=mask)
|
|
1510
|
+
# run fit on the debiased problem
|
|
1511
|
+
self.set_regularisation()
|
|
1512
|
+
self.set_verbose(temp_verb)
|
|
1513
|
+
logger.subinfo('Recomputing coefficients', indent_lvl=1, indent_char='*', with_progress=True)
|
|
1514
|
+
with ProgressBar(disable=self.verbose!=3, hide_on_exit=True, subinfo=True) as pbar:
|
|
1515
|
+
self.x, opt_details = commit.solvers.solve(self.get_y(), self.A, self.A.T, tol_fun=tol_fun, tol_x=tol_x, max_iter=max_iter, verbose=self.verbose, x0=x0, regularisation=self.regularisation_params, confidence_array=confidence_array)
|
|
1509
1516
|
|
|
1510
1517
|
elif (self.regularisation_params['regIC']!=None or self.regularisation_params['regEC']!= None or self.regularisation_params['regISO']!= None) and not debias:
|
|
1511
1518
|
logger.warning('Fitting with regularisation but without debiasing. The coefficients will be biased, use "debias=True" to debias the coefficients')
|
|
@@ -1621,64 +1628,26 @@ cdef class Evaluation :
|
|
|
1621
1628
|
niiMAP_hdr['descrip'] = f'Created with COMMIT {self.get_config("version")}'
|
|
1622
1629
|
niiMAP_hdr['db_name'] = ''
|
|
1623
1630
|
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
niiMAP_img[self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz']] = tmp
|
|
1646
|
-
niiMAP_hdr['cal_min'] = 0
|
|
1647
|
-
niiMAP_hdr['cal_max'] = tmp.max()
|
|
1648
|
-
nibabel.save( niiMAP, pjoin(RESULTS_path,'fit_RMSE.nii.gz') )
|
|
1649
|
-
|
|
1650
|
-
tmp = np.sum(y_mea**2,axis=1)
|
|
1651
|
-
idx = np.where( tmp < 1E-12 )
|
|
1652
|
-
tmp[ idx ] = 1
|
|
1653
|
-
tmp = np.sqrt( np.sum((y_mea-y_est)**2,axis=1) / tmp )
|
|
1654
|
-
tmp[ idx ] = 0
|
|
1655
|
-
|
|
1656
|
-
niiMAP_img[self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz']] = tmp
|
|
1657
|
-
niiMAP_hdr['cal_min'] = 0
|
|
1658
|
-
niiMAP_hdr['cal_max'] = 1
|
|
1659
|
-
nibabel.save( niiMAP, pjoin(RESULTS_path,'fit_NRMSE.nii.gz') )
|
|
1660
|
-
|
|
1661
|
-
else:
|
|
1662
|
-
nVOX = self.DICTIONARY['IC']['nVOX']
|
|
1663
|
-
y_mea = np.reshape( self.niiDWI_img[ self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz'], : ].flatten().astype(np.float32), (nVOX,-1) )
|
|
1664
|
-
y_est = np.reshape( self.A.dot(self.x), (nVOX,-1) ).astype(np.float32)
|
|
1665
|
-
tmp = np.sqrt( np.mean((y_mea-y_est)**2,axis=1) )
|
|
1666
|
-
logger.subinfo(f'RMSE: {tmp.mean():.3f} +/- {tmp.std():.3f}', indent_lvl=2, indent_char='-')
|
|
1667
|
-
niiMAP_img[ self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz'] ] = tmp
|
|
1668
|
-
niiMAP_hdr['cal_min'] = 0
|
|
1669
|
-
niiMAP_hdr['cal_max'] = tmp.max()
|
|
1670
|
-
nibabel.save( niiMAP, pjoin(RESULTS_path,'fit_RMSE.nii.gz') )
|
|
1671
|
-
|
|
1672
|
-
tmp = np.sum(y_mea**2,axis=1)
|
|
1673
|
-
idx = np.where( tmp < 1E-12 )
|
|
1674
|
-
tmp[ idx ] = 1
|
|
1675
|
-
tmp = np.sqrt( np.sum((y_mea-y_est)**2,axis=1) / tmp )
|
|
1676
|
-
tmp[ idx ] = 0
|
|
1677
|
-
logger.subinfo(f'NRMSE: {tmp.mean():.3f} +/- {tmp.std():.3f}', indent_lvl=2, indent_char='-')
|
|
1678
|
-
niiMAP_img[ self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz'] ] = tmp
|
|
1679
|
-
niiMAP_hdr['cal_min'] = 0
|
|
1680
|
-
niiMAP_hdr['cal_max'] = 1
|
|
1681
|
-
nibabel.save( niiMAP, pjoin(RESULTS_path,'fit_NRMSE.nii.gz') )
|
|
1631
|
+
nVOX = self.DICTIONARY['IC']['nVOX']
|
|
1632
|
+
y_mea = np.reshape( self.niiDWI_img[ self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz'], : ].flatten().astype(np.float32), (nVOX,-1) )
|
|
1633
|
+
y_est = np.reshape( self.A.dot(self.x), (nVOX,-1) ).astype(np.float32)
|
|
1634
|
+
tmp = np.sqrt( np.mean((y_mea-y_est)**2,axis=1) )
|
|
1635
|
+
logger.subinfo(f'RMSE: {tmp.mean():.3f} +/- {tmp.std():.3f}', indent_lvl=2, indent_char='-')
|
|
1636
|
+
niiMAP_img[ self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz'] ] = tmp
|
|
1637
|
+
niiMAP_hdr['cal_min'] = 0
|
|
1638
|
+
niiMAP_hdr['cal_max'] = tmp.max()
|
|
1639
|
+
nibabel.save( niiMAP, pjoin(RESULTS_path,'fit_RMSE.nii.gz') )
|
|
1640
|
+
|
|
1641
|
+
tmp = np.sum(y_mea**2,axis=1)
|
|
1642
|
+
idx = np.where( tmp < 1E-12 )
|
|
1643
|
+
tmp[ idx ] = 1
|
|
1644
|
+
tmp = np.sqrt( np.sum((y_mea-y_est)**2,axis=1) / tmp )
|
|
1645
|
+
tmp[ idx ] = 0
|
|
1646
|
+
logger.subinfo(f'NRMSE: {tmp.mean():.3f} +/- {tmp.std():.3f}', indent_lvl=2, indent_char='-')
|
|
1647
|
+
niiMAP_img[ self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz'] ] = tmp
|
|
1648
|
+
niiMAP_hdr['cal_min'] = 0
|
|
1649
|
+
niiMAP_hdr['cal_max'] = 1
|
|
1650
|
+
nibabel.save( niiMAP, pjoin(RESULTS_path,'fit_NRMSE.nii.gz') )
|
|
1682
1651
|
|
|
1683
1652
|
if self.confidence_map_img is not None:
|
|
1684
1653
|
confidence_array = np.reshape( self.confidence_map_img[ self.DICTIONARY['MASK_ix'], self.DICTIONARY['MASK_iy'], self.DICTIONARY['MASK_iz'], : ].flatten().astype(np.float32), (nVOX,-1) )
|
|
@@ -21,7 +21,7 @@ cdef class LinearOperator :
|
|
|
21
21
|
unsigned int [::1] ICv
|
|
22
22
|
unsigned int [::1] ECv
|
|
23
23
|
unsigned int [::1] ISOv
|
|
24
|
-
unsigned int [::1]
|
|
24
|
+
unsigned int [::1] ICm # debias mask for IC columns
|
|
25
25
|
float [::1] ICl
|
|
26
26
|
float [:, :, ::1] LUT_IC
|
|
27
27
|
float [:, :, ::1] LUT_EC
|
|
@@ -74,7 +74,7 @@ cdef class LinearOperator :
|
|
|
74
74
|
self.ICl = DICTIONARY['IC']['len']
|
|
75
75
|
self.ICv = DICTIONARY['IC']['vox']
|
|
76
76
|
self.ICo = DICTIONARY['IC']['dir']
|
|
77
|
-
self.
|
|
77
|
+
self.ICm = DICTIONARY['IC']['debias_mask']
|
|
78
78
|
self.ECv = DICTIONARY['EC']['vox']
|
|
79
79
|
self.ECo = DICTIONARY['EC']['dir']
|
|
80
80
|
self.ISOv = DICTIONARY['ISO']['vox']
|
|
@@ -140,7 +140,7 @@ cdef class LinearOperator :
|
|
|
140
140
|
COMMIT_A_nolut(
|
|
141
141
|
&v_in[0], &v_out[0],
|
|
142
142
|
self.ICnSTR,
|
|
143
|
-
&self.ICf[0], &self.
|
|
143
|
+
&self.ICf[0], &self.ICm[0], &self.ICv[0], &self.ICl[0],
|
|
144
144
|
&self.ISOv[0],
|
|
145
145
|
&self.ICthreads[0], &self.ISOthreads[0],
|
|
146
146
|
self.ISOnRF, self.nThreads
|
|
@@ -150,7 +150,7 @@ cdef class LinearOperator :
|
|
|
150
150
|
&v_in[0], &v_out[0],
|
|
151
151
|
self.nSAMPLES, self.ndirs,
|
|
152
152
|
self.ICnSTR, self.ECn, self.ISOn,
|
|
153
|
-
&self.ICf[0], &self.
|
|
153
|
+
&self.ICf[0], &self.ICm[0], &self.ICv[0], &self.ICo[0], &self.ICl[0],
|
|
154
154
|
&self.ECv[0], &self.ECo[0],
|
|
155
155
|
&self.ISOv[0],
|
|
156
156
|
&self.LUT_IC[0,0,0], &self.LUT_EC[0,0,0], &self.LUT_ISO[0,0],
|
|
@@ -163,7 +163,7 @@ cdef class LinearOperator :
|
|
|
163
163
|
COMMIT_At_nolut(
|
|
164
164
|
&v_in[0], &v_out[0],
|
|
165
165
|
self.ICnSTR, self.ICn,
|
|
166
|
-
&self.ICf[0], &self.
|
|
166
|
+
&self.ICf[0], &self.ICm[0], &self.ICv[0], &self.ICl[0],
|
|
167
167
|
&self.ISOv[0],
|
|
168
168
|
&self.ICthreadsT[0], &self.ISOthreadsT[0],
|
|
169
169
|
self.ISOnRF, self.nThreads
|
|
@@ -173,7 +173,7 @@ cdef class LinearOperator :
|
|
|
173
173
|
&v_in[0], &v_out[0],
|
|
174
174
|
self.nSAMPLES, self.ndirs,
|
|
175
175
|
self.ICnSTR, self.ICn, self.ECn, self.ISOn,
|
|
176
|
-
&self.ICf[0], &self.
|
|
176
|
+
&self.ICf[0], &self.ICm[0], &self.ICv[0], &self.ICo[0], &self.ICl[0],
|
|
177
177
|
&self.ECv[0], &self.ECo[0],
|
|
178
178
|
&self.ISOv[0],
|
|
179
179
|
&self.LUT_IC[0,0,0], &self.LUT_EC[0,0,0], &self.LUT_ISO[0,0],
|