Error importing fNIRS raw data (with one event marker)

Error_reviewRawData_1

When uploading fNIRS raw data using "Review raw data" I got the error message above. Upon further inspection I realized that one of my event markers only had one total marker.

Because of this the event data is transposed in "brainstorm3\toolbox\io\in_data_snirf.m" LINE 254-256:
if size(jnirs.nirs.stim(iEvt).data,2) > size(jnirs.nirs.stim(iEvt).data,1)
jnirs.nirs.stim(iEvt).data = jnirs.nirs.stim(iEvt).data';
end

Leading to the error message at LINE 258:
isExtended = ~all(jnirs.nirs.stim(iEvt).data(:,2) == 0);

"Index in position 2 exceeds array bounds"

If I comment out LINE 254-256 the data loads just fine, but I would like to make sure that doing so will not affect further processing.

Thank you for your time.

Monica

Hi Monica, there is a solution for this proposed in this PR:

We'll add the bugfix ASAP

@edelaire, it seems this PR went through the cracks.
Let me know what do you think of the proposed solution in the PR, so we address this specific one-occurrence event but once for all.

oups, sorry it was on my todo list and i forgot. yes the proposed solution looks good to me.

1 Like

Thank you!

Replacing LINE 254 with:
if size(jnirs.nirs.stim(iEvt).data, 1) < 3 && diff(size(jnirs.nirs.stim(iEvt).data) < 0)

works for my data!

@monicafolkerts @edelaire
This fix is part of Brainstorm now (commit: 3638bb5)
Update your Brainstorm instance to get the fix