ClusteredNeuroVol-class: ClusteredNeuroVol Class

ClusteredNeuroVol-classR Documentation

ClusteredNeuroVol Class

Description

This class represents a three-dimensional brain image divided into N disjoint partitions or clusters. It extends the SparseNeuroVol class to provide efficient storage and manipulation of clustered neuroimaging data.

Construct a ClusteredNeuroVol instance

Usage

ClusteredNeuroVol(mask, clusters, label_map = NULL, label = "")

Arguments

mask

an instance of class LogicalNeuroVol

clusters

a vector of clusters ids with length equal to number of nonzero voxels in mask mask

label_map

an optional list that maps from cluster id to a cluster label, e.g. (1 -> "FFA", 2 -> "PPA")

label

an optional character string used to label of the volume

Details

The ClusteredNeuroVol class is designed for efficient representation and manipulation of brain images with distinct, non-overlapping regions or clusters. It combines the memory efficiency of sparse representations with additional structures for managing cluster information.

The use case of ClusteredNeuroVol is to store volumetric data that has been clustered into discrete sets of voxels, each of which has an associated id. For example, this class can be used to represent parcellated neuroimaging volumes.

Value

ClusteredNeuroVol instance

Slots

mask

A LogicalNeuroVol object representing the logical mask indicating the spatial domain of the set of clusters.

clusters

An integer vector representing the cluster number for each voxel in the mask.

label_map

A named list where each element represents a cluster and its name.

cluster_map

An environment object that maps from cluster id to the set of 1D spatial indices belonging to that cluster.

Methods

This class inherits methods from the SparseNeuroVol class. Additional methods specific to cluster operations may be available.

Usage

ClusteredNeuroVol objects are particularly useful for:

  • Representing parcellated brain images

  • Storing results of clustering algorithms applied to neuroimaging data

  • Efficient manipulation and analysis of region-based neuroimaging data

See Also

SparseNeuroVol-class for the parent sparse volume class. LogicalNeuroVol-class for the mask representation.

Examples

## Not run: 
# Create a simple clustered brain volume
dim <- c(10L, 10L, 10L)
mask_data <- array(rep(c(TRUE, FALSE), 500), dim)
mask <- new("LogicalNeuroVol", .Data = mask_data,
            space = NeuroSpace(dim = dim, origin = c(0,0,0), spacing = c(1,1,1)))

clusters <- as.integer(runif(sum(mask_data)) * 5)
label_map <- list("Cluster1" = 1, "Cluster2" = 2, "Cluster3" = 3,
                  "Cluster4" = 4, "Cluster5" = 5)

cluster_map <- new.env()
for (i in 1:5) {
  cluster_map[[as.character(i)]] <- which(clusters == i)
}

clustered_vol <- new("ClusteredNeuroVol",
                     mask = mask,
                     clusters = clusters,
                     label_map = label_map,
                     cluster_map = cluster_map)

## End(Not run)


bspace <- NeuroSpace(c(16,16,16), spacing=c(1,1,1))
grid <- index_to_grid(bspace, 1:(16*16*16))
kres <- kmeans(grid, centers=10)
mask <- NeuroVol(rep(1, 16^3),bspace)
clusvol <- ClusteredNeuroVol(mask, kres$cluster)

bbuchsbaum/neuroim2 documentation built on Jan. 2, 2025, 3:38 p.m.