Converts exported Shimadzu LabNirs recordings to SNIRF format.
Project description
labnirs2snirf
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:
-
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.
-
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.
-
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
--typeand--dropoptions. -
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.
-
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
Once the package is published on PyPI, the installation will be as simple as
pip install labnirs2snirf.
For now, you need to download the source files either by cloning this repository or downloading a .zipped package.
# 1. clone the files from the repository (or download a .zip)
git clone https://github.com/zEdS15B3GCwq/labnirs2snirf.git
# 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
labnirs2snirf tests/small_labnirs.txt small.snirf
Documentation
Check the documentation for further details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file labnirs2snirf-0.1.1.tar.gz.
File metadata
- Download URL: labnirs2snirf-0.1.1.tar.gz
- Upload date:
- Size: 93.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0670709b51fbd98299ddc7c864c81693f53e814eb3a7559b7c22e827acb081f5
|
|
| MD5 |
303e335a130dddbeba196101ada75a11
|
|
| BLAKE2b-256 |
9a1ea7342665f0f41678c1caf648e83329a8d1e9a74f8c7543ea5fd298cd9625
|
Provenance
The following attestation bundles were made for labnirs2snirf-0.1.1.tar.gz:
Publisher:
publish.yml on zEdS15B3GCwq/labnirs2snirf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
labnirs2snirf-0.1.1.tar.gz -
Subject digest:
0670709b51fbd98299ddc7c864c81693f53e814eb3a7559b7c22e827acb081f5 - Sigstore transparency entry: 728973868
- Sigstore integration time:
-
Permalink:
zEdS15B3GCwq/labnirs2snirf@430a5d0d6c4ee1e090690542331b5a93ce04870a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/zEdS15B3GCwq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@430a5d0d6c4ee1e090690542331b5a93ce04870a -
Trigger Event:
release
-
Statement type:
File details
Details for the file labnirs2snirf-0.1.1-py3-none-any.whl.
File metadata
- Download URL: labnirs2snirf-0.1.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc0762f972e525a154359623827e1b679d506c3c285244faf27967bba5606a38
|
|
| MD5 |
d1b2909ee1e6f1ba66533d3117cb8dc0
|
|
| BLAKE2b-256 |
0f75a3750289d56fb4b3d0ff7735f0558afef72adb939accc4ea9be47f83b419
|
Provenance
The following attestation bundles were made for labnirs2snirf-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on zEdS15B3GCwq/labnirs2snirf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
labnirs2snirf-0.1.1-py3-none-any.whl -
Subject digest:
dc0762f972e525a154359623827e1b679d506c3c285244faf27967bba5606a38 - Sigstore transparency entry: 728973877
- Sigstore integration time:
-
Permalink:
zEdS15B3GCwq/labnirs2snirf@430a5d0d6c4ee1e090690542331b5a93ce04870a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/zEdS15B3GCwq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@430a5d0d6c4ee1e090690542331b5a93ce04870a -
Trigger Event:
release
-
Statement type: