huppertt / nirs-toolbox

Toolbox for fNIRS analysis
86 stars 61 forks source link

Incorrect rotation of landmarkPos2D/3D causes error #45

Open kdarti opened 5 months ago

kdarti commented 5 months ago

Describe the bug I tried to use the 2022.4.26 release to read a .snirf file with digitised 3D positions, in that case the landmarkLabels were not read, so I tried the current master branch.

With this branch, If lanmarkPos2D are not present, I also got an error, but I fixed this by inserting some fake positions.

Next, both snirf.nirs.probe.landmarkPos2D and snirf.nirs.probe.landmarkPos3D are rotated differently than e.g. source/detectorPos2D/3D, more specifically, landmarks are are arranged by column instead of row, see images below.

image image

This leads to an issue at the lines below.

https://github.com/huppertt/nirs-toolbox/blob/34c0042d1c5e5028f230371b8300d16c25d37001/%2Bnirs/%2Butil/snirf2data.m#L247-L248 https://github.com/huppertt/nirs-toolbox/blob/34c0042d1c5e5028f230371b8300d16c25d37001/%2Bnirs/%2Butil/snirf2data.m#L272-L273

Transposing snirf.nirs.probe.landmarkPos2D and snirf.nirs.probe.landmarkPos3D while debugging before running those lines solves it, but doesn't seem ideal.

To Reproduce

This is the file I used, as far as I can tell the 3D (and 2D) position specs conform to the snirf spec (x,y,z coordinates in separate columns) 2x12_fake_landmarkpos.zip

Expected behavior

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.