Skip to content

Commit e243cc7

Browse files
committed
[doc] update README, make examples self-contained
1 parent 905f87e commit e243cc7

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Compatibility: MATLAB R2008a or newer, or Octave 4.0 and newer
1010
* JNIfTI Specification Version: V1 Draft-2 (https://neurojson.org/jnifti/draft2)
1111
* Acknowledgement: This project is supported by US National Institute of Health (NIH)
12-
grant [U24-NS124027 (NeuroJSON)](https://reporter.nih.gov/project-details/10308329)
12+
grant [U24-NS124027 (NeuroJSON)](https://neurojson.org)
1313

1414
## Overview
1515

@@ -20,7 +20,7 @@ files (`.hdr/.img` and `.hdr.gz/.img.gz`).
2020

2121
More importantly, this is a toolbox that converts NIfTI data to its JSON-based
2222
replacement, JNIfTI (`.jnii` for text-based and `.bnii` for binary-based), defined
23-
by the JNIfTI specification (https://github.com/NeuroJSON/jnift). JNIfTI is a
23+
by the JNIfTI specification (https://github.com/NeuroJSON/jnifti). JNIfTI is a
2424
much more flexible, human-readable and extensible file format compared to the
2525
more rigid and opaque NIfTI format, making the data much easier to manipulate
2626
and share.
@@ -50,9 +50,13 @@ ZMat toolbox (https://github.com/NeuroJSON/zmat), although it is optional.
5050
### `nii2jnii` - To convert a NIfTI-1/2 file to a JNIfTI file or data structure
5151
Example:
5252
```
53+
img = uint16(reshape(1:10*30*20, [10, 30, 20])); % create sample data
54+
savenifti(img, 'test.nii'); % save sample data as an example nii file
55+
savenifti(img, 'test.nii.gz'); % save sample data as an example nii.gz file
56+
5357
nii=nii2jnii('test.nii', 'nii'); % read a .nii file as a nii structure
5458
nii=nii2jnii('test.nii.gz'); % read a .nii.gz file as a jnii structure
55-
nii2jnii('test.nii.gz', 'newdata.jnii') ;% read a .nii.gz file and convert to a text-JNIfTI file
59+
nii2jnii('test.nii.gz', 'newdata.jnii') ;% read a .nii.gz file and convert to a text-JNIfTI file
5660
nii2jnii('test.nii.gz', 'newdata.bnii','compression','zlib'); % read a .nii.gz file and convert to a binary-JNIfTI file with compression
5761
```
5862
### `loadnifti` - To read a NIfTI-1/2 (.nii or .nii.gz) file (alias to `nii2jnii`)
@@ -66,7 +70,7 @@ Example:
6670
```
6771
savenifti(img, 'test.nii.gz'); % save an array img to a compressed nifti file
6872
savenifti(img, 'test.nii', 'nifti2'); % save an array img to a nifti-2 file file
69-
savenifti(img, 'test.nii', header); % save an array img with an existing header
73+
savenifti(img, 'test.nii', nii.hdr); % save an array img with an existing header
7074
```
7175
### `loadjnifti` - To read a JNIfTI (.jnii or .bnii) file
7276
Example:
@@ -81,6 +85,8 @@ Example:
8185
jnii = jnifticreate(uint8(magic(10)), 'Name', '10x10 magic matrix');
8286
savejnifti(jnii, 'magic10.jnii');
8387
savejnifti(jnii, 'magic10_debug.bnii', 'Compression', 'gzip');
88+
savejnifti(jnii, 'test.jnii', 'Compression', 'zlib');
89+
savejnifti(jnii, 'test.bnii', 'Compression', 'zlib');
8490
```
8591
### `jnii2nii` - To convert a JNIfTI file or data structure to a NIfTI-1/2 file
8692
Example:

0 commit comments

Comments
 (0)