Skip to content

Commit 46f8ca8

Browse files
committed
ENH+DOC: Add axis input, docstring to interface
1 parent 74d1984 commit 46f8ca8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

sdcflows/interfaces/utils.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ class DenoiseImage(_DenoiseImageBase, _CopyHeaderInterface):
269269

270270
class _PadSlicesInputSpec(BaseInterfaceInputSpec):
271271
in_file = File(exists=True, mandatory=True, desc="3D or 4D NIfTI image")
272+
axis = traits.Int(
273+
2,
274+
usedefault=True,
275+
desc="The axis through which slices are stacked in the input data"
276+
)
272277

273278

274279
class _PadSlicesOutputSpec(TraitedSpec):
@@ -277,12 +282,17 @@ class _PadSlicesOutputSpec(TraitedSpec):
277282

278283

279284
class PadSlices(SimpleInterface):
285+
"""
286+
Check an image for uneven slices, and add an empty slice if necessary
287+
288+
This intends to avoid TOPUP's segfault without changing the standard configuration
289+
"""
280290
input_spec = _PadSlicesInputSpec
281291
output_spec = _PadSlicesOutputSpec
282292

283293
def _run_interface(self, runtime):
284294
self._results["out_file"], self._results["padded"] = _pad_num_slices(
285-
self.inputs.in_file, runtime.cwd,
295+
self.inputs.in_file, self.inputs.axis, runtime.cwd,
286296
)
287297
return runtime
288298

@@ -409,7 +419,7 @@ def _reoblique(in_epi, in_plumb, in_field, in_mask=None, newpath=None):
409419
def _pad_num_slices(in_file, ax=2, newpath=None):
410420
"""
411421
Ensure the image has even number of slices to avert TOPUP's segfault.
412-
422+
413423
Check if image has an even number of slices.
414424
If it does, return the image unaltered.
415425
Otherwise, return the image with an empty slice added.

0 commit comments

Comments
 (0)