Skip to content

Commit

Permalink
Merge pull request #503 from nipreps/oesteban-patch-1
Browse files Browse the repository at this point in the history
FIX: Merge/SplitSeries write to path of input image, instead of cwd
  • Loading branch information
oesteban authored Apr 22, 2020
2 parents 17ed748 + af7aa27 commit 9e69da2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions niworkflows/interfaces/nibabel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Nibabel-based interfaces."""
from pathlib import Path
import numpy as np
import nibabel as nb
from nipype import logging
Expand Down Expand Up @@ -124,9 +123,8 @@ def _run_interface(self, runtime):

self._results["out_files"] = []
for i, img_3d in enumerate(nb.four_to_three(img)):
out_file = str(
Path(fname_presuffix(in_file, suffix=f"_idx-{i:03}")).absolute()
)
out_file = fname_presuffix(in_file, suffix=f"_idx-{i:03}",
newpath=runtime.cwd)
img_3d.to_filename(out_file)
self._results["out_files"].append(out_file)

Expand Down Expand Up @@ -169,7 +167,8 @@ def _run_interface(self, runtime):
)

img_4d = nb.concat_images(nii_list)
out_file = fname_presuffix(self.inputs.in_files[0], suffix="_merged")
out_file = fname_presuffix(self.inputs.in_files[0], suffix="_merged",
newpath=runtime.cwd)
img_4d.to_filename(out_file)

self._results["out_file"] = out_file
Expand Down

0 comments on commit 9e69da2

Please sign in to comment.