Skip to content
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
22 changes: 16 additions & 6 deletions modules/nf-neuro/registration/anattodwi/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ process REGISTRATION_ANATTODWI {
tag "$meta.id"
label 'process_single'

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://scil.usherbrooke.ca/containers/scilus_2.0.2.sif':
'scilus/scilus:19c87b72bcbc683fb827097dda7f917940fda123' }"
container "scilus/scilus:2.2.0"

input:
tuple val(meta), path(t1), path(b0), path(metric)
Expand Down Expand Up @@ -73,11 +71,11 @@ process REGISTRATION_ANATTODWI {
# Iterate over images.
for image in t1_warped b0;
do
scil_viz_volume_screenshot.py *\${image}.nii.gz \${image}_coronal.png \
scil_viz_volume_screenshot *\${image}.nii.gz \${image}_coronal.png \
--slices \$coronal_mid --axis coronal \$viz_params
scil_viz_volume_screenshot.py *\${image}.nii.gz \${image}_sagittal.png \
scil_viz_volume_screenshot *\${image}.nii.gz \${image}_sagittal.png \
--slices \$sagittal_mid --axis sagittal \$viz_params
scil_viz_volume_screenshot.py *\${image}.nii.gz \${image}_axial.png \
scil_viz_volume_screenshot *\${image}.nii.gz \${image}_axial.png \
--slices \$axial_mid --axis axial \$viz_params

if [ \$image != b0 ];
Expand Down Expand Up @@ -107,6 +105,7 @@ process REGISTRATION_ANATTODWI {

cat <<-END_VERSIONS > versions.yml
"${task.process}":
scilpy: \$(uv pip -q -n list | grep scilpy | tr -s ' ' | cut -d' ' -f2)
ants: \$(antsRegistration --version | grep "Version" | sed -E 's/.*v([0-9.a-zA-Z-]+).*/\\1/')
mrtrix: \$(mrinfo -version 2>&1 | grep "== mrinfo" | sed -E 's/== mrinfo ([0-9.]+).*/\\1/')
imagemagick: \$(convert -version | sed -n 's/.*ImageMagick \\([0-9]\\{1,\\}\\.[0-9]\\{1,\\}\\.[0-9]\\{1,\\}\\).*/\\1/p')
Expand All @@ -117,7 +116,17 @@ process REGISTRATION_ANATTODWI {
def prefix = task.ext.prefix ?: "${meta.id}"

"""
set +e
function handle_code () {
local code=\$?
ignore=( 1 )
[[ " \${ignore[@]} " =~ " \$code " ]] || exit \$code
}
trap 'handle_code' ERR

antsRegistration -h
scil_viz_volume_screenshot -h
convert -h

touch ${prefix}__t1_warped.nii.gz
touch ${prefix}__output0GenericAffine.mat
Expand All @@ -127,6 +136,7 @@ process REGISTRATION_ANATTODWI {

cat <<-END_VERSIONS > versions.yml
"${task.process}":
scilpy: \$(uv pip -q -n list | grep scilpy | tr -s ' ' | cut -d' ' -f2)
ants: \$(antsRegistration --version | grep "Version" | sed -E 's/.*v([0-9.a-zA-Z-]+).*/\\1/')
mrtrix: \$(mrinfo -version 2>&1 | grep "== mrinfo" | sed -E 's/== mrinfo ([0-9.]+).*/\\1/')
imagemagick: \$(convert -version | sed -n 's/.*ImageMagick \\([0-9]\\{1,\\}\\.[0-9]\\{1,\\}\\.[0-9]\\{1,\\}\\).*/\\1/p')
Expand Down
38 changes: 19 additions & 19 deletions modules/nf-neuro/registration/anattodwi/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"id": "test",
"single_end": false
},
"test__output0GenericAffine.mat:md5,6eef07f9004fb96e57ae0404ffef174c"
"test__output0GenericAffine.mat:md5,18d03f6c1fd587b00b3bc9363eb8ed4f"
]
],
"1": [
Expand All @@ -17,7 +17,7 @@
"id": "test",
"single_end": false
},
"test__output1Warp.nii.gz:md5,e0995852e251bee5521572a4495a0bd6"
"test__output1Warp.nii.gz:md5,aa42d4dd6f227d986cd99df45425d5c5"
]
],
"2": [
Expand All @@ -26,7 +26,7 @@
"id": "test",
"single_end": false
},
"test__output1InverseWarp.nii.gz:md5,28694d2b41f5209ab8f1acbb219014fe"
"test__output1InverseWarp.nii.gz:md5,6a04d7c100075b4ba7a276a55a4094bd"
]
],
"3": [
Expand All @@ -35,7 +35,7 @@
"id": "test",
"single_end": false
},
"test__t1_warped.nii.gz:md5,9c34f424900adea263e39ed1f37a793f"
"test__t1_warped.nii.gz:md5,39c30c6251cba224989bc74a31540121"
]
],
"4": [
Expand All @@ -44,19 +44,19 @@
"id": "test",
"single_end": false
},
"test_registration_anattodwi_mqc.gif:md5,74a7cf404c443726487683c23bd926c0"
"test_registration_anattodwi_mqc.gif:md5,687252d31b0109f99a174b4e3960e4e6"
]
],
"5": [
"versions.yml:md5,f368bc76bf8d1f1a68caea3597b0c65b"
"versions.yml:md5,77dc5dd2d9f2f2b772043eef8471eb13"
],
"affine": [
[
{
"id": "test",
"single_end": false
},
"test__output0GenericAffine.mat:md5,6eef07f9004fb96e57ae0404ffef174c"
"test__output0GenericAffine.mat:md5,18d03f6c1fd587b00b3bc9363eb8ed4f"
]
],
"inverse_warp": [
Expand All @@ -65,7 +65,7 @@
"id": "test",
"single_end": false
},
"test__output1InverseWarp.nii.gz:md5,28694d2b41f5209ab8f1acbb219014fe"
"test__output1InverseWarp.nii.gz:md5,6a04d7c100075b4ba7a276a55a4094bd"
]
],
"mqc": [
Expand All @@ -74,7 +74,7 @@
"id": "test",
"single_end": false
},
"test_registration_anattodwi_mqc.gif:md5,74a7cf404c443726487683c23bd926c0"
"test_registration_anattodwi_mqc.gif:md5,687252d31b0109f99a174b4e3960e4e6"
]
],
"t1_warped": [
Expand All @@ -83,39 +83,39 @@
"id": "test",
"single_end": false
},
"test__t1_warped.nii.gz:md5,9c34f424900adea263e39ed1f37a793f"
"test__t1_warped.nii.gz:md5,39c30c6251cba224989bc74a31540121"
]
],
"versions": [
"versions.yml:md5,f368bc76bf8d1f1a68caea3597b0c65b"
"versions.yml:md5,77dc5dd2d9f2f2b772043eef8471eb13"
],
"warp": [
[
{
"id": "test",
"single_end": false
},
"test__output1Warp.nii.gz:md5,e0995852e251bee5521572a4495a0bd6"
"test__output1Warp.nii.gz:md5,aa42d4dd6f227d986cd99df45425d5c5"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
"nf-test": "0.9.0",
"nextflow": "25.04.7"
},
"timestamp": "2025-02-20T14:58:42.372471"
"timestamp": "2025-09-22T21:23:44.360834413"
},
"registration - anattodwi -stub-run": {
"content": [
[
"versions.yml:md5,f368bc76bf8d1f1a68caea3597b0c65b"
"versions.yml:md5,77dc5dd2d9f2f2b772043eef8471eb13"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
"nf-test": "0.9.0",
"nextflow": "25.04.7"
},
"timestamp": "2025-02-20T14:58:49.169195"
"timestamp": "2025-09-22T21:24:00.939016823"
}
}
14 changes: 8 additions & 6 deletions modules/nf-neuro/registration/ants/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ process REGISTRATION_ANTS {
tag "$meta.id"
label 'process_medium'

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
"https://scil.usherbrooke.ca/containers/scilus_latest.sif":
"scilus/scilus:19c87b72bcbc683fb827097dda7f917940fda123"}"
container "scilus/scilus:2.2.0"

input:
tuple val(meta), path(fixedimage), path(movingimage), path(mask) /* optional, input = [] */
Expand Down Expand Up @@ -80,11 +78,11 @@ process REGISTRATION_ANTS {
# Iterate over images.
for image in fixedimage warped;
do
scil_viz_volume_screenshot.py *\${image}.nii.gz \${image}_coronal.png \
scil_viz_volume_screenshot *\${image}.nii.gz \${image}_coronal.png \
--slices \$coronal_dim --axis coronal \$viz_params
scil_viz_volume_screenshot.py *\${image}.nii.gz \${image}_sagittal.png \
scil_viz_volume_screenshot *\${image}.nii.gz \${image}_sagittal.png \
--slices \$sagittal_dim --axis sagittal \$viz_params
scil_viz_volume_screenshot.py *\${image}.nii.gz \${image}_axial.png \
scil_viz_volume_screenshot *\${image}.nii.gz \${image}_axial.png \
--slices \$axial_dim --axis axial \$viz_params
if [ \$image != fixedimage ];
then
Expand All @@ -109,6 +107,7 @@ process REGISTRATION_ANTS {

cat <<-END_VERSIONS > versions.yml
"${task.process}":
scilpy: \$(uv pip -q -n list | grep scilpy | tr -s ' ' | cut -d' ' -f2)
ants: \$(antsRegistration --version | grep "Version" | sed -E 's/.*v([0-9.a-zA-Z-]+).*/\\1/')
mrtrix: \$(mrinfo -version 2>&1 | grep "== mrinfo" | sed -E 's/== mrinfo ([0-9.]+).*/\\1/')
imagemagick: \$(convert -version | grep "Version:" | sed -E 's/.*ImageMagick ([0-9.-]+).*/\\1/')
Expand All @@ -130,6 +129,8 @@ process REGISTRATION_ANTS {

antsRegistrationSyNQuick.sh -h
antsApplyTransforms -h
convert -h
scil_viz_volume_screenshot -h

touch ${prefix}__t1_warped.nii.gz
touch ${prefix}__output0GenericAffine.mat
Expand All @@ -139,6 +140,7 @@ process REGISTRATION_ANTS {

cat <<-END_VERSIONS > versions.yml
"${task.process}":
scilpy: \$(uv pip -q -n list | grep scilpy | tr -s ' ' | cut -d' ' -f2)
ants: \$(antsRegistration --version | grep "Version" | sed -E 's/.*v([0-9.a-zA-Z-]+).*/\\1/')
mrtrix: \$(mrinfo -version 2>&1 | grep "== mrinfo" | sed -E 's/== mrinfo ([0-9.]+).*/\\1/')
imagemagick: \$(convert -version | grep "Version:" | sed -E 's/.*ImageMagick ([0-9.-]+).*/\\1/')
Expand Down
Loading
Loading