[ENH] Starting conforming to new BIDS#152
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request updates the AFQ codebase to conform to new BIDS (Brain Imaging Data Structure) standards. The changes focus on updating model naming conventions, adding S0 (baseline signal) outputs, and refactoring decorators to handle multiple outputs.
Changes:
- Updated model naming in file suffixes (e.g., "dti" → "tensor", "dki" → "kurtosis", "fwdti" → "fwtensor", "msdki" → "mskurtosis")
- Modified DTI, DKI, and MSDKI fitting functions to return both model parameters and S0 values
- Refactored
as_file,as_fit_deriv, andas_imgdecorators to support multiple outputs - Enhanced metadata with descriptions for all derived metrics
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| AFQ/tasks/decorators.py | Refactored decorators to handle multiple output files and improved metadata handling |
| AFQ/tasks/data.py | Updated model names, added S0 outputs, and added metadata descriptions for all metrics |
| AFQ/models/dti.py | Added return_S0_hat parameter to DTI fitting function |
| AFQ/models/dki.py | Added return_S0_hat parameter to DKI fitting function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.
Comments suppressed due to low confidence (1)
AFQ/tasks/data.py:719
- Merge conflict marker detected in the code. The function signature contains unresolved merge conflict markers (<<<<<<< HEAD, =======, >>>>>>>) that need to be resolved. The parameters 'citations', 'data', and 'brain_mask' need to be properly merged.
data,
brain_mask,
citations,
rumba_wm_response=None,
rumba_gm_response=0.0008,
rumba_csf_response=0.003,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 13 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@arokem this is ready for review |
arokem
left a comment
There was a problem hiding this comment.
I think we still need to some transformation on the DKI parameters, so that they are stored in a format that is equivalent to the lower diagonal format of the DTI model.
Also, maybe not on this PR, but there is already a rather advanced draft of what BIDS-compliant tractography results would look like: https://docs.google.com/document/d/1ubDQ2RhgjnfGqoeukzEkPV9YEHhfYMERrj7-3b0c2HI/edit?tab=t.0
|
@arokem what do you have in mind? Dipy has this function: and should we do this in a separate PR or this PR? If it does not change filenames, maybe it can be postponed. But if its a quick fix, we can do it here. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Comments suppressed due to low confidence (1)
AFQ/tractography/tractography.py:191
odf_model == "GQ"andodf_model == "RUMBA"are handled as ifmodel_paramswere full-basis SH coefficients (usingorder_from_ncoef+sh_to_sf). However, the GQ/RUMBA tasks now save ODFs sampled ondefault_sphere(i.e., already a PMF/SF over sphere vertices). With the current logic,order_from_ncoef(model_params.shape[3])will fail for typical vertex counts and/or produce an incorrect PMF, breaking tractography. Handle GQ/RUMBA by passingmodel_paramsdirectly intodg.from_pmf(...)(and keep the SH->SF conversion only for AODF/full-basis SH inputs).
elif (odf_model == "GQ") or (odf_model == "RUMBA") or ("AODF" in odf_model):
sh_order = shm.order_from_ncoef(model_params.shape[3], full_basis=True)
pmf = shm.sh_to_sf(model_params, sphere, sh_order_max=sh_order, full_basis=True)
pmf[pmf < 0] = 0
dg = dg.from_pmf(
np.asarray(pmf, dtype=float), max_angle=max_angle, sphere=sphere
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@arokem if this passes the test, I believe this is ready to merge |
| Q = R.T @ R | ||
|
|
||
| A = csr_matrix(A) | ||
| Q = csr_matrix(Q) |
There was a problem hiding this comment.
Ha! This is probably a huge time save 😄
Addresses #77
Some notes: