dfsp-spirit / fsbrain

R library for structural neuroimaging. Provides high-level functions to access (read and write) and visualize surface-based brain morphometry data for individuals and groups.
Other
65 stars 13 forks source link

Fix white stripes in custom background of images exported with vis.export.from.coloredmeshes #21

Closed dfsp-spirit closed 3 years ago

dfsp-spirit commented 3 years ago

Describe the bug 2 horizontal white stripes occur in custom background color when using the background_color parameter of vis.export.from.coloredmeshes

To Reproduce

library('fsbrain')
download_optional_data();
download_fsaverage(accept_freesurfer_license = TRUE);
subjects_dir = get_optional_data_filepath("subjects_dir");
coloredmeshes = vis.subject.morph.standard(subjects_dir, "subject1", "sulc", cortex_only=TRUE, views=NULL);
vis.export.from.coloredmeshes(coloredmeshes, background_color = "black");

Expected behavior The background has the requested background color, no stripes.

Screenshots If applicable, add screenshots to help explain your problem. fsbrain_arranged

Environment:

Additional context This most likely occurs because of incorrect use of magick::image_append, which requires that images have the same height/width. Apparently the function still does something, but it first pads the smaller image with a non-configurable color (white). We may need to pad the smaller image manually with the background color before passing the images to magic::image_append to fix this bug.

dfsp-spirit commented 3 years ago

This is now fixed in dev and will be part of the next release (which most likely will be 0.4.3).