{"id":28502994,"url":"https://github.com/neurojson/jnifty","last_synced_at":"2025-07-05T12:30:53.569Z","repository":{"id":53875766,"uuid":"272120140","full_name":"NeuroJSON/jnifty","owner":"NeuroJSON","description":"Portable MATLAB/Octave toolbox for reading/writing NIFTI-1/2 and JNIFTI files","archived":false,"fork":false,"pushed_at":"2025-03-23T18:25:01.000Z","size":161,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-28T22:59:11.873Z","etag":null,"topics":["decoder","encoder","jnifti","json","matlab","neuroimaging","nifti-format","nih","octave","parser"],"latest_commit_sha":null,"homepage":"https://neurojson.org","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NeuroJSON.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE_Apache-2.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-14T02:34:38.000Z","updated_at":"2025-03-23T18:34:35.000Z","dependencies_parsed_at":"2024-01-15T22:38:05.574Z","dependency_job_id":"bed324ae-8473-43ea-8ff3-0a3b64b69cb3","html_url":"https://github.com/NeuroJSON/jnifty","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/NeuroJSON/jnifty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuroJSON%2Fjnifty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuroJSON%2Fjnifty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuroJSON%2Fjnifty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuroJSON%2Fjnifty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NeuroJSON","download_url":"https://codeload.github.com/NeuroJSON/jnifty/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuroJSON%2Fjnifty/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263741602,"owners_count":23504275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decoder","encoder","jnifti","json","matlab","neuroimaging","nifti-format","nih","octave","parser"],"created_at":"2025-06-08T16:38:46.649Z","updated_at":"2025-07-05T12:30:53.552Z","avatar_url":"https://github.com/NeuroJSON.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"![image](https://neurojson.org/wiki/upload/neurojson_banner_long.png)\n\n# JNIfTI Toolbox - Fast and portable NIfTI-1/2 reader/writer for MATLAB and Octave\n\n* Copyright (C) 2019-2025  Qianqian Fang \u003cq.fang at neu.edu\u003e\n* License: GNU General Public License version 3 (GPL v3) or Apache License 2.0, see License*.txt\n* Version: 0.8 (Tree of Life)\n* URL: https://github.com/NeuroJSON/jnifty\n* Compatibility: MATLAB R2008a or newer, or Octave 4.0 and newer\n* JNIfTI Specification Version: V1 Draft-2 (https://neurojson.org/jnifti/draft2)\n* Acknowledgement: This project is supported by US National Institute of Health (NIH)\n  grant [U24-NS124027 (NeuroJSON)](https://neurojson.org)\n\n## Overview\n\nThis is a fully functional NIfTI-1/2 reader/writer that supports both \nMATLAB and GNU Octave, and is capable of reading/writing both non-compressed \nand compressed NIfTI files (`.nii, .nii.gz`) as well as two-part Analyze7.5/NIfTI\nfiles (`.hdr/.img` and `.hdr.gz/.img.gz`).\n\nMore importantly, this is a toolbox that converts NIfTI data to its JSON-based\nreplacement, JNIfTI (`.jnii` for text-based and `.bnii` for binary-based), defined\nby the JNIfTI specification (https://github.com/NeuroJSON/jnifti). JNIfTI is a\nmuch more flexible, human-readable and extensible file format compared to the\nmore rigid and opaque NIfTI format, making the data much easier to manipulate\nand share.\n\n## Installation\n\nThe JNIfTI toolbox includes a stand-alone NIfTI-1/2 parser that works on both\nMATLAB and GNU Octave without needing additional components. To just reading and\nwriting the un-compressed NIfTI and Analyze7.5 files (.nii, .hdr/.img), one \nonly needs to run `addpath('/path/to/jnifty')`. For MATLAB, JNIfTI toolbox\nutilizes `memmapfile`-based disk-reading, making it very fast. For Octave, \n`memmapfile` is currently not implemented, so, a full reading is required.\n\nThe JNIfTI toolbox is also capable of reading/writing gzip-compressed NIfTI and \nAnalyze7.5 files (`.nii.gz, .hdr.gz, .img.gz`). This feature is supported in MATLAB\ndirectly without needing another toolbox (MATLAB must be in the JVM-enabled mode).\n\nTo save NIfTI-1/2 data as JNIfTI files, one needs to install JSONLab. The JNIfTI\ndata format supports internal compression (as oppose to external compression such\nas `*.gz` files).\n\nTo create or read compressed NIfTI/JNIfTI files in Octave, one may install the\nZMat toolbox (https://github.com/NeuroJSON/zmat), although it is optional.\n\n## Usage\n\n### `nii2jnii` - To convert a NIfTI-1/2 file to a JNIfTI file or data structure\nExample:\n```\n  img = uint16(reshape(1:10*30*20, [10, 30, 20]));  % create sample data\n  savenifti(img, 'test.nii');              % save sample data as an example nii file\n  savenifti(img, 'test.nii.gz');           % save sample data as an example nii.gz file\n\n  nii=nii2jnii('test.nii', 'nii');         % read a .nii file as a nii structure\n  nii=nii2jnii('test.nii.gz');             % read a .nii.gz file as a jnii structure\n  nii2jnii('test.nii.gz', 'newdata.jnii') ;% read a .nii.gz file and convert to a text-JNIfTI file\n  nii2jnii('test.nii.gz', 'newdata.bnii','compression','zlib'); % read a .nii.gz file and convert to a binary-JNIfTI file with compression\n```\n### `loadnifti` - To read a NIfTI-1/2 (.nii or .nii.gz) file (alias to `nii2jnii`)\nExample:\n```\n  nii=loadnifti('test.nii.gz');             % read a .nii.gz file as a jnii structure\n  nii=loadnifti('test.nii', 'nii');         % read a .nii file as a nii structure\n```\n### `savenifti` - To write an image as NIfTI-1/2 (.nii or .nii.gz) file\nExample:\n```\n  savenifti(img, 'test.nii.gz');        % save an array img to a compressed nifti file\n  savenifti(img, 'test.nii', 'nifti2'); % save an array img to a nifti-2 file file\n  savenifti(img, 'test.nii', nii.hdr);  % save an array img with an existing header\n```\n### `loadjnifti` - To read a JNIfTI (.jnii or .bnii) file\nExample:\n```\n  jnii = nii2jnii('test.nii.gz');\n  savejnifti(jnii, 'magic10.bnii', 'Compression', 'gzip');\n  newjnii = loadjnifti('magic10.bnii');\n```\n### `savejnifti` - To write a JNIfTI structure into a file (.jnii or .bnii)\nExample:\n```\n  jnii = jnifticreate(uint8(magic(10)), 'Name', '10x10 magic matrix');\n  savejnifti(jnii, 'magic10.jnii');\n  savejnifti(jnii, 'magic10_debug.bnii', 'Compression', 'gzip');\n  savejnifti(jnii, 'test.jnii', 'Compression', 'zlib');\n  savejnifti(jnii, 'test.bnii', 'Compression', 'zlib');\n```\n### `jnii2nii` - To convert a JNIfTI file or data structure to a NIfTI-1/2 file\nExample:\n```\n  nii = jnii2nii('test.jnii');             % read a .jnii file as an nii structure\n  nii = jnii2nii('test.bnii');             % read a .bnii file as an nii structure\n  jnii2nii('test.jnii', 'newdata.nii.gz'); % read a text-JNIfTI file to an .nii.gz file\n  jnii2nii('test.bnii', 'newdata.nii');    % read a text-JNIfTI file to an .nii file\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneurojson%2Fjnifty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneurojson%2Fjnifty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneurojson%2Fjnifty/lists"}