Skip to content

Commit

Permalink
[WIP] fix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
anroy1 committed Aug 9, 2024
1 parent d344adb commit 9808e7b
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 11 deletions.
18 changes: 13 additions & 5 deletions subworkflows/nf-scil/preproc_t1/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ workflow PREPROC_T1 {
ch_mask_nlmeans // channel: [ val(meta), [ mask ] ] , optional
ch_ref_n4 // channel: [ val(meta), [ ref, ref_mask ] ] , optional
ch_ref_resample // channel: [ val(meta), [ ref ] ] , optional
val_synth(false) // value: (default: false)
val_synth(false) // value: (default: false), , optional

main:

Expand All @@ -42,6 +42,10 @@ workflow PREPROC_T1 {
ch_bet = IMAGE_RESAMPLE.out.image
BETCROP_SYNTHBET ( ch_bet )
ch_versions = ch_versions.mix(BETCROP_SYNTHBET.out.versions.first())

// ** Setting BET output ** //
image_bet = BETCROP_SYNTHBET.out.bet_image
mask_bet = BETCROP_SYNTHBET.out.brain_mask
}

else {
Expand All @@ -50,24 +54,28 @@ workflow PREPROC_T1 {
ch_bet = IMAGE_RESAMPLE.out.image.join(ch_template).join(ch_probability_map)
BETCROP_ANTSBET ( ch_bet )
ch_versions = ch_versions.mix(BETCROP_ANTSBET.out.versions.first())

// ** Setting BET output ** //
image_bet = BETCROP_ANTSBET.out.t1
mask_bet = BETCROP_ANTSBET.out.mask
}

// ** crop image ** //
ch_crop = BETCROP_ANTSBET.out.t1.map{it + [[]]}
ch_crop = image_bet.map{it + [[]]}
BETCROP_CROPVOLUME_T1 ( ch_crop )
ch_versions = ch_versions.mix(BETCROP_CROPVOLUME_T1.out.versions.first())

// ** crop mask ** //
ch_crop_mask = BETCROP_ANTSBET.out.mask.join(BETCROP_CROPVOLUME_T1.out.bounding_box)
ch_crop_mask = mask_bet.join(BETCROP_CROPVOLUME_T1.out.bounding_box)
BETCROP_CROPVOLUME_MASK ( ch_crop_mask )
ch_versions = ch_versions.mix(BETCROP_CROPVOLUME_MASK.out.versions.first())

emit:
image_nlmeans = DENOISING_NLMEANS.out.image // channel: [ val(meta), [ image ] ]
image_N4 = PREPROC_N4.out.image // channel: [ val(meta), [ image ] ]
image_resample = IMAGE_RESAMPLE.out.image // channel: [ val(meta), [ image ] ]
image_bet = ch_bet_out.t1 // channel: [ val(meta), [ t1 ] ]
mask_bet = ch_bet_out.out.mask // channel: [ val(meta), [ mask ] ]
image_bet = image_bet // channel: [ val(meta), [ t1 ] ]
mask_bet = mask_bet // channel: [ val(meta), [ mask ] ]
crop_box = BETCROP_CROPVOLUME_T1.out.bounding_box // channel: [ val(meta), [ bounding_box ] ]
mask_final = BETCROP_CROPVOLUME_MASK.out.image // channel: [ val(meta), [ mask ] ]
t1_final = BETCROP_CROPVOLUME_T1.out.image // channel: [ val(meta), [ image ] ]
Expand Down
2 changes: 2 additions & 0 deletions subworkflows/nf-scil/preproc_t1/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ nextflow_workflow {
[ id:'test', single_end:false ],
[]
]}
input[6] = false
"""
}
}
Expand Down Expand Up @@ -124,6 +125,7 @@ nextflow_workflow {
[ id:'test', single_end:false ],
file("\${test_data_directory}/t1_unaligned.nii.gz")
]}
input[6] = false
"""
}
}
Expand Down
117 changes: 111 additions & 6 deletions subworkflows/nf-scil/preproc_t1/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,115 @@
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.0-rc1",
"nextflow": "24.04.3"
},
"timestamp": "2024-05-10T19:57:38.341812"
"timestamp": "2024-07-26T18:11:30.464682"
},
"preproc_t1_synth": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test_denoised.nii.gz:md5,b6d25b37b1101fea5c77bbbc711757c3"
]
],
"1": [
[
{
"id": "test",
"single_end": false
},
"test__image_n4.nii.gz:md5,ef0d9af46aa1e330c5d7679ead500596"
]
],
"2": [
[
{
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,88bae6bfeea1734111621b437e09548d"
]
],
"3": [

],
"4": [

],
"5": [

],
"6": [

],
"7": [

],
"8": [
"versions.yml:md5,97b6b9457caf964b9f20549672f692f0",
"versions.yml:md5,b979132991d8f72a3585465533bd5730",
"versions.yml:md5,c6563545d67d7ab20ad849adcaafcb71"
],
"crop_box": [

],
"image_N4": [
[
{
"id": "test",
"single_end": false
},
"test__image_n4.nii.gz:md5,ef0d9af46aa1e330c5d7679ead500596"
]
],
"image_bet": [

],
"image_nlmeans": [
[
{
"id": "test",
"single_end": false
},
"test_denoised.nii.gz:md5,b6d25b37b1101fea5c77bbbc711757c3"
]
],
"image_resample": [
[
{
"id": "test",
"single_end": false
},
"test__resampled.nii.gz:md5,88bae6bfeea1734111621b437e09548d"
]
],
"mask_bet": [

],
"mask_final": [

],
"t1_final": [

],
"versions": [
"versions.yml:md5,97b6b9457caf964b9f20549672f692f0",
"versions.yml:md5,b979132991d8f72a3585465533bd5730",
"versions.yml:md5,c6563545d67d7ab20ad849adcaafcb71"
]
}
],
"meta": {
"nf-test": "0.9.0-rc1",
"nextflow": "24.04.3"
},
"timestamp": "2024-07-26T17:13:02.031243"
},
"preproc_t1_classic": {
"content": [
Expand Down Expand Up @@ -336,9 +441,9 @@
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.0-rc1",
"nextflow": "24.04.3"
},
"timestamp": "2024-05-10T19:36:04.155481"
"timestamp": "2024-07-26T17:51:34.909311"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: "IMAGE_RESAMPLE" {
ext.voxel_size = 1
ext.interp = "lin"
}
withName: "BETCROP_CROPVOLUME_T1" {
Expand Down

0 comments on commit 9808e7b

Please sign in to comment.