Skip to content

Commit

Permalink
Fix issue in mgs_svs_ed special casing. Add xa50 test data.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtclarke committed Mar 6, 2024
1 parent a9d6313 commit efd3840
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This document contains the Spec2nii release history in reverse chronological ord
-----------
- Siemens .rda format now had corrected and validated orientations (tested on VE11 baseline).
- Siemens .rda format now handles MRSI/CSI data and matches DICOM output. Validated on VE11 baseline data.
- Fixes in Siemens Twix special case for universal editing sequence (HERMES conditions).
- Added handling of custom Bruker sequences `mt_sLASER`, `mt_MEGA_sLASER_V35` and `cl_STELASER_PA360_b`.

0.7.2 (Thursday 7th December 2023)
----------------------------------
Expand Down
2 changes: 1 addition & 1 deletion tests/spec2nii_test_data
Submodule spec2nii_test_data updated from 9322e3 to d300d5
20 changes: 20 additions & 0 deletions tests/test_siemens_rda.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

xa20_svs_path = siemens_path / 'XAData' / 'XA20/rda/spct_002.MR.MRI-LAB Test_Dir.5.1.114540.rda'
xa31_locale_svs_path = siemens_path / 'XAData' / 'XA31/rda/locale_XA31.rda'
xa50_path = siemens_path / 'XAData' / 'XA50' / 'Phantom_20240129.MR.10.1.155227.rda'

latin1_encoding = siemens_path / 'rda' / 'latin1.rda'

Expand Down Expand Up @@ -147,6 +148,25 @@ def test_xa31_locale_svs(tmp_path):
assert np.iscomplexobj(img_t.dataobj)


def test_xa50_svs(tmp_path):

subprocess.run([
'spec2nii', 'rda',
'-f', 'xa50_svs',
'-o', tmp_path,
'-j', xa50_path])

img_t = read_nifti_mrs(tmp_path / 'xa50_svs.nii.gz')

hdr_ext_codes = img_t.header.extensions.get_codes()
hdr_ext = json.loads(img_t.header.extensions[hdr_ext_codes.index(44)].get_content())

hdr_ext['ResonantNucleus'] = ['1H', ]

assert img_t.shape == (1, 1, 1, 2048)
assert np.iscomplexobj(img_t.dataobj)


def test_latin_encoding(tmp_path):

subprocess.check_call(['spec2nii', 'rda',
Expand Down
22 changes: 22 additions & 0 deletions tests/test_twix.py → tests/test_siemens_twix.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# Special cased data
hercules_ve = siemens_path / 'HERCULES' / 'Siemens_TIEMO_HERC.dat'
hercules_xa30 = siemens_path / 'HERCULES' / 'meas_MID02595_FID60346_HERC.dat'
hermes_xa50 = siemens_path / 'XAData' / 'XA50' / 'smm_svs_herc_v2_hermes.dat'


def test_VB(tmp_path):
Expand Down Expand Up @@ -202,6 +203,27 @@ def test_XA_HERCULES(tmp_path):
assert hdr_ext['dim_7'] == 'DIM_DYN'


def test_XA_HERMES(tmp_path):

subprocess.check_call(['spec2nii', 'twix',
'-e', 'image',
'-f', 'hermes_xa',
'-o', tmp_path,
'-j', str(hermes_xa50)])

img_t = read_nifti_mrs(tmp_path / 'hermes_xa.nii.gz')

hdr_ext_codes = img_t.header.extensions.get_codes()
hdr_ext = json.loads(img_t.header.extensions[hdr_ext_codes.index(44)].get_content())

assert img_t.shape == (1, 1, 1, 4096, 42, 4, 80)
assert np.iscomplexobj(img_t.dataobj)

assert hdr_ext['dim_5'] == 'DIM_COIL'
assert hdr_ext['dim_6'] == 'DIM_EDIT'
assert hdr_ext['dim_7'] == 'DIM_DYN'


def test_twix_mrsi_orientation(tmp_path):
'''Test that the (empty) mrsi has information matching the twix equivalent.'''

Expand Down

0 comments on commit efd3840

Please sign in to comment.