Skip to content

Commit 242bbb9

Browse files
committed
fix: add a --sloppy mode for topup to fit in Circle
and fix THP002, and pin latest rc of niworkflows
1 parent a05e701 commit 242bbb9

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Resolution (knot-spacing) of warps in mm
2+
--warpres=20,14,10
3+
# Subsampling level (a value of 2 indicates that a 2x2x2 neighbourhood is collapsed to 1 voxel)
4+
--subsamp=2,2,2
5+
# FWHM of gaussian smoothing
6+
--fwhm=8,2,1
7+
# Maximum number of iterations
8+
--miter=5,5,5
9+
# Relative weight of regularisation
10+
--lambda=0.005,0.000005,0.0000005
11+
# If set to 1 lambda is multiplied by the current average squared difference
12+
--ssqlambda=1
13+
# Regularisation model
14+
--regmod=bending_energy
15+
# If set to 1 movements are estimated along with the field
16+
--estmov=0,0,0
17+
# 0=Levenberg-Marquardt, 1=Scaled Conjugate Gradient
18+
--minmet=0,0,1
19+
# Quadratic or cubic splines
20+
--splineorder=3
21+
# Precision for calculation and storage of Hessian
22+
--numprec=double
23+
# Linear or spline interpolation
24+
--interp=spline
25+
# If set to 1 the images are individually scaled to a common mean intensity
26+
--scale=1

dmriprep/workflows/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ def init_single_subject_wf(subject_id):
293293
]),
294294
])
295295

296-
fmap_estimation_wf = init_fmap_estimation_wf(subject_data["dwi"])
296+
fmap_estimation_wf = init_fmap_estimation_wf(
297+
subject_data["dwi"], debug=config.execution.debug)
297298
workflow.connect([
298299
(referencenode, fmap_estimation_wf, [
299300
("dwi_reference", "inputnode.dwi_reference"),

dmriprep/workflows/fmap/base.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
def init_fmap_estimation_wf(
1212
epi_targets,
13+
debug=False,
1314
generate_report=True,
1415
name="fmap_estimation_wf",
1516
):
@@ -36,13 +37,14 @@ def init_fmap_estimation_wf(
3637

3738
inputnode = pe.Node(niu.IdentityInterface(fields=["dwi_reference", "dwi_mask"]),
3839
name="inputnode")
40+
wf.add_nodes([inputnode]) # TODO: remove when fully implemented
3941
# Create one outputnode with a port for each potential EPI target
40-
outputnode = pe.Node(niu.IdentityInterface(fields=[_fname2outname(p) for p in epi_targets]),
41-
name="outputnode")
42+
# outputnode = pe.Node(niu.IdentityInterface(fields=[_fname2outname(p) for p in epi_targets]),
43+
# name="outputnode")
4244

4345
# Return identity transforms for all if fieldmaps are ignored
4446
if "fieldmaps" in config.workflow.ignore:
45-
raise NotImplementedError
47+
return wf
4648

4749
# Set-up PEPOLAR estimators only with EPIs under fmap/
4850
# fmap_epi = {f: layout.get_metadata(f)
@@ -51,13 +53,16 @@ def init_fmap_estimation_wf(
5153
# suffix="epi", extension=("nii", "nii.gz"))}
5254

5355
metadata = [layout.get_metadata(p) for p in epi_targets]
56+
if any("TotalReadoutTime" not in m for m in metadata):
57+
return wf
58+
5459
pedirs = [m.get("PhaseEncodingDirection", "unknown") for m in metadata]
5560
if len(set(pedirs) - set(("unknown",))) > 1:
5661
if "unknown" in pedirs or len(set(pe[0] for pe in set(pedirs))) > 1:
5762
raise NotImplementedError
5863

5964
# Get EPI polarities and their metadata
60-
sdc_estimate_wf = init_pepolar_estimate_wf()
65+
sdc_estimate_wf = init_pepolar_estimate_wf(debug=debug)
6166
sdc_estimate_wf.inputs.inputnode.metadata = metadata
6267

6368
wf.connect([
@@ -83,7 +88,7 @@ def init_fmap_estimation_wf(
8388
return wf
8489

8590

86-
def init_pepolar_estimate_wf(generate_report=True, name="pepolar_estimate_wf"):
91+
def init_pepolar_estimate_wf(debug=False, generate_report=True, name="pepolar_estimate_wf"):
8792
"""Initialize a barebones TOPUP implementation."""
8893
from nipype.interfaces.afni import Automask
8994
from nipype.interfaces.fsl.epi import TOPUP
@@ -98,8 +103,8 @@ def init_pepolar_estimate_wf(generate_report=True, name="pepolar_estimate_wf"):
98103

99104
concat_blips = pe.Node(MergeSeries(), name="concat_blips")
100105

101-
topup = pe.Node(TOPUP(config=_pkg_fname("dmriprep", "data/flirtsch/b02b0.cnf")),
102-
name="topup")
106+
topup = pe.Node(TOPUP(config=_pkg_fname(
107+
"dmriprep", f"data/flirtsch/b02b0{'_quick' * debug}.cnf")), name="topup")
103108

104109
pre_mask = pe.Node(Automask(dilate=1, outputtype="NIFTI_GZ"),
105110
name="pre_mask")

0 commit comments

Comments
 (0)