Skip to content

Commit

Permalink
Merge pull request #23 from gagnonanthony/update_registration
Browse files Browse the repository at this point in the history
[ENH] Update registration modules
  • Loading branch information
arnaudbore authored Oct 30, 2024
2 parents 30047fb + 43ec7aa commit d4ec0e6
Show file tree
Hide file tree
Showing 13 changed files with 248 additions and 200 deletions.
8 changes: 4 additions & 4 deletions modules/nf-neuro/registration/anattodwi/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ process REGISTRATION_ANATTODWI {
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' }"
'https://scil.usherbrooke.ca/containers/scilus_2.0.2.sif':
'scilus/scilus:2.0.2' }"

input:
tuple val(meta), path(t1), path(b0), path(metric)
Expand Down Expand Up @@ -57,7 +57,7 @@ process REGISTRATION_ANATTODWI {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ants: 2.4.3
ants: antsRegistration --version | grep "Version" | sed -E 's/.*v([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/'
END_VERSIONS
"""

Expand All @@ -74,7 +74,7 @@ process REGISTRATION_ANATTODWI {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ants: 2.4.3
ants: antsRegistration --version | grep "Version" | sed -E 's/.*v([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/'
END_VERSIONS
"""
}
32 changes: 26 additions & 6 deletions modules/nf-neuro/registration/anattodwi/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nextflow_process {
script "../../../../../subworkflows/nf-neuro/load_test_data/main.nf"
process {
"""
input[0] = Channel.from( [ "processing.zip" ] )
input[0] = Channel.from( [ "T1w.zip", "b0.zip", "dti.zip" ] )
input[1] = "test.load-test-data"
"""
}
Expand All @@ -30,13 +30,33 @@ nextflow_process {
when {
process {
"""
input[0] = LOAD_DATA.out.test_data_directory
.map{ test_data_directory -> [
ch_split_test_data = LOAD_DATA.out.test_data_directory
.branch{
t1w: it.simpleName == "T1w"
b0: it.simpleName == "b0"
dti: it.simpleName == "dti"
}
ch_t1w = ch_split_test_data.t1w.map{
test_data_directory -> [
[ id:'test', single_end:false ],
file("\${test_data_directory}/T1w.nii.gz")
]
}
ch_b0 = ch_split_test_data.b0.map{
test_data_directory -> [
[ id:'test', single_end:false ],
file("\${test_data_directory}/b0.nii.gz")
]
}
ch_fa = ch_split_test_data.dti.map{
test_data_directory -> [
[ id:'test', single_end:false ],
file("\${test_data_directory}/mni_masked_2x2x2.nii.gz"),
file("\${test_data_directory}/b0_mean.nii.gz"),
file("\${test_data_directory}/fa.nii.gz")
]}
]
}
input[0] = ch_t1w
.join(ch_b0)
.join(ch_fa)
"""
}
}
Expand Down
30 changes: 15 additions & 15 deletions modules/nf-neuro/registration/anattodwi/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"id": "test",
"single_end": false
},
"test__output0GenericAffine.mat:md5,043decee0d131e79a802e3dcc61c22f0",
"test__output1InverseWarp.nii.gz:md5,62d6287e60dd36ffd477e71061f23077"
"test__output0GenericAffine.mat:md5,6eef07f9004fb96e57ae0404ffef174c",
"test__output1InverseWarp.nii.gz:md5,28694d2b41f5209ab8f1acbb219014fe"
]
],
"1": [
Expand All @@ -18,8 +18,8 @@
"id": "test",
"single_end": false
},
"test__output1Warp.nii.gz:md5,f896e4fef21f26c84bf834afd7fb5d55",
"test__output0GenericAffine.mat:md5,043decee0d131e79a802e3dcc61c22f0"
"test__output1Warp.nii.gz:md5,e0995852e251bee5521572a4495a0bd6",
"test__output0GenericAffine.mat:md5,6eef07f9004fb96e57ae0404ffef174c"
]
],
"2": [
Expand All @@ -28,19 +28,19 @@
"id": "test",
"single_end": false
},
"test__t1_warped.nii.gz:md5,ff651c76f4ea493de0a06a202e9f9fb2"
"test__t1_warped.nii.gz:md5,9c34f424900adea263e39ed1f37a793f"
]
],
"3": [
"versions.yml:md5,3b94092e010fc0f6bf505074a393ddcc"
"versions.yml:md5,4c48209a8bd74e5b5194b799152df754"
],
"t1_warped": [
[
{
"id": "test",
"single_end": false
},
"test__t1_warped.nii.gz:md5,ff651c76f4ea493de0a06a202e9f9fb2"
"test__t1_warped.nii.gz:md5,9c34f424900adea263e39ed1f37a793f"
]
],
"transfo_image": [
Expand All @@ -49,8 +49,8 @@
"id": "test",
"single_end": false
},
"test__output1Warp.nii.gz:md5,f896e4fef21f26c84bf834afd7fb5d55",
"test__output0GenericAffine.mat:md5,043decee0d131e79a802e3dcc61c22f0"
"test__output1Warp.nii.gz:md5,e0995852e251bee5521572a4495a0bd6",
"test__output0GenericAffine.mat:md5,6eef07f9004fb96e57ae0404ffef174c"
]
],
"transfo_trk": [
Expand All @@ -59,19 +59,19 @@
"id": "test",
"single_end": false
},
"test__output0GenericAffine.mat:md5,043decee0d131e79a802e3dcc61c22f0",
"test__output1InverseWarp.nii.gz:md5,62d6287e60dd36ffd477e71061f23077"
"test__output0GenericAffine.mat:md5,6eef07f9004fb96e57ae0404ffef174c",
"test__output1InverseWarp.nii.gz:md5,28694d2b41f5209ab8f1acbb219014fe"
]
],
"versions": [
"versions.yml:md5,3b94092e010fc0f6bf505074a393ddcc"
"versions.yml:md5,4c48209a8bd74e5b5194b799152df754"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-05-01T18:20:24.065842"
"timestamp": "2024-10-25T15:05:47.707432102"
}
}
14 changes: 7 additions & 7 deletions modules/nf-neuro/registration/ants/main.nf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

process REGISTRATION_ANTS {
tag "$meta.id"
label 'process_single'
label 'process_medium'

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' }"
'https://scil.usherbrooke.ca/containers/scilus_2.0.2.sif':
'scilus/scilus:2.0.2' }"

input:
tuple val(meta), path(fixedimage), path(movingimage), path(mask)
tuple val(meta), path(fixedimage), path(movingimage), path(mask) //** optional, input = [] **//

output:
tuple val(meta), path("*_warped.nii.gz") , emit: image
Expand Down Expand Up @@ -39,7 +39,7 @@ process REGISTRATION_ANTS {
if ( task.ext.collapse_output ) args += " -z " + task.ext.collapse_output

"""
export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1
export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=$task.cpus
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
Expand All @@ -62,7 +62,7 @@ process REGISTRATION_ANTS {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ants: 2.4.3
ants: antsRegistration --version | grep "Version" | sed -E 's/.*v([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/'
END_VERSIONS
"""

Expand All @@ -82,7 +82,7 @@ process REGISTRATION_ANTS {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ants: 2.4.3
ants: antsRegistration --version | grep "Version" | sed -E 's/.*v([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/'
END_VERSIONS
"""
}
83 changes: 61 additions & 22 deletions modules/nf-neuro/registration/ants/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ nextflow_process {
script "../../../../../subworkflows/nf-neuro/load_test_data/main.nf"
process {
"""
input[0] = Channel.from( [ "others.zip" ] )
input[0] = Channel.from( [ "T1w.zip", "b0.zip" ] )
input[1] = "test.load-test-data"
"""
}
Expand All @@ -29,13 +29,26 @@ nextflow_process {
when {
process {
"""
input[0] = LOAD_DATA.out.test_data_directory
.map{ test_data_directory -> [
[ id:'test', single_end:false ],
file("\${test_data_directory}/t1_crop.nii.gz"),
file("\${test_data_directory}/t1_resample.nii.gz"),
[]
]}
ch_split_test_data = LOAD_DATA.out.test_data_directory
.branch{
T1w: it.simpleName == "T1w"
b0: it.simpleName == "b0"
}
ch_T1w = ch_split_test_data.T1w.map{
test_data_directory -> [
[ id:'test' ],
file("\${test_data_directory}/T1w.nii.gz")
]
}
ch_b0 = ch_split_test_data.b0.map{
test_data_directory -> [
[ id:'test' ],
file("\${test_data_directory}/b0.nii.gz")
]
}
input[0] = ch_b0
.join(ch_T1w)
.map{ it + [[]] }
"""
}
}
Expand All @@ -52,13 +65,26 @@ nextflow_process {
when {
process {
"""
input[0] = LOAD_DATA.out.test_data_directory
.map{ test_data_directory -> [
[ id:'test', single_end:false ],
file("\${test_data_directory}/t1_crop.nii.gz"),
file("\${test_data_directory}/t1_resample.nii.gz"),
[]
]}
ch_split_test_data = LOAD_DATA.out.test_data_directory
.branch{
T1w: it.simpleName == "T1w"
b0: it.simpleName == "b0"
}
ch_T1w = ch_split_test_data.T1w.map{
test_data_directory -> [
[ id:'test' ],
file("\${test_data_directory}/T1w.nii.gz")
]
}
ch_b0 = ch_split_test_data.b0.map{
test_data_directory -> [
[ id:'test' ],
file("\${test_data_directory}/b0.nii.gz")
]
}
input[0] = ch_b0
.join(ch_T1w)
.map{ it + [[]] }
"""
}
}
Expand All @@ -75,13 +101,26 @@ nextflow_process {
when {
process {
"""
input[0] = LOAD_DATA.out.test_data_directory
.map{ test_data_directory -> [
[ id:'test', single_end:false ],
file("\${test_data_directory}/t1_crop.nii.gz"),
file("\${test_data_directory}/t1_resample.nii.gz"),
[]
]}
ch_split_test_data = LOAD_DATA.out.test_data_directory
.branch{
T1w: it.simpleName == "T1w"
b0: it.simpleName == "b0"
}
ch_T1w = ch_split_test_data.T1w.map{
test_data_directory -> [
[ id:'test' ],
file("\${test_data_directory}/T1w.nii.gz"),
file("\${test_data_directory}/T1w_mask.nii.gz")
]
}
ch_b0 = ch_split_test_data.b0.map{
test_data_directory -> [
[ id:'test' ],
file("\${test_data_directory}/b0.nii.gz")
]
}
input[0] = ch_b0
.join(ch_T1w)
"""
}
}
Expand Down
Loading

0 comments on commit d4ec0e6

Please sign in to comment.