Skip to content

Fix elastix documentation #905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 1, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 25 additions & 15 deletions nipype/interfaces/elastix/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# @Author: oesteban - code@oscaresteban.es
# @Date: 2014-06-02 12:06:50
# @Last Modified by: oesteban
# @Last Modified time: 2014-06-17 10:19:23
# @Last Modified time: 2014-09-01 21:03:57
"""
Interfaces to perform image registrations and to apply the resulting
displacement maps to images and points.
Expand All @@ -18,8 +18,6 @@

from ..base import (CommandLine, CommandLineInputSpec, isdefined,
TraitedSpec, File, traits, InputMultiPath)


from base import ElastixBaseInputSpec

from ... import logging
Expand All @@ -31,10 +29,8 @@ class RegistrationInputSpec(ElastixBaseInputSpec):
desc='fixed image')
moving_image = File(exists=True, mandatory=True, argstr='-m %s',
desc='moving image')

parameters = InputMultiPath(File(exists=True), mandatory=True, argstr='-p %s...',
desc='parameter file, elastix handles 1 or more -p')

fixed_mask = File(exists=True, argstr='-fMask %s', desc='mask for fixed image')
moving_mask = File(exists=True, argstr='-mMask %s', desc='mask for moving image')
initial_transform = File(exists=True, argstr='-t0 %s',
Expand All @@ -51,7 +47,8 @@ class RegistrationOutputSpec(TraitedSpec):


class Registration(CommandLine):
"""Elastix nonlinear registration interface
"""
Elastix nonlinear registration interface

Example
-------
Expand All @@ -63,6 +60,8 @@ class Registration(CommandLine):
>>> reg.inputs.parameters = ['elastix.txt']
>>> reg.cmdline
'elastix -f fixed1.nii -m moving1.nii -out ./ -p elastix.txt'


"""

_cmd = 'elastix'
Expand Down Expand Up @@ -140,17 +139,21 @@ class ApplyWarpOutputSpec(TraitedSpec):
warped_file = File(desc='input moving image warped to fixed image')

class ApplyWarp(CommandLine):
"""Use `transformix` to apply a transform on an input image.
"""
Use ``transformix`` to apply a transform on an input image.
The transform is specified in the transform-parameter file.

Example::
Example
-------

>>> from nipype.interfaces.elastix import ApplyWarp
>>> reg = ApplyWarp()
>>> reg.inputs.moving_image = 'moving1.nii'
>>> reg.inputs.transform_file = 'TransformParameters.0.txt'
>>> reg.cmdline
'transformix -in moving1.nii -out ./ -tp TransformParameters.0.txt'


"""

_cmd = 'transformix'
Expand All @@ -170,22 +173,26 @@ class AnalyzeWarpInputSpec(ElastixBaseInputSpec):


class AnalyzeWarpOutputSpec(TraitedSpec):
disp_field = File(exists=True, desc='displacements field')
jacdet_map = File(exists=True, desc='det(Jacobian) map')
jacmat_map = File(exists=True, desc='Jacobian matrix map')
disp_field = File(desc='displacements field')
jacdet_map = File(desc='det(Jacobian) map')
jacmat_map = File(desc='Jacobian matrix map')

class AnalyzeWarp(CommandLine):
"""Use `transformix` to get details from the input transform (generate
"""
Use transformix to get details from the input transform (generate
the corresponding deformation field, generate the determinant of the
Jacobian map or the Jacobian map itself)

Example::
Example
-------

>>> from nipype.interfaces.elastix import AnalyzeWarp
>>> reg = AnalyzeWarp()
>>> reg.inputs.transform_file = 'TransformParameters.0.txt'
>>> reg.cmdline
'transformix -def all -jac all -jacmat all -out ./ -tp TransformParameters.0.txt'


"""

_cmd = 'transformix -def all -jac all -jacmat all'
Expand Down Expand Up @@ -213,17 +220,20 @@ class PointsWarpOutputSpec(TraitedSpec):
warped_file = File(desc='input points displaced in fixed image domain')

class PointsWarp(CommandLine):
"""Use `transformix` to apply a transform on an input point set.
"""Use ``transformix`` to apply a transform on an input point set.
The transform is specified in the transform-parameter file.

Example::
Example
-------

>>> from nipype.interfaces.elastix import PointsWarp
>>> reg = PointsWarp()
>>> reg.inputs.points_file = 'surf1.vtk'
>>> reg.inputs.transform_file = 'TransformParameters.0.txt'
>>> reg.cmdline
'transformix -out ./ -def surf1.vtk -tp TransformParameters.0.txt'


"""

_cmd = 'transformix'
Expand Down
7 changes: 5 additions & 2 deletions nipype/interfaces/elastix/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# @Author: oesteban - code@oscaresteban.es
# @Date: 2014-06-17 10:17:07
# @Last Modified by: oesteban
# @Last Modified time: 2014-06-27 10:25:36
# @Last Modified time: 2014-09-01 21:05:33
"""
Generic interfaces to manipulate registration parameters files, including
transform files (to configure warpings)
Expand Down Expand Up @@ -51,14 +51,17 @@ class EditTransform(BaseInterface):
"""
Manipulates an existing transform file generated with elastix

Example::
Example
-------

>>> from nipype.interfaces.elastix import EditTransform
>>> tfm = EditTransform()
>>> tfm.inputs.transform_file = 'TransformParameters.0.txt'
>>> tfm.inputs.reference_image = 'fixed1.nii'
>>> tfm.inputs.output_type = 'unsigned char'
>>> tfm.run() # doctest: +SKIP


"""

input_spec = EditTransformInputSpec
Expand Down