Skip to content

Commit

Permalink
Created Transform class for motion correction
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Kaifosh committed Jan 16, 2015
1 parent 961c3de commit 28ee215
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions sima/motion/transform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import abc


class Transform(object):
"""Abstract class for geometric transforms."""
__metaclass__ = abc.ABCMeta

@abc.abstractmethod
def apply(self, source, grid=None):
"""Apply the transform to raw source data.
Parameters
----------
source : np.ndarray
grid :
Returns
-------
transformed : np.ndarray
"""
pass


class InvertibleTransform(Transform):
__metaclass__ = abc.ABCMeta

@abc.abstractmethod
def inverse(self):
pass


class DifferentiableTransform(Transform):
__metaclass__ = abc.ABCMeta

@abc.abstractmethod
def jacobian(self):
pass


class NullTransform(Transform):
"""Class to represent a null transform.
This may be useful to indicate that a transform could not be estimated.
It could return a grid of all NaN values when applied.
"""
pass


class Identity(Transform):
pass


class WithinFrameTranslation(Transform):
pass

0 comments on commit 28ee215

Please sign in to comment.