Skip to content

Commit 461bc5e

Browse files
committed
doc: add explanation to doctests [skip ci]
1 parent e59aaa6 commit 461bc5e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

nipype/interfaces/ants/utils.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class ImageMath(ANTSCommand, CopyHeaderInterface):
7878
"""
7979
Operations over images.
8080
81-
Example
82-
-------
81+
Examples
82+
--------
8383
>>> ImageMath(
8484
... op1='structural.nii',
8585
... operation='+',
@@ -104,17 +104,26 @@ class ImageMath(ANTSCommand, CopyHeaderInterface):
104104
... op2='0.005 0.999 256').cmdline
105105
'ImageMath 3 structural_maths.nii TruncateImageIntensity structural.nii 0.005 0.999 256'
106106
107+
By default, Nipype copies headers from the first input image (``op1``)
108+
to the output image.
109+
For the ``PadImage`` operation, the header cannot be copied from inputs to
110+
outputs, and so ``copy_header`` option is automatically set to ``False``.
111+
107112
>>> pad = ImageMath(
108113
... op1='structural.nii',
109-
... operation='PadImage',
110-
... op2='0.005 0.999 256')
114+
... operation='PadImage')
111115
>>> pad.inputs.copy_header
112116
False
113117
118+
While the operation is set to ``PadImage``,
119+
setting ``copy_header = True`` will have no effect.
120+
114121
>>> pad.inputs.copy_header = True
115122
>>> pad.inputs.copy_header
116123
False
117124
125+
For any other operation, ``copy_header`` can be enabled/disabled normally:
126+
118127
>>> pad.inputs.operation = "ME"
119128
>>> pad.inputs.copy_header = True
120129
>>> pad.inputs.copy_header

0 commit comments

Comments
 (0)