qsiprep icon indicating copy to clipboard operation
qsiprep copied to clipboard

[WIP] ENH: Add SIFT-classic

Open smeisler opened this issue 2 years ago • 5 comments

Related to #431.

Changes proposed in this pull request

  1. use_sift now takes as input "1" or "2" (or false) to differentiate between sift versions
  2. A separate SIFT1 class is created which takes in FOD, Tck and optional final streamline count (default 1million), and outputs filtered tractogram which becomes the main output of tractography fed into other workflows.

Documentation that should be reviewed

I have not updated documentation yet, but recon page would be affected

smeisler avatar Jun 18 '22 14:06 smeisler

Hmmm, the command is being generated and executed without error, but only the un-sifted tractogram is ultimately output, and under the sift name.

I think I confused output_node vs ds_tck_file, will fix and retest.

smeisler avatar Jun 18 '22 15:06 smeisler

This looks awesome - I'm not going to be able to code for the next few weeks, so I'll add write access for you on this repo

mattcieslak avatar Jun 18 '22 16:06 mattcieslak

Hi @mattcieslak,

Finally returned to this after a year or so and got something working.

Here is a summary of changes:

  1. use_sift now takes as input "1" or "2" (or false) to differentiate between sift versions
  2. iFod2 now has a sift_tracks output_spec for SIFT1 outputs.
  3. SIFT1 final streamline count can be set by specifying term_number in the sift_params in a given recon_spec. Otherwise, it will default to the default tcksift behavior (until streamline densities match the FOD lobe integrals).

Still in progress, might need some help with:

  1. I have tested this out locally, but I imagine I should set up a test on the repo.
  2. I don't think the use_sift options of 1, 2, or False is the most elegant, as I imagine a user could want to use SIFT2 for atlas connectivity and SIFT1 for tractography in a single recon specification.
  3. Add documentation
  4. Add an example recon_spec with SIFT1, perhaps something like Mrtrix-->PyAFQ spec, but starting with making a dense 10M streamline tractogram, SIFTing it to 1M, and then start PyAFQ.

tree on recon out directory (note the desc-sifttracks file):

├── sub-READ1003_ses-T1_acq-MDDW64_dir-PA_space-T1w_desc-preproc_desc-csfFOD_msmtcsd.txt
├── sub-READ1003_ses-T1_acq-MDDW64_dir-PA_space-T1w_desc-preproc_desc-csfFODmtnormed_msmtcsd.mif.gz
├── sub-READ1003_ses-T1_acq-MDDW64_dir-PA_space-T1w_desc-preproc_desc-gmFOD_msmtcsd.txt
├── sub-READ1003_ses-T1_acq-MDDW64_dir-PA_space-T1w_desc-preproc_desc-gmFODmtnormed_msmtcsd.mif.gz
├── sub-READ1003_ses-T1_acq-MDDW64_dir-PA_space-T1w_desc-preproc_desc-mtinliermask_msmtcsd.nii.gz
├── sub-READ1003_ses-T1_acq-MDDW64_dir-PA_space-T1w_desc-preproc_desc-mtnorm_msmtcsd.nii.gz
├── sub-READ1003_ses-T1_acq-MDDW64_dir-PA_space-T1w_desc-preproc_desc-sifttracks_ifod2.tck
├── sub-READ1003_ses-T1_acq-MDDW64_dir-PA_space-T1w_desc-preproc_desc-tracks_ifod2.tck
├── sub-READ1003_ses-T1_acq-MDDW64_dir-PA_space-T1w_desc-preproc_desc-wmFOD_msmtcsd.txt
└── sub-READ1003_ses-T1_acq-MDDW64_dir-PA_space-T1w_desc-preproc_desc-wmFODmtnormed_msmtcsd.mif.gz

0 directories, 10 files

Thoughts?

smeisler avatar Apr 24 '23 18:04 smeisler

2. iFod2 now has a sift_tracks output_spec for SIFT1 outputs.

I see now that this would be an issue for using the SIFT outputs for other workflows (e.g., PyAFQ), since they tend to look for the tck_file field. Will think about best way to change that.

Edit: addressed in commit below, where SIFT1 tck outfile is ported as outputnode's tck_file. Confirmed that the right sifted TCK is now being ported into AFQ segmentation. But still does not solve the problem if one wants to use both SIFT1 and SIFT2 outputs for different purposes.

smeisler avatar Apr 24 '23 18:04 smeisler

@mattcieslak do you think it could make sense to have SIFT1 become a separate entity from the tractography workflow? That way, in theory one could run whole brain tractography, use SIFT2 weights for connectivity, but also be able to use a SIFT1'd tractogram for tract segmentation, all in one recon spec.

smeisler avatar May 05 '23 14:05 smeisler