Skip to content

Commit 5808cc8

Browse files
committed
Merge branch 'fix/ImportsFromNipypeTesting' into fix/MinorErrorsNewInstaller
2 parents d5730c7 + 7975dc5 commit 5808cc8

File tree

8 files changed

+117
-11
lines changed

8 files changed

+117
-11
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Upcoming release 0.13
22
=====================
33

4+
* ENH: Add AFNI 3dNote interface (https://github.com/nipy/nipype/pull/1637)
45
* FIX: Minor bugfixes related to unicode literals (https://github.com/nipy/nipype/pull/1656)
56
* ENH: Add a DVARS calculation interface (https://github.com/nipy/nipype/pull/1606)
67
* ENH: New interface to b0calc of FSL-POSSUM (https://github.com/nipy/nipype/pull/1399)

docker/nipype_test/Dockerfile_py27

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ RUN chmod +x /usr/bin/run_*
4040
# Speed up building
4141
RUN mkdir -p /root/src/nipype
4242
COPY requirements.txt /root/src/nipype/requirements.txt
43-
RUN pip install -r /root/src/nipype/requirements.txt
43+
RUN pip install -r /root/src/nipype/requirements.txt && \
44+
sed -i 's/\(backend *: \).*$/\1Agg/g' /usr/local/miniconda/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
4445

4546
# Re-install nipype
4647
COPY . /root/src/nipype

docker/nipype_test/Dockerfile_py34

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ RUN rm -r ${FSLDIR}/bin/imglob && \
4545
# Speed up building
4646
RUN mkdir -p /root/src/nipype
4747
COPY requirements.txt /root/src/nipype/requirements.txt
48-
RUN pip install -r /root/src/nipype/requirements.txt
48+
RUN pip install -r /root/src/nipype/requirements.txt && \
49+
sed -i 's/\(backend *: \).*$/\1Agg/g' /usr/local/miniconda/lib/python3.4/site-packages/matplotlib/mpl-data/matplotlibrc
4950

5051
# Re-install nipype
5152
COPY . /root/src/nipype

docker/nipype_test/Dockerfile_py35

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ RUN rm -r ${FSLDIR}/bin/imglob && \
4343
# Speed up building
4444
RUN mkdir -p /root/src/nipype
4545
COPY requirements.txt /root/src/nipype/requirements.txt
46-
RUN pip install -r /root/src/nipype/requirements.txt
46+
RUN pip install -r /root/src/nipype/requirements.txt && \
47+
sed -i 's/\(backend *: \).*$/\1Agg/g' /usr/local/miniconda/lib/python3.5/site-packages/matplotlib/mpl-data/matplotlibrc
4748

4849
# Re-install nipype
4950
COPY . /root/src/nipype

nipype/interfaces/afni/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
Fim, BlurInMask, Autobox, TCorrMap, Bandpass, Retroicor,
1616
TCorrelate, TCorr1D, BrickStat, ROIStats, AutoTcorrelate,
1717
AFNItoNIFTI, Eval, Means, Hist, FWHMx, OutlierCount,
18-
QualityIndex)
18+
QualityIndex, Notes)
1919
from .svm import (SVMTest, SVMTrain)

nipype/interfaces/afni/preprocess.py

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from ...utils.filemanip import (load_json, save_json, split_filename)
2121
from ..base import (
2222
CommandLineInputSpec, CommandLine, Directory, TraitedSpec,
23-
traits, isdefined, File, InputMultiPath, Undefined)
23+
traits, isdefined, File, InputMultiPath, Undefined, Str)
2424

2525
from .base import (
2626
AFNICommandBase, AFNICommand, AFNICommandInputSpec, AFNICommandOutputSpec,
@@ -2102,7 +2102,6 @@ class CalcInputSpec(AFNICommandInputSpec):
21022102
other = File(desc='other options', argstr='')
21032103

21042104

2105-
21062105
class Calc(AFNICommand):
21072106
"""This program does voxel-by-voxel arithmetic on 3D datasets
21082107
@@ -2326,7 +2325,7 @@ class AutoboxInputSpec(AFNICommandInputSpec):
23262325
cropping box, and will clip off small isolated blobs.""")
23272326

23282327

2329-
class AutoboxOuputSpec(TraitedSpec): # out_file not mandatory
2328+
class AutoboxOutputSpec(TraitedSpec): # out_file not mandatory
23302329
x_min = traits.Int()
23312330
x_max = traits.Int()
23322331
y_min = traits.Int()
@@ -2357,7 +2356,7 @@ class Autobox(AFNICommand):
23572356

23582357
_cmd = '3dAutobox'
23592358
input_spec = AutoboxInputSpec
2360-
output_spec = AutoboxOuputSpec
2359+
output_spec = AutoboxOutputSpec
23612360

23622361
def aggregate_outputs(self, runtime=None, needed_outputs=None):
23632362
outputs = self._outputs()
@@ -2923,7 +2922,6 @@ class OutlierCountOutputSpec(TraitedSpec):
29232922
keep_extension=False, position=-1, desc='capture standard output')
29242923

29252924

2926-
29272925
class OutlierCount(CommandLine):
29282926
"""Create a 3D dataset from 2D image files using AFNI to3d command
29292927
@@ -2989,8 +2987,7 @@ class QualityIndexInputSpec(CommandLineInputSpec):
29892987

29902988

29912989
class QualityIndexOutputSpec(TraitedSpec):
2992-
out_file = File(desc='file containing the caputured standard output')
2993-
2990+
out_file = File(desc='file containing the captured standard output')
29942991

29952992

29962993
class QualityIndex(CommandLine):
@@ -3013,3 +3010,56 @@ class QualityIndex(CommandLine):
30133010
_cmd = '3dTqual'
30143011
input_spec = QualityIndexInputSpec
30153012
output_spec = QualityIndexOutputSpec
3013+
3014+
3015+
class NotesInputSpec(AFNICommandInputSpec):
3016+
in_file = File(desc='input file to 3dNotes',
3017+
argstr='%s',
3018+
position=-1,
3019+
mandatory=True,
3020+
exists=True,
3021+
copyfile=False)
3022+
add = Str(desc='note to add',
3023+
argstr='-a "%s"')
3024+
add_history = Str(desc='note to add to history',
3025+
argstr='-h "%s"',
3026+
xor=['rep_history'])
3027+
rep_history = Str(desc='note with which to replace history',
3028+
argstr='-HH "%s"',
3029+
xor=['add_history'])
3030+
delete = traits.Int(desc='delete note number num',
3031+
argstr='-d %d')
3032+
ses = traits.Bool(desc='print to stdout the expanded notes',
3033+
argstr='-ses')
3034+
out_file = File(desc='output image file name',
3035+
argstr='%s')
3036+
3037+
3038+
class Notes(CommandLine):
3039+
"""
3040+
A program to add, delete, and show notes for AFNI datasets.
3041+
3042+
For complete details, see the `3dNotes Documentation.
3043+
<http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dNotes.html>
3044+
3045+
Examples
3046+
========
3047+
3048+
>>> from nipype.interfaces import afni
3049+
>>> notes = afni.Notes()
3050+
>>> notes.inputs.in_file = "functional.HEAD"
3051+
>>> notes.inputs.add = "This note is added."
3052+
>>> notes.inputs.add_history = "This note is added to history."
3053+
>>> notes.cmdline #doctest: +IGNORE_UNICODE
3054+
'3dNotes -a "This note is added." -h "This note is added to history." functional.HEAD'
3055+
>>> res = notes.run() # doctest: +SKIP
3056+
"""
3057+
3058+
_cmd = '3dNotes'
3059+
input_spec = NotesInputSpec
3060+
output_spec = AFNICommandOutputSpec
3061+
3062+
def _list_outputs(self):
3063+
outputs = self.output_spec().get()
3064+
outputs['out_file'] = os.path.abspath(self.inputs.in_file)
3065+
return outputs
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from ....testing import assert_equal
3+
from ..preprocess import Notes
4+
5+
6+
def test_Notes_inputs():
7+
input_map = dict(add=dict(argstr='-a "%s"',
8+
),
9+
add_history=dict(argstr='-h "%s"',
10+
xor=[u'rep_history'],
11+
),
12+
args=dict(argstr='%s',
13+
),
14+
delete=dict(argstr='-d %d',
15+
),
16+
environ=dict(nohash=True,
17+
usedefault=True,
18+
),
19+
ignore_exception=dict(nohash=True,
20+
usedefault=True,
21+
),
22+
in_file=dict(argstr='%s',
23+
copyfile=False,
24+
mandatory=True,
25+
position=-1,
26+
),
27+
out_file=dict(argstr='%s',
28+
),
29+
outputtype=dict(),
30+
rep_history=dict(argstr='-HH "%s"',
31+
xor=[u'add_history'],
32+
),
33+
ses=dict(argstr='-ses',
34+
),
35+
terminal_output=dict(nohash=True,
36+
),
37+
)
38+
inputs = Notes.input_spec()
39+
40+
for key, metadata in list(input_map.items()):
41+
for metakey, value in list(metadata.items()):
42+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
43+
44+
45+
def test_Notes_outputs():
46+
output_map = dict(out_file=dict(),
47+
)
48+
outputs = Notes.output_spec()
49+
50+
for key, metadata in list(output_map.items()):
51+
for metakey, value in list(metadata.items()):
52+
yield assert_equal, getattr(outputs.traits()[key], metakey), value

nipype/testing/data/functional.HEAD

Whitespace-only changes.

0 commit comments

Comments
 (0)