From 8f28931732d5cce95f446f43ce22b3ada6ebd125 Mon Sep 17 00:00:00 2001 From: Anthony Gagnon Date: Fri, 25 Oct 2024 09:38:20 -0400 Subject: [PATCH 1/2] apply Alex's changes + reduce test data size --- .../nf-neuro/registration/anattodwi/main.nf | 8 +- modules/nf-neuro/registration/ants/main.nf | 14 +- .../registration/ants/tests/main.nf.test | 83 ++++++-- .../registration/ants/tests/main.nf.test.snap | 198 +++--------------- .../registration/antsapplytransforms/main.nf | 16 +- .../bundle_seg/tests/main.nf.test.snap | 10 +- .../nf-neuro/registration/tests/main.nf.test | 42 ++-- .../registration/tests/main.nf.test.snap | 52 ++--- 8 files changed, 168 insertions(+), 255 deletions(-) diff --git a/modules/nf-neuro/registration/anattodwi/main.nf b/modules/nf-neuro/registration/anattodwi/main.nf index 2a0ea72..f82e840 100644 --- a/modules/nf-neuro/registration/anattodwi/main.nf +++ b/modules/nf-neuro/registration/anattodwi/main.nf @@ -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) @@ -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 """ @@ -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 """ } diff --git a/modules/nf-neuro/registration/ants/main.nf b/modules/nf-neuro/registration/ants/main.nf index 006b17c..0531546 100644 --- a/modules/nf-neuro/registration/ants/main.nf +++ b/modules/nf-neuro/registration/ants/main.nf @@ -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 @@ -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 @@ -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 """ @@ -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 """ } diff --git a/modules/nf-neuro/registration/ants/tests/main.nf.test b/modules/nf-neuro/registration/ants/tests/main.nf.test index 3542742..6a10d5c 100644 --- a/modules/nf-neuro/registration/ants/tests/main.nf.test +++ b/modules/nf-neuro/registration/ants/tests/main.nf.test @@ -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( [ "raw_T1w.zip", "b0.zip" ] ) input[1] = "test.load-test-data" """ } @@ -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 == "raw_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 + [[]] } """ } } @@ -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 == "raw_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 + [[]] } """ } } @@ -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 == "raw_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 + [[]] } """ } } diff --git a/modules/nf-neuro/registration/ants/tests/main.nf.test.snap b/modules/nf-neuro/registration/ants/tests/main.nf.test.snap index 2210d93..f9b4fc0 100644 --- a/modules/nf-neuro/registration/ants/tests/main.nf.test.snap +++ b/modules/nf-neuro/registration/ants/tests/main.nf.test.snap @@ -3,237 +3,105 @@ "content": [ { "0": [ - [ - { - "id": "test", - "single_end": false - }, - "test__warped.nii.gz:md5,131b15551e4c2135b5d2beaf99b77b53" - ] + ], "1": [ - [ - { - "id": "test", - "single_end": false - }, - [ - "test__output0Warp.nii.gz:md5,8386e2afbc21d754877bcd75fc8edefa", - "test__output1GenericAffine.mat:md5,95fc005e7f2b4de689f3246b14b652c0" - ] - ] + ], "2": [ - [ - { - "id": "test", - "single_end": false - }, - [ - "test__output0InverseAffine.mat:md5,aa2254ecad64dcf4e931f3a6f6420039", - "test__output1InverseWarp.nii.gz:md5,6cfc53dc70a840be349f75131c82ec88" - ] - ] + ], "3": [ - "versions.yml:md5,e1ac7994c0f0169d932e94c6e97a4894" + ], "image": [ - [ - { - "id": "test", - "single_end": false - }, - "test__warped.nii.gz:md5,131b15551e4c2135b5d2beaf99b77b53" - ] + ], "transfo_image": [ - [ - { - "id": "test", - "single_end": false - }, - [ - "test__output0Warp.nii.gz:md5,8386e2afbc21d754877bcd75fc8edefa", - "test__output1GenericAffine.mat:md5,95fc005e7f2b4de689f3246b14b652c0" - ] - ] + ], "transfo_trk": [ - [ - { - "id": "test", - "single_end": false - }, - [ - "test__output0InverseAffine.mat:md5,aa2254ecad64dcf4e931f3a6f6420039", - "test__output1InverseWarp.nii.gz:md5,6cfc53dc70a840be349f75131c82ec88" - ] - ] + ], "versions": [ - "versions.yml:md5,e1ac7994c0f0169d932e94c6e97a4894" + ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-10T15:21:55.658936" + "timestamp": "2024-10-24T20:25:38.770257" }, "registration - ants - quick": { "content": [ { "0": [ - [ - { - "id": "test", - "single_end": false - }, - "test__warped.nii.gz:md5,881bfbc46523ed4805ff199996ee199f" - ] + ], "1": [ - [ - { - "id": "test", - "single_end": false - }, - [ - "test__output0Warp.nii.gz:md5,544b50db134e847bdd74bdb31a67f257", - "test__output1GenericAffine.mat:md5,fb0d319e41a7dd04cf65c793c3e78859" - ] - ] + ], "2": [ - [ - { - "id": "test", - "single_end": false - }, - [ - "test__output0InverseAffine.mat:md5,9d86318de62a00ea8ed59a8e0c5ee43c", - "test__output1InverseWarp.nii.gz:md5,909e5ac3b150a6edac675fadf3b348c0" - ] - ] + ], "3": [ - "versions.yml:md5,e1ac7994c0f0169d932e94c6e97a4894" + ], "image": [ - [ - { - "id": "test", - "single_end": false - }, - "test__warped.nii.gz:md5,881bfbc46523ed4805ff199996ee199f" - ] + ], "transfo_image": [ - [ - { - "id": "test", - "single_end": false - }, - [ - "test__output0Warp.nii.gz:md5,544b50db134e847bdd74bdb31a67f257", - "test__output1GenericAffine.mat:md5,fb0d319e41a7dd04cf65c793c3e78859" - ] - ] + ], "transfo_trk": [ - [ - { - "id": "test", - "single_end": false - }, - [ - "test__output0InverseAffine.mat:md5,9d86318de62a00ea8ed59a8e0c5ee43c", - "test__output1InverseWarp.nii.gz:md5,909e5ac3b150a6edac675fadf3b348c0" - ] - ] + ], "versions": [ - "versions.yml:md5,e1ac7994c0f0169d932e94c6e97a4894" + ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-10T18:08:59.528483" + "timestamp": "2024-10-24T20:25:41.956672" }, "registration - ants - options": { "content": [ { "0": [ - [ - { - "id": "test", - "single_end": false - }, - "test__warped.nii.gz:md5,58007213474153da113836b0b98de428" - ] + ], "1": [ - [ - { - "id": "test", - "single_end": false - }, - "test__output1GenericAffine.mat:md5,73802271efb0a0519ca40901a1be480b" - ] + ], "2": [ - [ - { - "id": "test", - "single_end": false - }, - "test__output0InverseAffine.mat:md5,eaf72200cee6f4843ff8b802738374b7" - ] + ], "3": [ - "versions.yml:md5,e1ac7994c0f0169d932e94c6e97a4894" + ], "image": [ - [ - { - "id": "test", - "single_end": false - }, - "test__warped.nii.gz:md5,58007213474153da113836b0b98de428" - ] + ], "transfo_image": [ - [ - { - "id": "test", - "single_end": false - }, - "test__output1GenericAffine.mat:md5,73802271efb0a0519ca40901a1be480b" - ] + ], "transfo_trk": [ - [ - { - "id": "test", - "single_end": false - }, - "test__output0InverseAffine.mat:md5,eaf72200cee6f4843ff8b802738374b7" - ] + ], "versions": [ - "versions.yml:md5,e1ac7994c0f0169d932e94c6e97a4894" + ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-10T15:22:59.155233" + "timestamp": "2024-10-24T20:25:45.064109" } } \ No newline at end of file diff --git a/modules/nf-neuro/registration/antsapplytransforms/main.nf b/modules/nf-neuro/registration/antsapplytransforms/main.nf index 3761521..9b1dd22 100644 --- a/modules/nf-neuro/registration/antsapplytransforms/main.nf +++ b/modules/nf-neuro/registration/antsapplytransforms/main.nf @@ -1,6 +1,6 @@ process REGISTRATION_ANTSAPPLYTRANSFORMS { tag "$meta.id" - label 'process_single' + label 'process_low' container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'scil.usherbrooke.ca/containers/scilus_1.6.0.sif': @@ -19,6 +19,7 @@ process REGISTRATION_ANTSAPPLYTRANSFORMS { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def suffix = task.ext.suffix ?: "${task.ext.first_suffix}_warped" : "warped" def dimensionality = task.ext.dimensionality ? "-d " + task.ext.dimensionality : "" def image_type = task.ext.image_type ? "-e " + task.ext.image_type : "" @@ -27,22 +28,27 @@ process REGISTRATION_ANTSAPPLYTRANSFORMS { def default_val = task.ext.default_val ? "-f " + task.ext.default_val : "" """ + export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=$task.cpus + export OMP_NUM_THREADS=1 + export OPENBLAS_NUM_THREADS=1 + antsApplyTransforms $dimensionality\ -i $image\ -r $reference\ - -o ${prefix}__warped.nii.gz\ + -o ${prefix}__${suffix}.nii.gz\ $interpolation\ -t $transform\ 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 """ stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def suffix = task.ext.suffix ?: "${task.ext.first_suffix}_warped" : "warped" def dimensionality = task.ext.dimensionality ? "-d " + task.ext.dimensionality : "" def image_type = task.ext.image_type ? "-e " + task.ext.image_type : "" @@ -53,11 +59,11 @@ process REGISTRATION_ANTSAPPLYTRANSFORMS { """ antsApplyTransforms -h - touch ${prefix}__warped_image.nii.gz + touch ${prefix}__${suffix}.nii.gz 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 """ } diff --git a/subworkflows/nf-neuro/bundle_seg/tests/main.nf.test.snap b/subworkflows/nf-neuro/bundle_seg/tests/main.nf.test.snap index 257c887..8fd45e3 100644 --- a/subworkflows/nf-neuro/bundle_seg/tests/main.nf.test.snap +++ b/subworkflows/nf-neuro/bundle_seg/tests/main.nf.test.snap @@ -29,7 +29,7 @@ ] ], "1": [ - "versions.yml:md5,0e994f9824f1e014fd5e939e0bce7061", + "versions.yml:md5,b5ff3e60063810aea9f911b2a439b592", "versions.yml:md5,e63f6133bb2e78ce211054111993be59" ], "bundles": [ @@ -59,15 +59,15 @@ ] ], "versions": [ - "versions.yml:md5,0e994f9824f1e014fd5e939e0bce7061", + "versions.yml:md5,b5ff3e60063810aea9f911b2a439b592", "versions.yml:md5,e63f6133bb2e78ce211054111993be59" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-13T15:58:13.048892" + "timestamp": "2024-10-24T20:26:57.178201" } } \ No newline at end of file diff --git a/subworkflows/nf-neuro/registration/tests/main.nf.test b/subworkflows/nf-neuro/registration/tests/main.nf.test index 86ebf60..0372185 100644 --- a/subworkflows/nf-neuro/registration/tests/main.nf.test +++ b/subworkflows/nf-neuro/registration/tests/main.nf.test @@ -21,7 +21,7 @@ nextflow_workflow { script "../../load_test_data/main.nf" process { """ - input[0] = Channel.from( [ "processing.zip", "freesurfer.zip", "registration.zip" ] ) + input[0] = Channel.from( [ "T1w.zip", "b0.zip", "dti.zip" ] ) input[1] = "test.load-test-data" """ } @@ -35,23 +35,23 @@ nextflow_workflow { """ ch_split_test_data = LOAD_DATA.out.test_data_directory .branch{ - processing: it.simpleName == "processing" - t1: it.simpleName == "freesurfer" - b0: it.simpleName == "registration" + t1w: it.simpleName == "T1w" + b0: it.simpleName == "b0" + dti: it.simpleName == "dti" } - input[0] = ch_split_test_data.processing.map{ + input[0] = ch_split_test_data.t1w.map{ test_data_directory -> [ [ id:'test', single_end:false ], - file("\${test_data_directory}/mni_masked_2x2x2.nii.gz") + file("\${test_data_directory}/T1w.nii.gz") ] } - input[1] = ch_split_test_data.processing.map{ + input[1] = ch_split_test_data.b0.map{ test_data_directory -> [ [ id:'test', single_end:false ], - file("\${test_data_directory}/b0_mean.nii.gz") + file("\${test_data_directory}/b0.nii.gz") ] } - input[2] = ch_split_test_data.processing.map{ + input[2] = ch_split_test_data.dti.map{ test_data_directory -> [ [ id:'test', single_end:false ], file("\${test_data_directory}/fa.nii.gz") @@ -79,19 +79,19 @@ nextflow_workflow { """ ch_split_test_data = LOAD_DATA.out.test_data_directory .branch{ - processing: it.simpleName == "processing" - t1: it.simpleName == "freesurfer" - b0: it.simpleName == "registration" + t1w: it.simpleName == "T1w" + b0: it.simpleName == "b0" + dti: it.simpleName == "dti" } - input[0] = ch_split_test_data.processing.map{ + input[0] = ch_split_test_data.t1w.map{ test_data_directory -> [ [ id:'test', single_end:false ], - file("\${test_data_directory}/mni_masked_2x2x2.nii.gz") + file("\${test_data_directory}/T1w.nii.gz") ]} - input[1] = ch_split_test_data.processing.map{ + input[1] = ch_split_test_data.b0.map{ test_data_directory -> [ [ id:'test', single_end:false ], - file("\${test_data_directory}/b0_mean.nii.gz") + file("\${test_data_directory}/b0.nii.gz") ]} input[2] = [] input[3] = Channel.empty() @@ -116,14 +116,14 @@ nextflow_workflow { """ ch_split_test_data = LOAD_DATA.out.test_data_directory .branch{ - processing: it.simpleName == "processing" - t1: it.simpleName == "freesurfer" - b0: it.simpleName == "registration" + t1w: it.simpleName == "T1w" + b0: it.simpleName == "b0" + dti: it.simpleName == "dti" } - input[0] = ch_split_test_data.t1.map{ + input[0] = ch_split_test_data.t1w.map{ test_data_directory -> [ [ id:'test' ], - file("\${test_data_directory}/t1.nii.gz") + file("\${test_data_directory}/T1w.nii.gz") ] } input[1] = ch_split_test_data.b0.map{ diff --git a/subworkflows/nf-neuro/registration/tests/main.nf.test.snap b/subworkflows/nf-neuro/registration/tests/main.nf.test.snap index 4039266..9ae3f2d 100644 --- a/subworkflows/nf-neuro/registration/tests/main.nf.test.snap +++ b/subworkflows/nf-neuro/registration/tests/main.nf.test.snap @@ -26,7 +26,7 @@ "id": "test", "single_end": false }, - "test__t1_warped.nii.gz:md5,ff651c76f4ea493de0a06a202e9f9fb2" + "test__t1_warped.nii.gz:md5,9c34f424900adea263e39ed1f37a793f" ] ], "1": [ @@ -38,8 +38,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" ] ], "3": [ @@ -48,8 +48,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" ] ], "4": [ @@ -59,7 +59,7 @@ ], "6": [ - "versions.yml:md5,9c255f4c751382be7bf6fe6ffb0d635d" + "versions.yml:md5,df4f87e4cf013e11f65c490298bc1249" ], "image_warped": [ [ @@ -67,7 +67,7 @@ "id": "test", "single_end": false }, - "test__t1_warped.nii.gz:md5,ff651c76f4ea493de0a06a202e9f9fb2" + "test__t1_warped.nii.gz:md5,9c34f424900adea263e39ed1f37a793f" ] ], "ref_segmentation": [ @@ -85,8 +85,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": [ @@ -95,12 +95,12 @@ "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,9c255f4c751382be7bf6fe6ffb0d635d" + "versions.yml:md5,df4f87e4cf013e11f65c490298bc1249" ] } ], @@ -108,7 +108,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-12T13:09:01.767340059" + "timestamp": "2024-10-25T09:25:14.344251" }, "registration - SyNQuick": { "content": [ @@ -119,7 +119,7 @@ "id": "test", "single_end": false }, - "test__warped.nii.gz:md5,88442ab57066e1fb1e03f90d73cdfc42" + "test__warped.nii.gz:md5,40010055cb124e9a5e61a2565f1f5db2" ] ], "1": [ @@ -132,8 +132,8 @@ "single_end": false }, [ - "test__output0Warp.nii.gz:md5,61436a721b29633474255640b5e44f7f", - "test__output1GenericAffine.mat:md5,3946e4d33c15911a9a1d72374fdbe4df" + "test__output0Warp.nii.gz:md5,790b8a076b1c146ffbb1d3ae614927d9", + "test__output1GenericAffine.mat:md5,b8f7939863fdef61b97d93f2b6021e12" ] ] ], @@ -144,8 +144,8 @@ "single_end": false }, [ - "test__output0InverseAffine.mat:md5,b30458b37b728d8ce97890b391ad9df9", - "test__output1InverseWarp.nii.gz:md5,278d1774561435ff0a3ec239872b74e5" + "test__output0InverseAffine.mat:md5,966aac28b5eda0fc6299672bfbeeb3ee", + "test__output1InverseWarp.nii.gz:md5,f6c7df8d65a8e31af3250bf8be5aece9" ] ] ], @@ -156,7 +156,7 @@ ], "6": [ - "versions.yml:md5,96376b8bc28640eef565e7f1e258dbb2" + "versions.yml:md5,9fe7f597ac6c76efff8851f9b672f17b" ], "image_warped": [ [ @@ -164,7 +164,7 @@ "id": "test", "single_end": false }, - "test__warped.nii.gz:md5,88442ab57066e1fb1e03f90d73cdfc42" + "test__warped.nii.gz:md5,40010055cb124e9a5e61a2565f1f5db2" ] ], "ref_segmentation": [ @@ -183,8 +183,8 @@ "single_end": false }, [ - "test__output0Warp.nii.gz:md5,61436a721b29633474255640b5e44f7f", - "test__output1GenericAffine.mat:md5,3946e4d33c15911a9a1d72374fdbe4df" + "test__output0Warp.nii.gz:md5,790b8a076b1c146ffbb1d3ae614927d9", + "test__output1GenericAffine.mat:md5,b8f7939863fdef61b97d93f2b6021e12" ] ] ], @@ -195,13 +195,13 @@ "single_end": false }, [ - "test__output0InverseAffine.mat:md5,b30458b37b728d8ce97890b391ad9df9", - "test__output1InverseWarp.nii.gz:md5,278d1774561435ff0a3ec239872b74e5" + "test__output0InverseAffine.mat:md5,966aac28b5eda0fc6299672bfbeeb3ee", + "test__output1InverseWarp.nii.gz:md5,f6c7df8d65a8e31af3250bf8be5aece9" ] ] ], "versions": [ - "versions.yml:md5,96376b8bc28640eef565e7f1e258dbb2" + "versions.yml:md5,9fe7f597ac6c76efff8851f9b672f17b" ] } ], @@ -209,6 +209,6 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-12T13:09:11.665469033" + "timestamp": "2024-10-25T09:19:43.397585" } } \ No newline at end of file From 43ec7aa8c9b19bcb2fde3999e9bb71e674130d5d Mon Sep 17 00:00:00 2001 From: Anthony Gagnon Date: Fri, 25 Oct 2024 18:09:10 +0000 Subject: [PATCH 2/2] update snapshots + change test data to use lean version --- .../registration/anattodwi/tests/main.nf.test | 32 +++- .../anattodwi/tests/main.nf.test.snap | 30 ++-- .../registration/ants/tests/main.nf.test | 12 +- .../registration/ants/tests/main.nf.test.snap | 168 +++++++++++++++--- .../registration/ants/tests/nextflow.config | 1 + .../registration/antsapplytransforms/main.nf | 12 +- .../tests/main.nf.test.snap | 10 +- .../registration/tests/main.nf.test.snap | 4 +- .../tests/nextflow_easyreg.config | 2 +- 9 files changed, 203 insertions(+), 68 deletions(-) diff --git a/modules/nf-neuro/registration/anattodwi/tests/main.nf.test b/modules/nf-neuro/registration/anattodwi/tests/main.nf.test index 2d651aa..a6a51a7 100644 --- a/modules/nf-neuro/registration/anattodwi/tests/main.nf.test +++ b/modules/nf-neuro/registration/anattodwi/tests/main.nf.test @@ -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" """ } @@ -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) """ } } diff --git a/modules/nf-neuro/registration/anattodwi/tests/main.nf.test.snap b/modules/nf-neuro/registration/anattodwi/tests/main.nf.test.snap index 79210f2..7c358ef 100644 --- a/modules/nf-neuro/registration/anattodwi/tests/main.nf.test.snap +++ b/modules/nf-neuro/registration/anattodwi/tests/main.nf.test.snap @@ -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": [ @@ -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": [ @@ -28,11 +28,11 @@ "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": [ [ @@ -40,7 +40,7 @@ "id": "test", "single_end": false }, - "test__t1_warped.nii.gz:md5,ff651c76f4ea493de0a06a202e9f9fb2" + "test__t1_warped.nii.gz:md5,9c34f424900adea263e39ed1f37a793f" ] ], "transfo_image": [ @@ -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": [ @@ -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" } } \ No newline at end of file diff --git a/modules/nf-neuro/registration/ants/tests/main.nf.test b/modules/nf-neuro/registration/ants/tests/main.nf.test index 6a10d5c..d565539 100644 --- a/modules/nf-neuro/registration/ants/tests/main.nf.test +++ b/modules/nf-neuro/registration/ants/tests/main.nf.test @@ -17,7 +17,7 @@ nextflow_process { script "../../../../../subworkflows/nf-neuro/load_test_data/main.nf" process { """ - input[0] = Channel.from( [ "raw_T1w.zip", "b0.zip" ] ) + input[0] = Channel.from( [ "T1w.zip", "b0.zip" ] ) input[1] = "test.load-test-data" """ } @@ -31,7 +31,7 @@ nextflow_process { """ ch_split_test_data = LOAD_DATA.out.test_data_directory .branch{ - T1w: it.simpleName == "raw_T1w" + T1w: it.simpleName == "T1w" b0: it.simpleName == "b0" } ch_T1w = ch_split_test_data.T1w.map{ @@ -67,7 +67,7 @@ nextflow_process { """ ch_split_test_data = LOAD_DATA.out.test_data_directory .branch{ - T1w: it.simpleName == "raw_T1w" + T1w: it.simpleName == "T1w" b0: it.simpleName == "b0" } ch_T1w = ch_split_test_data.T1w.map{ @@ -103,13 +103,14 @@ nextflow_process { """ ch_split_test_data = LOAD_DATA.out.test_data_directory .branch{ - T1w: it.simpleName == "raw_T1w" + 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.nii.gz"), + file("\${test_data_directory}/T1w_mask.nii.gz") ] } ch_b0 = ch_split_test_data.b0.map{ @@ -120,7 +121,6 @@ nextflow_process { } input[0] = ch_b0 .join(ch_T1w) - .map{ it + [[]] } """ } } diff --git a/modules/nf-neuro/registration/ants/tests/main.nf.test.snap b/modules/nf-neuro/registration/ants/tests/main.nf.test.snap index f9b4fc0..6f15a86 100644 --- a/modules/nf-neuro/registration/ants/tests/main.nf.test.snap +++ b/modules/nf-neuro/registration/ants/tests/main.nf.test.snap @@ -3,28 +3,70 @@ "content": [ { "0": [ - + [ + { + "id": "test" + }, + "test__warped.nii.gz:md5,4382217c04988eb01ed8f99916d7631c" + ] ], "1": [ - + [ + { + "id": "test" + }, + [ + "test__output0Warp.nii.gz:md5,6fee747df2c30bb48cf2b6897b5d3e17", + "test__output1GenericAffine.mat:md5,8e987eb08cc568478c37ae79a8824f8b" + ] + ] ], "2": [ - + [ + { + "id": "test" + }, + [ + "test__output0InverseAffine.mat:md5,d342d5f1c35a53cadcdf2d49a25f5ce8", + "test__output1InverseWarp.nii.gz:md5,1608837de13478dff81fe51ac1720d28" + ] + ] ], "3": [ - + "versions.yml:md5,825e9d4ea9e26675d7e236f243d73114" ], "image": [ - + [ + { + "id": "test" + }, + "test__warped.nii.gz:md5,4382217c04988eb01ed8f99916d7631c" + ] ], "transfo_image": [ - + [ + { + "id": "test" + }, + [ + "test__output0Warp.nii.gz:md5,6fee747df2c30bb48cf2b6897b5d3e17", + "test__output1GenericAffine.mat:md5,8e987eb08cc568478c37ae79a8824f8b" + ] + ] ], "transfo_trk": [ - + [ + { + "id": "test" + }, + [ + "test__output0InverseAffine.mat:md5,d342d5f1c35a53cadcdf2d49a25f5ce8", + "test__output1InverseWarp.nii.gz:md5,1608837de13478dff81fe51ac1720d28" + ] + ] ], "versions": [ - + "versions.yml:md5,825e9d4ea9e26675d7e236f243d73114" ] } ], @@ -32,34 +74,76 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-24T20:25:38.770257" + "timestamp": "2024-10-25T17:37:35.205440745" }, "registration - ants - quick": { "content": [ { "0": [ - + [ + { + "id": "test" + }, + "test__warped.nii.gz:md5,81358dd2f3223f567f4101e61490ae0f" + ] ], "1": [ - + [ + { + "id": "test" + }, + [ + "test__output0Warp.nii.gz:md5,24e6f53eaa3e4476bb627c374bc809ca", + "test__output1GenericAffine.mat:md5,48c8479a403e0c0ec29c69d37bb4c91a" + ] + ] ], "2": [ - + [ + { + "id": "test" + }, + [ + "test__output0InverseAffine.mat:md5,25d0b8a83a922f2e4e89c6a86258af15", + "test__output1InverseWarp.nii.gz:md5,24e6f53eaa3e4476bb627c374bc809ca" + ] + ] ], "3": [ - + "versions.yml:md5,825e9d4ea9e26675d7e236f243d73114" ], "image": [ - + [ + { + "id": "test" + }, + "test__warped.nii.gz:md5,81358dd2f3223f567f4101e61490ae0f" + ] ], "transfo_image": [ - + [ + { + "id": "test" + }, + [ + "test__output0Warp.nii.gz:md5,24e6f53eaa3e4476bb627c374bc809ca", + "test__output1GenericAffine.mat:md5,48c8479a403e0c0ec29c69d37bb4c91a" + ] + ] ], "transfo_trk": [ - + [ + { + "id": "test" + }, + [ + "test__output0InverseAffine.mat:md5,25d0b8a83a922f2e4e89c6a86258af15", + "test__output1InverseWarp.nii.gz:md5,24e6f53eaa3e4476bb627c374bc809ca" + ] + ] ], "versions": [ - + "versions.yml:md5,825e9d4ea9e26675d7e236f243d73114" ] } ], @@ -67,34 +151,64 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-24T20:25:41.956672" + "timestamp": "2024-10-25T17:14:19.681843788" }, "registration - ants - options": { "content": [ { "0": [ - + [ + { + "id": "test" + }, + "test__warped.nii.gz:md5,7cb6839d4af18d9d37a1bd9d07c8c57b" + ] ], "1": [ - + [ + { + "id": "test" + }, + "test__output1GenericAffine.mat:md5,c3a48d19c815206de2b140f505969317" + ] ], "2": [ - + [ + { + "id": "test" + }, + "test__output0InverseAffine.mat:md5,f473c1e548be1540cbf757202ffd5984" + ] ], "3": [ - + "versions.yml:md5,825e9d4ea9e26675d7e236f243d73114" ], "image": [ - + [ + { + "id": "test" + }, + "test__warped.nii.gz:md5,7cb6839d4af18d9d37a1bd9d07c8c57b" + ] ], "transfo_image": [ - + [ + { + "id": "test" + }, + "test__output1GenericAffine.mat:md5,c3a48d19c815206de2b140f505969317" + ] ], "transfo_trk": [ - + [ + { + "id": "test" + }, + "test__output0InverseAffine.mat:md5,f473c1e548be1540cbf757202ffd5984" + ] ], "versions": [ - + "versions.yml:md5,825e9d4ea9e26675d7e236f243d73114" ] } ], @@ -102,6 +216,6 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-24T20:25:45.064109" + "timestamp": "2024-10-25T17:14:25.782091391" } } \ No newline at end of file diff --git a/modules/nf-neuro/registration/ants/tests/nextflow.config b/modules/nf-neuro/registration/ants/tests/nextflow.config index dcb4d7c..3750dac 100644 --- a/modules/nf-neuro/registration/ants/tests/nextflow.config +++ b/modules/nf-neuro/registration/ants/tests/nextflow.config @@ -1,5 +1,6 @@ process { withName: "REGISTRATION_ANTS" { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + ext.repro_mode = 1 } } diff --git a/modules/nf-neuro/registration/antsapplytransforms/main.nf b/modules/nf-neuro/registration/antsapplytransforms/main.nf index 9b1dd22..4adac58 100644 --- a/modules/nf-neuro/registration/antsapplytransforms/main.nf +++ b/modules/nf-neuro/registration/antsapplytransforms/main.nf @@ -3,15 +3,15 @@ process REGISTRATION_ANTSAPPLYTRANSFORMS { label 'process_low' container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'scil.usherbrooke.ca/containers/scilus_1.6.0.sif': - 'scilus/scilus:1.6.0' }" + 'scil.usherbrooke.ca/containers/scilus_2.0.2.sif': + 'scilus/scilus:2.0.2' }" input: tuple val(meta), path(image), path(reference), path(transform) output: - tuple val(meta), path("*__warped.nii.gz"), emit: warped_image - path "versions.yml" , emit: versions + tuple val(meta), path("*__warped.nii.gz") , emit: warped_image + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -19,7 +19,7 @@ process REGISTRATION_ANTSAPPLYTRANSFORMS { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def suffix = task.ext.suffix ?: "${task.ext.first_suffix}_warped" : "warped" + def suffix = task.ext.first_suffix ? "${task.ext.first_suffix}_warped" : "warped" def dimensionality = task.ext.dimensionality ? "-d " + task.ext.dimensionality : "" def image_type = task.ext.image_type ? "-e " + task.ext.image_type : "" @@ -48,7 +48,7 @@ process REGISTRATION_ANTSAPPLYTRANSFORMS { stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def suffix = task.ext.suffix ?: "${task.ext.first_suffix}_warped" : "warped" + def suffix = task.ext.first_suffix ? "${task.ext.first_suffix}_warped" : "warped" def dimensionality = task.ext.dimensionality ? "-d " + task.ext.dimensionality : "" def image_type = task.ext.image_type ? "-e " + task.ext.image_type : "" diff --git a/modules/nf-neuro/registration/antsapplytransforms/tests/main.nf.test.snap b/modules/nf-neuro/registration/antsapplytransforms/tests/main.nf.test.snap index 1e9c493..66d4bd8 100644 --- a/modules/nf-neuro/registration/antsapplytransforms/tests/main.nf.test.snap +++ b/modules/nf-neuro/registration/antsapplytransforms/tests/main.nf.test.snap @@ -12,10 +12,10 @@ ] ], "1": [ - "versions.yml:md5,180609e91d7d492cd7db9b09f47f055d" + "versions.yml:md5,f45b96ead53b75f1fc565461836b1475" ], "versions": [ - "versions.yml:md5,180609e91d7d492cd7db9b09f47f055d" + "versions.yml:md5,f45b96ead53b75f1fc565461836b1475" ], "warped_image": [ [ @@ -29,9 +29,9 @@ } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-01T13:21:10.708882" + "timestamp": "2024-10-25T18:07:26.443335534" } } \ No newline at end of file diff --git a/subworkflows/nf-neuro/registration/tests/main.nf.test.snap b/subworkflows/nf-neuro/registration/tests/main.nf.test.snap index 9ae3f2d..8519d24 100644 --- a/subworkflows/nf-neuro/registration/tests/main.nf.test.snap +++ b/subworkflows/nf-neuro/registration/tests/main.nf.test.snap @@ -5,7 +5,7 @@ "test_reference_registered.nii.gz", "test_forward_field.nii.gz", "test_backward_field.nii.gz", - "test_floating_segmentation.nii.gz:md5:header,d559b931014ef191f9af17abf1152a3c,data,85934f256bb314487d31e1405393f31f", + "test_floating_segmentation.nii.gz:md5:header,74ed7e917b9fde7b2aaba7f512cc1edf,data,e1ed38ea961180d3e4c03a56c1c7bc4c", "test_reference_segmentation.nii.gz", [ "versions.yml:md5,3f38c911476c605480c02e484fcf6e9f" @@ -15,7 +15,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-12T13:16:40.170919866" + "timestamp": "2024-10-25T14:12:29.150266819" }, "registration - antsRegistration": { "content": [ diff --git a/subworkflows/nf-neuro/registration/tests/nextflow_easyreg.config b/subworkflows/nf-neuro/registration/tests/nextflow_easyreg.config index 5e5800b..b96d6d8 100644 --- a/subworkflows/nf-neuro/registration/tests/nextflow_easyreg.config +++ b/subworkflows/nf-neuro/registration/tests/nextflow_easyreg.config @@ -1,7 +1,7 @@ process { withName: "REGISTRATION_EASYREG" { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - memory = '16G' + memory = '14G' ext.field = true } }