labs.datasets.transforms.transform

Module: labs.datasets.transforms.transform

Inheritance diagram for nipy.labs.datasets.transforms.transform:

Inheritance diagram of nipy.labs.datasets.transforms.transform

The base Transform class.

This class defines the Transform interface and can be subclassed to define more clever composition logic.

Classes

CompositionError

class nipy.labs.datasets.transforms.transform.CompositionError

Bases: Exception

The Exception raised when composing transforms with non matching respective input and output word spaces.

__init__(*args, **kwargs)
args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

Transform

class nipy.labs.datasets.transforms.transform.Transform(input_space, output_space, mapping=None, inverse_mapping=None)

Bases: object

A transform is a representation of a transformation from one 3D space to another. It is composed of a coordinate mapping, or its inverse, as well as the name of the input and output spaces.

The Transform class is the base class for transformations and defines the transform object API.

__init__(input_space, output_space, mapping=None, inverse_mapping=None)

Create a new transform object.

Parameters:
mapping: callable f(x, y, z)

Callable mapping coordinates from the input space to the output space. It should take 3 numbers or arrays, and return 3 numbers or arrays of the same shape.

inverse_mapping: callable f(x, y, z)

Callable mapping coordinates from the output space to the input space. It should take 3 numbers or arrays, and return 3 numbers or arrays of the same shape.

input_space: string

Name of the input space

output_space: string

Name of the output space

Notes

You need to supply either the mapping or the inverse mapping.

composed_with(transform)

Returns a new transform obtained by composing this transform with the one provided.

Parameters:
transform: nipy.core.transforms.transform object

The transform to compose with.

get_inverse()

Return the inverse transform.

input_space = ''
inverse_mapping = None
mapping = None
output_space = ''