-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created Transform class for motion correction
- Loading branch information
Patrick Kaifosh
committed
Jan 16, 2015
1 parent
961c3de
commit 28ee215
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |