Package: fsbrain 0.5.5

fsbrain: Managing and Visualizing Brain Surface Data

Provides high-level access to neuroimaging data from standard software packages like 'FreeSurfer' <http://freesurfer.net/> on the level of subjects and groups. Load morphometry data, surfaces and brain parcellations based on atlases. Mask data using labels, load data for specific atlas regions only, and visualize data and statistical results directly in 'R'.

Authors:Tim Schäfer [aut, cre]

fsbrain_0.5.5.tar.gz
fsbrain_0.5.5.zip(r-4.5)fsbrain_0.5.5.zip(r-4.4)fsbrain_0.5.5.zip(r-4.3)
fsbrain_0.5.5.tgz(r-4.4-any)fsbrain_0.5.5.tgz(r-4.3-any)
fsbrain_0.5.5.tar.gz(r-4.5-noble)fsbrain_0.5.5.tar.gz(r-4.4-noble)
fsbrain_0.5.5.tgz(r-4.4-emscripten)fsbrain_0.5.5.tgz(r-4.3-emscripten)
fsbrain.pdf |fsbrain.html
fsbrain/json (API)

# Install 'fsbrain' in R:
install.packages('fsbrain', repos = c('https://dfsp-spirit.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/dfsp-spirit/fsbrain/issues

On CRAN:

3dbraindtifreesurfermeshmrineuroimagingresearchsurfacevisualizationvoxel

6.58 score 65 stars 13 scripts 526 downloads 1 mentions 220 exports 68 dependencies

Last updated 8 hours agofrom:073a93ea03. Checks:OK: 5 NOTE: 2. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 22 2024
R-4.5-winNOTENov 22 2024
R-4.5-linuxNOTENov 22 2024
R-4.4-winOKNov 22 2024
R-4.4-macOKNov 22 2024
R-4.3-winOKNov 22 2024
R-4.3-macOKNov 22 2024

Exports:alphablendannot.outlineannot.outline.border.verticesapply.label.to.morphdataapply.labeldata.to.morphdataapply.transformarrange.brainview.imagesarrange.brainview.images.gridbrainviewsclip_funclip.datacm.cbrycm.divcm.heatcm.qualcm.seqcollayer.bgcollayer.bg.atlascollayer.bg.meancurvcollayer.bg.sulccollayer.from.annotcollayer.from.annotdatacollayer.from.mask.datacollayer.from.morphlike.datacollayers.mergecoloredmesh.from.annotcoloredmesh.from.labelcoloredmesh.from.maskcoloredmesh.from.morph.nativecoloredmesh.from.morph.standardcoloredmesh.from.morphdatacoloredmesh.from.preloaded.datacoloredmesh.plot.colorbar.separatecoloredmeshes.from.colorcolorlist.brain.clusterscolors.are.grayscalecolors.have.transparencycombine.colorbar.with.brainview.animationcombine.colorbar.with.brainview.imageconstant.pervertexdatacube3D.triscubes3D.trisdelete_all_optional_datademographics.to.fsgd.filedemographics.to.qdec.table.datdesaturatedownload_fsaveragedownload_fsaverage3download_optional_datadownload_optional_paper_dataexportexport.coloredmesh.plyface.edgesfind.freesurferhomefind.subjectsdir.offs.coloredmeshfs.homefs.surface.as.adjacencylistfs.surface.to.igraphfs.surface.to.tmesh3dfs.surface.vertex.neighborsfsaverage.pathfsbrain.set.default.figsizefupgen.test.volumegeod.patches.color.overlaygeod.vert.neighborhoodgeodesic.dists.to.vertexgeodesic.pathget_optional_data_filepathget.atlas.region.namesget.rglstyleget.view.angle.namesgetIngroup.agg.atlas.nativegroup.agg.atlas.standardgroup.annotgroup.concat.measures.nativegroup.concat.measures.standardgroup.labelgroup.label.from.annotgroup.morph.agg.nativegroup.morph.agg.standardgroup.morph.agg.standard.vertexgroup.morph.nativegroup.morph.standardgroup.morph.standard.sfgroup.multimorph.agg.nativegroup.multimorph.agg.standardgroup.surfacegroupmorph.split.hemilisthasInhemilisthemilist.derive.hemihemilist.from.prefixed.listhemilist.get.combined.datahemilist.unwraphemilist.wraphighlight.points.sphereshighlight.vertices.on.subjecthighlight.vertices.on.subject.sphereshighlight.vertices.spheresis.fs.coloredmeshis.fs.coloredvoxelsis.fsbrainis.hemilistlabel.borderlabel.colFnlabel.colFn.invlabel.from.annotdatalabel.to.annotlabeldata.from.masklimit_funlimit_fun_nalimit_fun_na_insidelist_optional_datamask.from.labeldata.for.hemimesh.vertex.neighborsmkco.clustermkco.divmkco.heatmkco.seqnumverts.lhnumverts.rhprincipal.curvaturesqc.for.groupqc.from.regionwise.dfqc.from.segstats.tablesqc.vis.failcount.by.regionqdec.table.skeletonras2vox_tkrread.colorcsvread.md.demographicsread.md.subjectsread.md.subjects.from.fsgdregions.to.ignorereport.on.demographicsrglactionsrglorglotrglvoxelsscale01shape.descriptor.namesshape.descriptorsshift.hemis.apartsjd.demosjldspread.values.over.annotspread.values.over.hemispread.values.over.subjectsubject.annotsubject.atlas.aggsubject.filepath.morph.nativesubject.filepath.morph.standardsubject.labelsubject.label.from.annotsubject.lobessubject.masksubject.morph.nativesubject.morph.standardsubject.num.vertssubject.surfacesubject.volumesurface.curvaturestmesh3d.to.fs.surfacevdata.split.by.hemivertex.coordsvertex.hemisvis.color.on.subjectvis.coloredmeshesvis.coloredmeshes.rotatingvis.colortable.legendvis.data.on.fsaveragevis.data.on.group.nativevis.data.on.group.standardvis.data.on.subjectvis.dti.trkvis.export.from.coloredmeshesvis.fs.surfacevis.group.annotvis.group.coloredmeshesvis.group.morph.nativevis.group.morph.standardvis.labeldata.on.subjectvis.mask.on.subjectvis.path.along.vertsvis.pathsvis.paths.along.vertsvis.region.values.on.subjectvis.seg.legendvis.subject.annotvis.subject.labelvis.subject.morph.nativevis.subject.morph.standardvis.subject.previs.symmetric.data.on.subjectvislayout.from.coloredmeshesvol.boundary.boxvol.boundary.box.applyvol.hullvol.imagestackvol.intensity.to.colorvol.mask.from.segmentationvol.mergevol.overlay.colors.from.activationvol.overlay.colors.from.colortablevol.planesvol.slicevol.vox.from.crsvolvis.contourvolvis.lbvolvis.lightboxvolvis.voxelsvox2ras_tkrwrite.group.morph.standardwrite.group.morph.standard.mfwrite.group.morph.standard.sfwrite.region.aggregatedwrite.region.valueswrite.region.values.fsaverage

Dependencies:base64encbslibcachemclicolorspacecurldata.tabledigestdotCall64downloaderevaluatefansifarverfastmapfieldsfontawesomefreesurferformatsfsggplot2gluegridExtragtablehighrhtmltoolshtmlwidgetsisobandjquerylibjsonliteknitrlabelinglatticelifecyclemagickmagrittrmapsMASSMatrixmemoisemgcvmimemunsellnlmepillarpkgconfigpkgfilecacheplyrR6rappdirsRColorBrewerRcppreshaperglrlangrmarkdownsassscalesspamsquashtibbletinytexutf8vctrsviridisviridisLitewithrxfunxml2yaml

Brain volume visualization with fsbrain

Rendered fromfsbrain_vol.Rmdusingknitr::rmarkdownon Nov 22 2024.

Last update: 2021-09-10
Started: 2020-04-07

fsbrain: Managing and Visualizing Structural Neuroimaging Data in GNU R

Rendered fromfsbrain.Rmdusingknitr::rmarkdownon Nov 22 2024.

Last update: 2021-09-16
Started: 2019-10-25

The fsbrain FAQ

Rendered fromfsbrain_faq.Rmdusingknitr::rmarkdownon Nov 22 2024.

Last update: 2023-06-26
Started: 2020-05-01

Readme and manuals

Help Manual

Help pageTopics
Perform alpha blending for pairs of RGBA colors.alphablend
Compute outline vertex colors from annotation.annot.outline
Compute the border vertices for each region in an annot.annot.outline.border.vertices
Load a label from file and apply it to morphometry data.apply.label.to.morphdata
Apply a label to morphometry data.apply.labeldata.to.morphdata
Apply matmult transformation to input.apply.transform
Combine several brainview images into a new figure.arrange.brainview.images
Combine several brainview images as a grid into a new figure.arrange.brainview.images.grid
Show one or more views of the given meshes in rgl windows.brainviews
Get data clipping function.clip_fun
Clip data at quantiles to remove outliers.clip.data
Get cyan blue red yellow colormap function.cm.cbry
Return the standard fsbrain diverging colormap.cm.div
Return the standard fsbrain heat colormap.cm.heat
Return the standard fsbrain qualitative colormap.cm.qual
Return the standard fsbrain sequential colormap.cm.seq
Compute binarized mean curvature surface color layer.collayer.bg
Compute atlas or annotation surface color layer.collayer.bg.atlas
Compute binarized mean curvature surface color layer.collayer.bg.meancurv
Compute binarized sulcal depth surface color layer.collayer.bg.sulc
Compute surface color layer from annotation or atlas data.collayer.from.annot
Compute surface color layer from annotation or atlas data.collayer.from.annotdata
Compute surface color layer from morph-like data.collayer.from.mask.data
Compute surface color layer from morph-like data.collayer.from.morphlike.data
Merge two or more color layers based on their transparency values.collayers.merge
Create a coloredmesh from an annotation of an atlas.coloredmesh.from.annot
Create a coloredmesh from a label.coloredmesh.from.label
Create a coloredmesh from a mask.coloredmesh.from.mask
Create a coloredmesh from native space morphometry data.coloredmesh.from.morph.native
Create a coloredmesh from standard space morphometry data.coloredmesh.from.morph.standard
Create a coloredmesh from arbitrary data.coloredmesh.from.morphdata
Generate coloredmesh from loaded data.coloredmesh.from.preloaded.data
Draw colorbar for coloredmeshes in separate 2D plot.coloredmesh.plot.colorbar.separate
Create coloredmeshes for both hemis using pre-defined colors.coloredmeshes.from.color
Return diverging color listcolorlist.brain.clusters
Check for the given color strings whether they represent gray scale colors.colors.are.grayscale
Check for the given color strings whether they have transparency, i.e., an alpha channel value != fully opaque.colors.have.transparency
Combine a colorbar and a brain animation in gif format into a new animation.combine.colorbar.with.brainview.animation
Combine a colorbar and a brainview image into a new figure.combine.colorbar.with.brainview.image
Get vertex data for a single fs.surface or a hemilist of surfaces.constant.pervertexdata
Return triangles for a 3D cube or cuboid.cube3D.tris
Vectorized version of cube3D.triscubes3D.tris
Delete all data in the package cache.delete_all_optional_data
Write FreeSurfer Group Descriptor (FSGD) file from demographics dataframe.demographics.to.fsgd.file
Convert a dataframe containing demographics data to a qdec.table.dat file and related files.demographics.to.qdec.table.dat
Perform simple desaturation or grayscale conversion of RGBA colors.desaturate
Download the FreeSurfer v6 fsaverage subject.download_fsaverage
Download the FreeSurfer v6 low-resolution fsaverage3 subject.download_fsaverage3
Download optional data for this package if required.download_optional_data
Download extra data to reproduce the figures from the fsbrain paper.download_optional_paper_data
Export high-quality brainview image with a colorbar.export
Export a coloredmeshes with vertexcolors in PLY format.export.coloredmesh.ply
Enumerate all edges of the given faces or mesh.face.edges
Find the FREESURFER_HOME directory on disk.find.freesurferhome
Find the subject directory containing the fsaverage subject (or others) on disk.find.subjectsdir.of
fs.coloredmesh constructorfs.coloredmesh
Return FreeSurfer path.fs.home
Turn surface mesh into a igraph and return its adjacency list representation.fs.surface.as.adjacencylist
Create igraph undirected graph from a brain surface mesh.fs.surface.to.igraph
Get an rgl tmesh3d instance from a brain surface mesh.fs.surface.to.tmesh3d
Compute vertex neighborhoods or the full adjacency list for a mesh using the Rvcg or igraph library.fs.surface.vertex.neighbors
Return path to fsaverage dir.fsaverage.path
Set default figure size for fsbrain visualization functions.fsbrain.set.default.figsize
Transform first character of a string to uppercase.fup
Generate test 3D volume of integers. The volume has an outer background area (intensity value 'bg') and an inner foreground areas (intensity value 200L).gen.test.volume
Generate color overlay from geodesic patches around several vertices.geod.patches.color.overlay
Compute all vertices within given geodesic distance on the mesh.geod.vert.neighborhood
Compute geodesic circles and ball stats for given vertices.geodesic.circles
Simple internal wrapper around 'Rvcg::vcgDijkstra' with function check.geodesic.dists.to.vertex
Compute geodesic path from a source vertex to one or more target vertices.geodesic.path
Access a single file from the package cache by its file name.get_optional_data_filepath
Determine atlas region names from a subject.get.atlas.region.names
Get the default visualization style parameters as a named list.get.rglstyle
Get list of valid view angle names.get.view.angle.names
Retrieve values from nested named listsgetIn
Aggregate native space morphometry data over brain atlas regions and subjects for a group of subjects.group.agg.atlas.native
Aggregate standard space morphometry data over brain atlas regions and subjects for a group of subjects.group.agg.atlas.standard
Load annotations for a group of subjects.group.annot
Concatenate native space data for a group of subjects.group.concat.measures.native
Concatenate standard space data for a group of subjects.group.concat.measures.standard
Retrieve label data for a group of subjects.group.label
Extract a region from an atlas annotation as a label for a group of subjects.group.label.from.annot
Aggregate native space morphometry data over one hemisphere for a group of subjects.group.morph.agg.native
Aggregate standard space (fsaverage) morphometry data over one hemisphere for a group of subjects.group.morph.agg.standard
Aggregate standard space morphometry data over subjects.group.morph.agg.standard.vertex
Retrieve native space morphometry data for a group of subjects.group.morph.native
Retrieve standard space morphometry data for a group of subjects.group.morph.standard
Read combined data for a group from a single file.group.morph.standard.sf
Aggregate native space morphometry data for multiple measures over hemispheres for a group of subjects.group.multimorph.agg.native
Aggregate standard space (fsaverage) morphometry data for multiple measures over hemispheres for a group of subjects.group.multimorph.agg.standard
Retrieve surface mesh data for a group of subjects.group.surface
Split a per-vertex group data matrix for both hemispheres into a hemilist at given index.groupmorph.split.hemilist
Check for values in nested named listshasIn
Create a hemilist from lh and rh data.hemilist
Derive 'hemi' string from the data in a hemilisthemilist.derive.hemi
Create a hemilist from a named list with keys prefixed with 'lh_' and 'rh_'.hemilist.from.prefixed.list
Get combined data of hemi listhemilist.get.combined.data
Unwrap hemi data from a named hemi list.hemilist.unwrap
Wrap data into a named hemi list.hemilist.wrap
Draw small 3D spheres at given points.highlight.points.spheres
Highlight vertices given by index on a subject's meshes by coloring faces.highlight.vertices.on.subject
Highlight vertices given by index on a subject's meshes by coloring faces.highlight.vertices.on.subject.spheres
Draw small 3D spheres at given brain mesh vertices. Supports full brain (2 meshes) as well.highlight.vertices.spheres
Compute max width and height of magick images.images.dimmax
Check whether object is an fs.coloredmesh (S3)is.fs.coloredmesh
Check whether object is an fs.coloredvoxels instance (S3)is.fs.coloredvoxels
Check whether object is an fsbrain (S3)is.fsbrain
Check whether x is a hemilistis.hemilist
Compute border of a label.label.border
A simple colormap function for binary colors.label.colFn
A simple colormap function for binary colors.label.colFn.inv
Extract a region from an annotation as a label.label.from.annotdata
Merge several labels into an annotationlabel.to.annot
Create labeldata from a mask.labeldata.from.mask
Get data limiting function.limit_fun
Get data limiting function to NA.limit_fun_na
Get data limiting function, setting values inside range to NA.limit_fun_na_inside
Get file names available in package cache.list_optional_data
Create a binary mask from labels.mask.from.labeldata.for.hemi
Compute neighborhood of a vertexmesh.vertex.neighbors
Return recommended 'makecmap_options' for diverging cluster data.mkco.cluster
Return recommended 'makecmap_options' for diverging data.mkco.div
Return recommended 'makecmap_options' for sequential data with heatmap style.mkco.heat
Return recommended 'makecmap_options' for sequential data.mkco.seq
Determine vertex count of left hemi from hemilist of surfaces or the count itself.numverts.lh
Determine vertex count of right hemi from hemilist of surfaces or the count itself.numverts.rh
Computes principal curvatures according to 2 definitions from raw k1 and k2 values.principal.curvatures
Print description of a brain coloredmesh (S3).print.fs.coloredmesh
Print description of fs.coloredvoxels (S3).print.fs.coloredvoxels
Print description of an fsbrain (S3).print.fsbrain
Perform data quality check based on computed region stats.qc.for.group
Perform data quality check based on a dataframe containing aggregated region-wise data.qc.from.regionwise.df
Perform data quality check based on a segstats table.qc.from.segstats.tables
Visualize the number of outlier subjects per region in your dataset.qc.vis.failcount.by.region
Generate skeleton dataframe for FreeSurfer QDEC long file from subjects list.qdec.table.skeleton
The FreeSurfer default ras2vox_tkr matrix.ras2vox_tkr
Read colors from CSV file.read.colorcsv
Read demographics fileread.md.demographics
Read subjects fileread.md.subjects
Read subjects list from an FSGD file.read.md.subjects.from.fsgd
Give suggestions for regions to ignore for an atlas.regions.to.ignore
Print a demographics reportreport.on.demographics
Create rglactions list, suitable to be passed as parameter to vis functions.rglactions
Get rgloptions and consider global options.rglo
Get rgloptions for testing.rglot
Draw 3D boxes at locations using rgl.rglvoxels
Scale given values to range 0..1.scale01
Get all shape descriptor names.shape.descriptor.names
Computes geometric curvature-based descriptors.shape.descriptors
Shift hemispheres apart.shift.hemis.apart
Download optional demo data if needed and return its path.sjd.demo
Get subjects list from subjects.txt file in dir.sjld
Spread a single value for a region to all region vertices.spread.values.over.annot
Spread the values in the region_value_list and return them for one hemisphere.spread.values.over.hemi
Spread the values in the region_value_list and return them for one hemisphere.spread.values.over.subject
Load an annotation for a subject.subject.annot
Compute annot border vertices.subject.annot.border
Aggregate morphometry data over brain atlas regions for a subject.subject.atlas.agg
Construct filepath of native space morphometry data file.subject.filepath.morph.native
Construct filepath of standard space morphometry data file.subject.filepath.morph.standard
Retrieve label data for a single subject.subject.label
Extract a region from an atlas annotation as a label for a subject.subject.label.from.annot
Load labels representing brain lobes.subject.lobes
Compute a mask for a subject.subject.mask
Retrieve native space morphometry data for a single subject.subject.morph.native
Retrieve standard space morphometry data for a single subject.subject.morph.standard
Get subjects vertex count.subject.num.verts
Load a surface for a subject.subject.surface
Read a brain volume.subject.volume
Compute the k1 and k2 principal curvatures of a mesh.surface.curvatures
Get an fs.surface brain mesh from an rgl tmesh3d instance.tmesh3d.to.fs.surface
Split morph data vector at hemisphere boundary.vdata.split.by.hemi
Return coordinates for vertices, supporting entire brain via hemilist.vertex.coords
Return the proper hemi string ('lh' or 'rh') for each vertex.vertex.hemis
Visualize pre-defined vertex colors on a subject.vis.color.on.subject
Visualize a list of colored meshes in a single scene.vis.coloredmeshes
Visualize a list of colored meshes in a single scene and rotate them, movie-style.vis.coloredmeshes.rotating
Create a separate legend plot for a colortable or an annotation.vis.colortable.legend
Visualize arbitrary data on the fsaverage template subject, if available.vis.data.on.fsaverage
Visualize native space data on a group of subjects.vis.data.on.group.native
Visualize standard space data for a group on template.vis.data.on.group.standard
Visualize arbitrary data on the surface of any subject.vis.data.on.subject
Visualize DTI tracks from Diffusion Toolkit/TrackVis TRK format file.vis.dti.trk
Export high-quality brainview image with a colorbar.vis.export.from.coloredmeshes
Visualize fs.surface meshvis.fs.surface
Plot atlas annotations for a group of subjects.vis.group.annot
Plot coloredmeshes for a group of subjects.vis.group.coloredmeshes
Plot native space morphometry data for a group of subjects.vis.group.morph.native
Plot standard space morphometry data for a group of subjects.vis.group.morph.standard
Visualize a label on the surface of a subject.vis.labeldata.on.subject
Visualize a vertex mask on the surface of a subject.vis.mask.on.subject
Draw a 3D line from vertex to vertexvis.path.along.verts
Visualize many paths.vis.paths
Visualize several paths in different colors.vis.paths.along.verts
Visualize arbitrary data, one value per atlas region, on the surface of any subject (including template subjects).vis.region.values.on.subject
Plot legend for a brain volume segmentation based on colorLUT.vis.seg.legend
Visualize an annotation for a subject.vis.subject.annot
Visualize a binary label for a subject.vis.subject.label
Visualize native space morphometry data for a subject.vis.subject.morph.native
Visualize native space morphometry data for a subject or a group.vis.subject.morph.standard
Visualize pre-loaded data.vis.subject.pre
Visualize clusters or activation data on the surface of any subject.vis.symmetric.data.on.subject
Visualize coloredmeshes from several angles and combine the images into a new figure.vislayout.from.coloredmeshes
Compute 3D bounding box of a volume.vol.boundary.box
Apply a boundary box to a volume, returning the inner volume partvol.boundary.box.apply
Retain only the outer hull voxels of the foreground.vol.hull
Turn volume into an ImageMagick image stack.vol.imagestack
Convert integer intensity image to RGB color string form.vol.intensity.to.color
Extract subset from a volume by value.vol.mask.from.segmentation
Merge background volume and overlay to new colors.vol.merge
Generate colors for a 3D volume, based on the activation data and a colormap.vol.overlay.colors.from.activation
Compute voxel colors based on colortable.vol.overlay.colors.from.colortable
Translate names and indices of planes.vol.planes
Extract a slice of a 3D image stack.vol.slice
Compute R voxel index for FreeSurfer CRS voxel index.vol.vox.from.crs
Visualize contour of a volume.volvis.contour
Show continuous 3D voxel/volume data as a lightbox, optionally with a background brain volume and colormap.volvis.lb
Draw a lightbox view from volume slices.volvis.lightbox
Voxel-based visualization of volume mask at surface RAS positions.volvis.voxels
The FreeSurfer default vox2ras_tkr matrix.vox2ras_tkr
Write standard space group data to a standard FreeSurfer directory stucture.write.group.morph.standard
Write per-vertex standard space data for a group of subjects to given file names.write.group.morph.standard.mf
Reshape and write combined per-vertex data for a group to a single MGH file.write.group.morph.standard.sf
Write data aggregated over regions to morphometry file for group.write.region.aggregated
Write one value per atlas region for a subject.write.region.values
Write one value per atlas region for a template subject.write.region.values.fsaverage