Skip to content

Commit

Permalink
Propagate b0 threshold to dwibiascorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcieslak committed Feb 29, 2024
1 parent 999512f commit 71fe6ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions qsiprep/interfaces/mrtrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,10 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec, SeriesPreprocReportInputSpec
ants_c = traits.Str(default_value="[200x200,1e-6]", argstr="-ants.c %s", usedefault=True)
ants_s = traits.Str(default_value="4", argstr="-ants.s %s")
out_report = File("n4_report.svg", usedefault=True, desc="filename for the visual report")
bzero_max = traits.Int(
argstr="-config BZeroThreshold %d",
desc="Maximum b-value that can be considered a b=0",
)


class DWIBiasCorrectOutputSpec(SeriesPreprocReportOutputSpec):
Expand Down
8 changes: 6 additions & 2 deletions qsiprep/workflows/dwi/finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ def init_dwi_finalize_wf(
name="final_denoise_wf",
omp_nthreads=omp_nthreads,
source_file=source_file,
b0_threshold=b0_threshold,
do_biascorr=do_biascorr and write_derivatives,
num_dwi_acquisitions=len(all_dwis),
)
Expand Down Expand Up @@ -474,6 +475,7 @@ def init_finalize_denoising_wf(
omp_nthreads,
source_file,
do_biascorr,
b0_threshold,
num_dwi_acquisitions,
split_biascorr=False,
do_patch2self=False,
Expand Down Expand Up @@ -532,7 +534,9 @@ def init_finalize_denoising_wf(
if do_biascorr:
if not split_biascorr:
biascorr = pe.Node(
DWIBiasCorrect(method="ants"), name="biascorr", n_procs=omp_nthreads
DWIBiasCorrect(method="ants", bzero_max=b0_threshold),
name="biascorr",
n_procs=omp_nthreads,
)
ds_report_biascorr = pe.Node(
DerivativesDataSink(suffix=name + "_biascorr", source_file=source_file),
Expand Down Expand Up @@ -577,7 +581,7 @@ def init_finalize_denoising_wf(
scan_num += 1
biascorrs.append(
pe.Node(
DWIBiasCorrect(method="ants"),
DWIBiasCorrect(method="ants", bzero_max=b0_threshold),
name="biascorr%d" % scan_num,
n_procs=omp_nthreads,
)
Expand Down

0 comments on commit 71fe6ca

Please sign in to comment.