Skip to content

← file_system package

ImportNirs

Import data from a .n

irs (fNIRS) file. This node imports data stored in .nirs format, a format for fNIRS data used by the Homer2 fNIRS software package and adopted by various fNIRS hardware manufacturers and developers. Nirs files are Matlab files with a specific structure as defined in the Homer2 software manual (see link). Presently this node only converts .nirs files saved in Matlab version 7 format (saved with -v7 flag). Channel names are constructed from the source and detector indices and the wavelength, in the format: S<source_number>-D<detector_number>-<wavelength> (i.e., S01-D01-760). Source positions are stored in the positions_source field of the Space axis, and detector positions in the positions field. Wavelengths are stored in the wavelengths field. The signal stream will be named nirs (and modality NIRS will be stored in the stream's Origin.modality property). .Nirs files often only store the onset of a stim event and the duration is recorded externally. When importing such a file to Neuropype, a start marker is inserted at the stim onset and a matching end marker is inserted at the end (computed as the stim onset plus the duration of the stim). Certain device manufacturers store additional data in files other than the .nirs file, or add certain metadata fields to the .nirs file. This node supports some of these, such as accelerometer data for NirX devices saved in the aux field. Other channels besides the above that have the same number of timestamps will be grouped together in separate streams (i.e., physio), etc. More Info... Version 1.2.3

Ports/Properties

data

Output signal.

verbose name
Data
default value
None
port type
DataPort
value type
Packet (can be None)
data direction
OUT

filename

Name of the file to import (.n irs). If a relative path is given, a file of this name will be looked up in the standard data directories (these include cpe/resources and examples/).

verbose name
Filename
default value
port type
StringPort
value type
str (can be None)

device

Import data in .n irs format created by a specific device. Some devices have certain particularities or files which provide some additional data that is not included in the .nirs file. If importing data from a device listed here, the importer will try to account for that where possible. Select 'generic' for the standard .nirs format without any extra files or device-specific configuration.

verbose name
Device
default value
generic
port type
ComboPort
value type
str (can be None)

stim_conditions

A list of the stim conditions in for the dataset to be converted into markers. These should be the form of a dictionary in the following format: {'condition_index': ('condition_name', duration), ...}, where condition_index is a string representing the column number of the condition in the stim matrix (starting with '1', not '0'), 'condition_name' is a string descriptor of the stim, and 'duration' is a decimal number with the duration in seconds. I.e.,: { '1': ('left', 10.0), '2': ('right', 10.0), ... }. Matching 'start' and 'end' markers will be inserted into the data in the following format: condition_name-duration-start, condition_name-duration-end, i.e.: 'left-10.0-start', 'left-10.0-end'. If no conditions are provided, then only a stim onset marker will be added matching the condition-index (i.e., '1').

verbose name
Stim Conditions
default value
{}
port type
DictPort
value type
dict (can be None)

orientation

The orientation of the coordinate system used for the source and detector positions. 'right-handed' defines x as right, while 'left-handed' defines either y or z as right, and 'z-up' and 'y-up' define the vertical axis.

verbose name
Orientation
default value
right-handed z-up
port type
EnumPort
value type
str (can be None)

position_data_field

If the 3D positions data (unit, source positions, detector positions) are in a different field than 'SD', specify the field name here. For example, 'SD' might store the 2D positions, while the 3D positions are stored in another field.

verbose name
Position Data Field
default value
SD
port type
StringPort
value type
str (can be None)

accelerometer_data

If the device stored accelerometer data, specify the name of the top-level variable where this is stored (i.e ., 'aux'). Compatible with NirX devices (compatibility with other models may vary).

verbose name
Accelerometer Data
default value
None
port type
StringPort
value type
str (can be None)

one_based_naming

Use 1-based naming for sources and detectors (instead of 0-based)

verbose name
One Based Naming
default value
False
port type
BoolPort
value type
bool (can be None)

skip_coregistration

Skip co-registration of the source and detector positions to Neuropype's internal coordinate system. Set to True if you want to do the coregistration later using the CoregisterExistingLocations node (i.e., if co-registration depends on landmarks which are defined separately.

verbose name
Skip Coregistration
default value
False
port type
BoolPort
value type
bool (can be None)

file_missing

Whether to raise an exception (error) if the file is missing or not found (which may stop the pipeline), or print a log message and continue.

verbose name
File Missing
default value
raise
port type
EnumPort
value type
str (can be None)

sort_by

Sorting order for channels. If set to wavelength-first, the node outputs first all channels for the lowest wavelength, then all channels for the next highest wavelength etc. If set to link-first, then the node emits first all wavelengths for a given source-detector pair, then all wavelengths for the next source-detector pair, etc.

verbose name
Sort By
default value
wavelength-first
port type
EnumPort
value type
str (can be None)

verbose

Print info about the imported file.

verbose name
Verbose
default value
True
port type
BoolPort
value type
bool (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)

cloud_host

Cloud storage host to use (if any). You can override this option to select from what kind of cloud storage service data should be downloaded. On some environments (e.g., on NeuroScale), the value Default will be map to the default storage provider on that environment.

verbose name
Cloud Host
default value
Default
port type
EnumPort
value type
str (can be None)

cloud_account

Cloud account name on storage provider (use default if omitted). You can override this to choose a non-default account name for some storage provider (e.g., Azure or S3.). On some environments (e.g., on NeuroScale), this value will be default-initialized to your account.

verbose name
Cloud Account
default value
port type
StringPort
value type
str (can be None)

cloud_bucket

Cloud bucket to read from (use default if omitted). This is the bucket or container on the cloud storage provider that the file would be written to. On some environments (e.g., on NeuroScale), this value will be default-initialized to a bucket that has been created for you.

verbose name
Cloud Bucket
default value
port type
StringPort
value type
str (can be None)

cloud_credentials

Secure credential to access cloud data (use default if omitted). These are the security credentials (e.g., password or access token) for the the cloud storage provider. On some environments (e.g., on NeuroScale), this value will be default-initialized to the right credentials for you.

verbose name
Cloud Credentials
default value
port type
StringPort
value type
str (can be None)