Skip to content

Commit

Permalink
main dev, add test and meta
Browse files Browse the repository at this point in the history
  • Loading branch information
anroy1 committed Sep 12, 2024
1 parent 9546061 commit acda670
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
21 changes: 19 additions & 2 deletions subworkflows/nf-scil/registration/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ workflow REGISTRATION {

// ** Setting outputs ** //
image_warped = REGISTRATION_ANATTODWI.out.t1_warped
ref_warped = Channel.empty()
transfo_image = REGISTRATION_ANATTODWI.out.transfo_image
transfo_trk = REGISTRATION_ANATTODWI.out.transfo_trk
ref_segmentation = Channel.empty()
image_segmentation = Channel.empty()
}
else if ( params.run_surgery ) {
// ** Set up input channel ** //
ch_register = ch_ref.combine(ch_image, by: 0)
.combine(ch_ref_segmentation)
.combine(ch_flo_segmentation)
.combine(ch_ref_segmentation, by: 0)
.combine(ch_flo_segmentation, by: 0)

// ** Registration using Easyreg ** //
REGISTRATION_EASYREG ( ch_register )
Expand All @@ -50,7 +53,15 @@ workflow REGISTRATION {
// ** Setting outputs ** //
image_warped = REGISTRATION_EASYREG.out.flo_reg
transfo_image = REGISTRATION_EASYREG.out.fwd_field
.map{ it + [[]] }
transfo_trk = REGISTRATION_EASYREG.out.bak_field
.map{ [[]] + it }
ref_warped - REGISTRATON_EASYREG.out.ref_reg

// ** Setting optional outputs. If segmentations are not provided as inputs, ** //
// ** easyreg will outputs synthseg segmentations ** //
ref_segmentation = ch_ref_segmentation ? REGISTRATION_EASYREG.out.ref_seg : Channel.empty()
flo_segmentation = ch_ref_segmentation ? REGISTRATION_EASYREG.out.flo_seg : Channel.empty()

}
else {
Expand All @@ -72,14 +83,20 @@ workflow REGISTRATION {

// ** Setting outputs ** //
image_warped = REGISTRATION_ANTS.out.image
ref_warped = Channel.empty()
transfo_image = REGISTRATION_ANTS.out.transfo_image
transfo_trk = REGISTRATION_ANTS.out.transfo_trk
ref_segmentation = Channel.empty()
flo_segmentation = Channel.empty()
}

emit:
image_warped = image_warped // channel: [ val(meta), [ image ] ]
ref_warped = ref_warped // channel: [ val(meta), [ ref ] ]
transfo_image = transfo_image // channel: [ val(meta), [ warp, affine ] ]
transfo_trk = transfo_trk // channel: [ val(meta), [ inverseAffine, inverseWarp ] ]
ref_segmentation = ref_segmentation // channel: [ val(meta), [ ref_seg ] ]
flo_segmentation = flo_segmentation // channel: [ val(meta), [ flo_seg ] ]

versions = ch_versions // channel: [ versions.yml ]
}
16 changes: 16 additions & 0 deletions subworkflows/nf-scil/registration/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ output:
Channel containing warped moving images. Typically, this would be the warped T1 in DWI space.
Structure: [ val(meta), path(image) ]
pattern: "*.{nii,nii.gz}"
- ref_warped:
type: file
description: |
Channel containing warped reference images. Typically, this would be the warped T1 in DWI space.
Structure: [ val(meta), path(image) ]
pattern: "*.{nii,nii.gz}"
- transfo_image:
type: file
description: |
Expand All @@ -91,6 +97,16 @@ output:
be used to register tractograms or bundle in the subject's anatomical space.
Structure: [ val(meta), [ path(inverseAffine), path(inverseWarp) ]
pattern: "*.{nii,nii.gz,mat}"
- ref_segmentation:
type: file
description: |
Channel containing the file with the SynthSeg v2 (non-robust) segmentation + parcellation of the reference image.
pattern: "*.{nii,nii.gz}"
- flo_segmentation:
type: file
description: |
Channel containing the file with the SynthSeg v2 (non-robust) segmentation + parcellation of the floating image.
pattern: "*.{nii,nii.gz}"
- versions:
type: file
description: |
Expand Down
1 change: 1 addition & 0 deletions subworkflows/nf-scil/registration/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ nextflow_workflow {
tag "registration/anattodwi"
tag "registration"
tag "registration/ants"
tag "registration/easyreg"

tag "load_test_data"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
process {
withName: "REGISTRATION_EASYREG" {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
ext.field = true
}
}

Expand Down

0 comments on commit acda670

Please sign in to comment.