spyrit.core.warp

Stores deformation fields and warps images.

Contains DeformationField and AffineDeformationField, a subclass of the former. These classes are used to warp images according to a deformation field that is stored as as class attribute. They can be fed an image (called “original image”) and will return the warped image (”deformed image”).

The function that maps the original image pixel coordinates to the deformed image pixel coordinates is called the “deformation field” and is noted \(v\). The function that maps the pixels of the deformed image to the pixels of the original image is called the “inverse deformation field” and is noted \(u\). The deformation field and the inverse deformation field are related by the equation \(v = u^{-1}\).

Here, the two classes use and store the inverse deformation field \(u\) as a class attribute.

Classes

AffineDeformationField(func, time_vector, ...)

Stores an affine deformation field andn uses it to compute a discrete deformation field DeformationField.

DeformationField(field)

Stores a discrete deformation field as a \((b,h,w,2)\) tensor.