Table Of Contents

Previous topic

core.image.generators

Next topic

core.image.image_list

This Page

core.image.image

Module: core.image.image

Inheritance diagram for nipy.core.image.image:

This module defines the Image class, as well as two functions that create Image instances.

fromarray : create an Image instance from an ndarray

merge_images : create an Image by merging a sequence of Image instance

Class

Image

class nipy.core.image.image.Image(data, coordmap)

Bases: object

The Image class provides the core object type used in nipy. An Image represents a volumetric brain image and provides means for manipulating the image data. Most functions in the image module operate on Image objects.

Notes

Images should be created through the module functions load and fromarray.

Examples

>>> from nipy.core.image import image
>>> from nipy.testing import anatfile
>>> from nipy.io.api import load_image
>>> img = load_image(anatfile)
>>> import numpy as np
>>> img = image.fromarray(np.zeros((21, 64, 64), dtype='int16'),
...                       'kji', 'zxy')
__init__(data, coordmap)

Create an Image object from array and CoordinateMap object.

Images should be created through the module functions load and fromarray.

Parameters:

data : A numpy.ndarray

coordmap : A CoordinateMap Object

See also

load
load Image from a file
save
save Image to a file
fromarray
create an Image from a numpy array
affine
Affine transformation is one exists
coordmap
Coordinate mapping from input coords to output coords
header
The file header dictionary for this image. In order to update the header, you must first make a copy of the header, set the values you wish to change, then set the image header to the updated header.
ndim
Number of data dimensions
shape
Shape of data array

Functions

nipy.core.image.image.fromarray(data, innames, outnames, coordmap=None)

Create an image from a numpy array.

Parameters:

data : numpy array

A numpy array of three dimensions.

names : a list of axis names

coordmap : A CoordinateMap

If not specified, an identity coordinate map is created.

Returns:

image : An Image object

See also

load
function for loading images
save
function for saving images
nipy.core.image.image.merge_images(images, cls=<class 'nipy.core.image.image.Image'>, clobber=False, axis='merge')

Create a new file based image by combining a series of images together. The resulting CoordinateMap are essentially copies of images[0].coordmap

Parameters:

images : [Image]

The list of images to be merged

cls : class

The class of image to create

clobber : bool

Overwrite the file if it already exists

axis : string

Name of the concatenated axis.

Returns:

``cls`` :