Skip to content

Conversation

JBusgang
Copy link

Adds initial support for NIRS (Near-Infrared Spectroscopy) data processing within the BIDS export functionality.

This includes:

  • Recognizing NIRS data based on channel types.
  • Extracting NIRS-specific metadata (optode counts).
  • Creating 'nirs' subfolder and using '_nirs' suffix.
  • Exporting data to the SNIRF format.
  • Generating an optodes coordinate file.
  • Creating an events TSV file.

JBusgang added 5 commits June 27, 2025 15:00
Adds initial support for NIRS (Near-Infrared Spectroscopy) data processing within the BIDS export functionality.

This includes:
- Recognizing NIRS data based on channel types.
- Extracting NIRS-specific metadata (optode counts).
- Creating 'nirs' subfolder and using '_nirs' suffix.
- Exporting data to the SNIRF format.
- Generating an optodes coordinate file.
- Creating an events TSV file.
Adds functionality to export Brainstorm channel files in the BIDS _channels.tsv format, specifically tailored for NIRS data. This enhancement supports the BIDS standard for NIRS data organization.
Adds coordinate system information in json format for NIRS data (ScanRAS exclusively).
Improved export channel option using export_channel, replacing 'out_channel_bids'.
- Adds section of code to generate the .tsv file by calling out_nirs_channel
- Fixes detector labels (previously labelled 'S' instead of 'D')
- Changes channel type to NIRSCWAMPLITUDE, a valid BIDS raw data type. Potential improvement in future to add other valid data types.
- out_nirs_channel header explanation now uses the correct fields
- process_export_bids CreateMegJson has been working, no need for this note.
@JBusgang JBusgang marked this pull request as ready for review July 7, 2025 17:58
@JBusgang
Copy link
Author

JBusgang commented Jul 7, 2025

Hello @rcassani. I've worked with @Edouard2laire on this first version of the export bids function, making it work for NIRS data following the documentation of the BIDS team (https://bids-website.readthedocs.io/en/latest/datasets/examples.html).

Let us know if you have any comments!


%% Prepare coordinate structure
coorddata = struct();
coorddata = addField(coorddata, 'NIRSCoordinateSystem', 'SCANRAS'); % Make sure it isnt CapRAS
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This coordinate system doesnt seems valid for BIDS ? it is however, matching how we export the channel coordinate : export_channel(sInput.ChannelFile, bst_fullfile(megFolder, [prefix '_optodes.tsv']), 'BIDS-NIRS-SCANRAS-MM', 0);

any idea ?

JBusgang added 2 commits July 11, 2025 15:27
- Checks datasettype is either 'raw' or 'derivative'
- if not one of the two accepted values, defaults to 'raw' as per BIDS documentation and gives a warning.
- Adds 'FiducialsCoordinates' field with NAS, LPA, and RPA coordinates to coordsystem.json from ChannelMat.SCS
- Sets other fiducials coordinate metadata fields in coordsystem.json
@JBusgang
Copy link
Author

Hello @rcassani! We were wondering if you were able to give this pull a look. We are running into some issues and @Edouard2laire and I would like to schedule a meeting with you, if possible, to understand the coordinate system better. Thanks for your attention,

  • Jacob.

@rcassani
Copy link
Member

Hi @JBusgang, we could have a meeting next week to check this PR

@JBusgang
Copy link
Author

Perfect, I've set up a when2meet: https://www.when2meet.com/?31412184-lLPQb

@Edouard2laire
Copy link
Contributor

So let's say tuesday at 11am.
i will send you the zoom link latter today.

@Edouard2laire
Copy link
Contributor

hi @rcassani

Did you had time to look at the PR yet ? let me kbnow if you need anything from us to move forward :)

@rcassani
Copy link
Member

@Edouard2laire, @JBusgang, from the meeting we had I remember we agreed you'd check a couple of things on your side regarding the coordinate system.

No changes would be done in that topic?
If so, I can take a look to this PR

@Edouard2laire
Copy link
Contributor

i think you can start having a look. especially it would be very helpfulll if you could check the coordinate system issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants