-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
800b48d
commit 754962f
Showing
21 changed files
with
1,623 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
|
||
process BETCROP_FSLBETCROP { | ||
tag "$meta.id" | ||
label 'process_single' | ||
|
||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://scil.usherbrooke.ca/containers/scilus_1.6.0.sif': | ||
'scilus/scilus:1.6.0' }" | ||
|
||
input: | ||
tuple val(meta), path(dwi), path(bval), path(bvec) | ||
|
||
output: | ||
tuple val(meta), path("*dwi_bet_cropped.nii.gz") , emit: dwi | ||
tuple val(meta), path("*dwi_bet_cropped_mask.nii.gz") , emit: mask | ||
tuple val(meta), path("*dwi_boundingBox.pkl") , emit: bbox | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
||
def b0_thr = task.ext.b0_thr ? "--b0_thr " + task.ext.b0_thr : "" | ||
def bet_dwi_f = task.ext.bet_dwi_f ? "-f " + task.ext.bet_dwi_f : "" | ||
|
||
""" | ||
export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1 | ||
export OMP_NUM_THREADS=1 | ||
export OPENBLAS_NUM_THREADS=1 | ||
scil_extract_b0.py $dwi $bval $bvec ${prefix}__b0.nii.gz --mean \ | ||
$b0_thr --force_b0_threshold | ||
bet ${prefix}__b0.nii.gz ${prefix}__b0_bet.nii.gz -m -R $bet_dwi_f | ||
scil_image_math.py convert ${prefix}__b0_bet_mask.nii.gz ${prefix}__b0_bet_mask.nii.gz --data_type uint8 -f | ||
mrcalc $dwi ${prefix}__b0_bet_mask.nii.gz -mult ${prefix}__dwi_bet.nii.gz -quiet -nthreads 1 | ||
scil_crop_volume.py $dwi ${prefix}__dwi_bet_cropped.nii.gz -f \ | ||
--output_bbox ${prefix}__dwi_boundingBox.pkl -f | ||
scil_crop_volume.py ${prefix}__b0_bet_mask.nii.gz ${prefix}__dwi_bet_cropped_mask.nii.gz -f\ | ||
--input_bbox ${prefix}__dwi_boundingBox.pkl -f | ||
scil_image_math.py convert ${prefix}__dwi_bet_cropped_mask.nii.gz ${prefix}__dwi_bet_cropped_mask.nii.gz \ | ||
--data_type uint8 -f | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
scilpy: 1.6.0 | ||
mrtrix: \$(mrcalc -version 2>&1 | sed -n 's/== mrcalc \\([0-9.]\\+\\).*/\\1/p') | ||
fsl: \$(flirt -version 2>&1 | sed -n 's/FLIRT version \\([0-9.]\\+\\)/\\1/p') | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
||
""" | ||
scil_extract_b0.py -h | ||
bet -h | ||
scil_image_math.py -h | ||
mrcalc -h | ||
scil_crop_volume.py -h | ||
touch ${prefix}__dwi_bet_cropped.nii.gz | ||
touch ${prefix}__dwi_bet_cropped_mask.nii.gz | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
scilpy: 1.6.0 | ||
mrtrix: \$(mrcalc -version 2>&1 | sed -n 's/== mrcalc \\([0-9.]\\+\\).*/\\1/p') | ||
fsl: \$(flirt -version 2>&1 | sed -n 's/FLIRT version \\([0-9.]\\+\\)/\\1/p') | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json | ||
name: "betcrop_fslbetcrop" | ||
description: Perform Brain extraction using FSL BET followed by cropping empty planes around the data. | ||
keywords: | ||
- DWI | ||
- BET | ||
- Crop | ||
tools: | ||
- "FSL": | ||
description: "FSL Toolbox and Scilpy Toolbox" | ||
homepage: "https://fsl.fmrib.ox.ac.uk/fsl/fslwiki" | ||
- "Scilpy": | ||
description: "The Sherbrooke Connectivity Imaging Lab (SCIL) Python dMRI processing toolbox." | ||
homepage: "https://github.com/scilus/scilpy.git" | ||
- "MRtrix3": | ||
description: "Toolbox for image processing, analysis and visualisation of dMRI." | ||
homepage: "https://mrtrix.readthedocs.io/en/latest/" | ||
|
||
input: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'test', single_end:false ]` | ||
- dwi: | ||
type: file | ||
description: Nifti DWI volume to perform BET + crop. | ||
pattern: "*.{nii,nii.gz}" | ||
|
||
- bval: | ||
type: file | ||
description: B-values in FSL format. | ||
pattern: "*.bval" | ||
|
||
- bvec: | ||
type: file | ||
description: B-vectors in FSL format. | ||
pattern: "*.bvec" | ||
|
||
output: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'test', single_end:false ]` | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
|
||
- dwi: | ||
type: file | ||
description: Nifti DWI volume brain-extracted and cropped. | ||
pattern: "*dwi_bet_cropped.{nii,nii.gz}" | ||
|
||
- mask: | ||
type: file | ||
description: DWI mask brain-extracted and cropped. | ||
pattern: "*dwi_bet_cropped_mask.{nii,nii.gz}" | ||
|
||
- bbox: | ||
type: file | ||
description: DWI BoundingBox used for cropping. | ||
pattern: "*dwi_boundingBox.pkl" | ||
|
||
authors: | ||
- "@gagnonanthony" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
process DENOISING_MPPCA { | ||
tag "$meta.id" | ||
label 'process_single' | ||
|
||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://scil.usherbrooke.ca/containers/scilus_1.6.0.sif': | ||
'scilus/scilus:1.6.0' }" | ||
|
||
input: | ||
tuple val(meta), path(dwi) | ||
|
||
output: | ||
tuple val(meta), path("*_dwi_denoised.nii.gz") , emit: image | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def extent = task.ext.extent ? "-extent " + task.ext.extent : "" | ||
|
||
""" | ||
export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1 | ||
export OMP_NUM_THREADS=1 | ||
export OPENBLAS_NUM_THREADS=1 | ||
dwidenoise $dwi ${prefix}__pre_dwi_denoised.nii.gz $extent -nthreads 1 | ||
fslmaths ${prefix}__pre_dwi_denoised.nii.gz -thr 0 ${prefix}_dwi_denoised.nii.gz | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
mrtrix: \$(mrcalc -version 2>&1 | sed -n 's/== mrcalc \\([0-9.]\\+\\).*/\\1/p') | ||
fsl: \$(flirt -version 2>&1 | sed -n 's/FLIRT version \\([0-9.]\\+\\)/\\1/p') | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
||
""" | ||
dwidenoise -h | ||
fslmaths -h | ||
touch ${prefix}_dwi_denoised.nii.gz | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
mrtrix: \$(mrcalc -version 2>&1 | sed -n 's/== mrcalc \\([0-9.]\\+\\).*/\\1/p') | ||
fsl: \$(flirt -version 2>&1 | sed -n 's/FLIRT version \\([0-9.]\\+\\)/\\1/p') | ||
END_VERSIONS | ||
""" | ||
} |
Oops, something went wrong.