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

Add tractoflow subworkflow #82

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AlexVCaron
Copy link
Collaborator

Describe your changes

new subworkflow for tractoflow. I will lint and add tests soon

List test packages used by your subworkflow

Checklist before requesting a review

  • Create the tool:
    • Edit ./subworkflows/nf-neuro/<category>/<tool>/main.nf
    • Edit ./subworkflows/nf-neuro/<category>/<tool>/meta.yml
  • Generate the tests:
    • Edit ./subworkflows/nf-neuro/<category>/<tool>/tests/main.nf.test
    • Run the tests to generate the main.nf.test.snap snapshots
  • Ensure the syntax is correct :
    • Run prettier and editorconfig-checker to fix common syntax issues
    • Run nf-core subworkflows lint and fix all errors
    • Ensure your variables have good, clear names

Copy link
Contributor

@arnaudbore arnaudbore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are getting there !! We may need a discussion on teams to follow up with this discussion about params names and apart from a couple of comments everything seems ready.

RECONST_FRF( ch_reconst_frf )
ch_versions = ch_versions.mix(RECONST_FRF.out.versions.first())

/* Run fiber response aeraging over subjects */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* Run fiber response aeraging over subjects */
/* Run fiber response averaging over subjects */

acquisition biases, align anatomical and diffusion space, compute DTI and fODF metrics and generate whole brain
tractograms.
---------- Configuration ----------
- nextflow.config : contains an example configuration for the subworkflow. Includes :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove Includes :

dwi_fodf_fit_peaks_ventricle_min_md = 0.003

//**PFT tracking**//
fodf_fit_pft = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run_pft_tracking makes more sense to me. BUT I didn't see anywhere else.

fodf_fit_pft = true
fodf_pft_fit_random_seed = 0
fodf_pft_fit_algorithm = "prob"
fodf_pft_fit_step_size = 0.5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These names are imo too long why not using: pft_tracking_step_size etc... same for local_tracking_

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we we could, as much as possible and it still needs to make sense, keep the same var name we had with the original tractoflow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this, the simpler the parameters' names, the easier the user will understand how to use them. I think those are only for example purposes; when the subworkflow will be included in a pipeline, the nextflow.config and modules.config will need to be either copied or rewritten so they can be changed in the pipeline implementation of tractoflow.

on the preprocessed DWI image and extract relevant metrics.
PFT TRACKING (dipy)
Perform Particle Filtering Tractography (PFT) on the FODF to generate whole brain tractograms.
LOCAL TRACKING (dipy)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPU implementation if 100% scilpy

Copy link
Contributor

@gagnonanthony gagnonanthony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing job! 💯 I wrote some comments, but they shouldn't be hard to solve!

Comment on lines +54 to +56
ch_dwi, ch_rev_dwi,
ch_sbref, ch_rev_sbref,
ch_topup_config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason why you wrote the inputs as a pair rather than a vertical list? With the reverse images, it does make sense, but I think I would make it homogeneous with how we call the other subworkflows.

Comment on lines +77 to +83
ch_registration_fa = PREPROC_DWI.out.dwi_resample
.join(PREPROC_DWI.out.bval)
.join(PREPROC_DWI.out.bvec)
.join(PREPROC_DWI.out.b0_mask)

REGISTRATION_FA( ch_registration_fa )
ch_versions = ch_versions.mix(REGISTRATION_FA.out.versions.first())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this adds a process that could be avoided. Unless I am missing something, the complete DTI process (lines 137-143) could be placed here, and the resulting FA map could be used for registration. This would avoid computing the FA twice and reduce runtime.

Comment on lines +216 to +231
ch_pft_tracking = ANATOMICAL_SEGMENTATION.out.wm_mask
.join(ANATOMICAL_SEGMENTATION.out.gm_mask)
.join(ANATOMICAL_SEGMENTATION.out.csf_mask)
.join(RECONST_FODF.out.fodf)
.join(RECONST_DTIMETRICS.out.fa)
TRACKING_PFTTRACKING( ch_pft_tracking )
ch_versions = ch_versions.mix(TRACKING_PFTTRACKING.out.versions.first())

//
// MODULE: Run TRACKING/LOCALTRACKING
//
ch_local_tracking = ANATOMICAL_SEGMENTATION.out.wm_mask
.join(RECONST_FODF.out.fodf)
.join(RECONST_DTIMETRICS.out.fa)
TRACKING_LOCALTRACKING( ch_local_tracking )
ch_versions = ch_versions.mix(TRACKING_LOCALTRACKING.out.versions.first())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect to run both tracking methods in a single run? We should use parameters to select which one we want to run.

@@ -0,0 +1,347 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can drop this line.

fodf_fit_pft = true
fodf_pft_fit_random_seed = 0
fodf_pft_fit_algorithm = "prob"
fodf_pft_fit_step_size = 0.5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this, the simpler the parameters' names, the easier the user will understand how to use them. I think those are only for example purposes; when the subworkflow will be included in a pipeline, the nextflow.config and modules.config will need to be either copied or rewritten so they can be changed in the pipeline implementation of tractoflow.

Copy link
Contributor

@ThoumyreStanislas ThoumyreStanislas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work Alex! It's crazy to see it all finished. For my part, I don't have many comments, I agree with Arnaud and Anthony about the input nomenclature for FRF. Anthony's comment is relevant to the DTI_metrics module, which could be earlier to avoid calculating fa twice. But that's all, well done again! 🚀 🥇

description: |
(Optional) The input channel containing the brain probability mask for antsBET,
with intensity range 1 (definitely brain) to 0 (definitely background).
Structure: [ val(meta), path(probability_map) ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For anatomical segmentation, you can also add a lesion mask as an input to complete the segmentation. It's optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants