The surface and volume examples are roughly parallel, covering plotting both continuous statistical overlays and parcellations. The example code includes assigning values to parcels (e.g., to show the results of an analysis), adjusting the plot appearance, and doing math with the images in R. Please read both the text in the pdf and the code comments.
My intention is that the plotting functions and usage examples in these knitrs will enable beginners to quickly start making useful (and attractive!) knitr documents to summarize, explore, and describe their own analyses. Please let me know if you encounter any bugs, have a suggestion for an improvement, or have a new feature suggestion.
UPDATE 13 January 2025: I did a major update of knitrIntro_gifti.rnw and replaced the gifti screen capture in this post to match. See also a new blog post introducing volume and surface datasets.
UPDATE 31 March 2023: I uploaded corrected versions of niftiPlottingFunctions.R and knitrIntro_NIfTI.pdf to osf and the volumetric screenshot above. The correction was needed because of a bug in my plot.volume() function causing the negative colors to be reversed: instead of values near zero being dark blue, they were cyan. Major thanks to Tan Nguyen for spotting the unexpected coloring! If you downloaded a copy of niftiPlottingFunctions.R before 30 March 2023, please replace it with this version.
UPDATE 29 June 2021: Changed the volumetric screenshot to show the new (diverging) cool colors (and a legend); niftiPlottingFunctions.R and giftiPlottingFunctions.R now use the same color scales.
very nice. you might also be interested in "neurosurf"
ReplyDeletehttps://bbuchsbaum.github.io/neurosurf/articles/displaying-surfaces.html
Interesting package, thanks for the pointer! I couldn't tell from the description; does it also work with giftis, or with a different file format?
DeleteDear Dr. Etzel
ReplyDeleteThank you for sharing awesome codes and knowledge! I have one question. Do you think figures from your plot.surface code are eligible for the publication? Or is it only for the education?
When I use your plot.surface code, I think it generates pretty accurate figures. But wondered developer's thought. And if I use your code to generate figure, how can I reference yours?
Thanks!
Thank you for your kind comment! I have made publication plots with my plot.surface() function, usually setting the resolution a bit higher and/or having R write directly to an image file instead of to a knitr pdf.
DeleteFor citing, the osf doi ought to be most stable, https://doi.org/10.17605/OSF.IO/W7ZKC. I would appreciate it if you include my name, and perhaps the overview blog post, too.
My code depends on the gifti library, and he requests it be cited as Muschelli J (2020). _gifti: Reads in 'Neuroimaging' 'GIFTI' Files with Geometry Information_. R package version 0.8.0, .