Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Address memory issues in DWI pipeline #1323

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions mriqc/workflows/diffusion/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,21 @@ def dmri_qc_workflow(name='dwiMRIQC'):
get_lowb = pe.Node(
ExtractOrientations(),
name='get_lowb',
n_procs=max(1, config.nipype.omp_nthreads // 2),
n_procs=max(1, config.nipype.nprocs // 2),
)

# Generate B0 reference
dwi_ref = pe.Node(
RobustAverage(mc_method=None),
name='dwi_ref',
n_procs=max(1, config.nipype.omp_nthreads // 2),
n_procs=max(1, config.nipype.nprocs // 2),
)

hmc_b0 = pe.Node(
Volreg(args='-Fourier -twopass', zpad=4, outputtype='NIFTI_GZ'),
name='hmc_b0',
mem_gb=3.0,
n_procs=config.nipype.omp_nthreads,
n_procs=config.nipype.nprocs,
)

# Calculate brainmask
Expand All @@ -164,13 +164,13 @@ def dmri_qc_workflow(name='dwiMRIQC'):
averages = pe.MapNode(
WeightedStat(),
name='averages',
n_procs=max(1, config.nipype.omp_nthreads // 2),
n_procs=max(1, config.nipype.nprocs // 2),
iterfield=['in_weights'],
)
stddev = pe.MapNode(
WeightedStat(stat='std'),
name='stddev',
n_procs=max(1, config.nipype.omp_nthreads // 2),
n_procs=max(1, config.nipype.nprocs // 2),
iterfield=['in_weights'],
)

Expand All @@ -180,38 +180,38 @@ def dmri_qc_workflow(name='dwiMRIQC'):
nthreads=config.nipype.omp_nthreads,
),
name='dwidenoise',
n_procs=config.nipype.omp_nthreads,
n_procs=config.nipype.nprocs,
)
drift = pe.Node(
CorrectSignalDrift(),
name='drift',
n_procs=max(1, config.nipype.omp_nthreads // 2),
n_procs=max(1, config.nipype.nprocs // 2),
)
sp_mask = pe.Node(
SpikingVoxelsMask(),
name='sp_mask',
n_procs=max(1, config.nipype.omp_nthreads // 2),
n_procs=max(1, config.nipype.nprocs // 2),
)

# Fit DTI/DKI model
dwimodel = pe.Node(
DiffusionModel(),
name='dwimodel',
n_procs=max(1, config.nipype.omp_nthreads // 2),
n_procs=config.nipype.nprocs,
)

# Calculate CC mask
cc_mask = pe.Node(
CCSegmentation(),
name='cc_mask',
n_procs=max(1, config.nipype.omp_nthreads // 2),
n_procs=max(1, config.nipype.nprocs // 2),
)

# Run PIESNO noise estimation
piesno = pe.Node(
PIESNO(),
name='piesno',
n_procs=max(1, config.nipype.omp_nthreads // 2),
n_procs=max(1, config.nipype.nprocs // 2),
)

# EPI to MNI registration
Expand Down Expand Up @@ -483,7 +483,7 @@ def hmc_workflow(name='dMRI_HMC'):
Volreg(args='-Fourier -twopass', zpad=4, outputtype='NIFTI_GZ'),
name='motion_correct',
mem_gb=3.0,
n_procs=config.nipype.omp_nthreads,
n_procs=config.nipype.nprocs,
)

bvec_rot = pe.Node(RotateVectors(), name='bvec_rot')
Expand Down
5 changes: 5 additions & 0 deletions mriqc/workflows/diffusion/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ def init_dwi_report_wf(name='dwi_report_wf'):
mosaic_fa = pe.Node(
PlotMosaic(cmap='Greys_r'),
name='mosaic_fa',
n_procs=max(1, config.nipype.nprocs // 2),
)
mosaic_md = pe.Node(
PlotMosaic(cmap='Greys_r'),
name='mosaic_md',
n_procs=max(1, config.nipype.nprocs // 2),
)

mosaic_snr = pe.MapNode(
Expand All @@ -97,6 +99,7 @@ def init_dwi_report_wf(name='dwi_report_wf'):
),
name='mosaic_snr',
iterfield=['before', 'after'],
n_procs=max(1, config.nipype.nprocs // 2),
)

mosaic_noise = pe.MapNode(
Expand All @@ -106,6 +109,7 @@ def init_dwi_report_wf(name='dwi_report_wf'):
),
name='mosaic_noise',
iterfield=['in_file'],
n_procs=max(1, config.nipype.nprocs // 2),
)

if config.workflow.species.lower() in ('rat', 'mouse'):
Expand Down Expand Up @@ -187,6 +191,7 @@ def _gen_entity(inlist):
plot_heatmap = pe.Node(
DWIHeatmap(scalarmap_label='Shell-wise Fractional Anisotropy (FA)'),
name='plot_heatmap',
n_procs=config.nipype.nprocs,
)
ds_report_hm = pe.Node(
DerivativesDataSink(
Expand Down
Loading