Skip to content

Commit 9b9c3db

Browse files
committed
Added documentation and doctests.
1 parent a64071b commit 9b9c3db

File tree

3 files changed

+59
-23
lines changed

3 files changed

+59
-23
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,59 +2349,95 @@ class Warp(AFNICommand):
23492349
output_spec = AFNICommandOutputSpec
23502350

23512351

2352-
class QwarpInputSpec(CommandLineInputSpec):
2352+
class QwarpPlusMinusInputSpec(CommandLineInputSpec):
23532353
source_file = File(
2354-
desc='',
2354+
desc='Source image (opposite phase encoding direction than base image).',
23552355
argstr='-source %s',
23562356
mandatory=True,
23572357
exists=True,
23582358
copyfile=False)
23592359
base_file = File(
2360-
desc='',
2360+
desc='Base image (opposite phase encoding direction than source image).',
23612361
argstr='-base %s',
23622362
mandatory=True,
23632363
exists=True,
23642364
copyfile=False)
2365-
plusminus = traits.Bool(
2366-
desc='',
2367-
argstr='-plusminus')
2368-
pmNAMES = traits.List(traits.Str(),
2369-
desc='',
2370-
argstr='-pmNAMES %')
23712365
pblur = traits.List(traits.Float(),
2372-
desc='',
2373-
argstr='-pblur %s')
2366+
desc='The fraction of the patch size that'
2367+
'is used for the progressive blur by providing a '
2368+
'value between 0 and 0.25. If you provide TWO '
2369+
'values, the first fraction is used for '
2370+
'progressively blurring the base image and the '
2371+
'second for the source image.',
2372+
argstr='-pblur %g',
2373+
minlen=1,
2374+
maxlen=2)
23742375
blur = traits.List(traits.Float(),
2375-
desc='',
2376-
argstr='-blur %s')
2376+
desc="Gaussian blur the input images by (FWHM) voxels "
2377+
"before doing the alignment (the output dataset "
2378+
"will not be blurred). The default is 2.345 (for "
2379+
"no good reason). Optionally, you can provide 2 "
2380+
"values, and then the first one is applied to the "
2381+
"base volume, the second to the source volume. A "
2382+
"negative blur radius means to use 3D median "
2383+
"filtering, rather than Gaussian blurring. This "
2384+
"type of filtering will better preserve edges, "
2385+
"which can be important in alignment.",
2386+
argstr='-blur %g',
2387+
minlen=1,
2388+
maxlen=2)
23772389
noweight = traits.Bool(
2378-
desc='',
2390+
desc='If you want a binary weight (the old default), use this option.'
2391+
'That is, each voxel in the base volume automask will be'
2392+
'weighted the same in the computation of the cost functional.',
23792393
argstr='-noweight')
23802394
minpatch = traits.Int(
2381-
desc='',
2395+
desc="Set the minimum patch size for warp searching to 'mm' voxels.",
23822396
argstr='-minpatch %d')
23832397
nopadWARP = traits.Bool(
2384-
desc='',
2398+
desc='If for some reason you require the warp volume to'
2399+
'match the base volume, then use this option to have the output'
2400+
'WARP dataset(s) truncated.',
23852401
argstr='-nopadWARP')
23862402

23872403

2388-
class QwarpOutputSpec(TraitedSpec):
2404+
class QwarpPlusMinusOutputSpec(TraitedSpec):
23892405
warped_source = File(
2390-
desc='',
2406+
desc='Undistorted source file.',
23912407
exists=True)
23922408
warped_base = File(
2393-
desc='',
2409+
desc='Undistorted source file.',
23942410
exists=True)
23952411
source_warp = File(
2396-
desc='',
2412+
desc="Field suceptibility correction warp (in 'mm') for source image.",
23972413
exists=True)
23982414
base_warp = File(
2399-
desc='',
2415+
desc="Field suceptibility correction warp (in 'mm') for base image.",
24002416
exists=True)
24012417

24022418

2403-
class Qwarp(CommandLine):
2404-
_cmd = '3dQwarp -prefix Qwarp.nii.gz'
2419+
class QwarpPlusMinus(CommandLine):
2420+
"""A version of 3dQwarp for performing field susceptibility correction
2421+
using two images with opposing phase encoding directions.
2422+
2423+
For complete details, see the `3dQwarp Documentation.
2424+
<https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dQwarp.html>`_
2425+
2426+
Examples
2427+
========
2428+
2429+
>>> from nipype.interfaces import afni
2430+
>>> qwarp = afni.QwarpPlusMinus()
2431+
>>> qwarp.inputs.source_file = 'sub-01_dir-LR_epi.nii.gz'
2432+
>>> qwarp.inputs.nopadWARP = True
2433+
>>> qwarp.inputs.base_file = 'sub-01_dir-RL_epi.nii.gz'
2434+
>>> qwarp.cmdline # doctest: +ALLOW_UNICODE
2435+
'3dQwarp -prefix Qwarp.nii.gz -plusminus -source sub-01_dir-LR_epi.nii.gz
2436+
-base sub-01_dir-RL_epi.nii.gz'
2437+
>>> res = warp.run() # doctest: +SKIP
2438+
2439+
"""
2440+
_cmd = '3dQwarp -prefix Qwarp.nii.gz -plusminus'
24052441
input_spec = QwarpInputSpec
24062442
output_spec = QwarpOutputSpec
24072443

nipype/testing/data/sub-01_dir-LR_epi.nii.gz

Whitespace-only changes.

nipype/testing/data/sub-01_dir-RL_epi.nii.gz

Whitespace-only changes.

0 commit comments

Comments
 (0)