Skip to content

Commit

Permalink
Add tests for rda with latin1 encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtclarke committed Oct 12, 2023
1 parent b955c62 commit 3354ce1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/spec2nii_test_data
Submodule spec2nii_test_data updated from 6f205d to e0ad58
20 changes: 20 additions & 0 deletions tests/test_siemens_rda.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
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'

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


def test_xa20_svs(tmp_path):

Expand Down Expand Up @@ -53,3 +55,21 @@ def test_xa31_locale_svs(tmp_path):

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


def test_latin_encoding(tmp_path):

subprocess.check_call(['spec2nii', 'rda',
'-f', 'rda_latin1',
'-o', tmp_path,
'-j', str(latin1_encoding)])

img_t = read_nifti_mrs(tmp_path / 'rda_latin1.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)

0 comments on commit 3354ce1

Please sign in to comment.