Read / write access to NIfTI2 image format
Format described here:
Nifti2Header([binaryblock, endianness, ...]) | Class for NIfTI2 header |
Nifti2Image(dataobj, affine[, header, ...]) | Class for single file NIfTI2 format image |
Nifti2Pair(dataobj, affine[, header, extra, ...]) | Class for NIfTI2 format image, header pair |
Nifti2PairHeader([binaryblock, endianness, ...]) | Class for NIfTI2 pair header |
load(filename) | Load NIfTI2 single or pair image from filename |
save(img, filename) | Save NIfTI2 single or pair to filename |
Bases: nibabel.nifti1.Nifti1Header
Class for NIfTI2 header
NIfTI2 is a slightly simplified variant of NIfTI1 which replaces 32-bit floats with 64-bit floats, and increases some integer widths to 32 or 64 bits.
Initialize header from binary data block and extensions
Initialize header from binary data block and extensions
Create empty header binary block with given endianness
Get shape of data
Notes
Does not use Nifti1 freesurfer hack for large vectors described in Nifti1Header.set_data_shape()
Examples
>>> hdr = Nifti2Header()
>>> hdr.get_data_shape()
(0,)
>>> hdr.set_data_shape((1,2,3))
>>> hdr.get_data_shape()
(1, 2, 3)
Expanding number of dimensions gets default zooms
>>> hdr.get_zooms()
(1.0, 1.0, 1.0)
Set shape of data
If ndims == len(shape) then we set zooms for dimensions higher than ndims to 1.0
Parameters: | shape : sequence
|
---|
Notes
Does not apply nifti1 Freesurfer hack for long vectors (see Nifti1Header.set_data_shape())
Bases: nibabel.nifti1.Nifti1Image
Class for single file NIfTI2 format image
Initialize image
The image is a combination of (array-like, affine matrix, header), with optional metadata in extra, and filename / file-like objects contained in the file_map mapping.
Parameters: | dataobj : object
|
---|
Notes
If both a header and an affine are specified, and the affine does not match the affine that is in the header, the affine will be used, but the sform_code and qform_code fields in the header will be re-initialised to their default values. This is performed on the basis that, if you are changing the affine, you are likely to be changing the space to which the affine is pointing. The set_sform() and set_qform() methods can be used to update the codes after an image has been created - see those methods, and the manual for more details.
Initialize image
The image is a combination of (array-like, affine matrix, header), with optional metadata in extra, and filename / file-like objects contained in the file_map mapping.
Parameters: | dataobj : object
|
---|
Notes
If both a header and an affine are specified, and the affine does not match the affine that is in the header, the affine will be used, but the sform_code and qform_code fields in the header will be re-initialised to their default values. This is performed on the basis that, if you are changing the affine, you are likely to be changing the space to which the affine is pointing. The set_sform() and set_qform() methods can be used to update the codes after an image has been created - see those methods, and the manual for more details.
alias of Nifti2Header
Bases: nibabel.nifti1.Nifti1Pair
Class for NIfTI2 format image, header pair
Initialize image
The image is a combination of (array-like, affine matrix, header), with optional metadata in extra, and filename / file-like objects contained in the file_map mapping.
Parameters: | dataobj : object
|
---|
Notes
If both a header and an affine are specified, and the affine does not match the affine that is in the header, the affine will be used, but the sform_code and qform_code fields in the header will be re-initialised to their default values. This is performed on the basis that, if you are changing the affine, you are likely to be changing the space to which the affine is pointing. The set_sform() and set_qform() methods can be used to update the codes after an image has been created - see those methods, and the manual for more details.
Initialize image
The image is a combination of (array-like, affine matrix, header), with optional metadata in extra, and filename / file-like objects contained in the file_map mapping.
Parameters: | dataobj : object
|
---|
Notes
If both a header and an affine are specified, and the affine does not match the affine that is in the header, the affine will be used, but the sform_code and qform_code fields in the header will be re-initialised to their default values. This is performed on the basis that, if you are changing the affine, you are likely to be changing the space to which the affine is pointing. The set_sform() and set_qform() methods can be used to update the codes after an image has been created - see those methods, and the manual for more details.
alias of Nifti2PairHeader
Bases: nibabel.nifti2.Nifti2Header
Class for NIfTI2 pair header
Initialize header from binary data block and extensions
Initialize header from binary data block and extensions
Load NIfTI2 single or pair image from filename
Parameters: | filename : str
|
---|---|
Returns: | img : Nifti2Image or Nifti2Pair
|
Raises: | ImageFileError :
IOError :
|