Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anroy1 committed Aug 18, 2024
1 parent 6e55c72 commit 049dec7
Show file tree
Hide file tree
Showing 9 changed files with 332 additions and 13 deletions.
4 changes: 3 additions & 1 deletion modules/nf-scil/registration/convert/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ process REGISTRATION_CONVERT {
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
FSLOUTPUTTYPE=NIFTI_GZ
cp $fs_license \$FREESURFER_HOME/license.txt
declare -A affine_dictionnary=( ["--outlta"]="lta" \
Expand All @@ -55,7 +57,7 @@ process REGISTRATION_CONVERT {
["--outlps"]="nii.gz" \
["--outitk"]="nii.gz" \
["--outras"]="nii.gz" \
["--outvoz"]="mgz" )
["--outvox"]="mgz" )
ext_deform=\${deform_dictionnary[${out_format_deform}]}
Expand Down
182 changes: 176 additions & 6 deletions modules/nf-scil/registration/convert/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ nextflow_process {

test("registration - convert - default") {

config "./nextflow_fsants.config"
config "./nextflow_default.config"

when {
process {
"""
input[0] = LOAD_DATA.out.test_data_directory.map{
test_data_directory -> [
[ id:'test', single_end:false ], // meta map
file("/workspaces/nf-scil/deform.mgz"),
file("/workspaces/nf-scil/affine.lta"),
file("/workspaces/nf-scil/fs_deform.nii.gz"),
file("/workspaces/nf-scil/fs_affine.lta"),
file("\${test_data_directory}/t1.nii.gz"),
[],
file("\${test_data_directory}/license.txt")
Expand Down Expand Up @@ -64,11 +64,151 @@ nextflow_process {
input[0] = LOAD_DATA.out.test_data_directory.map{
test_data_directory -> [
[ id:'test', single_end:false ], // meta map
file("/workspaces/nf-scil/deform.mgz"),
file("/workspaces/nf-scil/affine.lta"),
file("/workspaces/nf-scil/fs_deform.nii.gz"),
file("/workspaces/nf-scil/fs_affine.lta"),
file("\${test_data_directory}/t1.nii.gz"),
file("\${test_data_directory}/fa.nii.gz"),
file("\${test_data_directory}/license.txt")
]
}
"""
}
}
}

// FSL output not fully implemented in mri_warp_convert

// test("registration - convert - fsfsl") {

// config "./nextflow_fsfsl.config"

// when {
// process {
// """
// input[0] = LOAD_DATA.out.test_data_directory.map{
// test_data_directory -> [
// [ id:'test', single_end:false ], // meta map
// file("/workspaces/nf-scil/fs_deform.nii.gz"),
// file("/workspaces/nf-scil/fs_affine.lta"),
// file("\${test_data_directory}/t1.nii.gz"),
// file("\${test_data_directory}/fa.nii.gz"),
// file("/workspaces/nf-scil/license.txt")
// ]
// }
// """
// }
// }

// then {
// assertAll(
// { assert process.success },
// { assert snapshot(process.out).match() }
// )
// }
// }

test("registration - convert - fslfs") {

config "./nextflow_fslfs.config"

when {
process {
"""
input[0] = LOAD_DATA.out.test_data_directory.map{
test_data_directory -> [
[ id:'test', single_end:false ], // meta map
file("/workspaces/nf-scil/fsl_deform.nii.gz"),
file("/workspaces/nf-scil/fsl_affine.mat"),
file("\${test_data_directory}/t1.nii.gz"),
file("\${test_data_directory}/fa.nii.gz"),
file("\${test_data_directory}/license.txt")
]
}
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("registration - convert - fslants") {

config "./nextflow_fslants.config"

when {
process {
"""
input[0] = LOAD_DATA.out.test_data_directory.map{
test_data_directory -> [
[ id:'test', single_end:false ], // meta map
file("/workspaces/nf-scil/fsl_deform.nii.gz"),
file("/workspaces/nf-scil/fsl_affine.mat"),
file("\${test_data_directory}/t1.nii.gz"),
file("\${test_data_directory}/fa.nii.gz"),
file("\${test_data_directory}/license.txt")
]
}
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("registration - convert - antsfs") {

config "./nextflow_antsfs.config"

when {
process {
"""
input[0] = LOAD_DATA.out.test_data_directory.map{
test_data_directory -> [
[ id:'test', single_end:false ], // meta map
file("/workspaces/nf-scil/ants_deform.nii.gz"),
file("/workspaces/nf-scil/ants_affine.txt"),
file("\${test_data_directory}/t1.nii.gz"),
file("\${test_data_directory}/fa.nii.gz"),
file("\${test_data_directory}/license.txt")
]
}
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("registration - convert - fslants") {

config "./nextflow_fslants.config"

when {
process {
"""
input[0] = LOAD_DATA.out.test_data_directory.map{
test_data_directory -> [
[ id:'test', single_end:false ], // meta map
file("/workspaces/nf-scil/fsl_deform.nii.gz"),
file("/workspaces/nf-scil/fsl_affine.mat"),
file("\${test_data_directory}/t1.nii.gz"),
file("\${test_data_directory}/fa.nii.gz"),
file("/workspaces/nf-scil/license.txt")
file("\${test_data_directory}/license.txt")
]
}
"""
Expand All @@ -83,4 +223,34 @@ nextflow_process {
}
}

// FSL output not fully implemented in mri_warp_convert

// test("registration - convert - antsfsl") {

// config "./nextflow_antsfsl.config"

// when {
// process {
// """
// input[0] = LOAD_DATA.out.test_data_directory.map{
// test_data_directory -> [
// [ id:'test', single_end:false ], // meta map
// file("/workspaces/nf-scil/ants_deform.nii.gz"),
// file("/workspaces/nf-scil/ants_affine.txt"),
// file("\${test_data_directory}/t1.nii.gz"),
// file("\${test_data_directory}/fa.nii.gz"),
// file("/workspaces/nf-scil/license.txt")
// ]
// }
// """
// }
// }

// then {
// assertAll(
// { assert process.success },
// { assert snapshot(process.out).match() }
// )
// }
// }
}
114 changes: 110 additions & 4 deletions modules/nf-scil/registration/convert/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,111 @@
{
"registration - convert - fsants": {
"registration - convert - default": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test__init_warp.txt:md5,5f989a979be61faa578ad619377a8a07"
]
],
"1": [
[
{
"id": "test",
"single_end": false
},
"test__deform_warp.nii.gz:md5,1c4fa470540b62d7f924f2ea104d64a6"
]
],
"2": [
"versions.yml:md5,9912ec095965c1ff571f77b447c18f92"
],
"deform_transform": [
[
{
"id": "test",
"single_end": false
},
"test__deform_warp.nii.gz:md5,1c4fa470540b62d7f924f2ea104d64a6"
]
],
"init_transform": [
[
{
"id": "test",
"single_end": false
},
"test__init_warp.txt:md5,5f989a979be61faa578ad619377a8a07"
]
],
"versions": [
"versions.yml:md5,9912ec095965c1ff571f77b447c18f92"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-06-30T01:52:43.678126"
},
"registration - convert - antsfs": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test__init_warp.lta:md5,ecb814619ad5125e5ee33f86ca6b9dd7"
]
],
"1": [
[
{
"id": "test",
"single_end": false
},
"test__deform_warp.nii.gz:md5,30070a7d9c9ce61976c67f6ba687e38c"
]
],
"2": [
"versions.yml:md5,9912ec095965c1ff571f77b447c18f92"
],
"deform_transform": [
[
{
"id": "test",
"single_end": false
},
"test__deform_warp.nii.gz:md5,30070a7d9c9ce61976c67f6ba687e38c"
]
],
"init_transform": [
[
{
"id": "test",
"single_end": false
},
"test__init_warp.lta:md5,ecb814619ad5125e5ee33f86ca6b9dd7"
]
],
"versions": [
"versions.yml:md5,9912ec095965c1ff571f77b447c18f92"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-06-30T01:54:17.641423"
},
"registration - convert - fslants": {
"content": [
{
"0": [
Expand All @@ -26,9 +132,9 @@
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-06-08T17:25:44.675169"
"timestamp": "2024-06-30T01:53:54.010164"
},
"registration - convert - default": {
"registration - convert - fslfs": {
"content": [
{
"0": [
Expand All @@ -55,6 +161,6 @@
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-06-08T17:25:11.431078"
"timestamp": "2024-06-30T01:53:30.533846"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
process {
withName: "REGISTRATION_CONVERT" {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
ext.in_format_init = "itk"
ext.out_format_init = "lta"
ext.in_format_deform = "itk"
ext.out_format_deform = "ras"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
process {
withName: "REGISTRATION_CONVERT" {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
ext.invert = "true"
ext.downsample = "true"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
process {
withName: "REGISTRATION_CONVERT" {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
ext.invert = "true"
ext.downsample = "true"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
process {
withName: "REGISTRATION_CONVERT" {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
ext.in_format_init = "lta"
ext.out_format_init = "fsl"
ext.in_format_deform = "ras"
ext.out_format_deform = "fsl"
}
}
Loading

0 comments on commit 049dec7

Please sign in to comment.