BilatNeuroSurfaceVector-class: Bilateral NeuroSurface Vector Class

BilatNeuroSurfaceVector-classR Documentation

Bilateral NeuroSurface Vector Class

Description

Represents surface data for both left and right hemispheres.

Details

The BilatNeuroSurfaceVector class provides a convenient container for organizing and analyzing data from both hemispheres of the brain simultaneously. It holds two NeuroSurfaceVector objects, one for each hemisphere, allowing researchers to:

  • Analyze bilateral symmetric or asymmetric patterns in brain data

  • Compare corresponding regions across hemispheres

  • Represent whole-brain surface data with proper hemisphere separation

  • Apply operations to both hemispheres while maintaining their distinct identities

This class is particularly useful for studies examining interhemispheric differences, bilateral effects, or any analysis that requires maintaining separate representations of the two hemispheres while treating them as parts of a unified whole.

Slots

left

NeuroSurfaceVector instance for the left hemisphere

right

NeuroSurfaceVector instance for the right hemisphere

See Also

NeuroSurfaceVector

Examples


# Create two simple tetrahedron meshes (one for each hemisphere)
# Left hemisphere
lh_vertices <- c(
  0, 0, 0,
  -1, 0, 0,
  0, 1, 0,
  0, 0, 1
)
# Right hemisphere
rh_vertices <- c(
  0, 0, 0,
  1, 0, 0,
  0, 1, 0,
  0, 0, 1
)

triangles <- c(
  1, 2, 3,
  1, 2, 4,
  1, 3, 4,
  2, 3, 4
)

# Create mesh3d objects
lh_mesh <- rgl::mesh3d(vertices = lh_vertices, triangles = triangles)
rh_mesh <- rgl::mesh3d(vertices = rh_vertices, triangles = triangles)

# Create graph representations
edges <- rbind(
  c(1,2), c(1,3), c(1,4),
  c(2,3), c(2,4),
  c(3,4)
)
lh_graph <- igraph::graph_from_edgelist(edges)
rh_graph <- igraph::graph_from_edgelist(edges)

# Create SurfaceGeometry objects
lh_geometry <- new("SurfaceGeometry",
                  mesh = lh_mesh,
                  graph = lh_graph,
                  hemi = "left")
rh_geometry <- new("SurfaceGeometry",
                  mesh = rh_mesh,
                  graph = rh_graph,
                  hemi = "right")

# Define indices for all vertices
indices <- 1:4

# Create Matrix data for each hemisphere
# Each has 4 vertices and 2 measures
require(Matrix)
lh_data <- Matrix(
  c(0.5, 1.2, 0.8, 0.6,   # Measure 1 values
    0.7, 0.3, 1.5, 0.9),  # Measure 2 values
  nrow = 4, ncol = 2,
  byrow = FALSE
)

rh_data <- Matrix(
  c(0.4, 1.1, 0.7, 0.5,   # Measure 1 values (slightly different from left)
    0.8, 0.4, 1.6, 1.0),  # Measure 2 values (slightly different from left)
  nrow = 4, ncol = 2,
  byrow = FALSE
)

# Create NeuroSurfaceVector objects for each hemisphere
lh_nsv <- new("NeuroSurfaceVector",
             geometry = lh_geometry,
             indices = indices,
             data = lh_data)

rh_nsv <- new("NeuroSurfaceVector",
             geometry = rh_geometry,
             indices = indices,
             data = rh_data)

# Create the BilatNeuroSurfaceVector object
bilat_nsv <- new("BilatNeuroSurfaceVector",
                left = lh_nsv,
                right = rh_nsv)

# Now you can access each hemisphere separately:
# bilat_nsv@left@data  # Left hemisphere data
# bilat_nsv@right@data # Right hemisphere data



bbuchsbaum/neurosurf documentation built on June 10, 2025, 8:22 p.m.