diff --git a/modules/nf-neuro/registration/convert/main.nf b/modules/nf-neuro/registration/convert/main.nf index dd0ffce..aa1be91 100644 --- a/modules/nf-neuro/registration/convert/main.nf +++ b/modules/nf-neuro/registration/convert/main.nf @@ -6,11 +6,11 @@ process REGISTRATION_CONVERT { containerOptions "--env FSLOUTPUTTYPE='NIFTI_GZ'" input: - tuple val(meta), path(affine), path(deform), path(source), path(target), path(fs_license) + tuple val(meta), path(deform), path(affine), path(source), path(target), path(fs_license) output: - tuple val(meta), path("*.{txt,lta,mat,dat}"), emit: affine_transform - tuple val(meta), path("*.{nii,nii.gz,mgz,m3z}"), emit: deform_transform + tuple val(meta), path("*out_deform_warp.{nii,nii.gz,mgz,m3z}") , emit: deform_transform + tuple val(meta), path("*out_affine_warp.{txt,lta,mat,dat}") , emit: affine_transform, optional: true path "versions.yml" , emit: versions when: @@ -40,15 +40,20 @@ process REGISTRATION_CONVERT { cp $fs_license \$FREESURFER_HOME/license.txt - declare -A affine_dictionnary=( ["--outlta"]="lta" \ - ["--outfsl"]="mat" \ - ["--outmni"]="xfm" \ - ["--outreg"]="dat" \ - ["--outniftyreg"]="txt" \ - ["--outitk"]="txt" \ - ["--outvox"]="txt" ) + if [[ -f "$affine" ]]; + then + declare -A affine_dictionnary=( ["--outlta"]="lta" \ + ["--outfsl"]="mat" \ + ["--outmni"]="xfm" \ + ["--outreg"]="dat" \ + ["--outniftyreg"]="txt" \ + ["--outitk"]="txt" \ + ["--outvox"]="txt" ) - ext_affine=\${affine_dictionnary[${out_format_affine}]} + ext_affine=\${affine_dictionnary[${out_format_affine}]} + + lta_convert ${invert} ${source_geometry_affine} ${target_geometry_affine} ${in_format_affine} ${out_format_affine} ${prefix}__out_affine_warp.\${ext_affine} + fi declare -A deform_dictionnary=( ["--outm3z"]="m3z" \ ["--outfsl"]="nii.gz" \ @@ -59,14 +64,13 @@ process REGISTRATION_CONVERT { ext_deform=\${deform_dictionnary[${out_format_deform}]} - lta_convert ${invert} ${source_geometry_affine} ${target_geometry_affine} ${in_format_affine} ${out_format_affine} ${prefix}__affine_warp.\${ext_affine} - mri_warp_convert ${source_geometry_deform} ${downsample} ${in_format_deform} ${out_format_deform} ${prefix}__deform_warp.\${ext_deform} + mri_warp_convert ${source_geometry_deform} ${downsample} ${in_format_deform} ${out_format_deform} ${prefix}__out_deform_warp.\${ext_deform} rm \$FREESURFER_HOME/license.txt cat <<-END_VERSIONS > versions.yml "${task.process}": - Freesurfer: 7.4.1 + Freesurfer: \$(mri_convert -version | grep "freesurfer" | sed -E 's/.* ([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/') END_VERSIONS """ @@ -78,12 +82,12 @@ process REGISTRATION_CONVERT { lta_convert -h mri_warp_convert -h - touch ${prefix}__affine_transform.txt touch ${prefix}__deform_transform.nii.gz + touch ${prefix}__affine_transform.txt cat <<-END_VERSIONS > versions.yml "${task.process}": - Freesurfer: 7.4.1 + Freesurfer: \$(mri_convert -version | grep "freesurfer" | sed -E 's/.* ([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/') END_VERSIONS """ } diff --git a/modules/nf-neuro/registration/convert/meta.yml b/modules/nf-neuro/registration/convert/meta.yml index b2b88a2..b37c0a2 100644 --- a/modules/nf-neuro/registration/convert/meta.yml +++ b/modules/nf-neuro/registration/convert/meta.yml @@ -19,16 +19,16 @@ input: Groovy Map containing sample information e.g. `[ id:'test', single_end:false ]` - - affine: - type: file - description: Affine transform to convert. Default usage expects Freesurfer .lta format from mri_synthmorph - pattern: "*.{lta,txt,xfm,dat}" - - deform: type: file description: Deform transform to convert. Default usage expects Freesurfer .mgz format from mri_synthmorph pattern: "*.{nii,nii.gz,mgz,m3z}" + - affine: + type: file + description: Affine transform to convert. Default usage expects Freesurfer .lta format from mri_synthmorph + pattern: "*.{lta,txt,xfm,dat}" + - source: type: file description: Moving Nifti volume used for registration. Defines source image geometry @@ -51,16 +51,16 @@ output: Groovy Map containing sample information e.g. `[ id:'test', single_end:false ]` - - affine_transform: - type: file - description: Affine transform. Default usage outputs ANTs (ITK) format .txt - pattern: "*.{txt,lta,mat,dat}" - - deform_transform: type: file description: Deform transform. Default usage outputs ANTs (ITK) format .nii.gz pattern: "*.{nii,nii.gz,mgz,m3z}" + - affine_transform: + type: file + description: Affine transform. Default usage outputs ANTs (ITK) format .txt + pattern: "*.{txt,lta,mat,dat}" + - versions: type: file description: File containing software versions diff --git a/modules/nf-neuro/registration/convert/tests/main.nf.test b/modules/nf-neuro/registration/convert/tests/main.nf.test index a28c3ed..4aee8bb 100644 --- a/modules/nf-neuro/registration/convert/tests/main.nf.test +++ b/modules/nf-neuro/registration/convert/tests/main.nf.test @@ -41,8 +41,8 @@ nextflow_process { ch_transforms = ch_split_test_data.transforms.map{ test_data_directory -> [ [ id:'test' ], - file("\${test_data_directory}/fs_affine.lta"), file("\${test_data_directory}/fs_deform.nii.gz"), + [] ] } ch_reslice = ch_split_test_data.reslice.map{ @@ -73,6 +73,54 @@ nextflow_process { } } + test("registration - convert - affine") { + + config "./nextflow_default.config" + + when { + process { + """ + ch_split_test_data = LOAD_DATA.out.test_data_directory + .branch{ + freesurfer: it.simpleName == "freesurfer" + reslice: it.simpleName == "freesurfer_reslice" + transforms: it.simpleName == "freesurfer_transforms" + } + ch_transforms = ch_split_test_data.transforms.map{ + test_data_directory -> [ + [ id:'test' ], + file("\${test_data_directory}/fs_deform.nii.gz"), + file("\${test_data_directory}/fs_affine.lta") + ] + } + ch_reslice = ch_split_test_data.reslice.map{ + test_data_directory -> [ + [ id:'test' ], + file("\${test_data_directory}/t1_reslice.nii.gz"), + file("\${test_data_directory}/fa_reslice.nii.gz") + ] + } + ch_freesurfer = ch_split_test_data.freesurfer.map{ + test_data_directory -> [ + [ id:'test' ], + file("\${test_data_directory}/license.txt") + ] + } + input[0] = ch_transforms + .join(ch_reslice) + .join(ch_freesurfer) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + test("registration - convert - fsants") { config "./nextflow_fsants.config" @@ -89,8 +137,8 @@ nextflow_process { ch_transforms = ch_split_test_data.transforms.map{ test_data_directory -> [ [ id:'test' ], - file("\${test_data_directory}/fs_affine.lta"), - file("\${test_data_directory}/fs_deform.nii.gz") + file("\${test_data_directory}/fs_deform.nii.gz"), + file("\${test_data_directory}/fs_affine.lta") ] } ch_reslice = ch_split_test_data.reslice.map{ @@ -137,8 +185,8 @@ nextflow_process { ch_transforms = ch_split_test_data.transforms.map{ test_data_directory -> [ [ id:'test' ], - file("\${test_data_directory}/fsl_affine.mat"), - file("\${test_data_directory}/fsl_deform.nii.gz") + file("\${test_data_directory}/fsl_deform.nii.gz"), + file("\${test_data_directory}/fsl_affine.mat") ] } ch_reslice = ch_split_test_data.reslice.map{ @@ -189,8 +237,8 @@ nextflow_process { ch_transforms = ch_split_test_data.transforms.map{ test_data_directory -> [ [ id:'test' ], - file("\${test_data_directory}/fsl_affine.mat"), - file("\${test_data_directory}/fsl_deform.nii.gz") + file("\${test_data_directory}/fsl_deform.nii.gz"), + file("\${test_data_directory}/fsl_affine.mat") ] } ch_reslice = ch_split_test_data.reslice.map{ @@ -237,8 +285,8 @@ nextflow_process { ch_transforms = ch_split_test_data.transforms.map{ test_data_directory -> [ [ id:'test' ], - file("\${test_data_directory}/ants_affine.txt"), - file("\${test_data_directory}/ants_deform.nii.gz") + file("\${test_data_directory}/ants_deform.nii.gz"), + file("\${test_data_directory}/ants_affine.txt") ] } ch_reslice = ch_split_test_data.reslice.map{ diff --git a/modules/nf-neuro/registration/convert/tests/main.nf.test.snap b/modules/nf-neuro/registration/convert/tests/main.nf.test.snap index 4d91a80..c360f93 100644 --- a/modules/nf-neuro/registration/convert/tests/main.nf.test.snap +++ b/modules/nf-neuro/registration/convert/tests/main.nf.test.snap @@ -7,7 +7,7 @@ { "id": "test" }, - "test__affine_warp.txt:md5,5f989a979be61faa578ad619377a8a07" + "test__out_deform_warp.nii.gz:md5,69052e6226da946bad1f9466285cbb89" ] ], "1": [ @@ -15,7 +15,7 @@ { "id": "test" }, - "test__deform_warp.nii.gz:md5,69052e6226da946bad1f9466285cbb89" + "test__out_affine_warp.txt:md5,5f989a979be61faa578ad619377a8a07" ] ], "2": [ @@ -26,7 +26,7 @@ { "id": "test" }, - "test__affine_warp.txt:md5,5f989a979be61faa578ad619377a8a07" + "test__out_affine_warp.txt:md5,5f989a979be61faa578ad619377a8a07" ] ], "deform_transform": [ @@ -34,7 +34,7 @@ { "id": "test" }, - "test__deform_warp.nii.gz:md5,69052e6226da946bad1f9466285cbb89" + "test__out_deform_warp.nii.gz:md5,69052e6226da946bad1f9466285cbb89" ] ], "versions": [ @@ -46,7 +46,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-24T20:50:14.250271" + "timestamp": "2024-10-29T14:22:02.235387011" }, "registration - convert - default": { "content": [ @@ -56,34 +56,24 @@ { "id": "test" }, - "test__affine_warp.txt:md5,5f989a979be61faa578ad619377a8a07" + "test__out_deform_warp.nii.gz:md5,69052e6226da946bad1f9466285cbb89" ] ], "1": [ - [ - { - "id": "test" - }, - "test__deform_warp.nii.gz:md5,69052e6226da946bad1f9466285cbb89" - ] + ], "2": [ "versions.yml:md5,9912ec095965c1ff571f77b447c18f92" ], "affine_transform": [ - [ - { - "id": "test" - }, - "test__affine_warp.txt:md5,5f989a979be61faa578ad619377a8a07" - ] + ], "deform_transform": [ [ { "id": "test" }, - "test__deform_warp.nii.gz:md5,69052e6226da946bad1f9466285cbb89" + "test__out_deform_warp.nii.gz:md5,69052e6226da946bad1f9466285cbb89" ] ], "versions": [ @@ -95,17 +85,17 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-24T20:50:09.870665" + "timestamp": "2024-10-29T14:21:53.170226694" }, "registration - convert - antsfs": { "content": [ - "test__affine_warp.lta", + "test__out_affine_warp.lta", [ [ { "id": "test" }, - "test__deform_warp.nii.gz:md5,599fbe3a6b85d61c0c67cea8be4972b7" + "test__out_deform_warp.nii.gz:md5,599fbe3a6b85d61c0c67cea8be4972b7" ] ], [ @@ -116,7 +106,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-24T20:50:44.315777" + "timestamp": "2024-10-29T14:22:34.546835256" }, "registration - convert - fslants": { "content": [ @@ -126,7 +116,56 @@ { "id": "test" }, - "test__affine_warp.txt:md5,074e8ac5777a91ba0808cd58c5a0cc44" + "test__out_deform_warp.nii.gz:md5,94feb8f0e648256eaa5ae0a47e5702c6" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test__out_affine_warp.txt:md5,074e8ac5777a91ba0808cd58c5a0cc44" + ] + ], + "2": [ + "versions.yml:md5,9912ec095965c1ff571f77b447c18f92" + ], + "affine_transform": [ + [ + { + "id": "test" + }, + "test__out_affine_warp.txt:md5,074e8ac5777a91ba0808cd58c5a0cc44" + ] + ], + "deform_transform": [ + [ + { + "id": "test" + }, + "test__out_deform_warp.nii.gz:md5,94feb8f0e648256eaa5ae0a47e5702c6" + ] + ], + "versions": [ + "versions.yml:md5,9912ec095965c1ff571f77b447c18f92" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T14:22:29.816461809" + }, + "registration - convert - affine": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test__out_deform_warp.nii.gz:md5,69052e6226da946bad1f9466285cbb89" ] ], "1": [ @@ -134,7 +173,7 @@ { "id": "test" }, - "test__deform_warp.nii.gz:md5,94feb8f0e648256eaa5ae0a47e5702c6" + "test__out_affine_warp.txt:md5,5f989a979be61faa578ad619377a8a07" ] ], "2": [ @@ -145,7 +184,7 @@ { "id": "test" }, - "test__affine_warp.txt:md5,074e8ac5777a91ba0808cd58c5a0cc44" + "test__out_affine_warp.txt:md5,5f989a979be61faa578ad619377a8a07" ] ], "deform_transform": [ @@ -153,7 +192,7 @@ { "id": "test" }, - "test__deform_warp.nii.gz:md5,94feb8f0e648256eaa5ae0a47e5702c6" + "test__out_deform_warp.nii.gz:md5,69052e6226da946bad1f9466285cbb89" ] ], "versions": [ @@ -165,17 +204,17 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-24T20:50:39.752948" + "timestamp": "2024-10-29T14:21:57.659285869" }, "registration - convert - fslfs": { "content": [ - "test__affine_warp.lta", + "test__out_affine_warp.lta", [ [ { "id": "test" }, - "test__deform_warp.nii.gz:md5,df432a27c586e57cad93af7509941cd4" + "test__out_deform_warp.nii.gz:md5,df432a27c586e57cad93af7509941cd4" ] ], [ @@ -186,6 +225,6 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-24T20:50:26.951153" + "timestamp": "2024-10-29T14:22:16.112616307" } } \ No newline at end of file diff --git a/modules/nf-neuro/registration/synthregistration/main.nf b/modules/nf-neuro/registration/synthregistration/main.nf index 6ebd3bd..c5e04a0 100644 --- a/modules/nf-neuro/registration/synthregistration/main.nf +++ b/modules/nf-neuro/registration/synthregistration/main.nf @@ -1,17 +1,16 @@ process REGISTRATION_SYNTHREGISTRATION { tag "$meta.id" - label 'process_single' + label 'process_high' container "freesurfer/synthmorph:3" - containerOptions "--entrypoint ''" + containerOptions "--entrypoint '' --env PYTHONPATH='/freesurfer/env/lib/python3.11/site-packages'" input: tuple val(meta), path(moving), path(fixed) output: - tuple val(meta), path("*__output_warped.nii.gz"), emit: warped_image - tuple val(meta), path("*__affine_warp.lta"), emit: affine_transform - tuple val(meta), path("*__deform_warp.nii.gz"), emit: deform_transform + tuple val(meta), path("*__output_warped.nii.gz") , emit: warped_image + tuple val(meta), path("*__deform_warp.nii.gz"), path("*__affine_warp.lta") , emit: transfo_image path "versions.yml" , emit: versions when: @@ -40,7 +39,7 @@ process REGISTRATION_SYNTHREGISTRATION { cat <<-END_VERSIONS > versions.yml "${task.process}": - Freesurfer: 7.4 + Freesurfer: 7.4.1 END_VERSIONS """ @@ -52,12 +51,12 @@ process REGISTRATION_SYNTHREGISTRATION { mri_synthmorph -h touch ${prefix}__output_warped.nii.gz - touch ${prefix}__affine_warp.lta touch ${prefix}__deform_warp.nii.gz + touch ${prefix}__affine_warp.lta cat <<-END_VERSIONS > versions.yml "${task.process}": - Freesurfer: 7.4 + Freesurfer: 7.4.1 END_VERSIONS """ } diff --git a/modules/nf-neuro/registration/synthregistration/meta.yml b/modules/nf-neuro/registration/synthregistration/meta.yml index 5a174b3..23f1da0 100644 --- a/modules/nf-neuro/registration/synthregistration/meta.yml +++ b/modules/nf-neuro/registration/synthregistration/meta.yml @@ -37,21 +37,16 @@ output: Groovy Map containing sample information e.g. `[ id:'test', single_end:false ]` - - affine_transform: - type: file - description: Affine transform for initialization - pattern: "*.{lta}" - - - deform_transform: - type: file - description: Deform transformation - pattern: "*.{nii.gz}" - - warped_image: type: file description: Warped image pattern: "*.{nii,.nii.gz}" + - transfo_image: + type: list + description: Tuple, Transformation files to warp images (nii.gz warp, lta file) + pattern: "*.{nii,nii.gz,lta}" + - versions: type: file description: File containing software versions diff --git a/modules/nf-neuro/registration/synthregistration/tests/main.nf.test b/modules/nf-neuro/registration/synthregistration/tests/main.nf.test index 0314ad8..1c343ca 100644 --- a/modules/nf-neuro/registration/synthregistration/tests/main.nf.test +++ b/modules/nf-neuro/registration/synthregistration/tests/main.nf.test @@ -46,8 +46,7 @@ nextflow_process { { assert process.success }, { assert snapshot( file(process.out.warped_image.get(0).get(1)).name, - file(process.out.affine_transform.get(0).get(1)).name, - file(process.out.deform_transform.get(0).get(1)).name, + file(process.out.transfo_image.get(0).get(1)).name, process.out.versions ).match() } ) diff --git a/modules/nf-neuro/registration/synthregistration/tests/main.nf.test.snap b/modules/nf-neuro/registration/synthregistration/tests/main.nf.test.snap index 19ef229..9919979 100644 --- a/modules/nf-neuro/registration/synthregistration/tests/main.nf.test.snap +++ b/modules/nf-neuro/registration/synthregistration/tests/main.nf.test.snap @@ -2,16 +2,15 @@ "registration - synthregistration": { "content": [ "test__output_warped.nii.gz", - "test__affine_warp.lta", "test__deform_warp.nii.gz", [ - "versions.yml:md5,49fb9c85da9f696926d1ab46ef0968fb" + "versions.yml:md5,b47e7679977b40079931dd778979a94d" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-01T22:36:18.972035" + "timestamp": "2024-10-30T18:08:53.765658701" } } \ No newline at end of file diff --git a/subworkflows/nf-neuro/registration/main.nf b/subworkflows/nf-neuro/registration/main.nf index f261557..42a2295 100644 --- a/subworkflows/nf-neuro/registration/main.nf +++ b/subworkflows/nf-neuro/registration/main.nf @@ -1,16 +1,18 @@ include { REGISTRATION_ANATTODWI } from '../../../modules/nf-neuro/registration/anattodwi/main' include { REGISTRATION_ANTS } from '../../../modules/nf-neuro/registration/ants/main' include { REGISTRATION_EASYREG } from '../../../modules/nf-neuro/registration/easyreg/main' +include { REGISTRATION_SYNTHREGISTRATION } from '../../../modules/nf-neuro/registration/synthregistration/main' -params.run_easyreg = false +params.run_easyreg = false +params.run_synthmorph = false workflow REGISTRATION { // ** The subworkflow requires at least ch_image and ch_ref as inputs to ** // // ** properly perform the registration. Supplying a ch_metric will select ** // // ** the REGISTRATION_ANATTODWI module meanwhile NOT supplying a ch_metric ** // - // ** will select the REGISTRATION_ANTS (SyN or SyNQuick) module.Alternatively, ** // - // ** NOT supplying ch_metric and activating run_surgery flag with select REGISTRATION_EASYREG ** // + // ** will select the REGISTRATION_ANTS (SyN or SyNQuick) module. Alternatively, ** // + // ** NOT supplying ch_metric and activating alternative module flag with select REGISTRATION_EASYREG or REGISTRATION_SYNTHMORPH ** // take: ch_image // channel: [ val(meta), [ image ] ] @@ -49,6 +51,23 @@ workflow REGISTRATION { } + else if ( params.run_synthmorph ) { + // ** Set up input channel ** // + ch_register = ch_image.join(ch_ref) + + // ** Registration using synthmorph ** // + REGISTRATION_SYNTHREGISTRATION ( ch_register ) + ch_versions = ch_versions.mix(REGISTRATION_SYNTHREGISTRATION.out.versions.first()) + + // ** Setting outputs ** // + image_warped = REGISTRATION_SYNTHREGISTRATION.out.warped_image + transfo_image = REGISTRATION_SYNTHREGISTRATION.out.transfo_image + transfo_trk = Channel.empty() + ref_warped = Channel.empty() + out_segmentation = Channel.empty() + out_ref_segmentation = Channel.empty() + } + else { if ( ch_metric ) { // ** Set up input channel ** // diff --git a/subworkflows/nf-neuro/registration/meta.yml b/subworkflows/nf-neuro/registration/meta.yml index dc00b34..fdf0836 100644 --- a/subworkflows/nf-neuro/registration/meta.yml +++ b/subworkflows/nf-neuro/registration/meta.yml @@ -7,8 +7,7 @@ description: | module calling AntsRegistration, with the metric as additional target. 2) if NO metric file is supplied, the subworkflow will use the REGISTRATION_ANTS module calling antsRegistrationSyN.sh or antsRegistrationSyNQuick.sh. - 3) alternatively, if the run_synth parameter is activated, the subworkflow will use the REGISTRATION_EASYREG module - calling mri_easyreg. + 3) alternatively, if an alternative model parameter is activated, the subworkflow will use the specified module This subworkflow outputs transformation files that can be used with the ANTSAPPLYTRANSFORMS module to warp any new image. Simply provide your moving image, reference image, and transformations files to the module to register a new image in the current space. Similar steps can be used to register @@ -22,6 +21,7 @@ components: - registration/anattodwi - registration/ants - registration/easyreg + - registration/synthregistration input: - ch_image: type: file diff --git a/subworkflows/nf-neuro/registration/tests/main.nf.test b/subworkflows/nf-neuro/registration/tests/main.nf.test index 0372185..039551c 100644 --- a/subworkflows/nf-neuro/registration/tests/main.nf.test +++ b/subworkflows/nf-neuro/registration/tests/main.nf.test @@ -13,6 +13,7 @@ nextflow_workflow { tag "registration" tag "registration/ants" tag "registration/easyreg" + tag "registration/synthregistration" tag "load_test_data" @@ -155,4 +156,46 @@ nextflow_workflow { ) } } + test("registration - synthregistration") { + config "./nextflow_synthregistration.config" + when { + workflow { + """ + ch_split_test_data = LOAD_DATA.out.test_data_directory + .branch{ + t1w: it.simpleName == "T1w" + b0: it.simpleName == "b0" + dti: it.simpleName == "dti" + } + input[0] = ch_split_test_data.t1w.map{ + test_data_directory -> [ + [ id:'test' ], + file("\${test_data_directory}/T1w.nii.gz") + ] + } + input[1] = ch_split_test_data.b0.map{ + test_data_directory -> [ + [ id:'test' ], + file("\${test_data_directory}/b0.nii.gz") + ] + } + input[2] = Channel.empty() + input[3] = Channel.empty() + input[4] = Channel.empty() + input[5] = Channel.empty() + """ + } + } + + then { + assertAll( + { assert workflow.success}, + { assert snapshot( + file(workflow.out.image_warped.get(0).get(1)).name, + file(workflow.out.transfo_image.get(0).get(1)).name, + workflow.out.versions + ).match()} + ) + } + } } diff --git a/subworkflows/nf-neuro/registration/tests/main.nf.test.snap b/subworkflows/nf-neuro/registration/tests/main.nf.test.snap index 8519d24..8731591 100644 --- a/subworkflows/nf-neuro/registration/tests/main.nf.test.snap +++ b/subworkflows/nf-neuro/registration/tests/main.nf.test.snap @@ -1,4 +1,18 @@ { + "registration - synthregistration": { + "content": [ + "test__output_warped.nii.gz", + "test__deform_warp.nii.gz", + [ + "versions.yml:md5,8d0f503c670198b4448f5db719d089bc" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T18:22:51.835424696" + }, "registration - easyreg": { "content": [ "test_floating_registered.nii.gz", @@ -108,7 +122,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-25T09:25:14.344251" + "timestamp": "2024-10-31T19:42:03.328847898" }, "registration - SyNQuick": { "content": [ @@ -209,6 +223,6 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-25T09:19:43.397585" + "timestamp": "2024-10-31T19:42:16.225779061" } } \ No newline at end of file diff --git a/subworkflows/nf-neuro/registration/tests/nextflow_synthregistration.config b/subworkflows/nf-neuro/registration/tests/nextflow_synthregistration.config new file mode 100644 index 0000000..ab852d8 --- /dev/null +++ b/subworkflows/nf-neuro/registration/tests/nextflow_synthregistration.config @@ -0,0 +1,12 @@ +process { + withName: "REGISTRATION_SYNTHREGISTRATION" { + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + memory = '20G' + ext.affine = "affine" + ext.warp = "deform" + ext.lambda = 0.9 + ext.steps = 9 + } +} + +params.run_synthmorph = true