Skip to content

Commit

Permalink
Missed a PSD in ge_read_pfile.py - adding in for hbcd2 (#145)
Browse files Browse the repository at this point in the history
* Missed a PSD in ge_read_pfile.py - adding in for hbcd2

* Add test for HBCD ge data.

* Update changelog

---------

Co-authored-by: wtclarke <[email protected]>
  • Loading branch information
agudmundson and wtclarke authored Aug 9, 2024
1 parent afbe82e commit e6c9024
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
This document contains the Spec2nii release history in reverse chronological order.

0.8.3 (Tuesday 9th August 2024)
-------------------------------
- Fix for multiple GE HBCD sequence names (again).

0.8.2 (Tuesday 9th July 2024)
-------------------------------
- Fix for multiple GE HBCD sequence names.
Expand Down
4 changes: 3 additions & 1 deletion spec2nii/GE/ge_read_pfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ def get_mapper(self):
'jpress', # wtc - added for J-edited data.
'jpress_ac', # ARC - added for Bergen jpress patch
'gaba', # wtc - added for Nottingham MEGA-PRESS sequence
'hbcd', # ATG - added HBCD - reuse GABA mapper
'hbcd', # ATG - added HBCD - reuse GABA mapper
'hbcd1', # ATG - added HBCD1 - reuse GABA mapper
'hbcd2', # ATG - added HBCD2 - reuse GABA mapper
'probe-p-mega_rml', # MM - added for Calgary MEGA-PRESS sequence
'repress7' # MM - added for old CUBRIC data
):
Expand Down
2 changes: 1 addition & 1 deletion tests/spec2nii_test_data
Submodule spec2nii_test_data updated from 8631cd to 1594c2
35 changes: 34 additions & 1 deletion tests/test_ge_pfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from .io_for_tests import read_nifti_mrs
from .io_for_tests import read_nifti_mrs_with_hdr

from nifti_mrs.nifti_mrs import NIFTI_MRS

# Data paths
ge_path = Path(__file__).parent / 'spec2nii_test_data' / 'ge'
Expand All @@ -32,6 +32,9 @@
mm_press_noid = ge_path / 'pFiles' / 'PRESS' / 'sub-01_ses-01_acq-press_svs_noID.7'
mm_slaser = ge_path / 'pFiles' / 'sLASER' / 'sub-01_ses-01_acq-slaser_svs_noID.7'

# HBCD / ISTHMUS datasets
hbcd2_path = ge_path / 'pFiles' / 'hbcd' / 'P31744.7'


def test_svs(tmp_path):

Expand Down Expand Up @@ -322,3 +325,33 @@ def test_mm_slaser(tmp_path):
assert img_ref.shape[:5] == (1, 1, 1, 4096, 32)
assert not hdr_ext_ref['WaterSuppressed']
assert hdr_ext_ref['dim_5'] == 'DIM_COIL'


def test_hbcd_isthmus(tmp_path):
subprocess.run([
'spec2nii', 'ge',
'-f', 'hbcd',
'-o', tmp_path,
'-j',
hbcd2_path])

assert (tmp_path / 'hbcd_edited.nii.gz').is_file()
assert (tmp_path / 'hbcd_ref_edited.nii.gz').is_file()
assert (tmp_path / 'hbcd_ref_short_te.nii.gz').is_file()
assert (tmp_path / 'hbcd_short_te.nii.gz').is_file()

img = NIFTI_MRS(tmp_path / 'hbcd_edited.nii.gz')
assert img.shape == (1, 1, 1, 2048, 56, 8, 4)
assert img.dim_tags == ['DIM_DYN', 'DIM_COIL', 'DIM_EDIT']

img = NIFTI_MRS(tmp_path / 'hbcd_ref_edited.nii.gz')
assert img.shape == (1, 1, 1, 2048, 4, 8)
assert img.dim_tags == ['DIM_DYN', 'DIM_COIL', None]

img = NIFTI_MRS(tmp_path / 'hbcd_ref_short_te.nii.gz')
assert img.shape == (1, 1, 1, 2048, 4, 8)
assert img.dim_tags == ['DIM_DYN', 'DIM_COIL', None]

img = NIFTI_MRS(tmp_path / 'hbcd_short_te.nii.gz')
assert img.shape == (1, 1, 1, 2048, 32, 8)
assert img.dim_tags == ['DIM_DYN', 'DIM_COIL', None]

0 comments on commit e6c9024

Please sign in to comment.