Skip to content

Commit ce25d24

Browse files
committed
fix: miscellaneous problems
1 parent f437f69 commit ce25d24

File tree

5 files changed

+12
-19
lines changed

5 files changed

+12
-19
lines changed

sdcflows/interfaces/bspline.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,7 @@ def _run_interface(self, runtime):
374374
unwarp = None
375375

376376
# Pre-cached interpolator object
377-
unwarp = B0FieldTransform(
378-
coeffs=[nb.load(cname) for cname in self.inputs.in_coeff],
379-
num_threads=(
380-
None if not isdefined(self.inputs.num_threads) else self.inputs.num_threads
381-
),
382-
)
377+
unwarp = B0FieldTransform(coeffs=[nb.load(cname) for cname in self.inputs.in_coeff])
383378

384379
# Reconstruct the field from the coefficients, on the target dataset's grid.
385380
unwarp.fit(
@@ -401,6 +396,9 @@ def _run_interface(self, runtime):
401396
pe_dir,
402397
ro_time,
403398
xfms=hmc_mats,
399+
# num_threads=(
400+
# None if not isdefined(self.inputs.num_threads) else self.inputs.num_threads
401+
# ),
404402
)
405403
return runtime
406404

sdcflows/transform.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def apply(
164164
cval: float = 0.0,
165165
prefilter: bool = True,
166166
output_dtype: Union[str, np.dtype] = None,
167-
num_threads: int = None,
167+
# num_threads: int = None,
168168
):
169169
"""
170170
Apply a transformation to an image, resampling on the reference spatial object.
@@ -202,8 +202,6 @@ def apply(
202202
output_dtype : :obj:`str` or :obj:`~numpy.dtype`
203203
Override the output data type, instead of propagating it from the
204204
moving image.
205-
num_threads : :obj:`int`
206-
Number of CPUs resampling can be parallelized on.
207205
208206
Returns
209207
-------
@@ -236,13 +234,14 @@ def apply(
236234
np.meshgrid(*ijk_axis, indexing="ij"), dtype="float32"
237235
).reshape(3, -1)
238236

239-
if xfms is None:
237+
if xfms is not None:
238+
mov_ras2vox = np.linalg.inv(moving.affine)
240239
# Map coordinates from reference to time-step
241240
xfms.reference = moving
242241
hmc_xyz = xfms.map(xfms.reference.ndcoords.T)
243242
# Convert from RAS to voxel coordinates
244243
voxcoords = (
245-
np.linalg.inv(xfms.reference.affine)
244+
mov_ras2vox
246245
@ _as_homogeneous(np.vstack(hmc_xyz), dim=xfms.reference.ndim).T
247246
)[:3, ...]
248247

sdcflows/workflows/apply/correction.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,8 @@ def init_unwarp_wf(*, free_mem=None, omp_nthreads=1, debug=False, name="unwarp_w
159159
(merge, average, [("out_file", "in_file")]),
160160
(average, brainextraction_wf, [("out_file", "inputnode.in_file")]),
161161
(merge, outputnode, [("out_file", "corrected")]),
162-
(resample, outputnode, [("out_field", "fieldmap"),
163-
("out_warp", "fieldwarp")]),
164-
(resample_ref, outputnode, [("out_field", "fieldmap_ref"),
165-
("out_warp", "fieldwarp_ref")]),
162+
(resample, outputnode, [("out_field", "fieldmap")]),
163+
(resample_ref, outputnode, [("out_field", "fieldmap_ref")]),
166164
(brainextraction_wf, outputnode, [
167165
("outputnode.out_file", "corrected_ref"),
168166
("outputnode.out_mask", "corrected_mask"),

sdcflows/workflows/fit/pepolar.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ def init_topup_wf(
229229
(split_blips, unwarp, [("out_files", "in_data")]),
230230
(sort_pe_blips, unwarp, [("readout_times", "ro_time"),
231231
("pe_dirs", "pe_dir")]),
232-
(unwarp, outputnode, [("out_warp", "out_warps"),
233-
("out_field", "fmap")]),
232+
(unwarp, outputnode, [("out_field", "fmap")]),
234233
(unwarp, concat_corrected, [("out_corrected", "in_files")]),
235234
(concat_corrected, ref_average, [("out_file", "in_file")]),
236235
])

sdcflows/workflows/fit/syn.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,7 @@ def init_syn_sdc_wf(
328328
(zooms_bmask, outputnode, [("output_image", "fmap_mask")]),
329329
(bs_filter, outputnode, [("out_coeff", "fmap_coeff")]),
330330
(unwarp, outputnode, [("out_corrected", "fmap_ref"),
331-
("out_field", "fmap"),
332-
("out_warp", "out_warp")]),
331+
("out_field", "fmap")]),
333332
])
334333
# fmt: on
335334

0 commit comments

Comments
 (0)