Skip to content

Commit 1c27d99

Browse files
committed
Add AFNI command 3dNotes.
1. Add 3dNotes to preprocess. It probably belongs in a utils file. 2. Fix typos in QualityIndexOutputSpec and AutoboxOutputSpec. 3. Remove a couple of extra empty lines.
1 parent 0f9a620 commit 1c27d99

File tree

1 file changed

+56
-6
lines changed

1 file changed

+56
-6
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = traits.Str(desc="note to add",
3023+
argstr="-a '%s'")
3024+
add_history = traits.Str(desc="note to add to history",
3025+
argstr="-h '%s'",
3026+
xor=["rep_history"])
3027+
rep_history = traits.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 as 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:
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

0 commit comments

Comments
 (0)