Skip to main content

Converts exported Shimadzu LabNirs recordings to SNIRF format.

Project description

labnirs2snirf

ci CodeQL Coverage Documentation python support PyPI version

This package provides tools to convert fNIRS experimental data exported from Shimadzu LabNIRS software to the Shared Near Infrared Spectroscopy Format (SNIRF), enabling compatibility with analysis tools like MNE-Python and other NIRS analysis software.

Features

  • Convert LabNIRS export files to SNIRF/HDF5 format
  • Your data is untouched (no unnecessary Hb -> OD -> raw conversion)
  • Support for importing probe positions from layout file (.sfp format only, for now)
  • Command-line interface and API
  • Exclude data based on type and wavelength (e.g. only include raw data for 2 wavelengths), to allow 3rd-party tools with specific requirements to read the file.

Motivation

Most popular analytical tools (Homer, MNE, etc.) do not support reading LabNirs data files and LabNirs has no official converter either. The recommended way for conversion, as far as I know, is to use the Shimadzu2nirs.m Matlab script to convert to .nirs format that Homer can import and save as .snirf.

However, the script takes haemoglobin concentration data and converts it back to OD and then to intensity, and I would prefer to use untouched raw data directly without any unnecessary transformation steps. I also just simply prefer to avoid using Matlab where possible.

This tool aims to simplify the process. Data exported from LabNirs (Hb or voltage or both) can be converted to .snirf in one step, without unnecessary conversion.

Current state of the project

The conversion tool is functional, with the following caveats:

  1. The expected file format is based on data from one single LabNIRS machine. Other machines or versions of the LabNIRS software could have a different output format, which is likely to lead to errors.

  2. I only use the recording mode in which task changes are marked by event triggers. Metadata fields may have a different meaning in other modi of operandi.

  3. Analysis tools (e.g. MNE, Homer) sometimes have their own limitations regarding snirf data format, and while labnirs2snirf produces valid .snirf files, those tools may not be able to read just any valid file. To help with this, it is possible to limit what is included in the .snirf file (e.g. only 2 wavelengths, only Hb or voltage data) using the --type and --drop options.

  4. LabNirs stores more metadata (e.g. task duration, pre and post rest periods) in additional files, that is not exported. In theory, I may implement reading metadata from those files in the future, but no guarantees. It may be easier to just add the missing information using other software.

  5. For now, probe location data can only be supplied in the .sfp file format. I may add support for more formats later. It is also possible not to include layout data (in which case all probes have all-zero coordinates), but that will not make 3rd party tools happy.

Quick Start

# 1. install labnirs2snirf from PyPI
pip install labnirs2snirf

# 2. run without parameters or with --help to print out usage instructions
labnirs2snirf
labnirs2snirf --help

# 3. convert labnirs file to .snirf
# You can use one of the data files on the project repository for testing, e.g.
# https://raw.githubusercontent.com/zEdS15B3GCwq/labnirs2snirf/refs/heads/main/data/test/small_labnirs.txt
labnirs2snirf small_labnirs.txt small.snirf

Documentation

Check the documentation for further details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

labnirs2snirf-0.1.3.tar.gz (93.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

labnirs2snirf-0.1.3-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file labnirs2snirf-0.1.3.tar.gz.

File metadata

  • Download URL: labnirs2snirf-0.1.3.tar.gz
  • Upload date:
  • Size: 93.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for labnirs2snirf-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d22bf93564c78081bb92ade6155ae5e19471104b9ed452af03c112102dc13231
MD5 6dbac0f727d1bec61ff07e4c693b4fa2
BLAKE2b-256 efde0084bb2e7b1fd9c8248ed9ffbf6893785fe1e2dede73bb176fb0db293a67

See more details on using hashes here.

Provenance

The following attestation bundles were made for labnirs2snirf-0.1.3.tar.gz:

Publisher: publish.yml on zEdS15B3GCwq/labnirs2snirf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file labnirs2snirf-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: labnirs2snirf-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for labnirs2snirf-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bb43b9321a292828d3ae327a21455f077228f24b42009d6b8d971dd8c398cddb
MD5 b8edf9b7fbe46878bdf08b98d5ebc1ee
BLAKE2b-256 b8cef60a185e8c7f2704582fac47a45fd7104ed8be1a982685b67837fce539ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for labnirs2snirf-0.1.3-py3-none-any.whl:

Publisher: publish.yml on zEdS15B3GCwq/labnirs2snirf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page