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

Symmetrical colorbars are drawn incorrectly #6

Closed
dfsp-spirit opened this issue May 20, 2020 · 2 comments
Closed

Symmetrical colorbars are drawn incorrectly #6

dfsp-spirit opened this issue May 20, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@dfsp-spirit
Copy link
Owner

dfsp-spirit commented May 20, 2020

There is something wrong with the visualization of symmetric color legends. Needs investigation.

For an example, draw a colorbar using the unit test for vis.symmetric.data.on.subject that uses the cluster data.

Reproducible example:

subjects_dir = file.path(find.freesurferhome()$found_at, 'subjects');
subject_id = 'fsaverage';

lh_demo_cluster_file = system.file("extdata", "lh.clusters_fsaverage.mgz", package = "fsbrain", mustWork = TRUE);
rh_demo_cluster_file = system.file("extdata", "rh.clusters_fsaverage.mgz", package = "fsbrain", mustWork = TRUE);

lh_clust = freesurferformats::read.fs.morph(lh_demo_cluster_file);   # contains a single positive cluster (activation, group difference), the other values are 0
rh_clust = freesurferformats::read.fs.morph(rh_demo_cluster_file);   # contains two negative clusters

vis.symmetric.data.on.subject(subjects_dir, subject_id, lh_clust, rh_clust, bg="curv", draw_colorbar = T);
@dfsp-spirit dfsp-spirit added the bug Something isn't working label May 20, 2020
@dfsp-spirit dfsp-spirit self-assigned this May 20, 2020
@dfsp-spirit
Copy link
Owner Author

This was a bug caused by passing the colors of the mesh instead of the color function to fields::imageplot. It was very apparent in the example above because many of the colors are NA for the cluster data, but in general, it was present in all colorbars.

This is fixed in the develop branch now, but needs some more testing to be sure it really works under all conditions. It will be part of the next release.

Note: As it is not in the master branch yet, installing from Github does not fix this (unless you install the develop branch, which is not recommended).

@dfsp-spirit
Copy link
Owner Author

dfsp-spirit commented May 28, 2020

This is fixed in the master branch and in release v0.2.1, which is now on CRAN. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant