Skip to main content

Converts exported Shimadzu LabNirs recordings to SNIRF format.

Project description

labnirs2snirf

ci CodeQL Coverage Documentation python support

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. step into the project folder
cd labnirs2snirf

# 3. create a Python virtual environment
python -m venv .venv

# 4. activate the virtual environment
./.venv/Scripts/activate

# 5. install labnirs2snirf and dependencies
python -m pip install .

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

# 7. 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.2.tar.gz (93.7 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.2-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: labnirs2snirf-0.1.2.tar.gz
  • Upload date:
  • Size: 93.7 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.2.tar.gz
Algorithm Hash digest
SHA256 1bff12864c173c217027142989ab8202a48f64fea18e2b909d7bb39d2623231d
MD5 2e22614b95e8b247ec0320befe3a1603
BLAKE2b-256 f1d13417e125f98cbc3b694e8e8d67d0cadd16756f8afc56fe8f30517d0d7a6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for labnirs2snirf-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: labnirs2snirf-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 26.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ace2152f531a387317ce66c630b5e3b84986cc7b4c28f46428145a4896928b62
MD5 d0cbfc29c6e225a91ac37508b7eaa591
BLAKE2b-256 357e2318b2a2ca55c65b32d84ccd53ce119026e5c1806fdf556eb0ad51e03ca1

See more details on using hashes here.

Provenance

The following attestation bundles were made for labnirs2snirf-0.1.2-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