huppertt / nirs-toolbox

Toolbox for fNIRS analysis
89 stars 61 forks source link

Module: loadNIRx() broken when loading data with short channels #48

Open ouhscgl opened 2 months ago

ouhscgl commented 2 months ago

Issue Brief Description At line 87 in the loadNIRx() function the assignment expects short channel count to match detector count. If this is not the case, the source-detector mask assignment will fail, as the matrix dimensions will not match.

Reproducing the Issue

  1. Attempt loading in a NIRx file (with short channels) using the nirs.io.loadNIRx() function. Always reproducible.

Suggested Fix from: 87 info.S_D_Mask(:,info.Detectors-info.ShortDetectors+1:end)=eye(info.ShortDetectors); to: 87 info.S_D_Mask(1:info.ShortDetectors,info.Detectors-info.ShortDetectors+1:end)=eye(info.ShortDetectors);

Fix Brief Description Reduces the left side matrix of the assignment from [detectorCount] x [shortDetectorCount] to [shortDetectorCount]^2, which always matches the right side matrix of the assignment.