| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
JSNIRF is a portable format for storage, interchange and processing data generated from functional near-infrared spectroscopy, or fNIRS - an emerging functional neuroimaging technique. Built upon the JData and SNIRF specifications, a JSNIRF file has both a text-based interface using the JavaScript Object Notation (JSON) [RFC4627] format and a binary interface using the University Binary JSON (UBJSON, https://ubjson.org) derived Binary JData (BJData) serialization format. It contains a compatibility layer to provide a 1-to-1 mapping to the existing HDF5 based SNIRF files. A JSNIRF file can be directly parsed by most existing JSON and BJData parsers. Advanced features include optional hierarchical data storage, grouping, compression, integration with heterogeneous scientific data enabled by JData data serialization framework.
This toolbox also provides a fast/complete reader/writer for the HDF5-based SNIRF files (along with any HDF5 data) via the EasyH5 toolbox (https://github.com/NeuroJSON/easyh5). The toolbox can read/write SNIRF v1.0 data files specified by the SNIRF specification https://github.com/fNIRS/snirf .
This toolbox is selectively dependent on the below toolboxes
A SNIRF data file is basically an HDF5 file. HDF5 (Hierarchical Data Format version 5) is a general purpose file format for storing flexible binary data. However, it has the below limitations:
In comparison, the JSNIRF data format is defined based on the JData specification. and supports both a text-based interface and a binary interface. The text form JSNIRF file is a plain JSON file, and has various advantages
The binary JSNIRF format uses a binary JSON format (BJData) which is also
The JSNIRF data structure is highly compatible with the SNIRF data structure. This toolbox provides utilities convert from one form to the other losslessly.
There are only two minor differences:
To further illustrate the above data reorganization steps, please find below an example
An original SNIRF/HDF5 data outline
/formatVersion /nirs1/ /metaDataTags /data1 /data2 /aux1 /aux2 /probe ... /nirs2/ /metaDataTags /data /aux1 /aux2 /aux3 /probe ...
is converted to the below JSON/JSNIRF data structure
{
"SNIRFData": [
{
"formatVersion": '1.0',
"metaDataTags":{
"SubjectID": ...
},
"data": [
{..for data1 ...},
{..for data2 ...}
],
"aux": [
{..for aux1 ...},
{..for aux2 ...}
],
"probe": ...
},
{
"formatVersion": '1.0',
"metaDataTags":{
"SubjectID": ...
},
"data": {...},
"aux": [
{..for aux1 ...},
{..for aux2 ...},
{..for aux3 ...}
],
"probe": ...
},
...
]
}
The JSNIRFY toolbox can be installed using a single command
addpath('/path/to/jsnirf');
where the /path/to/jsnirf should be replaced by the unzipped folder of the toolbox (i.e. the folder containing savejsnirf.m/loadjsnirf.m).
In order for this toolbox to work, one must install the below dependencies
Example:
data=snirfcreate; % create an empty SNIRF data structure
data=snirfcreate('data',realdata,'aux',realauxdata); % setting the default values to user data
data=jsnirfcreate('format','snirf'); % specify 'snirf' or 'jsnirf' using 'format' option
jsn=snirfdecode(loadh5('mydata.snirf', 'stringarray', 1)); % load raw HDF5 data and convert to a JSNIRF struct
Example:
data=loadsnirf('mydata.snirf'); % load an HDF5 SNIRF data file, same as loadh5+regrouph5
jdata=loadjsnirf('mydata.bnirs'); % load a binary JSON/JSNIRF data file
Example:
data=snirfcreate; data.nirs.data.dataTimeSeries=rand(100,5); data.nirs.metaDataTags.SubjectID='subj1'; data.nirs.metaDataTags.MeasurementDate=date; data.nirs.metaDataTags.MeasurementTime=datestr(now,'HH:MM:SS'); savesnirf(data,'test.snirf'); savejsnirf(data,'test.jnirs');
Please submit your bug reports, feature requests and questions to the Github Issues page at
https://github.com/NeuroJSON/jsnirfy/issues
Please feel free to fork our software, making changes, and submit your revision back to us via "Pull Requests". JSNIRFY toolbox is open-source and we welcome your contributions!
| Back | FazBrowse Home | New Git URL |