Processing Philips HERMES data

Hi all,

I am currently processing some HERMES 3T data from a Philips Scanner.

Osprey is failing to load the data with this error.

Error using reshape
Number of elements must not change. Use as one of the size inputs to
automatically calculate the appropriate size for that dimension.

Error in philipsLoad (line 62)
data = reshape(data, [2 header.samples header.rows]);

Error in io_loadspec_sdat (line 35)
[data, header] = philipsLoad(filename);

Error in osp_LoadSDAT (line 80)
raw = io_loadspec_sdat(MRSCont.files{metab_ll,kk},4,MRSCont.flags.isSERIES);

Error in OspreyLoad (line 194)
[MRSCont] = osp_LoadSDAT(MRSCont);

I have been trying to trouble shoot but have not made any progress, and so I wondered if this was a common error for Philips data? I have tried to process the data in gannet also, but it also fails to load.

The issue is effecting data collected all within the same cohort, it is likely something to do with how the data has been exported, as normally HERMES Philips runs fine.

Thank you in advance,

Alice

Hi Alice,

Can you post the contents of your job file? Specifically, are the following two options set correctly:

seqType = 'HERMES';
editTarget = {'GABA', 'GSH'};   

Hi Georg,

Yep! Here it is, and yes I had specified those options,

Thank you,

Alice

%% jobSDAT.m
% This function describes an Osprey job defined in a MATLAB script.
%
% A valid Osprey job contains four distinct classes of items:
% 1. basic information on the MRS sequence used
% 2. several settings for data handling and modeling
% 3. a list of MRS (and, optionally, structural imaging) data files
% to be loaded
% 4. an output folder to store the results and exported files
%
% The list of MRS and structural imaging files is provided in the form of
% cell arrays. They can simply be provided explicitly, or from a more
% complex script that automatically determines file names from a given
% folder structure.
%
% Osprey distinguishes between four sets of data:
% - metabolite (water-suppressed) data
% (MANDATORY)
% Defined in cell array “files”
% - water reference data acquired with the SAME sequence as the
% metabolite data, just without water suppression RF pulses. This
% data is used to determine complex coil combination
% coefficients, and perform eddy current correction.
% (OPTIONAL)
% Defined in cell array “files_ref”
% - additional water data used for water-scaled quantification,
% usually from short-TE acquisitions due to reduced T2-weighting
% (OPTIONAL)
% Defined in cell array “files_w”
% - Structural image data used for co-registration and tissue class
% segmentation (usually a T1 MPRAGE). These files need to be
% provided in the NIfTI format (.nii) or, for GE data, as a
% folder containing DICOM Files (
.dcm).
% (OPTIONAL)
% Defined in cell array “files_nii”
%
% Files in the formats
% - .7 (GE)
% - .SDAT, .DATA/.LIST, .RAW/.SIN/.LAB (Philips)
% - .DAT (Siemens)
% usually contain all of the acquired data in a single file per scan. GE
% systems store water reference data in the same .7 file, so there is no
% need to specify it separately under files_ref.
%
% Files in the formats
% - .DCM (any)
% - .IMA, .RDA (Siemens)
% may contain separate files for each average. Instead of providing
% individual file names, please specify folders. Metabolite data, water
% reference data, and water data need to be located in separate folders.
%
% In the example script at hand the MATLAB functions strrep and which are
% used to generate a relative path, which allows you to run the examples
% on your machine directly. To set up your own Osprey job supply the
% specific locations as described above.
%
% AUTHOR:
% Dr. Georg Oeltzschner (Johns Hopkins University, 2019-07-15)
% goeltzs1@jhmi.edu
%
% HISTORY:
% 2019-07-15: First version of the code.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% 1. SPECIFY SEQUENCE INFORMATION %%%

% Specify sequence type
seqType = ‘HERMES’; % OPTIONS: - ‘unedited’ (default)
% - ‘MEGA’
% - ‘HERMES’
% - ‘HERCULES’

% Specify editing targets
editTarget = {‘GABA’, ‘GSH’}; % OPTIONS: - {‘none’} (default if ‘unedited’)
% - {‘GABA’}, {‘GSH’}, {‘Lac’}, {‘PE322’}, {‘PE398’} (for ‘MEGA’)
% - {‘GABA’, ‘GSH’}, {‘GABA’, ‘Lac’}, {‘NAA’, ‘NAAG’} (for 'HERMES’and ‘HERCULES’)

                            % Specify data scenario

dataScenario = ‘invivo’; % OPTIONS: - ‘invivo’ (default)
% - ‘phantom’
% - ‘PRIAM’
% - ‘MRSI’
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% 2. SPECIFY DATA HANDLING AND MODELING OPTIONS %%%
% Which spectral registration method should be used? Robust spectral
% registration is default, a frequency restricted spectral registration
% method is also availaible and is linked to the fit range.
opts.SpecReg = ‘ProbSpecReg’; % OPTIONS: - ‘RobSpecReg’ (default) Spectral aligment with Water/Lipid removal, using simialrity meric, and weighted averaging
% - ‘ProbSpecReg’ Probabilistic spectral aligment to median target and weighted averaging
% - ‘RestrSpecReg’ Frequency restricted (fit range) spectral aligment, using simialrity meric, and weighted averaging
% - ‘none’

% Which algorithm do you want to align the sub spectra? L2 norm
% optimization is the default. This is only used for edited MRS!
% Which algorithm do you want to align the sub spectra? L2 norm
% optimization is the default. This is only used for edited MRS!
%Perform correction on the metabolite data (raw) or metabolite
%-nulled data (mm).
opts.SubSpecAlignment.mets = ‘L2Norm’; % OPTIONS: - ‘L2Norm’ (default)
% - ‘L1Norm’
% - ‘none’

%Perform eddy-current correction on the metabolite data (raw) or metabolite
%-nulled data (mm). This can either be done similar for all data sets by
%supplying a single value or specified for each dataset individually by supplying
% multiple entries (number has to match the number of datasets) e.g. to perform ECC
% for the second dataset only:
% opts.ECC.raw = [0 1];
% opts.ECC.mm = [0 1];

opts.ECC.raw = 1; % OPTIONS: - ‘1’ (default)
opts.ECC.mm = 1; % - ‘0’ (no)
% - array

% Save LCModel-exportable files for each spectrum?
opts.saveLCM = 0; % OPTIONS: - 0 (no, default)
% - 1 (yes)
% Save jMRUI-exportable files for each spectrum?
opts.savejMRUI = 0; % OPTIONS: - 0 (no, default)
% - 1 (yes)

% Save processed spectra in vendor-specific format (SDAT/SPAR, RDA, P)?
opts.saveVendor = 0; % OPTIONS: - 0 (no, default)
% - 1 (yes)

% Save processed spectra in NIfTI-MRS format?
opts.saveNII = 0; % OPTIONS: - 0 (no, default)
% - 1 (yes)

% Save PDF output for all Osprey modules and subjects?
opts.savePDF = 0; % OPTIONS: - 0 (no, default)
% - 1 (yes)

% Choose the fitting algorithm
opts.fit.method = ‘Osprey’; % OPTIONS: - ‘Osprey’ (default)

% Select the metabolites to be included in the basis set as a cell array,
% with entries separates by commas.
% With default Osprey basis sets, you can select the following metabolites:
% Ala, Asc, Asp, bHB, bHG, Cit, Cr, CrCH2, EtOH, GABA, GPC, GSH, Glc, Gln,
% Glu, Gly, H2O, mI, Lac, NAA, NAAG, PCh, PCr, PE, Phenyl, sI, Ser,
% Tau, Tyros, MM09, MM12, MM14, MM17, MM20, Lip09, Lip13, Lip20.
% If you enter ‘default’, the basis set will include all of the above
% except for Ala, bHB, bHG, Cit, EtOH, Glc, Gly, Phenyl, Ser, and Tyros.
opts.fit.includeMetabs = {‘default’}; % OPTIONS: - {‘default’}
% - {‘full’}
% - {custom}

% Choose the fitting style for difference-edited datasets (MEGA, HERMES, HERCULES)
% (only available for the Osprey fitting method)
opts.fit.style = ‘Separate’; % OPTIONS: - ‘Concatenated’ (default) - will fit DIFF and SUM simultaneously)
% - ‘Separate’ - will fit DIFF and OFF separately

% Determine fitting range (in ppm) for the metabolite and water spectra
opts.fit.range = [0.5 4]; % [ppm] Default: [0.2 4.2]
opts.fit.rangeWater = [2.0 7.4]; % [ppm] Default: [2.0 7.4]
opts.fit.GAP.A = ;
opts.fit.GAP.diff1 = ;

% Determine the baseline knot spacing (in ppm) for the metabolite spectra
opts.fit.bLineKnotSpace = 0.55; % [ppm] Default: 0.4.

% Add macromolecule and lipid basis functions to the fit?
opts.fit.fitMM = 1; % OPTIONS: - 0 (no)
% - 1 (yes, default)

% How do you want to model the co-edited macromolecules at 3 ppm for GABA-edited MRS?
opts.fit.coMM3 = ‘freeGauss’; % OPTIONS: - {‘3to2MM’} (default)
% - {‘3to2MMsoft’}
% - {‘1to1GABA’}
% - {‘1to1GABAsoft’}
% - {‘freeGauss’}
% - {‘fixedGauss’}
% - {‘none’}

opts.fit.FWHMcoMM3 = 14;

% Optional: In case the automatic basisset picker is not working you can manually
% select the path to the basis set in the osprey/fit/basis, i.e.:
% opts.fit.basisSetFile =
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

That’s odd (and very suspicious that Gannet is failing to load these data as well), which makes me slightly concerned about the integrity of the data. Can you post the contents of the SPAR header files as well (specifically the various measurement parameters)?

Hi Georg,

The parameters were:
HERMES (20ms editing pulses placed at 1.90 ppm, 4.56 ppm and 7.46 ppm in the ONGABA, ONGSH and OFF conditions respectively, TR/TE=2000/80ms, 240 averages, 16 interleaved water reference scans, 4096 datapoints sampled at 4000Hz spectral bandwidth). 3T, Philips.

And the header file (HERMES supressed):
!--------------------------------------------------------------------

!

!

! CAUTION - Investigational device.

! Limited by Federal Law to investigational use.

!

!

! GYROSCAN spectro parameter file.

! Last revised 05-July-2007.

!--------------------------------------------------------------------

! This file contains time domain data in the spectral dimension.

! S15/ACS: set of *.SPAR and *.SDAT files is created, (dataformat: VAX CPX floats)

!--------------------------------------------------------------------

examination_name : IRM PIP

scan_date : x (alice deleted)

patient_name : x (alice deleted)

patient_birth_date : x (alice deleted)

patient_position : “head_first”

patient_orientation : “supine”

samples : 2048

rows : 240

synthesizer_frequency : 127767888

offset_frequency : 0

sample_frequency : 2000

echo_nr : 1

mix_number : 1

nucleus : 1H

t0_mu1_direction : 0

echo_time : 80

repetition_time : 2000

averages : 1

volume_selection_enable : “yes”

volumes : 1

ap_size : 30

lr_size : 30

cc_size : 30

ap_off_center : 13.25861073

lr_off_center : -0.4159845412

cc_off_center : 18.67430496

ap_angulation : 0.05740550905

lr_angulation : 9.143896103

cc_angulation : -4.239692688

volume_selection_method : 1

phase_encoding_enable : “no”

t1_measurement_enable : “no”

t2_measurement_enable : “no”

time_series_enable : “no”

image_plane_slice_thickness : 0

slice_distance : 0

nr_of_slices_for_multislice : 1

Spec.image in plane transf : “plusB-minA”

!---------------------------------------------

spec_data_type : cf

spec_sample_extension :[V]

!--------------------

! Column parameters

!--------------------

spec_num_col : 2048

spec_col_lower_val : -1000

spec_col_upper_val : -998.9760132

spec_col_extension :[sec]

!-----------------

! Row parameters

!-----------------

spec_num_row : 240

spec_row_lower_val : 1

spec_row_upper_val : 240

spec_row_extension :[index]

!-------------------------------------------------

! Extra parameters in order to make data transfer

! possible between S15/ACS and SUNSPEC:

!-------------------------------------------------

num_dimensions : 2

!-------------------------------------------------

dim1_ext :[sec]

dim1_pnts : 2048

dim1_low_val : -1000

dim1_step : 0.0005000000237

dim1_direction : mu1

dim1_t0_point : 0

!-----------------------------------------------------

dim2_ext :[num]

dim2_pnts : 1

dim2_low_val : 1.000000

dim2_step : 1.000000

dim2_direction : x

dim2_t0_point : 50

!-----------------------------------------------------

dim3_ext :[num]

dim3_pnts : 1

dim3_low_val : 1.000000

dim3_step : 1.000000

dim3_direction : y

dim3_t0_point : 50

!---------------------------------------------------

! Additional parameters

!---------------------------------------------------

echo_acquisition : ECHO

TSI_factor : 1

spectrum_echo_time : 80

spectrum_inversion_time : 0

image_chemical_shift : 0

resp_motion_comp_technique : NONE

de_coupling : NO

equipment_sw_verions : 5.7.1 ; .7.1 ;

placeholder1 :

placeholder2 :

!-----------------------------------------------------

HERMES unsuppressed:
!--------------------------------------------------------------------

!

!

! CAUTION - Investigational device.

! Limited by Federal Law to investigational use.

!

!

! GYROSCAN spectro parameter file.

! Last revised 05-July-2007.

!--------------------------------------------------------------------

! This file contains time domain data in the spectral dimension.

! S15/ACS: set of *.SPAR and *.SDAT files is created, (dataformat: VAX CPX floats)

!--------------------------------------------------------------------

examination_name : IRM PIP

scan_date : x (alice deleted)

patient_name : x (alice deleted)

patient_birth_date : x (alice deleted)

patient_position : “head_first”

patient_orientation : “supine”

samples : 2048

rows : 240

synthesizer_frequency : 127767888

offset_frequency : 0

sample_frequency : 2000

echo_nr : 1

mix_number : 2

nucleus : 1H

t0_mu1_direction : 0

echo_time : 80

repetition_time : 2000

averages : 1

volume_selection_enable : “yes”

volumes : 1

ap_size : 30

lr_size : 30

cc_size : 30

ap_off_center : 13.25861073

lr_off_center : -0.4159845412

cc_off_center : 18.67430496

ap_angulation : 0.05740550905

lr_angulation : 9.143896103

cc_angulation : -4.239692688

volume_selection_method : 1

phase_encoding_enable : “no”

t1_measurement_enable : “no”

t2_measurement_enable : “no”

time_series_enable : “no”

image_plane_slice_thickness : 0

slice_distance : 0

nr_of_slices_for_multislice : 1

Spec.image in plane transf : “plusB-minA”

!---------------------------------------------

spec_data_type : cf

spec_sample_extension :[V]

!--------------------

! Column parameters

!--------------------

spec_num_col : 2048

spec_col_lower_val : -1000

spec_col_upper_val : -998.9760132

spec_col_extension :[sec]

!-----------------

! Row parameters

!-----------------

spec_num_row : 240

spec_row_lower_val : 1

spec_row_upper_val : 240

spec_row_extension :[index]

!-------------------------------------------------

! Extra parameters in order to make data transfer

! possible between S15/ACS and SUNSPEC:

!-------------------------------------------------

num_dimensions : 2

!-------------------------------------------------

dim1_ext :[sec]

dim1_pnts : 2048

dim1_low_val : -1000

dim1_step : 0.0005000000237

dim1_direction : mu1

dim1_t0_point : 0

!-----------------------------------------------------

dim2_ext :[num]

dim2_pnts : 1

dim2_low_val : 1.000000

dim2_step : 1.000000

dim2_direction : x

dim2_t0_point : 50

!-----------------------------------------------------

dim3_ext :[num]

dim3_pnts : 1

dim3_low_val : 1.000000

dim3_step : 1.000000

dim3_direction : y

dim3_t0_point : 50

!---------------------------------------------------

! Additional parameters

!---------------------------------------------------

echo_acquisition : ECHO

TSI_factor : 1

spectrum_echo_time : 80

spectrum_inversion_time : 0

image_chemical_shift : 0

resp_motion_comp_technique : NONE

de_coupling : NO

equipment_sw_verions : 5.7.1 ; .7.1 ;

placeholder1 :

placeholder2 :

!-----------------------------------------------------

Thank you again,

Alice

Just for posterity - the SDAT file size on this is 0 KB, which indicates faulty data export. Case closed :slight_smile: