[FieldTrip] Problem with re-referencing of fNIRS data

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Mon Jan 8 20:38:58 CET 2024


Hi Kamil,

I suggest that you put a breakpoint in the code, on line 89 of the function ft_nirs_optodedistance, and check what is going on. This is a generic strategy that I always use when any matlab code throws an error. This namely allows you to inspect the function’s workspace at the point at which the faulty line will be executed.

The reported error message is a low-level matlab error, which suggests that the number of elements in the vector ‘posidx’ (i.e. the left side of the =-sign) is different from the number of elements of the idxR and idXT vectors (i.e. on the right side of the =-sign). Given the fact that the code that is executing in line 89, is within a for-loop, and the fact that posIdx is the actual loop-variable, this is just a single value, which - from a distance (pun intended) - probably means that the idxR/idxT are either empty, or contain more than a single element.

Given that those quantities are derived from the ‘label’, and ‘olabel’ variables, which are defined on lines 67 and 68, this suggests that the code cannot handle well the way in which the datain.label, and the datain.opto.optolabel relate to one another. Once you have acertained that this is indeed the cause of your problem, you need to think about whether the discrepancy arises from your data (i.e. the naming convention of the labels is not how it should be), or whether the heuristic that is used in the code should be improved. If it is the latter, I suggest that you get in touch with the artinis folks (who contributed this part of the fieldtrip code) in order to look into this.

Best wishes,
Jan-Mathijs


On 5 Jan 2024, at 10:48, Kamil Hiralal via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear community,

My name is Kamil Hiralal and I am a PhD student at the Erasmus Medical Center in Rotterdam.
I am currently trying to analyze previously collected fNIRS data from a study investigating phenotypical overlap between children with autism spectrum disorder and Fragile X syndrome.

We have measured fNIRS signal using an Artinis device with a custom channel template with 8 channels of interest placed over the left and right frontal hemispheres. For both the left and right hemisphere, we have also used a short channel as reference.
I am currently trying to re-reference our normal distance channels based on the short channels, but I am having some trouble and was hoping somebody could help me out.

When I am trying to run the ft_nirs_referencechannelsubtraction() function, I get the following error:


Unable to perform assignment because the left and right sides have a different number of elements.

 Error in ft_nirs_optodedistance (line 89)

  optodedistance(posIdx)              = sqrt( (xf(idxR)-xf(idxT)).^2+(yf(idxR)-yf(idxT)).^2 ); % Pythagorean theorem

Error in ft_nirs_referencechannelsubtraction (line 123)

distances   = ft_nirs_optodedistance(datain);

I am using the default cfg set-up (shortdistance = 1.5, closedistance = 15, method = ‘QR’, verbose = FALSE). I am also using raw NIRS data, as outputted by FT_PREPROCESSING. I hope anyone might be able to help me with this question!

Best,
Kamil Hiralal
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C94d853bc26774257ecee08dc10817524%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638403395394354926%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ngMKvlqmKlUevw11A7Pdzj7%2FShFZe6nIYf6qAQWZr%2FI%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C94d853bc26774257ecee08dc10817524%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638403395394354926%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NJb783GuFpEIHD%2BS7y%2FO2FsWJ3vMSmmmbhLT1uMVLuQ%3D&reserved=0>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20240108/9682a729/attachment.htm>


More information about the fieldtrip mailing list