Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project streamlines from/to wm/gm #640

Merged
merged 2 commits into from
Feb 28, 2023

Conversation

frheault
Copy link
Member

@frheault frheault commented Nov 3, 2022

This new script expands on a previous version, projecting values from WM (streamlines) to the cortex (endpoints).
This version can project data from GM or WM to GM or WM (4 combos)

The data can come from metric maps (like before, FA, MD) or data_per_streamline or data_per_point (new).
The data_per_* can be from the .trk metadata or loaded from an array file.

This can be useful to project FA to the cortex, (WM->GM) or cortical thickness to the deep WM (GM->WM).
It can be used to visualize the distribution of streamlines and what they "touch" in a different way.

test_for_kurt_project.zip

@arnaudbore arnaudbore self-requested a review November 3, 2022 14:32
@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

Copy link
Contributor

@AntoineTheb AntoineTheb left a comment

Choose a reason for hiding this comment

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

Following discussions that we had, the main should be cleaned up and functions should be moved into scilpy instead of mixing IO and logic.

logging.warning('Empty bundle file {}. Skipping'.format(args.bundle))
return

mins, maxs, indices = _process_streamlines(sft.streamlines,
Copy link
Contributor

Choose a reason for hiding this comment

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

This and the following lines should be abstracted in a or multiple functions, which can reside in scilpy. The function(s) could return maps that can be saved in the main function. Overall, only IO should be in the main function.

return p


def _compute_streamline_mean(cur_ind, cur_min, cur_max, data):
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably has a place in the library

return streamline_average


def _process_streamlines(streamlines, just_endpoints):
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably has a place in the library and/or use functions that are already in the library

return mins, maxs, indices


def _project_metrics(curr_metric_map, count, orig_s, streamline_mean,
Copy link
Contributor

Choose a reason for hiding this comment

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

This could also go into the library. I would also add comments to tell the user that this function has side-effects instead of returns.

@frheault frheault force-pushed the project_streamlines_gm_wm branch from 6b25d6e to 27a5f6a Compare February 28, 2023 17:31
@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

@arnaudbore arnaudbore merged commit 6d13a24 into scilus:master Feb 28, 2023
@frheault frheault deleted the project_streamlines_gm_wm branch February 28, 2024 21:07
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.

3 participants