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

[ENH] Update image/resample #22

Merged
merged 2 commits into from
Oct 30, 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
16 changes: 9 additions & 7 deletions modules/nf-neuro/image/resample/main.nf
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
process IMAGE_RESAMPLE {
tag "$meta.id"
label 'process_single'
label 'process_high_memory'

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

input:
tuple val(meta), path(image), path(ref) /* optional, input = [] */
Expand All @@ -18,6 +19,7 @@ process IMAGE_RESAMPLE {

script:
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ? "${task.ext.first_suffix}_resampled" : "resampled"
def reference = "$ref" ? "--ref $ref" : ""
def voxel_size = task.ext.voxel_size ? "--voxel_size " + task.ext.voxel_size : ""
def volume_size = task.ext.volume_size ? "--volume_size " + task.ext.volume_size : ""
Expand All @@ -31,28 +33,28 @@ process IMAGE_RESAMPLE {
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1

scil_volume_resample.py $image ${prefix}__resampled.nii.gz \
scil_volume_resample.py $image ${prefix}_${suffix}.nii.gz \
$voxel_size $volume_size $reference $iso_min \
$f $enforce_dimensions $interp


cat <<-END_VERSIONS > versions.yml
"${task.process}":
scilpy: 2.0.1
scilpy: \$(pip list | grep scilpy | tr -s ' ' | cut -d' ' -f2)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ? "${task.ext.first_suffix}_resampled" : "resampled"
"""
scil_volume_resample.py -h

touch ${prefix}__resampled.nii.gz
touch ${prefix}_${suffix}.nii.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
scilpy: 2.0.1
scilpy: \$(pip list | grep scilpy | tr -s ' ' | cut -d' ' -f2)
END_VERSIONS
"""
}
2 changes: 1 addition & 1 deletion modules/nf-neuro/image/resample/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ keywords:
- resample
- nifti
- volume
- Scilpy
- scilpy
tools:
- "scilpy":
description: "The Sherbrooke Connectivity Imaging Lab (SCIL) Python dMRI processing toolbox."
Expand Down
70 changes: 35 additions & 35 deletions modules/nf-neuro/image/resample/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,f3164907d16ceabf606a03ea0efd3a2f"
"test_resampled.nii.gz:md5,f3164907d16ceabf606a03ea0efd3a2f"
]
],
"1": [
"versions.yml:md5,f2c9fb731758ad9909571d60a85fa792"
"versions.yml:md5,06181e25531a3ebdefdfd2e641a3d645"
],
"image": [
[
{
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,f3164907d16ceabf606a03ea0efd3a2f"
"test_resampled.nii.gz:md5,f3164907d16ceabf606a03ea0efd3a2f"
]
],
"versions": [
"versions.yml:md5,f2c9fb731758ad9909571d60a85fa792"
"versions.yml:md5,06181e25531a3ebdefdfd2e641a3d645"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-05-08T12:39:51.794554"
"timestamp": "2024-10-24T15:30:19.061192"
},
"image - resample - nn": {
"content": [
Expand All @@ -43,31 +43,31 @@
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,8d3e1c9552673b1ce60bc4d090198564"
"test_resampled.nii.gz:md5,8d3e1c9552673b1ce60bc4d090198564"
]
],
"1": [
"versions.yml:md5,f2c9fb731758ad9909571d60a85fa792"
"versions.yml:md5,06181e25531a3ebdefdfd2e641a3d645"
],
"image": [
[
{
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,8d3e1c9552673b1ce60bc4d090198564"
"test_resampled.nii.gz:md5,8d3e1c9552673b1ce60bc4d090198564"
]
],
"versions": [
"versions.yml:md5,f2c9fb731758ad9909571d60a85fa792"
"versions.yml:md5,06181e25531a3ebdefdfd2e641a3d645"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-05-08T12:40:24.002411"
"timestamp": "2024-10-24T15:30:42.725713"
},
"image - resample - volsize": {
"content": [
Expand All @@ -78,31 +78,31 @@
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,7c83b666f9fb2d68643a20d1c7ac21d8"
"test_resampled.nii.gz:md5,7c83b666f9fb2d68643a20d1c7ac21d8"
]
],
"1": [
"versions.yml:md5,f2c9fb731758ad9909571d60a85fa792"
"versions.yml:md5,06181e25531a3ebdefdfd2e641a3d645"
],
"image": [
[
{
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,7c83b666f9fb2d68643a20d1c7ac21d8"
"test_resampled.nii.gz:md5,7c83b666f9fb2d68643a20d1c7ac21d8"
]
],
"versions": [
"versions.yml:md5,f2c9fb731758ad9909571d60a85fa792"
"versions.yml:md5,06181e25531a3ebdefdfd2e641a3d645"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-05-08T12:39:35.764922"
"timestamp": "2024-10-24T15:30:07.1626"
},
"image - resample - voxsize": {
"content": [
Expand All @@ -113,31 +113,31 @@
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,6ffdabab138186db2dab6f98ea6e9ffb"
"test_resampled.nii.gz:md5,6ffdabab138186db2dab6f98ea6e9ffb"
]
],
"1": [
"versions.yml:md5,f2c9fb731758ad9909571d60a85fa792"
"versions.yml:md5,06181e25531a3ebdefdfd2e641a3d645"
],
"image": [
[
{
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,6ffdabab138186db2dab6f98ea6e9ffb"
"test_resampled.nii.gz:md5,6ffdabab138186db2dab6f98ea6e9ffb"
]
],
"versions": [
"versions.yml:md5,f2c9fb731758ad9909571d60a85fa792"
"versions.yml:md5,06181e25531a3ebdefdfd2e641a3d645"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-05-08T12:39:18.016911"
"timestamp": "2024-10-24T15:29:55.01735"
},
"image - resample - ref": {
"content": [
Expand All @@ -148,30 +148,30 @@
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,0a45d21ff294fda2e41c620cf83d0406"
"test_resampled.nii.gz:md5,0a45d21ff294fda2e41c620cf83d0406"
]
],
"1": [
"versions.yml:md5,f2c9fb731758ad9909571d60a85fa792"
"versions.yml:md5,06181e25531a3ebdefdfd2e641a3d645"
],
"image": [
[
{
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,0a45d21ff294fda2e41c620cf83d0406"
"test_resampled.nii.gz:md5,0a45d21ff294fda2e41c620cf83d0406"
]
],
"versions": [
"versions.yml:md5,f2c9fb731758ad9909571d60a85fa792"
"versions.yml:md5,06181e25531a3ebdefdfd2e641a3d645"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-05-08T12:40:07.720638"
"timestamp": "2024-10-24T15:30:31.018615"
}
}
36 changes: 18 additions & 18 deletions subworkflows/nf-neuro/preproc_dwi/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@
[
"versions.yml:md5,0280006ceecc575513278292734ffb27",
"versions.yml:md5,3340c4b5e56ca52f7342be3c9044eb47",
"versions.yml:md5,4d981a0200b8820dd789f135a9dd320f",
"versions.yml:md5,5dce7a8c0b0d6b91ef7826f88c86370e",
"versions.yml:md5,7ddf2e98f59b19c9b933670550f26ad7",
"versions.yml:md5,962f76092c8795ce5e6d768304e2d230",
"versions.yml:md5,b4c068383da080f871c90828b1de0082",
"versions.yml:md5,c15ba5efd24564dba4710b6da8c4b791",
"versions.yml:md5,d1ae2ca80502bf88c4b1c4a42fba6ced",
"versions.yml:md5,d3010f785c88ee5946806a8a758e7efb",
"versions.yml:md5,d68fe3399120f84f1add62181708780b",
"versions.yml:md5,ea5858879452a59bb355228ae7f38111",
"versions.yml:md5,f041502e22449973d84ac1c618e8ebf9"
],
"test_b0.nii.gz",
"test__resampled.nii.gz",
"test_resampled.nii.gz",
"test__dwi_eddy_corrected.bvec",
"test__image_boundingBox.pkl",
"test__image_n4.nii.gz",
"test__resampled.nii.gz",
"test_resampled.nii.gz",
"test__dwi_corrected.nii.gz"
],
"meta": {
"nf-test": "0.9.0-rc1",
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-05T18:15:01.714505"
"timestamp": "2024-10-24T15:39:59.890109"
},
"preproc_dwi_rev_b0": {
"content": [
Expand All @@ -51,28 +51,28 @@
[
"versions.yml:md5,0280006ceecc575513278292734ffb27",
"versions.yml:md5,3340c4b5e56ca52f7342be3c9044eb47",
"versions.yml:md5,4d981a0200b8820dd789f135a9dd320f",
"versions.yml:md5,5dce7a8c0b0d6b91ef7826f88c86370e",
"versions.yml:md5,7ddf2e98f59b19c9b933670550f26ad7",
"versions.yml:md5,962f76092c8795ce5e6d768304e2d230",
"versions.yml:md5,b4c068383da080f871c90828b1de0082",
"versions.yml:md5,c15ba5efd24564dba4710b6da8c4b791",
"versions.yml:md5,d1ae2ca80502bf88c4b1c4a42fba6ced",
"versions.yml:md5,d3010f785c88ee5946806a8a758e7efb",
"versions.yml:md5,ea5858879452a59bb355228ae7f38111",
"versions.yml:md5,f041502e22449973d84ac1c618e8ebf9"
],
"test_b0.nii.gz",
"test__resampled.nii.gz",
"test_resampled.nii.gz",
"test__dwi_eddy_corrected.bvec",
"test__image_boundingBox.pkl",
"test__image_n4.nii.gz",
"test__resampled.nii.gz",
"test_resampled.nii.gz",
"test__dwi_corrected.nii.gz"
],
"meta": {
"nf-test": "0.9.0-rc1",
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-05T18:10:40.247701"
"timestamp": "2024-10-24T15:35:59.573081"
},
"preproc_dwi_all_options": {
"content": [
Expand All @@ -88,27 +88,27 @@
[
"versions.yml:md5,0280006ceecc575513278292734ffb27",
"versions.yml:md5,3340c4b5e56ca52f7342be3c9044eb47",
"versions.yml:md5,4d981a0200b8820dd789f135a9dd320f",
"versions.yml:md5,5dce7a8c0b0d6b91ef7826f88c86370e",
"versions.yml:md5,7ddf2e98f59b19c9b933670550f26ad7",
"versions.yml:md5,962f76092c8795ce5e6d768304e2d230",
"versions.yml:md5,b4c068383da080f871c90828b1de0082",
"versions.yml:md5,c15ba5efd24564dba4710b6da8c4b791",
"versions.yml:md5,d1ae2ca80502bf88c4b1c4a42fba6ced",
"versions.yml:md5,d68fe3399120f84f1add62181708780b",
"versions.yml:md5,ea5858879452a59bb355228ae7f38111",
"versions.yml:md5,f041502e22449973d84ac1c618e8ebf9"
],
"test_b0.nii.gz",
"test__resampled.nii.gz",
"test_resampled.nii.gz",
"test__dwi_eddy_corrected.bvec",
"test__image_boundingBox.pkl",
"test__image_n4.nii.gz",
"test__resampled.nii.gz",
"test_resampled.nii.gz",
"test__dwi_corrected.nii.gz"
],
"meta": {
"nf-test": "0.9.0-rc1",
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-05T18:20:22.568596"
"timestamp": "2024-10-24T15:44:27.839939"
}
}
Loading