From 286836a8e5415918b232c51166add8250fdb14c8 Mon Sep 17 00:00:00 2001 From: Helge <47348963+HJZollner@users.noreply.github.com> Date: Thu, 12 Jan 2023 16:39:19 -0500 Subject: [PATCH] [BUG FIX] - SpectroFrequency nii-mrs header extension issue - io_writeniimrs - Helge - Added an additional line to io_writeniimrs that converts the SpectrometerFrequency entry into a cell array. This will result in an array of numbers for the json encoded header extension. The file is afterward readable in FSLeyes (and Osprey). --- libraries/FID-A/inputOutput/io_writeniimrs.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/FID-A/inputOutput/io_writeniimrs.m b/libraries/FID-A/inputOutput/io_writeniimrs.m index bb1f345b..6d4d7f5e 100644 --- a/libraries/FID-A/inputOutput/io_writeniimrs.m +++ b/libraries/FID-A/inputOutput/io_writeniimrs.m @@ -159,6 +159,10 @@ in.nii_mrs.hdr_ext.(sprintf('dim_%i',JJ+4)) = dimname{JJ}; end +if ~iscell(in.nii_mrs.hdr_ext.SpectrometerFrequency) + in.nii_mrs.hdr_ext.SpectrometerFrequency = {in.nii_mrs.hdr_ext.SpectrometerFrequency}; +end + nii.ext.ecode = 44; nii.ext.edata_decoded = jsonencode(in.nii_mrs.hdr_ext); len = int32(numel(nii.ext.edata_decoded));