nipy / nipype

Workflows and interfaces for neuroimaging packages
https://nipype.readthedocs.org/en/latest/
Other
745 stars 529 forks source link

Freesurfer longitudinal pipeline - ReconAll flags #3345

Open 0rC0 opened 3 years ago

0rC0 commented 3 years ago

Summary

Hello everybody,

I'm going to implement the flags for the Freesurfer longitudinal pipeline in ReconAll.

I would like to ask if there is interest in a pull request about that.

Actual behavior

The Freesurfer longitudinal pipeline needs recon-all flags like -base -tp -long, whose are not implemented yet.

effigies commented 3 years ago

Hi, yes, these would be a great addition.

ghisvail commented 2 years ago

We are also interested by this interface. Is it still in the works?

Otherwise, we would be keen in giving it a go to replace our custom subprocess calls in Clinica.

0rC0 commented 2 years ago

We are also interested by this interface. Is it still in the works? Otherwise, we would be keen in giving it a go to replace our custom subprocess calls in Clinica.

Hello,

I'm not working any more on this addition.

Freesurfer uses and wants a somehow fixed directory structure. For example, the command worked if the structure was:

subjects_dir
|
|-sub1-timepoint1
|-| -mri
  |-stats
  |-....
|- sub1-timepoint2
|-| -mri
  |-stats
  |-....

but not for other structures, and I didn't manage to write something enough flexible to be integrated in a nipype workflow or the directory structure of the temp files of a workflow.

l-espana commented 1 year ago

Hello, I've also been interested in working on this for a while and have some basic code going that creates a separate "base" and "longitudinal" interface specification. FreeSurfer does generate specific output directory structures but I'm not entirely sure what other folder structures would cause this to not work. At any rate, would be happy to discuss if this issue is still of interest to others.

ghisvail commented 1 year ago

I've also been interested in working on this for a while and have some basic code going that creates a separate "base" and "longitudinal" interface specification. FreeSurfer does generate specific output directory structures but I'm not entirely sure what other folder structures would cause this to not work.

@l-espana if you have already got code that works, that would be a great starting point for a PR to iterate upon.

I have been focusing on pydra-freesurfer with plans to backport the longitudinal interface back to Nipype eventually, if no one beats me to it before. Feel free to have a go 👍

0rC0 commented 1 year ago

Sorry, I have pressed close for a mistake :P. I reopen it

If someone is still working or want to work to this issue and have some code to share to start with, I would be happy to give my contribution :-).

Anyway, my main problem was the following. Let's imagine we have a workflow that runs the single-subject recon-all, so, we have the two recon-all directories in paths like:

/workflow_temp/some1/path1/reconall/sid.baseline (1)
/workflow_temp/some2/path2/reconall/sid.followup (2)

The longitudinal pipeline of Freesurfer uses commands like:

  recon-all -base sid_templace -tp sid.baseline -tp sid.followup  -all
  recon-all -long sid.baseline sid_template -all
  recon-all -long sid.followup sid_template -all

and needs that the folders sid.baseline, sid.followup, sid.template are subfolders of $SUBJECTS_DIR, that should be the workflow temp directory of our longitudinal recon-all node

l-espana commented 1 year ago

I guess I would question leaving recon-all outputs in a temporary workflow directory rather than using, say, a freesurfer derivatives directory and just referencing that as the $SUBJECTS_DIR. (Unless I'm completely misunderstanding...) Working with FreeSurfer data in the past, we usually have to make sure all of the original recons pass inspection before running the rest of the longitudinal pipeline anyways, so it makes sense to me to keep things separated. I'm close to opening a PR I think, so maybe we can continue discussing. :)