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

Tight layout with 9 view inflated #50

Closed
mattsodoma opened this issue Mar 15, 2023 · 8 comments
Closed

Tight layout with 9 view inflated #50

mattsodoma opened this issue Mar 15, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@mattsodoma
Copy link

I am trying to get a tight layout with the inflated brain on the 9 view. I was reading the FAQ which pointed me to use vislayout.from.coloredmeshes and to use shift_hemis_apart so the hemispheres on inflated don't overlap. My issue, is that when I use export, it recognizes the rglaction correctly and the hemispheres are seperated. However, when I use vislayout.from.coloredmeshes it does not separate the hemispheres. On the other hand, when I use the vislayout.from.coloredmeshes, I get the type of spacing that I would like whereas export has a lot of white space. Wondering if I am doing something wrong in my vislayout call or export calls. Pictures and code below:

Export image:
combined loglate YMb_inflated

vislayout.from.coloredmeshes image

combined loglate YMb_inflated2

code:
`x<-vis.symmetric.data.on.subject(subjects_dir, subject_id, lh_clust, rh_clust, bg="curv", surface = "inflated", rglactions = list('shift_hemis_apart'=TRUE), views = NULL)

export(x, img_only = TRUE, output_img = output_saveinflated,rglactions = list('shift_hemis_apart'=TRUE),view_angles=c("t9"),colorbar_legend= legendname)

vislayout.from.coloredmeshes(x,output_img = output_saveinflated2, view_angles = get.view.angle.names(angle_set = "t9"),rglactions = list('shift_hemis_apart'=TRUE))`

@dfsp-spirit
Copy link
Owner

dfsp-spirit commented Mar 23, 2023

This definitely should not happen. I will try to reproduce locally and let you know.

Which environment and version of fsbrain are you using?

Environment:

  • Operating System [e.g. MacOS10.13, or Ubuntu 20.04]:
  • R version (output of R --version in system shell):
  • fsbrain version (output of packageVersion('fsbrain') in R):

@dfsp-spirit
Copy link
Owner

Okay, I can reproduce this locally with the latest official release version of fsbrain. Confirmed as a bug. I will look into it.

@dfsp-spirit dfsp-spirit self-assigned this Mar 23, 2023
@dfsp-spirit dfsp-spirit added the bug Something isn't working label Mar 23, 2023
@mattsodoma
Copy link
Author

Hi Tim,

Thank you for looking into it. Not sure if this information is still helpful, but it was present on both my work and home desktop.
Work:
R version 4.2.2
MacOS Ventura 13.2.1
fsbrain 0.5.3

Home (not sure of specifics right now but its fairly recent reinstall of windows so everything is newer updates)
Windows 11
R version 4.1+
fsbrain likely 0.5.3

Thank you,
Matt

@dfsp-spirit
Copy link
Owner

Thanks for the additional info!

dfsp-spirit added a commit that referenced this issue Mar 24, 2023
@dfsp-spirit
Copy link
Owner

Hi Matthew (@mattsodoma),

I have rolled out a fix for this on the master branch. The fix is not yet on CRAN, but it will go there with the next fsbrain release. To use the fixed version, you will have to install via remotes:

install.packages("remotes")
remotes::install_github("dfsp-spirit/fsbrain")

IMPORTANT: If you did this in a session that already had fsbrain loaded, you will have to completely restart R. Clicking Session -> New Session in RStudio is not enough! To be sure, just restart RStudio completely. If you do not do this, you will not be using the freshly installed package version, but the old broken one.

Then you can try this:

fsbrain::download_optional_data();
    fsbrain::download_fsaverage(accept_freesurfer_license = TRUE);
    subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
    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

    cm = fsbrain::vis.symmetric.data.on.subject(subjects_dir, subject_id, lh_clust, rh_clust, surface="inflated", bg="curv_light", rglactions = list('shift_hemis_apart'=TRUE), views = NULL);

    fsbrain::export(cm, img_only = TRUE, output_img = "fsbrain_issue50_export.png", rglactions = list('shift_hemis_apart'=TRUE), view_angles=fsbrain::get.view.angle.names(angle_set = "t9"), colorbar_legend= "issue50 test");

fsbrain_issue50_export

@dfsp-spirit
Copy link
Owner

Please let me know whether this fixes your problem.

@mattsodoma
Copy link
Author

Hi Tim,
I just tested this on my home computer (windows) and it worked as expected! Appreciate the help.
Matt

@dfsp-spirit
Copy link
Owner

Great to hear to that!

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

2 participants