diff --git a/subworkflows/nf-neuro/anatomical_segmentation/main.nf b/subworkflows/nf-neuro/anatomical_segmentation/main.nf index e554201..798efff 100644 --- a/subworkflows/nf-neuro/anatomical_segmentation/main.nf +++ b/subworkflows/nf-neuro/anatomical_segmentation/main.nf @@ -1,11 +1,8 @@ // ** Importing modules from nf-neuro ** // include { SEGMENTATION_FASTSEG } from '../../../modules/nf-neuro/segmentation/fastseg/main' include { SEGMENTATION_FREESURFERSEG } from '../../../modules/nf-neuro/segmentation/freesurferseg/main' - include { SEGMENTATION_SYNTHSEG } from '../../../modules/nf-neuro/segmentation/synthseg/main' -params.run_synthseg = params.run_synthseg ?: false - workflow ANATOMICAL_SEGMENTATION { // ** Two input channels for the segmentation processes since they are using ** // @@ -19,10 +16,6 @@ workflow ANATOMICAL_SEGMENTATION { ch_versions = Channel.empty() - if ( ch_image && ch_freesurferseg ) { - error('Both input channels cannot be passed simultaneously') - } - if ( ch_freesurferseg ) { // ** Freesurfer segmentation ** // SEGMENTATION_FREESURFERSEG ( ch_freesurferseg ) @@ -47,13 +40,13 @@ workflow ANATOMICAL_SEGMENTATION { wm_mask = SEGMENTATION_SYNTHSEG.out.wm_mask gm_mask = SEGMENTATION_SYNTHSEG.out.gm_mask csf_mask = SEGMENTATION_SYNTHSEG.out.csf_mask - parc = SEGMENTATION_SYNTHSEG.out.parc - resample = SEGMENTATION_SYNTHSEG.out.resample - volume = SEGMENTATION_SYNTHSEG.out.vol - qc = SEGMENTATION_SYNTHSEG.out.qc wm_map = Channel.empty() gm_map = Channel.empty() csf_map = Channel.empty() + gm_parc = SEGMENTATION_SYNTHSEG.out.gm_parc + resample = SEGMENTATION_SYNTHSEG.out.resample + volume = SEGMENTATION_SYNTHSEG.out.volume + qc_score = SEGMENTATION_SYNTHSEG.out.qc_score } else { @@ -75,12 +68,13 @@ workflow ANATOMICAL_SEGMENTATION { wm_mask = wm_mask // channel: [ val(meta), [ wm_mask ] ] gm_mask = gm_mask // channel: [ val(meta), [ gm_mask ] ] csf_mask = csf_mask // channel: [ val(meta), [ csf_mask ] ] - parc = parc // channel: [ val(meta), [ parc ] ] - resample = resample // channel: [ val(meta), [ resample ] ] - qc = qc // channel: [ val(meta), [ qc ] ] wm_map = wm_map // channel: [ val(meta), [ wm_map ] ] gm_map = gm_map // channel: [ val(meta), [ gm_map ] ] csf_map = csf_map // channel: [ val(meta), [ csf_map ] ] + gm_parc = gm_parc // channel: [ val(meta), [ gm_parc ] ] + resample = resample // channel: [ val(meta), [ resample ] ] + volume = volume // channel: [ val(meta), [ volume ] ] + qc_score = qc_score // channel: [ val(meta), [ qc_score ] ] versions = ch_versions // channel: [ versions.yml ] } diff --git a/subworkflows/nf-neuro/anatomical_segmentation/meta.yml b/subworkflows/nf-neuro/anatomical_segmentation/meta.yml index 2f04d55..cae7496 100644 --- a/subworkflows/nf-neuro/anatomical_segmentation/meta.yml +++ b/subworkflows/nf-neuro/anatomical_segmentation/meta.yml @@ -17,6 +17,7 @@ keywords: components: - segmentation/fastseg - segmentation/freesurferseg + - segmentation/synthseg input: - ch_image: type: file @@ -62,24 +63,6 @@ output: is used and not with FreeSurfer's parcellation files. Structure: [ val(meta), path(wm_maps) ] pattern: "*.{nii,nii.gz}" - - parc: - type: file - description: | - Channel containing the optional nifti cortical parcellation volume from synthseg. - pattern: "*.{nii,nii.gz}" - Structure: [ val(meta), path(parc) ] - - vol: - type: file - description: | - Channel containing the optional Output CSV file with volumes for all structures and subjects. - Structure: [ val(meta), path(vol) ] - pattern: "*.csv" - - qc: - type: file - description: | - Channel containing the optional output CSV file with qc scores for all subjects. - Structure: [ val(meta), path(qc) ] - pattern: "*.csv" - gm_maps: type: file description: | @@ -94,6 +77,24 @@ output: is used and not with FreeSurfer's parcellation files. Structure: [ val(meta), path(csf_maps) ] pattern: "*.{nii,nii.gz}" + - gm_parc: + type: file + description: | + Channel containing the optional nifti cortical parcellation volume from synthseg. + pattern: "*.{nii,nii.gz}" + Structure: [ val(meta), path(gm_parc) ] + - volume: + type: file + description: | + Channel containing the optional Output CSV file with volumes for all structures and subjects. + Structure: [ val(meta), path(volume) ] + pattern: "*.csv" + - qc_score: + type: file + description: | + Channel containing the optional output CSV file with qc scores for all subjects. + Structure: [ val(meta), path(qc_score) ] + pattern: "*.csv" - versions: type: file description: | diff --git a/subworkflows/nf-neuro/anatomical_segmentation/tests/main.nf.test b/subworkflows/nf-neuro/anatomical_segmentation/tests/main.nf.test index bae319c..a52d2e4 100644 --- a/subworkflows/nf-neuro/anatomical_segmentation/tests/main.nf.test +++ b/subworkflows/nf-neuro/anatomical_segmentation/tests/main.nf.test @@ -11,6 +11,7 @@ nextflow_workflow { tag "segmentation" tag "segmentation/fastseg" tag "segmentation/freesurferseg" + tag "segmentation/synthseg" tag "load_test_data" diff --git a/subworkflows/nf-neuro/anatomical_segmentation/tests/nextflow_synthseg.config b/subworkflows/nf-neuro/anatomical_segmentation/tests/nextflow_synthseg.config index d45d1c1..cd9b788 100644 --- a/subworkflows/nf-neuro/anatomical_segmentation/tests/nextflow_synthseg.config +++ b/subworkflows/nf-neuro/anatomical_segmentation/tests/nextflow_synthseg.config @@ -3,9 +3,6 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } withName: "REGISTRATION_SYNTHSEG" { ext.fast = true + run_synthseg = true } } - -params { - run_synthseg = true -}