Skip to content

[ENH] Add SS3T CSD (single-shell 3-tissue) via cs_dmri - #235

Open
chiuhoward wants to merge 4 commits into
tractometry:mainfrom
chiuhoward:ss3t
Open

chiuhoward wants to merge 4 commits into
tractometry:mainfrom
chiuhoward:ss3t

Conversation

@chiuhoward

@chiuhoward chiuhoward commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Addresses #233. Independent of #234 (either merge order works); the HBN comparison below was run with it.

  • ss3t_params in AFQ/tasks/data.py, next to rumba_params: SS3T CSD via cs_dmri on pyAFQ's data, gtab and brain_mask (so b=0 + one shell via the existing min_bval / max_bval). Writes _model-ss3tcsd_param-{wm,gm,csf}_dwimap.nii.gz. One kwarg, ss3t_sh_order_max (default 8), named like the CSD/OPDT/CSA ones.
  • odf_model="SS3TCSD" tracks from it with no change to tracking.
  • cs_dmri fits in MRtrix3's tournier07 basis; _tournier07_to_descoteaux07 projects the WM fODF onto the legacy descoteaux07 basis pyAFQ reads.
  • Optional extra: pip install "pyAFQ[cs_dmri]" (also in all). Citation: dhollander2016novel.

Test: test_tournier07_to_descoteaux07 in test_csd.py checks the conversion exactly against cs_dmri's own .pam5 export (descoteaux07 legacy). It fails for each of the wrong conversions we tried (none; legacy tournier07; non-legacy descoteaux07).

Validation: full pyAFQ run, SS3T vs plain CSD (odf_model="CSD"), pyAFQ defaults otherwise; both runs of each dataset share registration, masks and tissue maps, so they differ only in the fODF model. One subject each, 40 bundles:

density r, median (range) Dice, median (range) endpoint r, median FA profile r, median recognized streamlines, CSD / SS3T
Stanford HARDI b2000 0.98 (0.65–1.00) 0.90 (0.46–0.97) 0.94 0.997 2.28M / 1.88M
HBN b1000 0.98 (0.42–0.99) 0.90 (0.39–0.96) 0.90 0.992 1.88M / 1.62M
HBN b2000 0.98 (0.67–1.00) 0.89 (0.49–0.95) 0.92 0.991 2.26M / 1.94M

The lowest agreement is in SLF I/II in all three datasets.

Per-bundle tables and figures are in the attached HTML (zipped).
pyafq_ss3t_e2e.html.zip

HBN is run with #234, without which the HBN brain mask is fractional and CSD (not SS3T: cs_dmri treats the mask as m > 0) leaves about 9% of white matter with all-zero coefficients.

Side note, separate from SS3T: HBN (b=0/1000/2000) reduced to one shell with min_bval / max_bval crashes at the profiles step with ValueError: MSDKI requires at least 3 b-values. get_data_plan picks the default scalars from the unfiltered bvals, so msdki_msd / msdki_msk are added and MSDKI is then fitted on b=0 + one shell. We passed scalars=["dti_fa", "dti_md", "t1w_over_b0"]. Happy to open a separate PR that counts shells after the filter.

🤖 Generated with Claude Code

chiuhoward and others added 4 commits November 17, 2026 10:11
Adds ss3t_params (odf_model="SS3TCSD"): Dhollander responses, SS3T-CSD
and mtnormalise from cs_dmri on pyAFQ's data, gtab and brain mask. The
WM fODF is projected from cs_dmri's tournier07 basis onto descoteaux07;
GM and CSF signal fractions are written alongside. Optional extra
pyAFQ[ss3t].

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Replace the end-to-end SS3T vs CSD peak-agreement test in test_api.py
with a unit test in test_csd.py that checks the projection against
cs_dmri's own export of an SS3T fit to DIPY's descoteaux07 basis.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@chiuhoward chiuhoward changed the title Add SS3T CSD (single-shell 3-tissue) via cs_dmri [ENH] Add SS3T CSD (single-shell 3-tissue) via cs_dmri Nov 18, 2026

@arokem arokem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall looks good but I'm not sure about that conversion.

Comment thread AFQ/tasks/data.py
]


def _tournier07_to_descoteaux07(sh):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure this is the best way to do this. @36000 : I think you have some code that does this without the projection to a sphere? Could you please share?

This branch has not been deployed

No deployments
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.

2 participants