supereeg.Nifti

class supereeg.Nifti(data, affine=None, **kwargs)[source]

Nifti class for the supereeg package. Extends the Nibabel.Nifti1Image class.

Parameters:
data : object or path to Nifti1Image, supereeg.Brain, supereeg.Model, supereeg.Nifti or np.ndarray

Data can be a nifti image (either supereeg.Nifti or path to Nifti1Image), supereeg.Brain object, supereeg.Model object, or a np.ndarray an N-D array containing the image data

affine : np.ndarray

A (4, 4) affine matrix mapping array coordinates to coordinates in MNI coordinate space.

header : nibabel.nifti1.Nifti1Header

Image metadata in the form of a header (optional parameter, use when creating nifti object from np.ndarray).

Returns:
nii : supereeg.Nifti

Instance of Nifti data class, (nibabel.nifti1.Nifti1Image subclass)

Attributes:
affine
dataobj
header
in_memory

True when any array data is in memory cache

shape
slicer

Slicer object that returns cropped and subsampled images

Methods

ImageArrayProxy alias of ArrayProxy
ImageSlicer alias of SpatialFirstSlicer
as_reoriented(ornt) Apply an orientation change and return a new image
filespec_to_file_map(klass, filespec) Make file_map for this class from filename filespec
filespec_to_files(klass, filespec) filespec_to_files class method is deprecated.
from_file_map(klass, file_map[, mmap, ...]) class method to create image from mapping in file_map `
from_filename(klass, filename[, mmap, ...]) class method to create image from filename filename
from_files(klass, file_map) from_files class method is deprecated.
from_image(klass, img) Class method to create new instance of own class from img
get_affine() Get affine from image
get_data([caching]) Return image data from image with any necessary scaling applied
get_fdata([caching, dtype]) Return floating point image data with necessary scaling applied
get_filename() Fetch the image filename
get_header() Get header from image
get_locs() Return locations of voxels
get_qform([coded]) Return 4x4 affine matrix from qform parameters in header
get_sform([coded]) Return 4x4 affine matrix from sform parameters in header
get_shape() Return shape for image
header_class alias of Nifti1Header
info() Print info about the Nifti
instance_to_filename(klass, img, filename) Save img in our own format, to name implied by filename
load(klass, filename[, mmap, keep_file_open]) class method to create image from filename filename
make_file_map(klass[, mapping]) Class method to make files holder for this image type
make_gif(gifpath[, index, name]) Plots nifti data as png and compiles as gif
orthoview() Plot the image using OrthoSlicer3D
path_maybe_image(klass, filename[, sniff, ...]) Return True if filename may be image matching this class
plot_anat([pdfpath, index]) Plots nifti data
plot_glass_brain([pdfpath, index]) Plots nifti data
save(filepath) Save file to disk
set_filename(filename) Sets the files in the object from a given filename
set_qform(affine[, code, strip_shears]) Set qform header values from 4x4 affine
set_sform(affine[, code]) Set sform transform from 4x4 affine
to_file_map([file_map]) Write image to file_map or contained self.file_map
to_filename(filename) Write image to files implied by filename string
to_files([file_map]) to_files method is deprecated.
to_filespec(filename) to_filespec method is deprecated.
uncache() Delete any cached read of data from proxied data
update_header() Harmonize header with image data and affine
get_data_dtype  
get_slice  
set_data_dtype  
__init__(data, affine=None, **kwargs)[source]

Methods

__init__(data[, affine])
as_reoriented(ornt) Apply an orientation change and return a new image
filespec_to_file_map(klass, filespec) Make file_map for this class from filename filespec
filespec_to_files(klass, filespec) filespec_to_files class method is deprecated.
from_file_map(klass, file_map[, mmap, ...]) class method to create image from mapping in file_map `
from_filename(klass, filename[, mmap, ...]) class method to create image from filename filename
from_files(klass, file_map) from_files class method is deprecated.
from_image(klass, img) Class method to create new instance of own class from img
get_affine() Get affine from image
get_data([caching]) Return image data from image with any necessary scaling applied
get_data_dtype()
get_fdata([caching, dtype]) Return floating point image data with necessary scaling applied
get_filename() Fetch the image filename
get_header() Get header from image
get_qform([coded]) Return 4x4 affine matrix from qform parameters in header
get_sform([coded]) Return 4x4 affine matrix from sform parameters in header
get_shape() Return shape for image
info() Print info about the Nifti
instance_to_filename(klass, img, filename) Save img in our own format, to name implied by filename
load(klass, filename[, mmap, keep_file_open]) class method to create image from filename filename
make_file_map(klass[, mapping]) Class method to make files holder for this image type
make_gif(gifpath[, index, name]) Plots nifti data as png and compiles as gif
orthoview() Plot the image using OrthoSlicer3D
path_maybe_image(klass, filename[, sniff, ...]) Return True if filename may be image matching this class
plot_anat([pdfpath, index]) Plots nifti data
plot_glass_brain([pdfpath, index]) Plots nifti data
save(filepath) Save file to disk
set_data_dtype(dtype)
set_filename(filename) Sets the files in the object from a given filename
set_qform(affine[, code, strip_shears]) Set qform header values from 4x4 affine
set_sform(affine[, code]) Set sform transform from 4x4 affine
to_file_map([file_map]) Write image to file_map or contained self.file_map
to_filename(filename) Write image to files implied by filename string
to_files([file_map]) to_files method is deprecated.
to_filespec(filename) to_filespec method is deprecated.
uncache() Delete any cached read of data from proxied data
update_header() Harmonize header with image data and affine

Attributes

affine
dataobj
files_types
header
in_memory True when any array data is in memory cache
makeable
rw
shape
valid_exts