From 0ef3b94194dde1f64efb9d0c1c42bb256e964bb5 Mon Sep 17 00:00:00 2001 From: neurosignal Date: Fri, 10 Oct 2025 16:07:09 +0300 Subject: [PATCH 1/2] updated to handle string type digitization --- external/mne/fiff_read_meas_info.m | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/external/mne/fiff_read_meas_info.m b/external/mne/fiff_read_meas_info.m index 6c589459..72d61626 100644 --- a/external/mne/fiff_read_meas_info.m +++ b/external/mne/fiff_read_meas_info.m @@ -15,6 +15,10 @@ % License : BSD 3-clause % % +% Revision 1.15 2025/06/30 10:10:30 +% Improved to handle string type digitization, especially in the new FIFF +% data by MEGIN +% % Revision 1.14 2009/03/31 01:12:30 msh % Improved ID handling % @@ -214,6 +218,22 @@ p = p + 1; tag = fiff_read_tag(fid,pos); dig(p) = tag.data; + elseif kind == FIFF.FIFF_DIG_STRING % added to address updated FIFF format (2024-25) + tag = fiff_read_tag(fid,pos); + if length(tag.data.r)>3 + assert(mod(length(tag.data.r), 3) == 0,... + 'length of vector tag.data.r must be 3*(no. of points in a string)') + rr = reshape(tag.data.r, 3, []); + for pp = 1:(length(tag.data.r)/3) + p = p + 1; + tag_data_pp = tag.data; + tag_data_pp.r = rr(:,pp); + dig(p) = tag_data_pp; + end + else + p = p + 1; + dig(p) = tag.data; + end else if kind == FIFF.FIFF_MNE_COORD_FRAME tag = fiff_read_tag(fid,pos); From 76698b3d0069516bbd56dce302ebdf03b1d5dab3 Mon Sep 17 00:00:00 2001 From: neurosignal Date: Fri, 10 Oct 2025 18:24:55 +0300 Subject: [PATCH 2/2] updated to read tags for string type digitization --- external/mne/fiff_read_tag.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/external/mne/fiff_read_tag.m b/external/mne/fiff_read_tag.m index 52ba1d52..3a530a83 100644 --- a/external/mne/fiff_read_tag.m +++ b/external/mne/fiff_read_tag.m @@ -11,6 +11,10 @@ % License : BSD 3-clause % % +% Revision 1.17 2025/06/30 10:10:30 +% Added to read string type digitization, especially in the new FIFF +% data by MEGIN +% % Revision 1.16 2008/11/17 15:07:00 msh % Added reading of short, unsigned short, and unsigned int data % @@ -278,6 +282,12 @@ tag.data.ident = fread(fid,1,'int32=>int32'); tag.data.r = fread(fid,3,'single=>single'); tag.data.coord_frame = 0; + case FIFF.FIFFT_DIG_STRING_STRUCT + tag.data.kind = fread(fid,1,'int32=>int32'); + tag.data.ident = fread(fid,1,'int32=>int32'); + npts = fread(fid,1,'int32=>int32'); + tag.data.r = fread(fid,npts*3,'single=>single'); + tag.data.coord_frame = 0; case FIFF.FIFFT_COORD_TRANS_STRUCT tag.data.from = fread(fid,1,'int32=>int32'); tag.data.to = fread(fid,1,'int32=>int32');