Base

Common interface for transforms.

classnitransforms.base.ImageGrid(image)[source]

Class to represent spaces of gridded data (images).

propertyaffine

Access the indexes-to-RAS affine.

propertyheader

Access the original reference’s header.

index(x)[source]

Get the image array’s indexes corresponding to coordinates.

propertyinverse

Access the RAS-to-indexes affine.

propertyndcoords

List the physical coordinates of this gridded space samples.

propertyndindex

List the indexes corresponding to the space grid.

ras(ijk)[source]

Get RAS+ coordinates from input indexes.

classnitransforms.base.SampledSpatialData(dataset)[source]

Represent sampled spatial data: regularly gridded (images) and surfaces.

propertyndcoords

List the physical coordinates of this sample.

propertyndim

Access the number of dimensions.

propertynpoints

Access the total number of voxels.

propertyshape

Access the space’s size of each dimension.

classnitransforms.base.SpatialReference[source]

Factory to create spatial references.

staticfactory(dataset)[source]

Create a reference for spatial transforms.

classnitransforms.base.SurfaceMesh(dataset)[source]

Class to represent surface meshes.

check_sphere(tolerance=1.001)[source]

Check sphericity of surface.Based onhttps://github.com/Washington-University/workbench/blob/7ba3345d161d567a4b628ceb02ab4471fc96cb20/src/Files/SurfaceResamplingHelper.cxx#L503

classnitransforms.base.TransformBase(reference=None)[source]

Abstract image class to represent transforms.

apply(*args,**kwargs)[source]

Apply the transform to a dataset.

Deprecated. Please usenitransforms.resampling.apply instead.

map(x,inverse=False)[source]

Apply\(y = f(x)\).

TransformBase implements the identity transform.

Parameters:
  • x (N x D numpy.ndarray) – Input RAS+ coordinates (i.e., physical coordinates).

  • inverse (bool) – IfTrue, apply the inverse transform\(x = f^{-1}(y)\).

Returns:

y – Transformed (mapped) RAS+ coordinates (i.e., physical coordinates).

Return type:

N x D numpy.ndarray

propertyndim

Access the dimensions of the reference space.

propertyreference

Access a reference space where data will be resampled onto.

to_filename(filename,fmt='X5',moving=None,x5_inverse=False)[source]

Store the transform in BIDS-Transforms HDF5 file format (.x5).

exceptionnitransforms.base.TransformError[source]

A custom exception for transforms.