Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update versaFlow from development repository #3

Merged
merged 59 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
7c573d6
Fix apply topup
AlexVCaron Jul 11, 2023
f08b3e6
register epi rev to forward dwi after epi corrections
AlexVCaron Aug 3, 2023
05d9ef0
minor fix
AlexVCaron Aug 3, 2023
79fad2e
minor fix
AlexVCaron Aug 3, 2023
eea06da
Several little fixes
AlexVCaron Aug 2, 2023
2617d87
Update readme
AlexVCaron Aug 15, 2023
9f94e73
Improve registration and segmentation
AlexVCaron Aug 22, 2023
7c662ca
Fix cache invalidation problem on T1 mask
AlexVCaron Aug 24, 2023
f1c8b05
Replace rev image with aligned one when available
AlexVCaron Aug 29, 2023
ff57cf4
Merge branch 'fix/hotfixes' of https://github.com/AlexVCaron/mrHARDIf…
AlexVCaron Aug 29, 2023
6e91121
Fix segmentation (dgm regions m ust be wm for tracking to work),
AlexVCaron Aug 30, 2023
e10e11f
Merge branch 'fix/hotfixes' of https://github.com/AlexVCaron/mrHARDIf…
AlexVCaron Aug 30, 2023
31d0ccf
Create process to generate composite transforms out of ANTs (easier t…
AlexVCaron Sep 1, 2023
90d6328
Minor fixes
AlexVCaron Sep 1, 2023
d4157ac
Stage transforms correctly
AlexVCaron Sep 2, 2023
a49ad0e
minor fixes
AlexVCaron Sep 2, 2023
d79a317
Minor fix
AlexVCaron Sep 2, 2023
9aa0431
add suffix
AlexVCaron Sep 2, 2023
265f523
minor fix
AlexVCaron Sep 2, 2023
bb3e9ed
Fix publish_all
AlexVCaron Sep 7, 2023
0724fec
Overwrite output files on resume
AlexVCaron Sep 7, 2023
a0d5d93
Fix apply topup
AlexVCaron Jul 11, 2023
6994292
register epi rev to forward dwi after epi corrections
AlexVCaron Aug 3, 2023
16cda70
minor fix
AlexVCaron Aug 3, 2023
596957e
minor fix
AlexVCaron Aug 3, 2023
165c2d2
Replace rev image with aligned one when available
AlexVCaron Aug 29, 2023
266c74a
Renaming to versaflow
AlexVCaron Aug 7, 2023
05b16e7
Update readme
AlexVCaron Aug 10, 2023
913500d
register epi rev to forward dwi after epi corrections
AlexVCaron Aug 3, 2023
8156c57
minor fix
AlexVCaron Aug 3, 2023
2bb87f9
minor fix
AlexVCaron Aug 3, 2023
f29735a
Fix ants_ai initialization
AlexVCaron Aug 11, 2023
62577d5
Minor fix for now, will remove later
AlexVCaron Aug 12, 2023
04e8361
Send template to b0 (T1 is registered)
AlexVCaron Aug 13, 2023
9a5a11a
Update registration parameters
AlexVCaron Aug 14, 2023
2c8c5b6
update citation
AlexVCaron Aug 14, 2023
99be78d
Renaming to versaFlow
AlexVCaron Aug 14, 2023
02a2f71
Update image readme
AlexVCaron Aug 14, 2023
507f0a0
Update usage
AlexVCaron Aug 14, 2023
a2f95b3
Minor fix
AlexVCaron Aug 15, 2023
f0baa61
Update readme
AlexVCaron Aug 15, 2023
51ddd51
Improve registration and segmentation
AlexVCaron Aug 22, 2023
9bc92f5
Fix cache invalidation problem on T1 mask
AlexVCaron Aug 24, 2023
c9d0c3d
Fix segmentation (dgm regions m ust be wm for tracking to work),
AlexVCaron Aug 30, 2023
2fb1f2e
Create process to generate composite transforms out of ANTs (easier t…
AlexVCaron Sep 1, 2023
bc84e6d
Minor fixes
AlexVCaron Sep 1, 2023
cbab379
Stage transforms correctly
AlexVCaron Sep 2, 2023
fca8a18
minor fixes
AlexVCaron Sep 2, 2023
c3afdc9
Minor fix
AlexVCaron Sep 2, 2023
81763da
add suffix
AlexVCaron Sep 2, 2023
370f220
minor fix
AlexVCaron Sep 2, 2023
24fa0cb
Fix publish_all
AlexVCaron Sep 7, 2023
92ee506
Overwrite output files on resume
AlexVCaron Sep 7, 2023
32784ea
Reverse order of transforms entering reoder (so its in the right orde…
AlexVCaron Sep 22, 2023
bca16f9
Bad pvf cropping (wm comes after csf in alpha order)
AlexVCaron Sep 22, 2023
9b427db
Merge branch 'fix/hotfixes' of https://github.com/AlexVCaron/mrHARDIf…
AlexVCaron Sep 22, 2023
47bebd3
Reverse transforms inputed to composer
AlexVCaron Sep 22, 2023
e857986
Missing reverse
AlexVCaron Sep 22, 2023
df25263
Apply renaming to versaFlow
AlexVCaron Sep 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .config/b0_to_template_affine_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
1.,
64,
"Regular",
1.,
0.7,
True
],
"klass": "mrHARDI.traits.ants.MetricMI"
Expand Down Expand Up @@ -84,7 +84,7 @@
1.,
64,
"Regular",
1.,
0.8,
True
],
"klass": "mrHARDI.traits.ants.MetricMI"
Expand Down
46 changes: 44 additions & 2 deletions .config/b0_to_template_syn_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

c.AntsConfiguration.passes = [{
"conv_eps": 1e-5,
"conv_max_iter": [1000, 500, 300, 200, 100],
"conv_win": 30,
"conv_max_iter": [100, 50, 20, 10, 10],
"conv_win": 10,
"grad_step": 0.2,
"var_penality": 3,
"var_total": 0,
Expand Down Expand Up @@ -80,6 +80,48 @@
0.5,
0
]
}, {
"conv_eps": 1e-5,
"conv_max_iter": [50, 20, 20],
"conv_win": 20,
"grad_step": 0.1,
"var_penality": 3,
"var_total": 0,
"klass": "mrHARDI.traits.ants.AntsSyN",
"metrics": [
{
"target_index": 0,
"moving_index": 1,
"args": [
0.65,
64,
"Regular",
1.
],
"klass": "mrHARDI.traits.ants.MetricMI"
},
{
"target_index": 0,
"moving_index": 2,
"args": [
0.35,
2,
"Regular",
1.
],
"klass": "mrHARDI.traits.ants.MetricCC"
}
],
"shrinks": [
8,
4,
1
],
"smoothing": [
1.5,
1.,
0
]
}]

c.AntsConfiguration.use_float = False
6 changes: 4 additions & 2 deletions .config/dwi_n4_normalization_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@

c.N4BiasCorrectionConfiguration.filter_width = 0.075

c.N4BiasCorrectionConfiguration.knot_distance = 4.0
c.N4BiasCorrectionConfiguration.spline_order = 3

c.N4BiasCorrectionConfiguration.iterations = [500, 200, 150, 100]
c.N4BiasCorrectionConfiguration.knot_distance = 64.0

c.N4BiasCorrectionConfiguration.iterations = [100, 100, 50, 30]

c.N4BiasCorrectionConfiguration.noise = 0.01

Expand Down
2 changes: 1 addition & 1 deletion .config/prepare_topup_base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

c.TopupConfiguration.reg_model = "bending_energy"

c.TopupConfiguration.scale_intensities = True
c.TopupConfiguration.scale_intensities = False

c.TopupConfiguration.spl_order = "cubic"

Expand Down
6 changes: 4 additions & 2 deletions .config/t1_n4_normalization_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@

c.N4BiasCorrectionConfiguration.filter_width = 0.075

c.N4BiasCorrectionConfiguration.knot_distance = 4.0
c.N4BiasCorrectionConfiguration.spline_order = 3

c.N4BiasCorrectionConfiguration.iterations = [200, 200, 100, 100]
c.N4BiasCorrectionConfiguration.knot_distance = 16.0

c.N4BiasCorrectionConfiguration.iterations = [80, 80, 40, 30]

c.N4BiasCorrectionConfiguration.noise = 0.01

Expand Down
8 changes: 4 additions & 4 deletions .config/t1_to_b0_syn_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

c.AntsConfiguration.passes = [{
"conv_eps": 1e-6,
"conv_max_iter": [50, 50],
"conv_max_iter": [30, 30],
"conv_win": 10,
"grad_step": 0.1,
"var_penality": 3,
Expand All @@ -48,18 +48,18 @@
"moving_index": 0,
"args": [
0.65,
64,
2,
"Regular",
1.
],
"klass": "mrHARDI.traits.ants.MetricMI"
"klass": "mrHARDI.traits.ants.MetricCC"
},
{
"target_index": 1,
"moving_index": 0,
"args": [
0.35,
4,
2,
"Regular",
1.
],
Expand Down
4 changes: 2 additions & 2 deletions .config/t1_to_template_affine_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

c.AntsConfiguration.passes = [{
"conv_eps": 1e-6,
"conv_max_iter": [400, 200, 100, 50],
"conv_max_iter": [400, 100, 50, 20],
"conv_win": 10,
"grad_step": 0.1,
"klass": "mrHARDI.traits.ants.AntsRigid",
Expand Down Expand Up @@ -78,7 +78,7 @@
]
}, {
"conv_eps": 1e-6,
"conv_max_iter": [500, 300, 150, 75],
"conv_max_iter": [200, 100, 50, 20],
"conv_win": 20,
"grad_step": 0.1,
"klass": "mrHARDI.traits.ants.AntsAffine",
Expand Down
37 changes: 33 additions & 4 deletions .config/t1_to_template_syn_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
c.AntsConfiguration.match_histogram = True

c.AntsConfiguration.passes = [{
"conv_eps": 1e-10,
"conv_max_iter": [400, 400, 200, 200],
"conv_win": 20,
"conv_eps": 1e-7,
"conv_max_iter": [50, 50, 20, 20],
"conv_win": 10,
"grad_step": 0.2,
"var_penality": 3,
"var_total": 0,
Expand All @@ -48,7 +48,7 @@
"moving_index": 0,
"args": [
1.0,
192,
64,
"Regular",
1.0
],
Expand All @@ -67,6 +67,35 @@
1.,
0.
]
}, {
"conv_eps": 1e-7,
"conv_max_iter": [20, 10],
"conv_win": 10,
"grad_step": 0.1,
"var_penality": 3,
"var_total": 0,
"klass": "mrHARDI.traits.ants.AntsSyN",
"metrics": [
{
"target_index": 0,
"moving_index": 0,
"args": [
1.0,
4,
"Regular",
1.0
],
"klass": "mrHARDI.traits.ants.MetricCC"
}
],
"shrinks": [
4,
1
],
"smoothing": [
2.,
0.
]
}]

c.AntsConfiguration.use_float = False
Binary file not shown.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
[![Docker containers](https://img.shields.io/badge/Docker%20images-dockerhub-blue?style=plaflat&logo=docker&labelColor=2e343b)](https://hub.docker.com/repository/docker/avcaron/versa)
[![DOI](https://zenodo.org/badge/430873937.svg)](https://zenodo.org/badge/latestdoi/430873937)

# versaFlow

versaFlow is a diffusion MRI processing pipeline configured to handle high
# versaflow

versaflow is a diffusion MRI processing pipeline configured to handle high
angular and spatial resolution data. By default it is configured to process
Maccaca Mulatta brain images; profiles to handle other types of primates, as
well as the human brain are being developped. The pipeline's pre-processing
Expand Down Expand Up @@ -141,7 +142,14 @@ automatically handled in a future version of the pipeline.
To run the pipeline, we recommend creating a directory per run that contains log and
cache of execution from Nextflow. In that directory, then run the following command

`nextflow run -resume -w cache -dsl2 <root of versaFlow>/main.nf --data_root <data root>
```
nextflow run \
-resume \
-w cache \
-dsl2 \
<root of versaFlow>/main.nf \
--data_root <data root>
```

Additional parameters to this command can be supplied, such as :

Expand Down
8 changes: 6 additions & 2 deletions USAGE
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ OPTIONAL ARGUMENTS [possible values] (default values)

- I/O :
--output_root Output directory where to put processed datasets ($output_root)
--publish_all Publish all files generated by each process in a directory named "all" under the output root [true|false] ($publish_all)
--publish_mode Strategy used to copy the processed files in the output root [copy|link] ($publish_mode)
--publish_all Publish all files generated by each process in a directory named
"all" under the output root [true|false] ($publish_all)
--publish_mode Strategy used to copy the processed files in the output root
[symlink|rellink|link|copy|copyNoFollow|move] ($publish_mode)
--publish_all_mode Strategy used to copy to whole processing tree in the output root
[symlink|rellink|link|copy|copyNoFollow|move] ($publish_all_mode)
--verbose_outputs Output of additional files and of debug messages in logs [true|false] ($verbose_outputs)
--random_seed Random seed to input to all random number generators ($random_seed)
--check_memory_requirements Check if enough memory is available to run the pipeline [true|false] ($check_memory_requirements)
Expand Down
2 changes: 2 additions & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def display_run_info () {
log.info " - Output root : $params.output_root"
log.info " - Publish mode : $params.publish_mode"
log.info " - Publish all outputs ${params.publish_all ? "(enabled)" : "(disabled)"}"
log.info " - Publish all mode : $params.publish_all_mode"
log.info " - Verbose ${params.verbose_outputs ? "(enabled)" : "(disabled)"}"
log.info " - Random seed : $params.random_seed"
log.info " - Check memory : $params.check_memory_requirements"
Expand Down Expand Up @@ -221,6 +222,7 @@ def display_usage () {
"output_root" : "$params.output_root",
"publish_all" : "$params.publish_all",
"publish_mode" : "$params.publish_mode",
"publish_all_mode" : "$params.publish_all_mode",
"verbose_outputs" : "$params.verbose_outputs",
"resample_data" : "$params.resample_data",
"check_memory_requirements": "$params.check_memory_requirements",
Expand Down
2 changes: 1 addition & 1 deletion modules/functions.nf
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@ def collect_paths ( data_channel ) {
return data_channel.map{
[it[0], (it.size() > 2 ? it[1..-1] : [it[1]] ).findAll{ it }]
}
}
}
8 changes: 4 additions & 4 deletions modules/processes/brain_extraction.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ process deepbet_t1 {
label params.use_cuda ? "res_single_cpu" : params.on_hcp ? "res_full_node_override" : "res_max_cpu"
label params.use_cuda ? "res_gpu" : ""

publishDir "${params.output_root}/all/${sid}/$caller_name/${task.process.replaceAll(":", "/")}", mode: "link", enabled: params.publish_all
publishDir "${params.output_root}/${sid}", saveAs: { f -> f.contains("metadata") ? null : remove_alg_suffixes(f) }, mode: params.publish_mode
publishDir "${params.output_root}/all/${sid}/$caller_name/${task.process.replaceAll(":", "/")}", mode: "$params.publish_all_mode", enabled: params.publish_all, overwrite: true
publishDir "${params.output_root}/${sid}", saveAs: { f -> f.contains("metadata") ? null : remove_alg_suffixes(f) }, mode: params.publish_mode, overwrite: true

input:
tuple val(sid), path(t1_image)
Expand All @@ -28,8 +28,8 @@ process bet_mask {
label "BET"
label "res_single_cpu"

publishDir "${params.output_root}/all/${sid}/$caller_name/${task.process.replaceAll(":", "/")}", mode: "link", enabled: params.publish_all
publishDir "${params.output_root}/${sid}", saveAs: { f -> f.contains("metadata") ? null : add_suffix(remove_alg_suffixes(f), suffix ? "$suffix" : "_bet_mask") }, mode: params.publish_mode
publishDir "${params.output_root}/all/${sid}/$caller_name/${task.process.replaceAll(":", "/")}", mode: "$params.publish_all_mode", enabled: params.publish_all, overwrite: true
publishDir "${params.output_root}/${sid}", saveAs: { f -> f.contains("metadata") ? null : add_suffix(remove_alg_suffixes(f), suffix ? "$suffix" : "_bet_mask") }, mode: params.publish_mode, overwrite: true

input:
tuple val(sid), path(img)
Expand Down
Loading