Skip to content

Commit 75be890

Browse files
committed
fix: do not accept multiple files
1 parent 5617345 commit 75be890

File tree

1 file changed

+16
-36
lines changed

1 file changed

+16
-36
lines changed

sdcflows/interfaces/bspline.py

+16-36
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,7 @@ def _run_interface(self, runtime):
276276

277277

278278
class _ApplyCoeffsFieldInputSpec(BaseInterfaceInputSpec):
279-
in_data = InputMultiObject(
280-
File(exist=True, mandatory=True, desc="input EPI data to be corrected")
281-
)
279+
in_data = File(exist=True, mandatory=True, desc="input EPI data to be corrected")
282280
in_coeff = InputMultiObject(
283281
File(exists=True),
284282
mandatory=True,
@@ -288,23 +286,17 @@ class _ApplyCoeffsFieldInputSpec(BaseInterfaceInputSpec):
288286
exists=True,
289287
desc="the transform by which the fieldmap can be resampled on the target EPI's grid.",
290288
)
291-
in_xfms = InputMultiObject(
292-
File(exists=True), desc="list of head-motion correction matrices"
293-
)
294-
ro_time = InputMultiObject(
295-
traits.Float(mandatory=True, desc="EPI readout time (s).")
296-
)
297-
pe_dir = InputMultiObject(
298-
traits.Enum(
299-
"i",
300-
"i-",
301-
"j",
302-
"j-",
303-
"k",
304-
"k-",
305-
mandatory=True,
306-
desc="the phase-encoding direction corresponding to in_data",
307-
)
289+
in_xfms = File(exists=True, desc="list of head-motion correction matrices")
290+
ro_time = traits.Float(mandatory=True, desc="EPI readout time (s).")
291+
pe_dir = traits.Enum(
292+
"i",
293+
"i-",
294+
"j",
295+
"j-",
296+
"k",
297+
"k-",
298+
mandatory=True,
299+
desc="the phase-encoding direction corresponding to in_data",
308300
)
309301
num_threads = traits.Int(nohash=True, desc="number of threads")
310302
approx = traits.Bool(
@@ -361,18 +353,6 @@ class ApplyCoeffsField(SimpleInterface):
361353
def _run_interface(self, runtime):
362354
from sdcflows.transform import B0FieldTransform
363355

364-
n = len(self.inputs.in_data)
365-
366-
ro_time = self.inputs.ro_time
367-
if len(ro_time) == 1:
368-
ro_time *= n
369-
370-
pe_dir = self.inputs.pe_dir
371-
if len(pe_dir) == 1:
372-
pe_dir *= n
373-
374-
unwarp = None
375-
376356
# Pre-cached interpolator object
377357
unwarp = B0FieldTransform(coeffs=[nb.load(cname) for cname in self.inputs.in_coeff])
378358

@@ -390,12 +370,12 @@ def _run_interface(self, runtime):
390370
# self._results["out_field"] = out_field
391371

392372
# HMC matrices are only necessary when reslicing the data (i.e., apply())
393-
hmc_mats = None
373+
# Check the length of in_xfms matches that of in_data
394374
self._results["out_corrected"] = unwarp.apply(
395375
self.inputs.in_data,
396-
pe_dir,
397-
ro_time,
398-
xfms=hmc_mats,
376+
self.inputs.pe_dir,
377+
self.input.ro_time,
378+
xfms=self.inputs.in_xfms,
399379
# num_threads=(
400380
# None if not isdefined(self.inputs.num_threads) else self.inputs.num_threads
401381
# ),

0 commit comments

Comments
 (0)