Add -normalize-PAM50 argument to metric extraction script to allow interpolation to PAM50 space - #5236
Add -normalize-PAM50 argument to metric extraction script to allow interpolation to PAM50 space#5236valosekj wants to merge 25 commits into
-normalize-PAM50 argument to metric extraction script to allow interpolation to PAM50 space#5236Conversation
…_extract_metric` to interpolate the extracted metric values into PAM50 dimensions per slice
|
@sandrinebedard reviewed the PR. @joshuacwnewton, could you also review the PR? Thank you 🙏 |
|
In the progress of reviewing this PR. Just trying to figure out why the tests are failing! 🤔 |
joshuacwnewton
left a comment
There was a problem hiding this comment.
There are a lot of good things to this PR (thanks for adding tests!) but I think I may have found an important thing to discuss in terms of the order of aggregation and interpolation.
sct_extract_metric: normalize DWI to PAM50-normalize-PAM50 argument to metric extraction script (to allow interpolating DTI in PAM50 space)
…ic_normalize_pam50
-normalize-PAM50 argument to metric extraction script (to allow interpolating DTI in PAM50 space)-normalize-PAM50 argument to metric extraction script to allow interpolation to PAM50 space
Since `-normalize-PAM50` already requires `-perslice 1`, the two separate `extract_metric()` calls were redundant. Context: #5236 (comment)
interpolate_metrics() expects compute_shape()'s output form (one Metric object per metric, multiple slices), while _build_pam50_agg_metric() works with extract_metric()'s output form (one dict per slice, multiple metrics). Context: #5236 (comment)
sct_extract_metric aggregates in native space then interpolates to PAM50, while sct_process_segmentation interpolates to PAM50 first then aggregates. Context: #5236 (comment)
joshuacwnewton
left a comment
There was a problem hiding this comment.
I think this LGTM! I just had a few small comments to address the remaining open conversations, but I think the overall structure/plan of this PR seems sound, and I appreciate the new tests. :)
Co-authored-by: Joshua Newton <joshuacwnewton@gmail.com>
Thanks Joshua! Context: #5236 (comment)
Thank you for your review and suggestions, @joshuacwnewton! Let me test the PR on the spine-generic dataset before merging it! |
Sounds good to me! :) |
…oolbox#5236 - comment out perlevel native extraction-- used in another analysis; not needed now - update config_process_data_dwi.json
Checklist
Description
This PR implements per-slice interpolation to
sct_extract_metricto enable computing DTI maps in the native and then interpolating them per vert level to the PAM50 template space.I'm reusing spinalcordtoolbox.metrics_to_PAM50.interpolate_metrics.
Example usage
amu01_dwi_moco_FA.csv sample:
Files:
PR5236.zip
TODO
Due to high DWI slice thickness (5mm), there are “steps” at the “interface” of discs (see slide 8) --> try to include one slice above and below each level for the interpolation.
Linked issues
Related: spinalcordtoolbox/PAM50-normalized-metrics#41