Bringing NIRS optode positions into Neuropype
This tutorial describes how to bring NIRS optode positions into Neuropype (needed for any source level computation) while streaming or importing NIRS data.
Live data (streaming)
Using LSLInput
If you are able to modify your LSL stream header (at its point of origin), you can add the source and detector positions to the LSL stream, to be automatically parsed by the LSLInput
node.
The detector optode positions should be provided in the <location>
tag of each channel in similar fashion to the EEG LSL/XDF metadata spec. You may also use the <positions>
tag instead of the <location>
tag, as described below. The source optode positions should be provided as a
<channel>
<unit>
<type>
<label>
<positions>
<X>
<Y>
<Z>
</positions>
<positions_source>
<X>
<Y>
<Z>
</positions_source>
.... (other optional tags)
</channel>
The LSLInput
node will automatically parse the optode positions and store them in the .positions
(detectors) and .positions_source
(sources) fields of the Space
axis. Nodes handling NIRS data will expect them to be in this format.
Important note: In the next Neuropype release we will be supporting the new LSL/XDF metadata spec for NIRS. We will continue to support the above structure for backward compatibility, though it may be deprecated in the future so we recommend using the new spec, which is much more complete.
Using AddProbeLocations
If you are not able to modify your LSL stream header, you can use the AddProbeLocations
node to add the optode positions to the data stream. This node will add the optode positions to the .positions
and .positions_source
fields of the Space
axis. Simply add the AddProbeLocations
node to your pipeline after LSLInput
and specify the source and detector positions in the sources
and detectors
properties. (See node docs for details.)
Offline data (importing)
ImportNIRS
If importing a .nirs
use the ImportNIRS
node which will automatically parse the positions from the SD
field. If the positions are stored in a different field, you can specify the field name in the position_data
property of the node.
ImportXDF
If you recorded data to disk in XDF format using the RecordToXDF
node, the optode positions will be stored in the positions
and positions_source
(detector and source, respectively) fields of the Space
axis, providing they were either present in the LSL stream or added with AddProbeLocations as above. If they're not there, you can use the AddProbeLocations
after ImportXDF
and which will work the same way as described above with LSL.