7
7
#
8
8
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
9
9
''' Read / write access to NIfTI1 image format
10
+
11
+ NIfTI1 format defined at http://nifti.nimh.nih.gov/nifti-1/
10
12
'''
11
13
from __future__ import division , print_function
12
14
import warnings
@@ -518,10 +520,10 @@ def from_fileobj(klass, fileobj, size, byteswap):
518
520
519
521
520
522
class Nifti1Header (SpmAnalyzeHeader ):
521
- ''' Class for NIFTI1 header
523
+ ''' Class for NIfTI1 header
522
524
523
- The NIFTI1 header has many more coded fields than the simpler Analyze
524
- variants. Nifti1 headers also have extensions.
525
+ The NIfTI1 header has many more coded fields than the simpler Analyze
526
+ variants. NIfTI1 headers also have extensions.
525
527
526
528
Nifti allows the header to be a separate file, as part of a nifti image /
527
529
header pair, or to precede the data in a single file. The object needs to
@@ -1067,7 +1069,7 @@ def set_slope_inter(self, slope, inter=None):
1067
1069
self ._structarr ['scl_inter' ] = inter
1068
1070
1069
1071
def get_dim_info (self ):
1070
- ''' Gets nifti MRI slice etc dimension information
1072
+ ''' Gets NIfTI MRI slice etc dimension information
1071
1073
1072
1074
Returns
1073
1075
-------
@@ -1080,7 +1082,7 @@ def get_dim_info(self):
1080
1082
1081
1083
where ``data array`` is the array returned by ``get_data``
1082
1084
1083
- Because nifti1 files are natively Fortran indexed:
1085
+ Because NIfTI1 files are natively Fortran indexed:
1084
1086
0 is fastest changing in file
1085
1087
1 is medium changing in file
1086
1088
2 is slowest changing in file
@@ -1262,7 +1264,7 @@ def get_slice_duration(self):
1262
1264
1263
1265
Notes
1264
1266
-----
1265
- The Nifti1 spec appears to require the slice dimension to be
1267
+ The NIfTI1 spec appears to require the slice dimension to be
1266
1268
defined for slice_duration to have meaning.
1267
1269
'''
1268
1270
_ , _ , slice_dim = self .get_dim_info ()
@@ -1572,12 +1574,14 @@ def _chk_xform_code(klass, code_type, hdr, fix):
1572
1574
1573
1575
1574
1576
class Nifti1PairHeader (Nifti1Header ):
1575
- ''' Class for nifti1 pair header '''
1577
+ ''' Class for NIfTI1 pair header '''
1576
1578
# Signal whether this is single (header + data) file
1577
1579
is_single = False
1578
1580
1579
1581
1580
1582
class Nifti1Pair (analyze .AnalyzeImage ):
1583
+ """ Class for NIfTI1 format image, header pair
1584
+ """
1581
1585
header_class = Nifti1PairHeader
1582
1586
1583
1587
def __init__ (self , dataobj , affine , header = None ,
@@ -1795,6 +1799,8 @@ def set_sform(self, affine, code=None, **kwargs):
1795
1799
1796
1800
1797
1801
class Nifti1Image (Nifti1Pair ):
1802
+ """ Class for single file NIfTI1 format image
1803
+ """
1798
1804
header_class = Nifti1Header
1799
1805
files_types = (('image' , '.nii' ),)
1800
1806
@@ -1815,7 +1821,7 @@ def update_header(self):
1815
1821
1816
1822
1817
1823
def load (filename ):
1818
- """ Load nifti1 single or pair from `filename`
1824
+ """ Load NIfTI1 single or pair from `filename`
1819
1825
1820
1826
Parameters
1821
1827
----------
@@ -1825,11 +1831,11 @@ def load(filename):
1825
1831
Returns
1826
1832
-------
1827
1833
img : Nifti1Image or Nifti1Pair
1828
- nifti1 single or pair image instance
1834
+ NIfTI1 single or pair image instance
1829
1835
1830
1836
Raises
1831
1837
------
1832
- ImageFileError: if `filename` doesn't look like nifti1
1838
+ ImageFileError: if `filename` doesn't look like NIfTI1
1833
1839
IOError : if `filename` does not exist
1834
1840
"""
1835
1841
try :
@@ -1840,7 +1846,7 @@ def load(filename):
1840
1846
1841
1847
1842
1848
def save (img , filename ):
1843
- """ Save nifti1 single or pair to `filename`
1849
+ """ Save NIfTI1 single or pair to `filename`
1844
1850
1845
1851
Parameters
1846
1852
----------
0 commit comments