Issue with the call of nnls
Closed this issue · 9 comments
Hello,
Thanks for sharing this nice work. I am writing here after quite a lot of debugging, facing an issue with the package. After running:
python run_real_data_script.py --path_to_folder='......' --input='allEchoes_magn.nii.gz' --mask='mask.nii.gz' --minTE=5.3 --nTE=11 --TR=1500 --FA_method='spline' --FA_smooth='yes' --denoise='TV' --reg_method='X2' --reg_matrix='L1' --savefig='yes' --savefig_slice=13 --numcores=-1 --myelin_T2=40
I get the error:
.
.
.
17 slices processed
18 slices processed
19 slices processed
20 slices processed
21 slices processed
22 slices processed
9% (22 of 230) |##### | Elapsed Time: 0:00:06 ETA: 0:01:05multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/dimitriosgkotsoulias/miniconda3/envs/mrenv/lib/python3.12/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^^^^^
File "/home/dimitriosgkotsoulias/miniconda3/envs/mrenv/lib/python3.12/site-packages/joblib/_parallel_backends.py", line 620, in call
return self.func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dimitriosgkotsoulias/miniconda3/envs/mrenv/lib/python3.12/site-packages/joblib/parallel.py", line 288, in call
return [func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/dimitriosgkotsoulias/gkotsoulias_software/PYTHON_scripts/multicomponent-T2-toolbox-master/flip_angle_algorithms/fa_estimation.py", line 51, in fitting_slice_FA_spline_method
f, rnorm_f = nnls( Dic_i, M )
^^^^^^^^^^^^^^^^
File "/home/dimitriosgkotsoulias/gkotsoulias_software/PYTHON_scripts/multicomponent-T2-toolbox-master/intravoxel_algorithms/algorithms.py", line 77, in nnls
x, rnorm, mode = _nnls.nnls(A, m, n, b, w, zz, index, maxiter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: nnls() takes from 2 to 3 positional arguments but 8 were given
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/dimitriosgkotsoulias/gkotsoulias_software/PYTHON_scripts/multicomponent-T2-toolbox-master/run_real_data_script.py", line 122, in
motor_recon_met2(TE_array, path_to_data, path_to_mask, path_to_save_data, TR, reg_method, reg_matrix, denoise, FA_method, FA_smooth, myelin_T2_cutoff, num_cores)
File "/home/dimitriosgkotsoulias/gkotsoulias_software/PYTHON_scripts/multicomponent-T2-toolbox-master/motor/motor_recon_met2_real_data.py", line 365, in motor_recon_met2
FA_par = Parallel(n_jobs=num_cores, backend='multiprocessing')(delayed(fitting_slice_FA_spline_method)(Dic_3D_LR, Dic_3D, data_slice[:,voxely,:], mask_slice[:, voxely], alpha_values_spline, nx, alpha_values) for voxely in range(ny))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dimitriosgkotsoulias/miniconda3/envs/mrenv/lib/python3.12/site-packages/joblib/parallel.py", line 1098, in call
self.retrieve()
File "/home/dimitriosgkotsoulias/miniconda3/envs/mrenv/lib/python3.12/site-packages/joblib/parallel.py", line 975, in retrieve
self._output.extend(job.get(timeout=self.timeout))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dimitriosgkotsoulias/miniconda3/envs/mrenv/lib/python3.12/multiprocessing/pool.py", line 774, in get
raise self._value
TypeError: nnls() takes from 2 to 3 positional arguments but 8 were given
23 slices processed
Any ideas where this error emerges from and why specifically on the 23rd slice (and not earlier)? Could it be and incompatibility of the nnls different usages in the code?
Thanks a lot in advance!
Dimitri
ps. I can share a dataset confidentially in order to check the issue if needed.
Solved by taking care of specific package dependencies.
Hi, please let me know if you need any help. I could run an example dataset on my computer to double-check the quality of the estimated maps. Depending on the software/package versions, nnls is called in the toolbox as _nnls or __nnls.
Hi Erick,
problem is solved for now, I managed to use the tool -thanks for openly sharing.
The quality of the maps looks fine with a more 'educated' choice of the cut-off T2, as we are talking about post mortem samples (and there are multiple tissue microstructural changes to consider - the spectra are altered and the lobes are closer). I will
let you know if I get to any question regarding the software.
Thanks a lot for your reply.
Dimitri
Fantastic! I'm really curious about your results. If you're using 7T, the cut-off should be smaller...
Amazing! Did you plot the spectra from some voxels?
X2-I is the standard method, but if the data is noisy, the L-curve could be better (although sometimes it tends to merge both lobes).
I used L-curve (although the data are not so noisy). I plan to check out the results with X2-I as well in the next days. I can share the spectra when I get access to my other laptop.
BTW, do you visit ISMRM/ESMRMB?
That is great!
I will attend the next ESMRMB congress in Barcelona.
We are organizing this workshop on diffusion MRI: https://www.esmrmb2024.org/pre-congress-new-horizons/
Great then, lets meet up there ! Thanks for the link.