Skip to content

Commit

Permalink
Add option to compute dwi sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ppoulin91 committed Jun 22, 2021
1 parent 0975d6d commit 98d5cfb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions USAGE
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ OPTIONAL BIDS ARGUMENTS (current value)

OPTIONAL ARGUMENTS (current value)

--compute_sh Compute DWI ODF as SH using the provided --basis and --sh_order ($compute_sh).

--b0_thr_extract_b0 All b-values below b0_thr_extract_b0 are considered b=0 images ($b0_thr_extract_b0).
--dwi_shell_tolerance All b-values to +-dwi_shell_tolerance are considered as the same b-value ($dwi_shell_tolerance).

Expand Down
28 changes: 27 additions & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if(params.help) {

cpu_count = Runtime.runtime.availableProcessors()
bindings = ["clean_bids":"$params.clean_bids",
"compute_sh":"$params.compute_sh",
"b0_thr_extract_b0":"$params.b0_thr_extract_b0",
"dwi_shell_tolerance":"$params.dwi_shell_tolerance",
"dilate_b0_mask_prelim_brain_extraction":"$params.dilate_b0_mask_prelim_brain_extraction",
Expand Down Expand Up @@ -284,7 +285,11 @@ number_subj_for_compare
"Please be sure to have the same acquisitions for all subjects."}
}

dwi.into{dwi_for_prelim_bet; dwi_for_denoise}
dwi.into{dwi_for_prelim_bet; dwi_for_denoise; dwi_for_sh}
gradients.into{gradients; gradients_for_sh}
dwi_for_sh
.join(gradients_for_sh)
.set{dwi_and_gradients_for_sh}

if (params.pft_random_seed instanceof String){
pft_random_seed = params.pft_random_seed?.tokenize(',')
Expand Down Expand Up @@ -336,6 +341,27 @@ process README {
"""
}

process DWI_SH {
cpus 1

input:
set sid, file(dwi), file(bval), file(bvec) from dwi_and_gradients_for_sh

output:
file "${sid}__dwi_sh.nii.gz"

when:
params.compute_sh

script:
"""
export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
scil_compute_sh_from_signal.py --sh_order $params.sh_order --sh_basis $params.basis $dwi $bval $bvec ${sid}__dwi_sh.nii.gz
"""
}

process Bet_Prelim_DWI {
cpus 2

Expand Down
3 changes: 3 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ params {
b0_thr_extract_b0=10
dwi_shell_tolerance=20

//**Compute DWI ODF as SH**//
compute_sh=false

//**Preliminary DWI brain extraction**//
dilate_b0_mask_prelim_brain_extraction=5
bet_prelim_f=0.16
Expand Down

0 comments on commit 98d5cfb

Please sign in to comment.