Commit 7c0e60d3 authored by William Clarke's avatar William Clarke
Browse files

Fix fsl_mrsi bug with no water. Will be v1.1.4.

parent 0a4acec5
This document contains the FSL-MRS release history in reverse chronological order.
1.1.4 (WIP)
------------------------------
1.1.4 (Tuesday 3rd August 2021)
-------------------------------
- Fixed bug in calculation of molality concentration. Tissue mole fractions had been swapped for tissue volume fractions. Molar concentrations unaffected.
- Fixed bug in mrs_tools split
- Fixed bug in alignment of multi-dimensional data.
- Fixed bug in fsl_mrsi: data without a water reference now works.
- fsl_mrsi now outputs fitting nuisance parameters: phases, and shifts & linewidths for each metabolite group.
- Add NIfTI-MRS reshape command
- Add basis_tools remove_peak option to run HLSVD, typical usage for removing TMS peak.
......
......@@ -27,7 +27,7 @@ class MRSI(object):
# process H2O
if H2O is None:
H2O = np.full(FID.shape, None)
H2O = np.full(FID.shape[:3], None)
elif H2O.shape != FID.shape:
raise ValueError('H2O must be None or numpy array '
'of the same shape as FID.')
......@@ -208,9 +208,12 @@ class MRSI(object):
as a single MRS object.
'''
FID = misc.volume_to_list(self.data, self.mask)
H2O = misc.volume_to_list(self.H2O, self.mask)
FID = sum(FID) / len(FID)
H2O = sum(H2O) / len(H2O)
if not np.array_equal(self.H2O, np.full(self.data.shape[:3], None)):
H2O = misc.volume_to_list(self.H2O, self.mask)
H2O = sum(H2O) / len(H2O)
else:
H2O = None
mrs_out = MRS(FID=FID,
header=self.header,
......
......@@ -497,11 +497,11 @@ def runvoxel(mrs_in, args, Fitargs, echotime, repetition_time):
# Internal and Water quantification if requested
if (mrs.H2O is None) or (echotime is None) or (repetition_time is None):
if echotime is None:
if mrs.H2O is not None and echotime is None:
warnings.warn('H2O file provided but could not determine TE:'
' no absolute quantification will be performed.',
UserWarning)
if repetition_time is None:
if mrs.H2O is not None and repetition_time is None:
warnings.warn('H2O file provided but could not determine TR:'
' no absolute quantification will be performed.',
UserWarning)
......
......@@ -55,3 +55,34 @@ def test_fsl_mrsi(tmp_path):
assert (tmp_path / 'fit_out/nuisance/combined_lw_group0.nii.gz').exists()
assert (tmp_path / 'fit_out/nuisance/gamma_group0.nii.gz').exists()
assert (tmp_path / 'fit_out/nuisance/sigma_group0.nii.gz').exists()
def test_fsl_mrsi_noh2o(tmp_path):
subprocess.check_call(['fsl_mrsi',
'--data', data['metab'],
'--basis', data['basis'],
'--output', str(tmp_path / 'fit_out'),
'--add_MM',
'--mask', data['mask'],
'--overwrite',
'--combine', 'Cr', 'PCr'])
assert (tmp_path / 'fit_out/fit').exists()
assert (tmp_path / 'fit_out/qc').exists()
assert (tmp_path / 'fit_out/uncertainties').exists()
assert (tmp_path / 'fit_out/concs').exists()
assert (tmp_path / 'fit_out/nuisance').exists()
assert (tmp_path / 'fit_out/concs/raw/NAA.nii.gz').exists()
assert (tmp_path / 'fit_out/concs/internal/NAA.nii.gz').exists()
assert (tmp_path / 'fit_out/uncertainties/NAA_sd.nii.gz').exists()
assert (tmp_path / 'fit_out/qc/NAA_snr.nii.gz').exists()
assert (tmp_path / 'fit_out/fit/fit.nii.gz').exists()
assert (tmp_path / 'fit_out/nuisance/p0.nii.gz').exists()
assert (tmp_path / 'fit_out/nuisance/p1.nii.gz').exists()
assert (tmp_path / 'fit_out/nuisance/shift_group0.nii.gz').exists()
assert (tmp_path / 'fit_out/nuisance/combined_lw_group0.nii.gz').exists()
assert (tmp_path / 'fit_out/nuisance/gamma_group0.nii.gz').exists()
assert (tmp_path / 'fit_out/nuisance/sigma_group0.nii.gz').exists()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment