Skip to content

Commit 82f419b

Browse files
authored
Merge pull request #457 from effigies/fix/one-layer-syn
fix: Only fit high-frequency spline for SyN-SDC
2 parents 08e198f + 6a9da18 commit 82f419b

File tree

4 files changed

+19
-25
lines changed

4 files changed

+19
-25
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ jobs:
341341
nipreps/sdcflows:latest \
342342
pytest -v --junit-xml=/out/pytest.xml \
343343
--cov sdcflows --cov-report xml:/out/unittests.xml \
344-
sdcflows/
344+
-n auto sdcflows/
345345
- save_cache:
346346
key: workdir-v3-{{ .Branch }}-{{ .BuildNum }}
347347
paths:

.github/workflows/unittests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ jobs:
175175
run: |
176176
export LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH
177177
export PATH=$ANTSPATH:${AFNI_HOME}:/usr/lib/fsl/5.0:$PATH
178-
pytest -v --cov sdcflows --cov-report xml:cov.xml --doctest-modules sdcflows
178+
pytest -v --cov sdcflows --cov-report xml:cov.xml --doctest-modules -n auto sdcflows
179179
180180
- uses: codecov/codecov-action@v4
181181
with:

sdcflows/utils/epimanip.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@
2323
"""
2424
Manipulation of EPI data.
2525
26-
.. testsetup::
27-
28-
>>> tmpdir = getfixture('tmpdir')
29-
>>> tmp = tmpdir.chdir() # changing to a temporary directory
30-
>>> nb.Nifti1Image(np.zeros((90, 90, 60)), None, None).to_filename(
31-
... tmpdir.join('epi.nii.gz').strpath)
32-
3326
"""
3427

3528

@@ -42,6 +35,15 @@ def get_trt(in_meta, in_file=None):
4235
The first option is that a ``TotalReadoutTime`` field is found
4336
in the JSON sidecar:
4437
38+
.. testsetup::
39+
40+
>>> cwd = os.getcwd()
41+
>>> tmpdir = getfixture('tmpdir')
42+
>>> tmp = tmpdir.chdir() # changing to a temporary directory
43+
>>> nb.Nifti1Image(np.zeros((90, 90, 60)), None, None).to_filename(
44+
... tmpdir.join('epi.nii.gz').strpath)
45+
46+
4547
>>> meta = {'TotalReadoutTime': 0.05251}
4648
>>> get_trt(meta)
4749
0.05251
@@ -157,6 +159,10 @@ def get_trt(in_meta, in_file=None):
157159
Traceback (most recent call last):
158160
ValueError:
159161
162+
.. testcleanup::
163+
164+
>>> os.chdir(cwd)
165+
160166
.. admonition:: Thanks
161167
162168
With thanks to Dr. Rorden for his thorough

sdcflows/workflows/fit/syn.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@
2222
#
2323
"""
2424
Estimating the susceptibility distortions without fieldmaps.
25-
26-
.. testsetup::
27-
28-
>>> tmpdir = getfixture('tmpdir')
29-
>>> tmp = tmpdir.chdir() # changing to a temporary directory
30-
>>> data = np.zeros((10, 10, 10, 1, 3))
31-
>>> data[..., 1] = 1
32-
>>> nb.Nifti1Image(data, None, None).to_filename(
33-
... tmpdir.join('field.nii.gz').strpath)
34-
35-
3625
"""
3726
from nipype.pipeline import engine as pe
3827
from nipype.interfaces import utility as niu
@@ -138,9 +127,7 @@ def init_syn_sdc_wf(
138127
from ...interfaces.bspline import (
139128
ApplyCoeffsField,
140129
BSplineApprox,
141-
DEFAULT_LF_ZOOMS_MM,
142130
DEFAULT_HF_ZOOMS_MM,
143-
DEFAULT_ZOOMS_MM,
144131
)
145132
from ...interfaces.brainmask import BinaryDilation, Union
146133

@@ -272,9 +259,10 @@ def init_syn_sdc_wf(
272259
name="bs_filter",
273260
)
274261
bs_filter.interface._always_run = debug
275-
bs_filter.inputs.bs_spacing = (
276-
[DEFAULT_LF_ZOOMS_MM, DEFAULT_HF_ZOOMS_MM] if not sloppy else [DEFAULT_ZOOMS_MM]
277-
)
262+
bs_filter.inputs.bs_spacing = [DEFAULT_HF_ZOOMS_MM]
263+
264+
if sloppy:
265+
bs_filter.inputs.zooms_min = 4.0
278266

279267
workflow.connect([
280268
(inputnode, readout_time, [(("epi_ref", _pop), "in_file"),

0 commit comments

Comments
 (0)