Skip to content

Commit 10639df

Browse files
slimnsouroesteban
authored andcommitted
Changed fsl version to 5.0.11 and switched from eddy_correct to eddy_openmp
1 parent c769a5d commit 10639df

File tree

3 files changed

+94
-13
lines changed

3 files changed

+94
-13
lines changed

Dockerfile

100644100755
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,36 @@ COPY .docker/fsl-6.0/bin/topup /usr/share/fsl/5.0/bin/topup
9696
COPY .docker/fsl-6.0/bin/imglob /usr/share/fsl/5.0/bin/imglob
9797
COPY .docker/fsl-6.0/lib/* /usr/lib/fsl/5.0/
9898

99+
ENV FSLDIR="/opt/fsl-5.0.11" \
100+
PATH="/opt/fsl-5.0.11/bin:$PATH" \
101+
FSLOUTPUTTYPE="NIFTI_GZ"
102+
103+
RUN apt-get update -qq && \
104+
apt-get install -y -q --no-install-recommends \
105+
bc \
106+
dc \
107+
file \
108+
libfontconfig1 \
109+
libfreetype6 \
110+
libgl1-mesa-dev \
111+
libglu1-mesa-dev \
112+
libgomp1 \
113+
libice6 \
114+
libxcursor1 \
115+
libxft2 \
116+
libxinerama1 \
117+
libxrandr2 \
118+
libxrender1 \
119+
libxt6 \
120+
python \
121+
wget && \
122+
apt-get clean && \
123+
rm -rf /var/lib/apt/lists/* && \
124+
echo "Downloading FSL ..." && \
125+
wget -q http://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py && \
126+
chmod 775 fslinstaller.py && \
127+
/usr/bin/python fslinstaller.py -d /opt/fsl-5.0.11 -V 5.0.11 -q
128+
99129
# Installing ANTs 2.3.3 (NeuroDocker build)
100130
# Note: the URL says 2.3.4 but it is actually 2.3.3
101131
ENV ANTSPATH=/usr/lib/ants

dmriprep/workflows/dwi/base.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,18 @@ def _bold_reg_suffix(fallback):
203203
# fmt: on
204204

205205
# Eddy distortion correction
206-
eddy_wf = init_eddy_wf()
206+
eddy_wf = init_eddy_wf(debug=config.execution.debug)
207+
eddy_wf.inputs.inputnode.metadata = layout.get_metadata(str(dwi_file))
207208
# fmt:off
208209
workflow.connect([
209210
(dwi_reference_wf, eddy_wf, [
210211
("outputnode.ref_image", "inputnode.dwi_file"),
211-
])
212+
("outputnode.dwi_mask", "inputnode.dwi_mask"),
213+
]),
214+
(inputnode, eddy_wf, [
215+
("in_bvec", "inputnode.in_bvec"),
216+
("in_bval", "inputnode.in_bval")
217+
]),
212218
])
213219
# fmt:on
214220

dmriprep/workflows/dwi/eddy.py

100644100755
Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def gen_eddy_textfiles(in_file, in_meta):
5252
return out_acqparams, out_index
5353

5454

55-
def init_eddy_wf(name="eddy_wf"):
55+
def init_eddy_wf(debug=False, name="eddy_wf"):
5656
"""
5757
Create a workflow for head-motion & Eddy currents distortion estimation with FSL.
5858
@@ -72,26 +72,71 @@ def init_eddy_wf(name="eddy_wf"):
7272
The eddy corrected diffusion image..
7373
7474
"""
75-
from nipype.interfaces.fsl import EddyCorrect
76-
77-
inputnode = pe.Node(niu.IdentityInterface(fields=["dwi_file"]), name="inputnode",)
75+
from nipype.interfaces.fsl import Eddy
76+
77+
inputnode = pe.Node(
78+
niu.IdentityInterface(
79+
fields=[
80+
"dwi_file",
81+
"metadata",
82+
"dwi_mask",
83+
"in_bvec",
84+
"in_bval"
85+
]
86+
),
87+
name="inputnode",
88+
)
7889

79-
outputnode = pe.Node(niu.IdentityInterface(fields=["out_eddy"]), name="outputnode",)
90+
outputnode = pe.Node(
91+
niu.IdentityInterface(
92+
fields=[
93+
"out_rotated_bvecs",
94+
"out_eddy"
95+
]
96+
),
97+
name="outputnode",
98+
)
8099

81100
workflow = Workflow(name=name)
82101
workflow.__desc__ = f"""\
83102
Geometrical distortions derived from the so-called Eddy-currents, and head-motion
84-
realignment parameters were estimated with the joint modeling of ``eddy_correct``,
85-
included in FSL {EddyCorrect().version} [@eddy].
103+
realignment parameters were estimated with the joint modeling of ``eddy_openmp``,
104+
included in FSL {Eddy().version} [@eddy].
86105
"""
106+
eddy = pe.Node(
107+
Eddy(repol=True, cnr_maps=True, residuals=True, method="jac"),
108+
name="eddy",
109+
)
87110

88-
eddy_correct = pe.Node(EddyCorrect(), name="eddy_correct",)
111+
if debug:
112+
eddy.inputs.niter = 1
113+
114+
# Generate the acqp and index files for eddy
115+
gen_eddy_files = pe.Node(
116+
niu.Function(
117+
input_names=["in_file", "in_meta"],
118+
output_names=["out_acqparams", "out_index"],
119+
function=gen_eddy_textfiles,
120+
),
121+
name="gen_eddy_files",
122+
)
89123

90-
# Connect the workflow
91124
# fmt:off
92125
workflow.connect([
93-
(inputnode, eddy_correct, [("dwi_file", "in_file")]),
94-
(eddy_correct, outputnode, [("eddy_corrected", "out_eddy")]),
126+
(inputnode, eddy, [
127+
("dwi_file", "in_file"),
128+
("dwi_mask", "in_mask"),
129+
("in_bvec", "in_bvec"),
130+
("in_bval", "in_bval"),
131+
]),
132+
(inputnode, gen_eddy_files, [
133+
("dwi_file", "in_file"),
134+
("metadata", "in_meta")
135+
]),
136+
(eddy, outputnode, [
137+
("out_corrected", "out_eddy"),
138+
("out_rotated_bvecs", "out_rotated_bvecs")
139+
]),
95140
])
96141
# fmt:on
97142
return workflow

0 commit comments

Comments
 (0)