Skip to content

Commit 32d693d

Browse files
committed
fix: consider blip up or down of phase encoding
1 parent f972dba commit 32d693d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sdcflows/workflows/fit/syn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def _extract_field(in_file, epi_meta):
293293
>>> nii.shape
294294
(10, 10, 10)
295295
296-
>>> np.allclose(nii.get_fdata(), 200)
296+
>>> np.allclose(nii.get_fdata(), -200)
297297
True
298298
299299
"""
@@ -308,7 +308,7 @@ def _extract_field(in_file, epi_meta):
308308
np.squeeze(fieldnii.get_fdata(dtype="float32"))[
309309
..., "ijk".index(epi_meta[1]["PhaseEncodingDirection"][0])
310310
]
311-
/ trt
311+
/ trt * (-1.0 if epi_meta[1]["PhaseEncodingDirection"].endswith("-") else 1.0)
312312
)
313313
out_file = fname_presuffix(in_file[0], suffix="_fieldmap")
314314
nii = nb.Nifti1Image(data, fieldnii.affine, None)

sdcflows/workflows/fit/tests/test_syn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_syn_wf(tmpdir, datadir, workdir, outdir):
2323
/ "sdcflows-tests"
2424
/ "sub-100185_task-machinegame_run-1_boldref.nii.gz"
2525
),
26-
{"PhaseEncodingDirection": "j", "TotalReadoutTime": 0.005},
26+
{"PhaseEncodingDirection": "j-", "TotalReadoutTime": 0.005},
2727
)
2828
syn_wf.inputs.inputnode.epi_mask = str(
2929
derivs_path
@@ -74,7 +74,7 @@ def test_syn_wf(tmpdir, datadir, workdir, outdir):
7474

7575
fmap_reports_wf = init_fmap_reports_wf(
7676
output_dir=str(outdir),
77-
fmap_type="pepolar",
77+
fmap_type="sdcsyn",
7878
)
7979
fmap_reports_wf.inputs.inputnode.source_files = [
8080
str(

0 commit comments

Comments
 (0)