From e6c9024e4eb5d9070a6fd0fe93dec0923f12b1f4 Mon Sep 17 00:00:00 2001 From: "Aaron Gudmundson, PhD" Date: Fri, 9 Aug 2024 02:37:24 -0400 Subject: [PATCH] Missed a PSD in ge_read_pfile.py - adding in for hbcd2 (#145) * Missed a PSD in ge_read_pfile.py - adding in for hbcd2 * Add test for HBCD ge data. * Update changelog --------- Co-authored-by: wtclarke --- CHANGELOG.md | 4 ++++ spec2nii/GE/ge_read_pfile.py | 4 +++- tests/spec2nii_test_data | 2 +- tests/test_ge_pfile.py | 35 ++++++++++++++++++++++++++++++++++- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbe50ee..4bfdd18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/spec2nii/GE/ge_read_pfile.py b/spec2nii/GE/ge_read_pfile.py index 77054eb..1b8749d 100644 --- a/spec2nii/GE/ge_read_pfile.py +++ b/spec2nii/GE/ge_read_pfile.py @@ -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 ): diff --git a/tests/spec2nii_test_data b/tests/spec2nii_test_data index 8631cdc..1594c26 160000 --- a/tests/spec2nii_test_data +++ b/tests/spec2nii_test_data @@ -1 +1 @@ -Subproject commit 8631cdc0f22abead50a22f202ca6a290629de569 +Subproject commit 1594c2625a53a877670f9dd0492c0e1b6f3471d5 diff --git a/tests/test_ge_pfile.py b/tests/test_ge_pfile.py index fe37e66..4489409 100644 --- a/tests/test_ge_pfile.py +++ b/tests/test_ge_pfile.py @@ -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' @@ -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): @@ -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]