diff --git a/modules/nf-neuro/image/applymask/main.nf b/modules/nf-neuro/image/applymask/main.nf index c5604110..c5d44ba4 100644 --- a/modules/nf-neuro/image/applymask/main.nf +++ b/modules/nf-neuro/image/applymask/main.nf @@ -16,12 +16,14 @@ process IMAGE_APPLYMASK { script: def prefix = task.ext.prefix ?: "${meta.id}" + def suffix = task.ext.first_suffix ? task.ext.first_suffix + "_masked" : "masked" def nthreads_mrtrix = task.ext.single_thread ? "-nthreads 0" : "-nthreads ${task.cpus}" + def data_type = task.ext.data_type ? "-datatype ${task.ext.data_type}" : " -datatype float32" """ export OMP_NUM_THREADS=${task.ext.single_thread ? 1 : task.cpus} - mrcalc $image $mask -mult ${prefix}_masked.nii.gz -force -quiet ${nthreads_mrtrix} + mrcalc $image $mask -mult ${prefix}_${suffix}.nii.gz -force -quiet ${nthreads_mrtrix} ${data_type} cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -31,9 +33,9 @@ process IMAGE_APPLYMASK { stub: def prefix = task.ext.prefix ?: "${meta.id}" - + def suffix = task.ext.first_suffix ? task.ext.first_suffix + "_masked" : "masked" """ - touch ${prefix}_masked.nii.gz + touch ${prefix}_${suffix}.nii.gz mrcalc -h diff --git a/modules/nf-neuro/image/applymask/meta.yml b/modules/nf-neuro/image/applymask/meta.yml index 4a39a89c..fec98b23 100644 --- a/modules/nf-neuro/image/applymask/meta.yml +++ b/modules/nf-neuro/image/applymask/meta.yml @@ -32,10 +32,20 @@ input: ontologies: - edam: http://edamontology.org/format_3989 # GZIP format args: + - first_suffix: + type: string + description: Suffix for the output image file. This will be used as the first part of the suffix, followed by "_masked". + default: "" - single_thread: type: boolean description: If true, the command will be run in single-threaded mode. By default, the command will use multiple threads based on the number of CPUs allocated to the task. default: false + - data_type: + type: string + description: | + Data type for the output image. Use the following format: + uint8, int16, int32, int64, float16, float32 or float64. + default: "float32" output: image: - - meta: diff --git a/modules/nf-neuro/registration/ants/main.nf b/modules/nf-neuro/registration/ants/main.nf index 46c7c2b2..05098645 100644 --- a/modules/nf-neuro/registration/ants/main.nf +++ b/modules/nf-neuro/registration/ants/main.nf @@ -6,10 +6,10 @@ process REGISTRATION_ANTS { container "scilus/scilus:2.2.2" input: - tuple val(meta), path(fixed_image), path(moving_image), path(fixed_mask), path(moving_mask) //** optional, input = [] **// + tuple val(meta), path(fixed_image), path(moving_image) output: - tuple val(meta), path("*_warped.nii.gz") , emit: image_warped + tuple val(meta), path("*_warped.nii.gz") , emit: image_warped tuple val(meta), path("*_forward1_affine.mat") , emit: forward_affine, optional: true tuple val(meta), path("*_forward0_warp.nii.gz") , emit: forward_warp, optional: true tuple val(meta), path("*_backward1_warp.nii.gz") , emit: backward_warp, optional: true @@ -18,8 +18,8 @@ process REGISTRATION_ANTS { tuple val(meta), path("*_backward*.{nii.gz,mat}", arity: '1..2') , emit: backward_image_transform tuple val(meta), path("*_backward*.{nii.gz,mat}", arity: '1..2') , emit: forward_tractogram_transform tuple val(meta), path("*_forward*.{nii.gz,mat}", arity: '1..2') , emit: backward_tractogram_transform - tuple val(meta), path("*_registration_ants_mqc.gif") , emit: mqc, optional: true - path "versions.yml" , emit: versions + tuple val(meta), path("*_registration_ants_mqc.gif") , emit: mqc, optional: true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -36,10 +36,6 @@ process REGISTRATION_ANTS { def nthreads = task.ext.single_thread ? 1 : task.cpus args += " -n $nthreads" - if ( fixed_mask || moving_mask ) { - args += " -x \"${fixed_mask ?: 'NULL'},${moving_mask ?: 'NULL'}\"" - } - if ( task.ext.initial_transform ) args += " -i [$fixed_image,$moving_image,${initialization_types[task.ext.initial_transform]}]" if ( task.ext.histogram_bins ) args += " -r $task.ext.histogram_bins" if ( task.ext.spline_distance ) args += " -s $task.ext.spline_distance" diff --git a/modules/nf-neuro/registration/ants/meta.yml b/modules/nf-neuro/registration/ants/meta.yml index 1ace418e..1bf98c95 100644 --- a/modules/nf-neuro/registration/ants/meta.yml +++ b/modules/nf-neuro/registration/ants/meta.yml @@ -145,20 +145,6 @@ input: mandatory: true ontologies: - edam: http://edamontology.org/format_4001 # NIFTI format - - fixed_mask: - type: file - description: Mask(s) for the fixed image space - pattern: "*.{nii,nii.gz}" - mandatory: false - ontologies: - - edam: http://edamontology.org/format_4001 # NIFTI format - - moving_mask: - type: file - description: Mask(s) for the moving image space - pattern: "*.{nii,nii.gz}" - mandatory: false - ontologies: - - edam: http://edamontology.org/format_4001 # NIFTI format output: image_warped: - - meta: diff --git a/modules/nf-neuro/registration/ants/tests/main.nf.test b/modules/nf-neuro/registration/ants/tests/main.nf.test index f11029fb..ae0b3b5b 100644 --- a/modules/nf-neuro/registration/ants/tests/main.nf.test +++ b/modules/nf-neuro/registration/ants/tests/main.nf.test @@ -46,16 +46,8 @@ nextflow_process { file("\${test_data_directory}/t1.nii.gz") ] } - ch_T1w_mask = ch_split_test_data.T1w.map{ - test_data_directory -> [ - [ id:'test' ], - file("\${test_data_directory}/T1w_mask.nii.gz") - ] - } input[0] = ch_T1w .join(ch_moving) - .join(ch_T1w_mask) - .map{ meta, T1w, t1, T1w_mask -> [meta, T1w, t1, T1w_mask, []] } """ } } @@ -89,16 +81,8 @@ nextflow_process { file("\${test_data_directory}/t1.nii.gz") ] } - ch_T1w_mask = ch_split_test_data.T1w.map{ - test_data_directory -> [ - [ id:'test' ], - file("\${test_data_directory}/T1w_mask.nii.gz") - ] - } input[0] = ch_T1w .join(ch_moving) - .join(ch_T1w_mask) - .map{ meta, T1w, t1, T1w_mask -> [meta, T1w, t1, T1w_mask, []] } """ } } @@ -132,16 +116,8 @@ nextflow_process { file("\${test_data_directory}/t1.nii.gz") ] } - ch_T1w_mask = ch_split_test_data.T1w.map{ - test_data_directory -> [ - [ id:'test' ], - file("\${test_data_directory}/T1w_mask.nii.gz") - ] - } input[0] = ch_T1w .join(ch_moving) - .join(ch_T1w_mask) - .map{ meta, T1w, t1, T1w_mask -> [meta, T1w, t1, T1w_mask, []] } """ } } @@ -176,16 +152,8 @@ nextflow_process { file("\${test_data_directory}/t1.nii.gz") ] } - ch_T1w_mask = ch_split_test_data.T1w.map{ - test_data_directory -> [ - [ id:'test' ], - file("\${test_data_directory}/T1w_mask.nii.gz") - ] - } input[0] = ch_T1w .join(ch_moving) - .join(ch_T1w_mask) - .map{ meta, T1w, t1, T1w_mask -> [meta, T1w, t1, T1w_mask, []] } """ } } 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 a439947c..88cc7ac1 100644 --- a/modules/nf-neuro/registration/ants/tests/main.nf.test.snap +++ b/modules/nf-neuro/registration/ants/tests/main.nf.test.snap @@ -19,7 +19,7 @@ { "id": "test" }, - "test_t1_warped.nii.gz:md5,8089d84a4f511207f26307ce92353bbb" + "test_t1_warped.nii.gz:md5,c74eb8a596f1f6959f8db828d0d9ddc1" ] ], "1": [ @@ -27,7 +27,7 @@ { "id": "test" }, - "test_forward1_affine.mat:md5,18c2ec8b5cf3fb4e038cce665eb53e7c" + "test_forward1_affine.mat:md5,41afa6fa72a013820a3d3d8ce4986002" ] ], "10": [ @@ -38,7 +38,7 @@ { "id": "test" }, - "test_forward0_warp.nii.gz:md5,d1f0ce951610683042aab377c665295d" + "test_forward0_warp.nii.gz:md5,806c26fdf31077d4b035a2009db54c95" ] ], "3": [ @@ -46,7 +46,7 @@ { "id": "test" }, - "test_backward1_warp.nii.gz:md5,e5324ab5af8cceda46e0bb642dfc02aa" + "test_backward1_warp.nii.gz:md5,4cca843970b2ed3d02ecf43a31502857" ] ], "4": [ @@ -54,7 +54,7 @@ { "id": "test" }, - "test_backward0_affine.mat:md5,ba4cdd24110970c8d08b8df39ee4fd95" + "test_backward0_affine.mat:md5,9b6845301aaeaf43a1cf9da4e4cb671f" ] ], "5": [ @@ -63,8 +63,8 @@ "id": "test" }, [ - "test_forward0_warp.nii.gz:md5,d1f0ce951610683042aab377c665295d", - "test_forward1_affine.mat:md5,18c2ec8b5cf3fb4e038cce665eb53e7c" + "test_forward0_warp.nii.gz:md5,806c26fdf31077d4b035a2009db54c95", + "test_forward1_affine.mat:md5,41afa6fa72a013820a3d3d8ce4986002" ] ] ], @@ -74,8 +74,8 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,ba4cdd24110970c8d08b8df39ee4fd95", - "test_backward1_warp.nii.gz:md5,e5324ab5af8cceda46e0bb642dfc02aa" + "test_backward0_affine.mat:md5,9b6845301aaeaf43a1cf9da4e4cb671f", + "test_backward1_warp.nii.gz:md5,4cca843970b2ed3d02ecf43a31502857" ] ] ], @@ -85,8 +85,8 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,ba4cdd24110970c8d08b8df39ee4fd95", - "test_backward1_warp.nii.gz:md5,e5324ab5af8cceda46e0bb642dfc02aa" + "test_backward0_affine.mat:md5,9b6845301aaeaf43a1cf9da4e4cb671f", + "test_backward1_warp.nii.gz:md5,4cca843970b2ed3d02ecf43a31502857" ] ] ], @@ -96,8 +96,8 @@ "id": "test" }, [ - "test_forward0_warp.nii.gz:md5,d1f0ce951610683042aab377c665295d", - "test_forward1_affine.mat:md5,18c2ec8b5cf3fb4e038cce665eb53e7c" + "test_forward0_warp.nii.gz:md5,806c26fdf31077d4b035a2009db54c95", + "test_forward1_affine.mat:md5,41afa6fa72a013820a3d3d8ce4986002" ] ] ], @@ -106,7 +106,7 @@ { "id": "test" }, - "test_T1_to_T1_slab_registration_ants_mqc.gif:md5,fba29c34dd2cebde98e9c72e5c991550" + "test_T1_to_T1_slab_registration_ants_mqc.gif:md5,b685aa586e6b61196b442740c1056eb5" ] ], "backward_affine": [ @@ -114,7 +114,7 @@ { "id": "test" }, - "test_backward0_affine.mat:md5,ba4cdd24110970c8d08b8df39ee4fd95" + "test_backward0_affine.mat:md5,9b6845301aaeaf43a1cf9da4e4cb671f" ] ], "backward_image_transform": [ @@ -123,8 +123,8 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,ba4cdd24110970c8d08b8df39ee4fd95", - "test_backward1_warp.nii.gz:md5,e5324ab5af8cceda46e0bb642dfc02aa" + "test_backward0_affine.mat:md5,9b6845301aaeaf43a1cf9da4e4cb671f", + "test_backward1_warp.nii.gz:md5,4cca843970b2ed3d02ecf43a31502857" ] ] ], @@ -134,8 +134,8 @@ "id": "test" }, [ - "test_forward0_warp.nii.gz:md5,d1f0ce951610683042aab377c665295d", - "test_forward1_affine.mat:md5,18c2ec8b5cf3fb4e038cce665eb53e7c" + "test_forward0_warp.nii.gz:md5,806c26fdf31077d4b035a2009db54c95", + "test_forward1_affine.mat:md5,41afa6fa72a013820a3d3d8ce4986002" ] ] ], @@ -144,7 +144,7 @@ { "id": "test" }, - "test_backward1_warp.nii.gz:md5,e5324ab5af8cceda46e0bb642dfc02aa" + "test_backward1_warp.nii.gz:md5,4cca843970b2ed3d02ecf43a31502857" ] ], "forward_affine": [ @@ -152,7 +152,7 @@ { "id": "test" }, - "test_forward1_affine.mat:md5,18c2ec8b5cf3fb4e038cce665eb53e7c" + "test_forward1_affine.mat:md5,41afa6fa72a013820a3d3d8ce4986002" ] ], "forward_image_transform": [ @@ -161,8 +161,8 @@ "id": "test" }, [ - "test_forward0_warp.nii.gz:md5,d1f0ce951610683042aab377c665295d", - "test_forward1_affine.mat:md5,18c2ec8b5cf3fb4e038cce665eb53e7c" + "test_forward0_warp.nii.gz:md5,806c26fdf31077d4b035a2009db54c95", + "test_forward1_affine.mat:md5,41afa6fa72a013820a3d3d8ce4986002" ] ] ], @@ -172,8 +172,8 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,ba4cdd24110970c8d08b8df39ee4fd95", - "test_backward1_warp.nii.gz:md5,e5324ab5af8cceda46e0bb642dfc02aa" + "test_backward0_affine.mat:md5,9b6845301aaeaf43a1cf9da4e4cb671f", + "test_backward1_warp.nii.gz:md5,4cca843970b2ed3d02ecf43a31502857" ] ] ], @@ -182,7 +182,7 @@ { "id": "test" }, - "test_forward0_warp.nii.gz:md5,d1f0ce951610683042aab377c665295d" + "test_forward0_warp.nii.gz:md5,806c26fdf31077d4b035a2009db54c95" ] ], "image_warped": [ @@ -190,7 +190,7 @@ { "id": "test" }, - "test_t1_warped.nii.gz:md5,8089d84a4f511207f26307ce92353bbb" + "test_t1_warped.nii.gz:md5,c74eb8a596f1f6959f8db828d0d9ddc1" ] ], "mqc": [ @@ -198,7 +198,7 @@ { "id": "test" }, - "test_T1_to_T1_slab_registration_ants_mqc.gif:md5,fba29c34dd2cebde98e9c72e5c991550" + "test_T1_to_T1_slab_registration_ants_mqc.gif:md5,b685aa586e6b61196b442740c1056eb5" ] ], "versions": [ @@ -210,7 +210,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-06-03T22:41:08.268383497" + "timestamp": "2026-06-04T10:27:29.392349393" }, "registration - ants - SyN": { "content": [ @@ -220,7 +220,7 @@ { "id": "test" }, - "test_t1_warped.nii.gz:md5,02ff01272aadd0acca8672c444678a7b" + "test_t1_warped.nii.gz:md5,7c5756d1bdcf72eac1541e9c5d98f9db" ] ], "1": [ @@ -228,7 +228,7 @@ { "id": "test" }, - "test_forward1_affine.mat:md5,872eb964ad5deaeea7f492924b404cb8" + "test_forward1_affine.mat:md5,0fb5879b315f32bb8e06aa2993009115" ] ], "10": [ @@ -239,7 +239,7 @@ { "id": "test" }, - "test_forward0_warp.nii.gz:md5,439c1de9d275d39a203e2806ada000c7" + "test_forward0_warp.nii.gz:md5,a32206a00e93b79054e9b8fa0f7c8015" ] ], "3": [ @@ -247,7 +247,7 @@ { "id": "test" }, - "test_backward1_warp.nii.gz:md5,cd5d6021085ac029614fa525ceaf9847" + "test_backward1_warp.nii.gz:md5,4e85fa2257f7364fde205adfa1b3c8d3" ] ], "4": [ @@ -255,7 +255,7 @@ { "id": "test" }, - "test_backward0_affine.mat:md5,e92fa10025dc221232530b0b23f9ed4b" + "test_backward0_affine.mat:md5,ff00be1483698e5478bfa94abf2b42b2" ] ], "5": [ @@ -264,8 +264,8 @@ "id": "test" }, [ - "test_forward0_warp.nii.gz:md5,439c1de9d275d39a203e2806ada000c7", - "test_forward1_affine.mat:md5,872eb964ad5deaeea7f492924b404cb8" + "test_forward0_warp.nii.gz:md5,a32206a00e93b79054e9b8fa0f7c8015", + "test_forward1_affine.mat:md5,0fb5879b315f32bb8e06aa2993009115" ] ] ], @@ -275,8 +275,8 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,e92fa10025dc221232530b0b23f9ed4b", - "test_backward1_warp.nii.gz:md5,cd5d6021085ac029614fa525ceaf9847" + "test_backward0_affine.mat:md5,ff00be1483698e5478bfa94abf2b42b2", + "test_backward1_warp.nii.gz:md5,4e85fa2257f7364fde205adfa1b3c8d3" ] ] ], @@ -286,8 +286,8 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,e92fa10025dc221232530b0b23f9ed4b", - "test_backward1_warp.nii.gz:md5,cd5d6021085ac029614fa525ceaf9847" + "test_backward0_affine.mat:md5,ff00be1483698e5478bfa94abf2b42b2", + "test_backward1_warp.nii.gz:md5,4e85fa2257f7364fde205adfa1b3c8d3" ] ] ], @@ -297,8 +297,8 @@ "id": "test" }, [ - "test_forward0_warp.nii.gz:md5,439c1de9d275d39a203e2806ada000c7", - "test_forward1_affine.mat:md5,872eb964ad5deaeea7f492924b404cb8" + "test_forward0_warp.nii.gz:md5,a32206a00e93b79054e9b8fa0f7c8015", + "test_forward1_affine.mat:md5,0fb5879b315f32bb8e06aa2993009115" ] ] ], @@ -310,7 +310,7 @@ { "id": "test" }, - "test_backward0_affine.mat:md5,e92fa10025dc221232530b0b23f9ed4b" + "test_backward0_affine.mat:md5,ff00be1483698e5478bfa94abf2b42b2" ] ], "backward_image_transform": [ @@ -319,8 +319,8 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,e92fa10025dc221232530b0b23f9ed4b", - "test_backward1_warp.nii.gz:md5,cd5d6021085ac029614fa525ceaf9847" + "test_backward0_affine.mat:md5,ff00be1483698e5478bfa94abf2b42b2", + "test_backward1_warp.nii.gz:md5,4e85fa2257f7364fde205adfa1b3c8d3" ] ] ], @@ -330,8 +330,8 @@ "id": "test" }, [ - "test_forward0_warp.nii.gz:md5,439c1de9d275d39a203e2806ada000c7", - "test_forward1_affine.mat:md5,872eb964ad5deaeea7f492924b404cb8" + "test_forward0_warp.nii.gz:md5,a32206a00e93b79054e9b8fa0f7c8015", + "test_forward1_affine.mat:md5,0fb5879b315f32bb8e06aa2993009115" ] ] ], @@ -340,7 +340,7 @@ { "id": "test" }, - "test_backward1_warp.nii.gz:md5,cd5d6021085ac029614fa525ceaf9847" + "test_backward1_warp.nii.gz:md5,4e85fa2257f7364fde205adfa1b3c8d3" ] ], "forward_affine": [ @@ -348,7 +348,7 @@ { "id": "test" }, - "test_forward1_affine.mat:md5,872eb964ad5deaeea7f492924b404cb8" + "test_forward1_affine.mat:md5,0fb5879b315f32bb8e06aa2993009115" ] ], "forward_image_transform": [ @@ -357,8 +357,8 @@ "id": "test" }, [ - "test_forward0_warp.nii.gz:md5,439c1de9d275d39a203e2806ada000c7", - "test_forward1_affine.mat:md5,872eb964ad5deaeea7f492924b404cb8" + "test_forward0_warp.nii.gz:md5,a32206a00e93b79054e9b8fa0f7c8015", + "test_forward1_affine.mat:md5,0fb5879b315f32bb8e06aa2993009115" ] ] ], @@ -368,8 +368,8 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,e92fa10025dc221232530b0b23f9ed4b", - "test_backward1_warp.nii.gz:md5,cd5d6021085ac029614fa525ceaf9847" + "test_backward0_affine.mat:md5,ff00be1483698e5478bfa94abf2b42b2", + "test_backward1_warp.nii.gz:md5,4e85fa2257f7364fde205adfa1b3c8d3" ] ] ], @@ -378,7 +378,7 @@ { "id": "test" }, - "test_forward0_warp.nii.gz:md5,439c1de9d275d39a203e2806ada000c7" + "test_forward0_warp.nii.gz:md5,a32206a00e93b79054e9b8fa0f7c8015" ] ], "image_warped": [ @@ -386,7 +386,7 @@ { "id": "test" }, - "test_t1_warped.nii.gz:md5,02ff01272aadd0acca8672c444678a7b" + "test_t1_warped.nii.gz:md5,7c5756d1bdcf72eac1541e9c5d98f9db" ] ], "mqc": [ @@ -401,7 +401,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-06-04T09:14:11.394213705" + "timestamp": "2026-06-04T10:22:28.649714216" }, "registration - ants - no warps": { "content": [ @@ -411,7 +411,7 @@ { "id": "test" }, - "test_t1_warped.nii.gz:md5,938a3906d8d2ca9f500ab34c25b5dae7" + "test_t1_warped.nii.gz:md5,9f4d57c0e9cde3da4ab4718f360abce6" ] ], "1": [ @@ -419,7 +419,7 @@ { "id": "test" }, - "test_forward1_affine.mat:md5,562def074e1973a35b5e16bd8b1515d9" + "test_forward1_affine.mat:md5,72aee9284d5e624be5dbc15cfce8151c" ] ], "10": [ @@ -436,7 +436,7 @@ { "id": "test" }, - "test_backward0_affine.mat:md5,44b80fe9baf645d16299395959793d65" + "test_backward0_affine.mat:md5,862976c1966b1af64acd7b40d0f922e4" ] ], "5": [ @@ -445,7 +445,7 @@ "id": "test" }, [ - "test_forward1_affine.mat:md5,562def074e1973a35b5e16bd8b1515d9" + "test_forward1_affine.mat:md5,72aee9284d5e624be5dbc15cfce8151c" ] ] ], @@ -455,7 +455,7 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,44b80fe9baf645d16299395959793d65" + "test_backward0_affine.mat:md5,862976c1966b1af64acd7b40d0f922e4" ] ] ], @@ -465,7 +465,7 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,44b80fe9baf645d16299395959793d65" + "test_backward0_affine.mat:md5,862976c1966b1af64acd7b40d0f922e4" ] ] ], @@ -475,7 +475,7 @@ "id": "test" }, [ - "test_forward1_affine.mat:md5,562def074e1973a35b5e16bd8b1515d9" + "test_forward1_affine.mat:md5,72aee9284d5e624be5dbc15cfce8151c" ] ] ], @@ -487,7 +487,7 @@ { "id": "test" }, - "test_backward0_affine.mat:md5,44b80fe9baf645d16299395959793d65" + "test_backward0_affine.mat:md5,862976c1966b1af64acd7b40d0f922e4" ] ], "backward_image_transform": [ @@ -496,7 +496,7 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,44b80fe9baf645d16299395959793d65" + "test_backward0_affine.mat:md5,862976c1966b1af64acd7b40d0f922e4" ] ] ], @@ -506,7 +506,7 @@ "id": "test" }, [ - "test_forward1_affine.mat:md5,562def074e1973a35b5e16bd8b1515d9" + "test_forward1_affine.mat:md5,72aee9284d5e624be5dbc15cfce8151c" ] ] ], @@ -518,7 +518,7 @@ { "id": "test" }, - "test_forward1_affine.mat:md5,562def074e1973a35b5e16bd8b1515d9" + "test_forward1_affine.mat:md5,72aee9284d5e624be5dbc15cfce8151c" ] ], "forward_image_transform": [ @@ -527,7 +527,7 @@ "id": "test" }, [ - "test_forward1_affine.mat:md5,562def074e1973a35b5e16bd8b1515d9" + "test_forward1_affine.mat:md5,72aee9284d5e624be5dbc15cfce8151c" ] ] ], @@ -537,7 +537,7 @@ "id": "test" }, [ - "test_backward0_affine.mat:md5,44b80fe9baf645d16299395959793d65" + "test_backward0_affine.mat:md5,862976c1966b1af64acd7b40d0f922e4" ] ] ], @@ -549,7 +549,7 @@ { "id": "test" }, - "test_t1_warped.nii.gz:md5,938a3906d8d2ca9f500ab34c25b5dae7" + "test_t1_warped.nii.gz:md5,9f4d57c0e9cde3da4ab4718f360abce6" ] ], "mqc": [ @@ -564,6 +564,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-06-03T22:41:19.541042931" + "timestamp": "2026-06-04T10:27:42.101532717" } } \ No newline at end of file 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 debb01cf..bf141c06 100644 --- a/subworkflows/nf-neuro/bundle_seg/tests/main.nf.test.snap +++ b/subworkflows/nf-neuro/bundle_seg/tests/main.nf.test.snap @@ -36,7 +36,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-02-26T14:26:41.784029405" + "timestamp": "2026-06-04T13:38:16.327628109" }, "rbx - download atlas - ants registration": { "content": [ @@ -75,6 +75,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-06-02T20:03:03.095138057" + "timestamp": "2026-06-04T13:37:11.622705415" } } \ No newline at end of file diff --git a/subworkflows/nf-neuro/output_template_space/tests/main.nf.test.snap b/subworkflows/nf-neuro/output_template_space/tests/main.nf.test.snap index 9edc894c..5b25a6bb 100644 --- a/subworkflows/nf-neuro/output_template_space/tests/main.nf.test.snap +++ b/subworkflows/nf-neuro/output_template_space/tests/main.nf.test.snap @@ -77,7 +77,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-06-02T20:04:53.696301982" + "timestamp": "2026-06-04T13:39:54.610205112" }, "Template MNI152NLin2009aAsym - using synthmorph registration": { "content": [ @@ -152,7 +152,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-02-26T22:42:44.929412455" + "timestamp": "2026-06-04T13:40:36.60965249" }, "Template MNI152NLin2009cAsym - local templates": { "content": [ @@ -232,6 +232,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-06-02T20:04:18.303384843" + "timestamp": "2026-06-04T13:39:07.012635952" } } \ No newline at end of file diff --git a/subworkflows/nf-neuro/registration/main.nf b/subworkflows/nf-neuro/registration/main.nf index 01a6582a..aa3d7be0 100644 --- a/subworkflows/nf-neuro/registration/main.nf +++ b/subworkflows/nf-neuro/registration/main.nf @@ -4,7 +4,8 @@ include { REGISTRATION_EASYREG } from '../../../modules/nf-neuro/registration/ include { REGISTRATION_SYNTHMORPH } from '../../../modules/nf-neuro/registration/synthmorph/main' include { REGISTRATION_CONVERT } from '../../../modules/nf-neuro/registration/convert/main' include { UTILS_OPTIONS } from '../utils_options/main' - +include { IMAGE_APPLYMASK as MASK_FIXED_IMAGE} from '../../../modules/nf-neuro/image/applymask/main' +include { IMAGE_APPLYMASK as MASK_MOVING_IMAGE} from '../../../modules/nf-neuro/image/applymask/main' workflow REGISTRATION { @@ -34,6 +35,16 @@ workflow REGISTRATION { UTILS_OPTIONS("${moduleDir}/meta.yml", options, true) options = UTILS_OPTIONS.out.options.value + MASK_FIXED_IMAGE ( ch_fixed_image.join(ch_fixed_mask) ) + ch_fixed_image = ch_fixed_image.join(MASK_FIXED_IMAGE.out.image, remainder: true) + .map({ meta, orig, fixed -> [meta, fixed?: orig] }) + ch_versions = ch_versions.mix(MASK_FIXED_IMAGE.out.versions.first()) + + MASK_MOVING_IMAGE ( ch_moving_image.join(ch_moving_mask) ) + ch_moving_image = ch_moving_image.join(MASK_MOVING_IMAGE.out.image, remainder: true) + .map({ meta, orig, moving -> [meta, moving?: orig] }) + ch_versions = ch_versions.mix(MASK_MOVING_IMAGE.out.versions.first()) + if ( options.run_easyreg ) { // ** Registration using Easyreg ** // // Result : [ meta, reference, image | [], ref-segmentation | [], segmentation | [] ] @@ -201,7 +212,6 @@ workflow REGISTRATION { ch_register = ch_register.ants_syn .join(ch_fixed_mask, remainder: true) .join(ch_moving_mask, remainder: true) - .map{ it[0..2] + [it[4] ?: []] + [it[5] ?: []] } REGISTRATION_ANTS ( ch_register ) ch_versions = ch_versions.mix(REGISTRATION_ANTS.out.versions.first()) diff --git a/subworkflows/nf-neuro/registration/meta.yml b/subworkflows/nf-neuro/registration/meta.yml index 29923bf8..0404c1ae 100644 --- a/subworkflows/nf-neuro/registration/meta.yml +++ b/subworkflows/nf-neuro/registration/meta.yml @@ -47,6 +47,7 @@ components: - registration/convert - registration/easyreg - registration/synthmorph + - image/applymask - utils_options input: - ch_fixed_image: @@ -93,7 +94,7 @@ input: - ch_fixed_mask: type: file description: | - FOR USE WITH ANTS SYN REGISTRATION ONLY. The input channel containing the mask file in fixed image space. + Fixed mask will be use to mask the fixed image during registration. structure: - meta: type: map @@ -106,7 +107,7 @@ input: - ch_moving_mask: type: file description: | - FOR USE WITH ANTS SYN REGISTRATION ONLY. The input channel containing the mask file in moving image space. + Moving mask will be use to mask the moving image during registration. structure: - meta: type: map diff --git a/subworkflows/nf-neuro/registration/tests/main.nf.test b/subworkflows/nf-neuro/registration/tests/main.nf.test index 20f5dec8..0d5a4d2f 100644 --- a/subworkflows/nf-neuro/registration/tests/main.nf.test +++ b/subworkflows/nf-neuro/registration/tests/main.nf.test @@ -16,6 +16,7 @@ nextflow_workflow { tag "registration/convert" tag "registration/easyreg" tag "registration/synthmorph" + tag "image/applymask" tag "subworkflows/utils_options" diff --git a/subworkflows/nf-neuro/registration/tests/main.nf.test.snap b/subworkflows/nf-neuro/registration/tests/main.nf.test.snap index 510ea20c..0017177e 100644 --- a/subworkflows/nf-neuro/registration/tests/main.nf.test.snap +++ b/subworkflows/nf-neuro/registration/tests/main.nf.test.snap @@ -69,10 +69,10 @@ } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "25.04.8" + "nf-test": "0.9.3", + "nextflow": "25.10.2" }, - "timestamp": "2025-10-16T20:51:47.326447932" + "timestamp": "2026-06-04T13:33:58.944010211" }, "registration - easyreg": { "content": [ @@ -163,10 +163,10 @@ } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "25.04.8" + "nf-test": "0.9.3", + "nextflow": "25.10.2" }, - "timestamp": "2025-10-15T18:55:55.830874285" + "timestamp": "2026-06-04T13:33:44.280377972" }, "registration - ANTs - SyNQuick": { "content": [ @@ -256,6 +256,7 @@ ] ], "versions": [ + "versions.yml:md5,8f4cb1a55910da303007d7c2202e62f0", "versions.yml:md5,a338911f46f2c623d87eab600c524ffb" ] } @@ -264,7 +265,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-06-02T20:05:53.555032692" + "timestamp": "2026-06-04T13:33:26.753578263" }, "registration - ANTs - Anat to DWI": { "content": [ @@ -362,6 +363,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-02-26T22:46:42.344818522" + "timestamp": "2026-06-04T13:33:13.90620864" } } \ No newline at end of file diff --git a/subworkflows/nf-neuro/tractoflow/main.nf b/subworkflows/nf-neuro/tractoflow/main.nf index 149b3835..357076f6 100644 --- a/subworkflows/nf-neuro/tractoflow/main.nf +++ b/subworkflows/nf-neuro/tractoflow/main.nf @@ -14,7 +14,7 @@ include { RECONST_MEANFRF } from '../../../modules/nf-neuro/reconst/meanfrf/m include { RECONST_DTIMETRICS } from '../../../modules/nf-neuro/reconst/dtimetrics/main' include { RECONST_FODF } from '../../../modules/nf-neuro/reconst/fodf/main' include { RECONST_QBALL } from '../../../modules/nf-neuro/reconst/qball/main' -include { IMAGE_MATH } from '../../../modules/nf-neuro/image/math/main' +include { IMAGE_APPLYMASK } from '../../../modules/nf-neuro/image/applymask/main' // TRACKING include { TRACKING_PFTTRACKING } from '../../../modules/nf-neuro/tracking/pfttracking/main' @@ -179,14 +179,18 @@ workflow TRACTOFLOW { // SUBWORKFLOW: Run REGISTRATION // if ( options.preproc_dwi_keep_dwi_with_skull ) { - IMAGE_MATH(RECONST_DTIMETRICS.out.fa.join(PREPROC_DWI.out.b0_mask)) - ch_fa_for_registration = IMAGE_MATH.out.image - ch_versions = ch_versions.mix(IMAGE_MATH.out.versions.first()) + IMAGE_APPLYMASK(RECONST_DTIMETRICS.out.fa.join(PREPROC_DWI.out.b0_mask)) + ch_fa_for_registration = IMAGE_APPLYMASK.out.image + ch_versions = ch_versions.mix(IMAGE_APPLYMASK.out.versions.first()) } else { ch_fa_for_registration = RECONST_DTIMETRICS.out.fa } + PREPROC_DWI.out.b0.view() + PREPROC_T1.out.t1_final.view() + ch_fa_for_registration.view() + T1_REGISTRATION( PREPROC_DWI.out.b0, PREPROC_T1.out.t1_final, diff --git a/subworkflows/nf-neuro/tractoflow/meta.yml b/subworkflows/nf-neuro/tractoflow/meta.yml index 5ac7a143..9561f087 100644 --- a/subworkflows/nf-neuro/tractoflow/meta.yml +++ b/subworkflows/nf-neuro/tractoflow/meta.yml @@ -44,7 +44,7 @@ keywords: components: - image/convertdwi - image/convert - - image/math + - image/applymask - anatomical_segmentation - preproc_dwi - preproc_t1 diff --git a/subworkflows/nf-neuro/tractoflow/modules.config b/subworkflows/nf-neuro/tractoflow/modules.config index b8d8b8b2..f54e2700 100644 --- a/subworkflows/nf-neuro/tractoflow/modules.config +++ b/subworkflows/nf-neuro/tractoflow/modules.config @@ -96,10 +96,9 @@ process { ext.first_suffix = "t1" } - withName: "TRACTOFLOW:IMAGE:MATH" { - ext.operation = "multiplication" + withName: "TRACTOFLOW:IMAGE:APPLYMASK" { ext.data_type = "float32" - ext.suffix = "fa_masked" + ext.first_suffix = "fa" } //withName: "TRACTOFLOW:T1_REGISTRATION:REGISTER_ANATTODWI" { diff --git a/subworkflows/nf-neuro/tractoflow/tests/main.nf.test b/subworkflows/nf-neuro/tractoflow/tests/main.nf.test index 1af9e337..fbe462c8 100644 --- a/subworkflows/nf-neuro/tractoflow/tests/main.nf.test +++ b/subworkflows/nf-neuro/tractoflow/tests/main.nf.test @@ -18,7 +18,7 @@ nextflow_workflow { tag "image/convert" tag "image/convertdwi" - tag "image/math" + tag "image/applymask" tag "reconst/dtimetrics" tag "reconst/frf" tag "reconst/fodf" diff --git a/subworkflows/nf-neuro/tractoflow/tests/main.nf.test.snap b/subworkflows/nf-neuro/tractoflow/tests/main.nf.test.snap index 550a1ef8..d7a84da8 100644 --- a/subworkflows/nf-neuro/tractoflow/tests/main.nf.test.snap +++ b/subworkflows/nf-neuro/tractoflow/tests/main.nf.test.snap @@ -393,7 +393,6 @@ "versions": [ "versions.yml:md5,229b67add04c70923f1bca378b7b2187", "versions.yml:md5,68aaff09474ed3ae149c1cffb0651f0d", - "versions.yml:md5,7c2302570358741fd2c8a9c5f9df41cb", "versions.yml:md5,7cabc91ec64b5e824e9b8f60d7dcf930", "versions.yml:md5,7fae1f6758d48901013496c0a680b81b", "versions.yml:md5,85cf18214259841972e1ea51961dc19d", @@ -401,6 +400,7 @@ "versions.yml:md5,b1f30072384bba1505d84f60281dfc24", "versions.yml:md5,cdfc3f4153b62c413e2fc6e948f2ef21", "versions.yml:md5,e808fc7967f50aad087f14c8cbcdc7e1", + "versions.yml:md5,f63f0d3dff7878bb46899a6b96ac2497", "versions.yml:md5,fee3d07623cc095a898f0a1de534a05b" ], "volume_fraction": [ @@ -441,7 +441,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-06-03T15:18:39.539666595" + "timestamp": "2026-06-04T13:46:26.983105632" }, "tractoflow - no rev": { "content": [ @@ -941,6 +941,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2026-06-03T15:16:19.494671141" + "timestamp": "2026-06-04T13:44:16.486282515" } } \ No newline at end of file