Skip to content

Commit

Permalink
Fix Alex's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anroy1 committed Sep 25, 2024
1 parent f6a0866 commit 99dc26a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 36 deletions.
22 changes: 8 additions & 14 deletions subworkflows/nf-neuro/anatomical_segmentation/main.nf
Original file line number Diff line number Diff line change
@@ -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 ** //
Expand All @@ -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 )
Expand All @@ -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 {
Expand All @@ -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 ]
}
37 changes: 19 additions & 18 deletions subworkflows/nf-neuro/anatomical_segmentation/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ keywords:
components:
- segmentation/fastseg
- segmentation/freesurferseg
- segmentation/synthseg
input:
- ch_image:
type: file
Expand Down Expand Up @@ -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: |
Expand All @@ -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: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ nextflow_workflow {
tag "segmentation"
tag "segmentation/fastseg"
tag "segmentation/freesurferseg"
tag "segmentation/synthseg"

tag "load_test_data"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 99dc26a

Please sign in to comment.