Skip to content

Commit 82107dd

Browse files
committed
Merge pull request #1089 from oesteban/fix/DCMStackOutput-1087
Fix DCMStack output
2 parents 2bca6f8 + df63a28 commit 82107dd

File tree

6 files changed

+25
-3
lines changed

6 files changed

+25
-3
lines changed

CHANGES

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

4+
* FIX: Enable absolute path definitions in DCMStack (https://github.com/nipy/nipype/pull/1089)
5+
* ENH: New algorithm: mesh.WarpPoints applies displacements fields to point sets.
6+
* ENH: Improved FieldMap-Based (FMB) workflow for correction of susceptibility distortions
7+
in EPI seqs. (https://github.com/nipy/nipype/pull/1019)
8+
* ENH: Added interface to simulate DWIs using the multi-tensor model
9+
(https://github.com/nipy/nipype/pull/1085)
410
* ENH: New mesh.MeshWarpMaths to operate on surface-defined warpings
511
(https://github.com/nipy/nipype/pull/1016)
612
* FIX: Refactor P2PDistance, change name to ComputeMeshWarp, add regression tests,

nipype/interfaces/dcmstack.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ def sanitize_path_comp(path_comp):
4242
result.append(char)
4343
return ''.join(result)
4444

45+
4546
class NiftiGeneratorBaseInputSpec(TraitedSpec):
4647
out_format = traits.Str(desc="String which can be formatted with "
4748
"meta data to create the output filename(s)")
48-
out_ext = traits.Str('.nii.gz',
49-
usedefault=True,
49+
out_ext = traits.Str('.nii.gz', usedefault=True,
5050
desc="Determines output file type")
51+
use_cwd = traits.Bool(True, usedefault=True,
52+
desc='use interface\'s current working directory')
53+
5154

5255
class NiftiGeneratorBase(BaseInterface):
5356
'''Base class for interfaces that produce Nifti files, potentially with
@@ -73,7 +76,12 @@ def _get_out_path(self, meta, idx=None):
7376
out_fmt = '-'.join(out_fmt)
7477
out_fn = (out_fmt % meta) + self.inputs.out_ext
7578
out_fn = sanitize_path_comp(out_fn)
76-
return path.join(os.getcwd(), out_fn)
79+
80+
if self.inputs.use_cwd:
81+
return path.join(os.getcwd(), out_fn)
82+
else:
83+
return path.abspath(out_fn)
84+
7785

7886
class DcmStackInputSpec(NiftiGeneratorBaseInputSpec):
7987
dicom_files = traits.Either(InputMultiPath(File(exists=True)),

nipype/interfaces/tests/test_auto_DcmStack.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ def test_DcmStack_inputs():
1313
out_ext=dict(usedefault=True,
1414
),
1515
out_format=dict(),
16+
use_cwd=dict(usedefault=True,
17+
),
1618
)
1719
inputs = DcmStack.input_spec()
1820

nipype/interfaces/tests/test_auto_GroupAndStack.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ def test_GroupAndStack_inputs():
1313
out_ext=dict(usedefault=True,
1414
),
1515
out_format=dict(),
16+
use_cwd=dict(usedefault=True,
17+
),
1618
)
1719
inputs = GroupAndStack.input_spec()
1820

nipype/interfaces/tests/test_auto_MergeNifti.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ def test_MergeNifti_inputs():
1010
),
1111
out_format=dict(),
1212
sort_order=dict(),
13+
use_cwd=dict(usedefault=True,
14+
),
1315
)
1416
inputs = MergeNifti.input_spec()
1517

nipype/interfaces/tests/test_auto_SplitNifti.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ def test_SplitNifti_inputs():
99
),
1010
out_format=dict(),
1111
split_dim=dict(),
12+
use_cwd=dict(usedefault=True,
13+
),
1214
)
1315
inputs = SplitNifti.input_spec()
1416

0 commit comments

Comments
 (0)