Skip to content

Commit

Permalink
Rename the FNIRT registration technique to FSL.
Browse files Browse the repository at this point in the history
  • Loading branch information
FredLoney committed Jun 26, 2017
1 parent d2bf7d1 commit 80ac075
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
31 changes: 16 additions & 15 deletions qipipe/pipeline/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
ANTS_INITIALIZER_CONF_SECTION = 'ants.AffineInitializer'
"""The initializer ANTs registration configuration sections."""

FNIRT_CONF_SECTIONS = ['fsl.FLIRT', 'fsl.FNIRT']
"""The FNIRT registration configuration sections."""
FSL_CONF_SECTIONS = ['fsl.FLIRT', 'fsl.FNIRT']
"""The FSL registration configuration sections."""


def run(subject, session, scan, reference, *in_files, **opts):
Expand Down Expand Up @@ -91,23 +91,24 @@ class RegistrationWorkflow(WorkflowBase):
Three registration techniques are supported:
- ``ants``: ANTS_ SyN_ symmetric normalization diffeomorphic registration
(default)
- ``ants``: ANTS_ SyN_ symmetric normalization diffeomorphic
registration (default)
- ``fnirt``: FSL_ FNIRT_ non-linear registration
- ``fsl``: FSL_ FNIRT_ non-linear registration
- ``mock``: Test technique which copies each input scan image to the
output image file
- ``mock``: Test technique which copies each input scan image to
the output image file
The optional workflow configuration file can contain overrides for the
Nipype interface inputs in the following sections:
The optional workflow configuration file can contain overrides for
the Nipype interface inputs in the following sections:
- ``AffineInitializer``: the :class:`qipipe.interfaces.ants.utils.AffineInitializer`
options
- ``AffineInitializer``: the
:class:`qipipe.interfaces.ants.utils.AffineInitializer` options
- ``ants.Registration``: the ANTs `Registration interface`_ options
- ``ants.ApplyTransforms``: the ANTs `ApplyTransform interface`_ options
- ``ants.ApplyTransforms``: the ANTs `ApplyTransform interface`_
options
- ``fsl.FNIRT``: the FSL `FNIRT interface`_ options
Expand Down Expand Up @@ -515,8 +516,8 @@ def _create_realignment_workflow(self, **opts):
# Copy the meta-data.
realign_wf.connect(symlink, 'out_file', copy_meta, 'dest_file')

elif self.technique == 'fnirt':
self.profile_sections = FNIRT_CONF_SECTIONS
elif self.technique == 'fsl':
self.profile_sections = FSL_CONF_SECTIONS

# Make the affine transformation.
flirt = pe.Node(fsl.FLIRT(), name='flirt')
Expand Down Expand Up @@ -586,7 +587,7 @@ def _create_profile(technique, configuration, sections, reference, dest):
# The reference is the XNAT file name without a directory.
_, prf_reference = os.path.split(reference)
# The correct technique names.
TECHNIQUE_NAMES = dict(ants='ANTs', fnirt='FNIRT', mock='Mock')
TECHNIQUE_NAMES = dict(ants='ANTs', fsl='FSL', mock='Mock')
prf_technique = TECHNIQUE_NAMES.get(technique.lower(), technique)
# Replace the technique in configuration keys for consistency.
tech_pat = "$%s\." % technique
Expand Down
21 changes: 12 additions & 9 deletions test/unit/helpers/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from nose.tools import (assert_true, assert_equal, assert_not_equal, assert_is_not_none)
from qiutil.ast_config import read_config
from qipipe.helpers import metadata
from qipipe.helpers.constants import CONF_DIR
from qipipe.pipeline.registration import FNIRT_CONF_SECTIONS
from qipipe.pipeline.registration import FSL_CONF_SECTIONS
from ... import ROOT

CONF_DIR = os.path.abspath(os.path.join(ROOT, 'conf'))

RESULTS = os.path.join(ROOT, 'results', 'helpers')


Expand All @@ -19,15 +20,17 @@ def tearDown(self):
shutil.rmtree(RESULTS, True)

def test_create_profile(self):
in_file = os.path.join(CONF_DIR, 'reg_test.cfg')
in_file = os.path.join(CONF_DIR, 'registration.cfg')
in_cfg = dict(read_config(in_file))
dest = os.path.join(RESULTS, 'reg_test.cfg')
self.profile = metadata.create_profile(in_cfg, FNIRT_CONF_SECTIONS,
dest=dest)
assert_true(os.path.exists(dest),
"The profile was not created")
dest = os.path.join(RESULTS, 'registration.cfg')
profile = metadata.create_profile(in_cfg, FSL_CONF_SECTIONS,
dest=dest)
assert_equal(profile, dest, 'The profile path is incorrect')
assert_true(os.path.exists(dest), 'The profile was not created')
prf_cfg = dict(read_config(dest))
section_map = {s: s.split('.')[-1] for s in FNIRT_CONF_SECTIONS}
section_map = {
s: 'fsl ' + s.split('.')[-1] for s in FSL_CONF_SECTIONS
}
prf_sections = prf_cfg.keys()
assert_equal(set(prf_sections), set(section_map.values()),
"The profile sections are incorrect: %s" % prf_sections)
Expand Down

0 comments on commit 80ac075

Please sign in to comment.