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 26, 2024
1 parent 294f6cb commit cc7c8af
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 26 deletions.
10 changes: 3 additions & 7 deletions modules/nf-neuro/registration/synthregistration/environment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
name: "registration_synthregistration"
channels:
- Docker
- Apptainer
dependencies:
- "Freesurfer:synthmorph"
channels: []
dependencies: []
name: registration_synthregistration
10 changes: 5 additions & 5 deletions modules/nf-neuro/registration/synthregistration/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ process REGISTRATION_SYNTHREGISTRATION {

output:
tuple val(meta), path("*__output_warped.nii.gz"), emit: warped_image
tuple val(meta), path("*__affine_warp.lta"), emit: affine_transform
tuple val(meta), path("*__deform_warp.nii.gz"), emit: deform_transform
tuple val (meta), path("*__init_warp.lta"), emit: init_transform
path "versions.yml" , emit: versions

when:
Expand All @@ -21,7 +21,7 @@ process REGISTRATION_SYNTHREGISTRATION {
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

def init = task.ext.init ? "-m " + task.ext.init : "-m affine"
def affine = task.ext.affine ? "-m " + task.ext.affine : "-m affine"
def warp = task.ext.warp ? "-m " + task.ext.warp : "-m deform"
def header = task.ext.header ? "-H" : ""
def gpu = task.ext.gpu ? "-g" : ""
Expand All @@ -35,8 +35,8 @@ process REGISTRATION_SYNTHREGISTRATION {
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
mri_synthmorph -j $task.cpus ${init} -t ${prefix}__init_warp.lta $moving $fixed
mri_synthmorph -j $task.cpus ${warp} ${gpu} ${lambda} ${steps} ${extent} ${weight} -i ${prefix}__init_warp.lta -t ${prefix}__deform_warp.nii.gz -o ${prefix}__output_warped.nii.gz $moving $fixed
mri_synthmorph -j $task.cpus ${affine} -t ${prefix}__affine_warp.lta $moving $fixed
mri_synthmorph -j $task.cpus ${warp} ${gpu} ${lambda} ${steps} ${extent} ${weight} -i ${prefix}__affine_warp.lta -t ${prefix}__deform_warp.nii.gz -o ${prefix}__output_warped.nii.gz $moving $fixed
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand All @@ -52,8 +52,8 @@ process REGISTRATION_SYNTHREGISTRATION {
mri_synthmorph -h
touch ${prefix}__output_warped.nii.gz
touch ${prefix}__affine_warp.lta
touch ${prefix}__deform_warp.nii.gz
touch ${prefix}__init_warp.lta
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
9 changes: 6 additions & 3 deletions modules/nf-neuro/registration/synthregistration/meta.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
name: "registration_synthregistration"
description: Perform registration using SynthMorph from Freesurfer. Outputs transforms in Freesurfer format .lta for affine and .nii.gz (synthmorph also supports .mgz) for deform, both in RAS orientation, which can be converted for ANTs with respectively lta_convert and mri_warp_convert, which support a wide range of conversion formats and orientations. Conversion can be processed using the registration/convert module which can be used successively to this one.
description: Perform registration using SynthMorph from Freesurfer. Outputs transforms in Freesurfer format .lta for affine and .nii.gz (synthmorph also supports .mgz) for deform, both in RAS orientation. Conversion to other formats is done using lta_convert and mri_warp_convert respectively, which support a wide range of conversion formats and orientations, such as ANTs ans FSL. To convert the output of this module, use the registration/convert module successively to it.
keywords:
- registration
- Registration
- Brain imaging
- MRI
- Synthetic
- AI
- CNN
tools:
- "Freesurfer":
description: "Freesurfer Synthmorph"
Expand Down Expand Up @@ -34,7 +37,7 @@ output:
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- init_transform:
- affine_transform:
type: file
description: Affine transform for initialization
pattern: "*.{lta}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ nextflow_process {
script "../../../../../subworkflows/nf-neuro/load_test_data/main.nf"
process {
"""
input[0] = Channel.from( [ "freesurfer.zip" ] )
input[0] = Channel.from( [ "processing.zip" ] )
input[1] = "test.load-test-data"
"""
}
Expand All @@ -32,8 +32,8 @@ nextflow_process {
input[0] = LOAD_DATA.out.test_data_directory
.map{ test_data_directory -> [
[ id:'test', single_end:false ],
file("\${test_data_directory}/t1.nii.gz"),
file("\${test_data_directory}/fa.nii.gz")
file("\${test_data_directory}/mni_masked_2x2x2.nii.gz"),
file("\${test_data_directory}/b0_mean.nii.gz")
]}
"""
}
Expand All @@ -43,8 +43,8 @@ nextflow_process {
{ assert process.success },
{ assert snapshot(
niftiMD5SUM(process.out.warped_image.get(0).get(1)),
process.out.affine_transform,
niftiMD5SUM(process.out.deform_transform.get(0).get(1)),
process.out.init_transform,
process.out.versions
).match() }
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"registration - synthregistration": {
"content": [
"test__output_warped.nii.gz:md5:header,a1c8a7cfd88d5b632700819988507e8b,data,2526d950d4d6786c40faf5285e2f08af",
"test__deform_warp.nii.gz:md5:header,4a9989cf78e087331c587e0d656ee96f,data,3dcaa6acc0ee1a933d8792d9c2fc740d",
"test__output_warped.nii.gz:md5:header,616ccfd9e4dd6202483736565cca4946,data,81a995f1f9c8ff28b60206767528f078",
[
[
{
"id": "test",
"single_end": false
},
"test__init_warp.lta:md5,eb15bf7f338f1d5bd71227c40b6dbc68"
"test__affine_warp.lta:md5,86e977bba905112ce22d18fe265321f4"
]
],
"test__deform_warp.nii.gz:md5:header,513f2229597974a5b77a761d52d2c671,data,694f8b2b18234277cb8eebd60ab18c16",
[
"versions.yml:md5,49fb9c85da9f696926d1ab46ef0968fb"
]
Expand All @@ -20,6 +20,6 @@
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-24T17:03:44.420784"
"timestamp": "2024-09-25T01:17:49.969972"
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
process {
memory = "14G"
withName: "REGISTRATION_SYNTHREGISTRATION" {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
memory = 20
ext.init = "affine"
ext.affine = "affine"
ext.warp = "deform"
ext.threads = 1
ext.lambda = 0.9
ext.steps = 9
}
Expand Down

0 comments on commit cc7c8af

Please sign in to comment.