Skip to content

Commit

Permalink
Changed name of cortex.align.fs_manual to cortex.align.manual (#434)
Browse files Browse the repository at this point in the history
* Changed name of cortex.align.fs_manual to cortex.align.manual, with deprecation warnigns and legacy function fs_manual() that now just maps to manual()

* Apply suggestions from code review

Co-authored-by: Tom Dupré la Tour <[email protected]>
  • Loading branch information
marklescroart and TomDLT authored Apr 1, 2022
1 parent dec4ebd commit bb2a4fc
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions cortex/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from builtins import input
import warnings

def manual(subject, xfmname, reference=None, **kwargs):
def mayavi_manual(subject, xfmname, reference=None, **kwargs):
"""Open GUI for manually aligning a functional volume to the cortical surface for `subject`. This
creates a new transform called `xfm`. The name of a nibabel-readable file (e.g. nii) should be
supplied as `reference`. This image will be copied into the database.
Expand Down Expand Up @@ -36,6 +36,13 @@ def manual(subject, xfmname, reference=None, **kwargs):
m : 2D ndarray, shape (4, 4)
Transformation matrix.
"""

warnings.warn("This is the old cortex.align.manual(), and has been "
"deprecated. Please use the new cortex.align.manual() "
"(previously cortex.align.fs_manual()), which uses "
"the `freeview` program in the freesurfer suite, to "
"perform manual alignment.", DeprecationWarning
)
from .database import db
from .mayavi_aligner import get_aligner
def save_callback(aligner):
Expand Down Expand Up @@ -83,7 +90,16 @@ def view_callback(aligner):

return m

def fs_manual(subject, xfmname, output_name="register.lta", wm_color="yellow",

def fs_manual(subject, xfmname, **kwargs):
"""Legacy name for cortex.align.manual. Please use that function, and see the help there."""
warnings.warn(("Deprecated name - function has been renamed cortex.align.manual"
"This function name will be removed in a future release."
), DeprecationWarning)
return manual(subject, xfmname, **kwargs)


def manual(subject, xfmname, output_name="register.lta", wm_color="yellow",
pial_color="blue", wm_surface='white', noclean=False, reference=None, inspect_only=False):
"""Open Freesurfer FreeView GUI for manually aligning/adjusting a functional
volume to the cortical surface for `subject`. This creates a new transform
Expand All @@ -102,6 +118,9 @@ def fs_manual(subject, xfmname, output_name="register.lta", wm_color="yellow",
ALSO: all the freesurfer environment stuff shouldn't be necessary, except that
I don't know what vox2ras-tkr is doing.
Renamed from fs_manual() to manual(), since old manual() function was no longer
supported (or functional) for a while due to changes in mayavi.
Parameters
----------
Expand Down

0 comments on commit bb2a4fc

Please sign in to comment.