Skip to content

WIP: Dtitk #2185

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 30 commits into from
Jan 21, 2018
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6ea8e5d
added interface for dtitk
May 19, 2017
5232552
Added interface for DTITK command-line tools
kesshijordan May 19, 2017
ae59226
Added several docstring tests and untested interfaces
kesshijordan May 19, 2017
f1dc18b
changed relative imports to absolute, fixed docstring tests
kesshijordan May 20, 2017
8b45b9b
Merge remote-tracking branch 'upstream/master' into dtitk
Sep 7, 2017
c7122ac
added init
Sep 7, 2017
7b8b5db
changed input variable names
kesshijordan Sep 15, 2017
1127b4d
added # doctest: +SKIP
kesshijordan Sep 15, 2017
3808fee
Merge remote-tracking branch 'upstream/master' into dtitk
kesshijordan Sep 15, 2017
54d9d1d
added init file
kesshijordan Sep 19, 2017
0a4bda2
fixed variable name changes
kesshijordan Sep 19, 2017
b37f65f
added auto-generated tests
kesshijordan Sep 19, 2017
3182baa
removed .cache from git
kesshijordan Oct 3, 2017
7eaab1c
Merge branch 'master' of https://github.com/nipy/nipype into dtitk
kesshijordan Oct 13, 2017
8812dc7
fixed some changes from mgxd code review, but circle failing so testi…
kesshijordan Oct 13, 2017
6a393ca
testing file naming
kesshijordan Oct 30, 2017
af96a0b
Merge remote-tracking branch 'upstream/master' into dtitk
kesshijordan Oct 30, 2017
d240443
Rigid registration node tested and works
kesshijordan Oct 30, 2017
0807cdb
tested affine
kesshijordan Oct 30, 2017
78821e4
returned to .nii.gz; will deal with .nii later
kesshijordan Dec 2, 2017
948811f
changed output var names
kesshijordan Dec 3, 2017
89628d0
fixed typo
kesshijordan Dec 4, 2017
9c84405
fix typo
kesshijordan Dec 5, 2017
7ad09b8
regenerated tests so var names are updated
kesshijordan Dec 6, 2017
74f736e
Merge branch 'master' into dtitk
mgxd Jan 5, 2018
64f7202
Delete stderr.nipype
kesshijordan Jan 11, 2018
80a4262
Delete stdout.nipype
kesshijordan Jan 11, 2018
b567e0a
Merge remote-tracking branch 'upstream/master' into dtitk
effigies Jan 19, 2018
da31236
make specs
effigies Jan 19, 2018
f60c149
TEST: Drop extra auto test
effigies Jan 19, 2018
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
22 changes: 22 additions & 0 deletions .cache/v/cache/lastfailed
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file isn't necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two quick questions:

  1. There isn't anything in the directories from .cache on: Is there any reason not to remove everything including .cache? (or is it better to just delete lastfailed?)
  2. I see the comment about lastfailed not being necessary: is that the only comment, or is there somewhere else I should be looking for other comments?

Thanks again, @mgxd!
Kesshi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kesshijordan

  1. I believe the .cache directory is created by pytest when running nipype's tests, and this file just serves as a reminder when retrying - you can keep this in your local clone, but it doesn't really serve a purpose on the master repo.
  2. Nope, that's it!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kesshijordan - lastfailed is the only one that's included in the commit. probably got added by mistake. but in general nothing in .cache should be in the commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @satra. I removed the .cache file from git and have pushed the change. @mgxd is there anything else I need to address?

"nipype/algorithms/tests/test_tsnr.py": true,
"nipype/interfaces/dtitk/tests/test_auto_AffineTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py": true,
"nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_RigidTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py": true,
"nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py": true,
"nipype/pipeline/plugins/tests/test_base.py": true,
"nipype/testing/tests/test_utils.py": true,
"nipype/workflows/rsfmri/fsl/tests/test_resting.py": true
}
44 changes: 44 additions & 0 deletions nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..utils import TCatSubBrick


def test_TCatSubBrick_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True,
),
in_files=dict(argstr='%s%s ...',
copyfile=False,
mandatory=True,
position=-1,
),
out_file=dict(argstr='-prefix %s',
genfile=True,
),
outputtype=dict(),
rlt=dict(argstr='-rlt%s',
position=1,
),
terminal_output=dict(nohash=True,
),
)
inputs = TCatSubBrick.input_spec()

for key, metadata in list(input_map.items()):
for metakey, value in list(metadata.items()):
assert getattr(inputs.traits()[key], metakey) == value


def test_TCatSubBrick_outputs():
output_map = dict(out_file=dict(),
)
outputs = TCatSubBrick.output_spec()

for key, metadata in list(output_map.items()):
for metakey, value in list(metadata.items()):
assert getattr(outputs.traits()[key], metakey) == value
15 changes: 15 additions & 0 deletions nipype/interfaces/dtitk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""The dtitk module provides classes for interfacing with the `Diffusion
Tensor Imaging Toolkit (DTI-TK)
<http://dti-tk.sourceforge.net/pmwiki/pmwiki.php>`_ command line tools.

Top-level namespace for dti-tk.
"""

# from .base import ()
from ..dtitk.registration import (RigidTask, AffineTask, DiffeoTask,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from .registration import ... is a bit cleaner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

ComposeXfmTask, diffeoSymTensor3DVolTask,
affSymTensor3DVolTask, affScalarVolTask,
diffeoScalarVolTask)
from ..dtitk.utils import (TVAdjustOriginTask, TVAdjustVoxSpTask,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

SVAdjustVoxSpTask, TVResampleTask, SVResampleTask,
TVtoolTask, BinThreshTask)
81 changes: 81 additions & 0 deletions nipype/interfaces/dtitk/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The dtitk module provides classes for interfacing with the `DTITK
<http://dti-tk.sourceforge.net/pmwiki/pmwiki.php>`_ command line tools.

These are the base tools for working with DTITK.
Preprocessing tools are found in dtitk/preprocess.py
Registration tools are found in dtitk/registration.py

Currently these tools are supported:

* Rigid Tensor Registration
* Affine Tensor Registration
* Diffeomorphic Tensor Registration

Examples
--------
See the docstrings of the individual classes for examples.

"""
from __future__ import print_function, division, unicode_literals, \
absolute_import

import os

from ... import logging
from ...utils.filemanip import fname_presuffix
from ..base import CommandLine
from nipype.interfaces.fsl.base import Info

LOGGER = logging.getLogger('interface')


class CommandLineDtitk(CommandLine):

def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True,
ext=None):
"""Generate a filename based on the given parameters.

The filename will take the form: cwd/basename<suffix><ext>.
If change_ext is True, it will use the extentions specified in
<instance>intputs.output_type.

Parameters
----------
basename : str
Filename to base the new filename on.
cwd : str
Path to prefix to the new filename. (default is os.getcwd())
suffix : str
Suffix to add to the `basename`. (defaults is '' )
change_ext : bool
Flag to change the filename extension to the FSL output type.
(default True)

Returns
-------
fname : str
New filename based on given parameters.

"""

if basename == '':
msg = 'Unable to generate filename for command %s. ' % self.cmd
msg += 'basename is not set!'
raise ValueError(msg)
if cwd is None:
cwd = os.getcwd()
if ext is None:
ext = Info.output_type_to_ext(self.inputs.output_type)
if change_ext:
if suffix:
suffix = ''.join((suffix, ext))
else:
suffix = ext
if suffix is None:
suffix = ''
fname = fname_presuffix(basename, suffix=suffix,
use_ext=False, newpath=cwd)
return fname
Loading