Skip to content

Commit b77b4bc

Browse files
committed
Merge pull request #1152 from mick-d/FSLgeom
New interface for fslcpgeom
2 parents 22b3182 + 820f383 commit b77b4bc

File tree

4 files changed

+72
-2
lines changed

4 files changed

+72
-2
lines changed

CHANGES

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

4+
* ENH: New interface for FSL fslcpgeom utility (https://github.com/nipy/nipype/pull/1152)
45
* FIX: Enable absolute path definitions in DCMStack (https://github.com/nipy/nipype/pull/1089,
56
replaced by https://github.com/nipy/nipype/pull/1093)
67
* ENH: New mesh.MeshWarpMaths to operate on surface-defined warpings

nipype/interfaces/fsl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
PlotTimeSeries, PlotMotionParams, ConvertXFM,
1818
SwapDimensions, PowerSpectrum, Reorient2Std,
1919
Complex, InvWarp, WarpUtils, ConvertWarp, WarpPoints,
20-
WarpPointsToStd, RobustFOV)
20+
WarpPointsToStd, RobustFOV, CopyGeom)
2121

2222
from .epi import (PrepareFieldmap, TOPUP, ApplyTOPUP, Eddy, EPIDeWarp,
2323
SigLoss, EddyCorrect, EpiReg)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from nipype.testing import assert_equal
3+
from nipype.interfaces.fsl.utils import CopyGeom
4+
5+
def test_CopyGeom_inputs():
6+
input_map = dict(args=dict(argstr='%s',
7+
),
8+
dest_file=dict(argstr='%s',
9+
copyfile=True,
10+
mandatory=True,
11+
position=1,
12+
),
13+
environ=dict(nohash=True,
14+
usedefault=True,
15+
),
16+
ignore_dims=dict(argstr='-d',
17+
position='-1',
18+
),
19+
ignore_exception=dict(nohash=True,
20+
usedefault=True,
21+
),
22+
in_file=dict(argstr='%s',
23+
mandatory=True,
24+
position=0,
25+
),
26+
output_type=dict(),
27+
terminal_output=dict(nohash=True,
28+
),
29+
)
30+
inputs = CopyGeom.input_spec()
31+
32+
for key, metadata in input_map.items():
33+
for metakey, value in metadata.items():
34+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
35+
36+
def test_CopyGeom_outputs():
37+
output_map = dict(out_file=dict(),
38+
)
39+
outputs = CopyGeom.output_spec()
40+
41+
for key, metadata in output_map.items():
42+
for metakey, value in metadata.items():
43+
yield assert_equal, getattr(outputs.traits()[key], metakey), value
44+

nipype/interfaces/fsl/utils.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,36 @@
2626
from ..base import (traits, TraitedSpec, OutputMultiPath, File,
2727
CommandLine, CommandLineInputSpec, isdefined)
2828
from ...utils.filemanip import (load_json, save_json, split_filename,
29-
fname_presuffix)
29+
fname_presuffix, copyfile)
3030

3131
warn = warnings.warn
3232
warnings.filterwarnings('always', category=UserWarning)
3333

34+
class CopyGeomInputSpec(FSLCommandInputSpec):
35+
in_file = File(exists=True, mandatory=True, argstr="%s", position=0,
36+
desc="source image")
37+
dest_file = File(exists=True, mandatory=True, argstr="%s", position=1,
38+
desc="destination image", copyfile=True, output_name='out_file',
39+
name_source='dest_file', name_template='%s')
40+
ignore_dims = traits.Bool(desc=('Do not copy image dimensions'),
41+
argstr='-d', position="-1")
42+
43+
class CopyGeomOutputSpec(TraitedSpec):
44+
out_file = File(exists=True, desc="image with new geometry header")
45+
46+
class CopyGeom(FSLCommand):
47+
"""Use fslcpgeom to copy the header geometry information to another image.
48+
Copy certain parts of the header information (image dimensions, voxel dimensions,
49+
voxel dimensions units string, image orientation/origin or qform/sform info)
50+
from one image to another. Note that only copies from Analyze to Analyze
51+
or Nifti to Nifti will work properly. Copying from different files will result
52+
in loss of information or potentially incorrect settings.
53+
"""
54+
_cmd = "fslcpgeom"
55+
input_spec = CopyGeomInputSpec
56+
output_spec = CopyGeomOutputSpec
57+
58+
3459
class RobustFOVInputSpec(FSLCommandInputSpec):
3560
in_file = File(exists=True,
3661
desc='input filename',

0 commit comments

Comments
 (0)