nitransforms icon indicating copy to clipboard operation
nitransforms copied to clipboard

Feat: Implement a visualisation feature to NiTransforms

Open jmarabotto opened this issue 1 year ago • 4 comments

Addition of new file vis.py. Calls nitransform's nonlinear DenseFieldTransform class to illustrate corresponding transform objects through:

  • Distorted image and grid
  • Quiver plot coloured according to Diffusion Scalar map
  • Jacobian map

which can be illustrated all together (3x3 grid of plots, showing axial, coronal and sagittal projections for each graph) or individually.

jmarabotto avatar Jul 08 '24 09:07 jmarabotto

Can you post screenshots?

effigies avatar Jul 10 '24 13:07 effigies

Can you post screenshots?

Overview (3x3 plot grid): https://output.circle-artifacts.com/output/job/bb500396-f329-4c10-b994-6ac6365bc443/artifacts/0/tmp/tests/artifacts/show_transform.svg NOTE sliders don't work yet but would be a cool interactive tool for updating slices.

Distorted grid lines superimposed over deformed brain density map: https://output.circle-artifacts.com/output/job/bb500396-f329-4c10-b994-6ac6365bc443/artifacts/0/tmp/tests/artifacts/plot_distortion.svg

Quiver plot of the deltas field: https://output.circle-artifacts.com/output/job/bb500396-f329-4c10-b994-6ac6365bc443/artifacts/0/tmp/tests/artifacts/plot_quiverdsm.svg NOTE colours represent the diffusion scalar map of the vector field (red: dominant x-component; green: dominant y-component; blue: dominant z-component; light->dark: weak dominance -> strong dominance)

Jacobian map: https://output.circle-artifacts.com/output/job/bb500396-f329-4c10-b994-6ac6365bc443/artifacts/0/tmp/tests/artifacts/plot_jacobian.svg

Hopefully this sets a good (or useful) base for the implementation of a visualisation module to nitransforms, or at least can act as a good starting point to spring new ideas.

jmarabotto avatar Jul 11 '24 14:07 jmarabotto

Codecov Report

Attention: Patch coverage is 96.25850% with 11 lines in your changes missing coverage. Please review.

Please upload report for BASE (master@4662d29). Learn more about missing BASE report.

Files with missing lines Patch % Lines
nitransforms/vis.py 96.56% 4 Missing and 6 partials :warning:
nitransforms/io/fsl.py 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #212   +/-   ##
=========================================
  Coverage          ?   95.20%           
=========================================
  Files             ?       17           
  Lines             ?     2150           
  Branches          ?      252           
=========================================
  Hits              ?     2047           
  Misses            ?       80           
  Partials          ?       23           
Flag Coverage Δ
unittests 95.20% <96.25%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jul 11 '24 14:07 codecov[bot]

@effigies this is now ready for review! Latest plots can be accessed through the CircleCi workflow, under build_pytest > Artifacts. These shouldn't be too different (if at all) to the links posted above.

jmarabotto avatar Jul 15 '24 13:07 jmarabotto