Commit 0a8565f1 authored by William Clarke's avatar William Clarke
Browse files

Fix bug in nifti mrs align.

parent 53cfec37
......@@ -3,7 +3,9 @@ This document contains the FSL-MRS release history in reverse chronological orde
1.1.4 (WIP)
------------------------------
- Fixed bug in mrs_tools split
- Fixed bug in alignment of multi-dimensional data.
- fsl_mrsi now outputs fitting nuisance parameters: phases, and shifts & linewidths for each metabolite group.
- Add NIfTI-MRS reshape command
1.1.3 (Tuesday 29th June 2021)
------------------------------
......
......@@ -8,6 +8,7 @@ from pathlib import Path
from fsl_mrs.utils.preproc import nifti_mrs_proc as nproc
from fsl_mrs.utils.mrs_io import read_FID
from fsl_mrs.utils.nifti_mrs_tools import split
from fsl_mrs import __version__
......@@ -58,11 +59,19 @@ def test_average():
def test_align():
nmrs_obj = read_FID(metab)
with_coils, _ = split(nmrs_obj, 'DIM_COIL', 3)
aligned1 = nproc.align(with_coils, 'DIM_DYN', ppmlim=(1.0, 4.0), niter=1, apodize=5)
assert aligned1.hdr_ext['ProcessingApplied'][0]['Method'] == 'Frequency and phase correction'
assert aligned1.hdr_ext['ProcessingApplied'][0]['Details']\
== 'fsl_mrs.utils.preproc.nifti_mrs_proc.align, dim=DIM_DYN, '\
'target=None, ppmlim=(1.0, 4.0), niter=1, apodize=5.'
combined = nproc.coilcombine(nmrs_obj)
aligned = nproc.align(combined, 'DIM_DYN', ppmlim=(1.0, 4.0), niter=1, apodize=5)
aligned2 = nproc.align(combined, 'DIM_DYN', ppmlim=(1.0, 4.0), niter=1, apodize=5)
assert aligned.hdr_ext['ProcessingApplied'][1]['Method'] == 'Frequency and phase correction'
assert aligned.hdr_ext['ProcessingApplied'][1]['Details']\
assert aligned2.hdr_ext['ProcessingApplied'][1]['Method'] == 'Frequency and phase correction'
assert aligned2.hdr_ext['ProcessingApplied'][1]['Details']\
== 'fsl_mrs.utils.preproc.nifti_mrs_proc.align, dim=DIM_DYN, '\
'target=None, ppmlim=(1.0, 4.0), niter=1, apodize=5.'
......
......@@ -180,7 +180,7 @@ def align(data, dim, target=None, ppmlim=None, niter=2, apodize=10, figure=False
aligned_obj = data.copy()
for dd, idx in data.iterate_over_dims(dim=dim,
iterate_over_space=True,
reduce_dim_index=True):
reduce_dim_index=False):
out = preproc.phase_freq_align(
dd.T,
......
Supports Markdown
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