neighbors_in_regions: Create the neighbor indices on a group of subregions.

Description Usage Arguments Value Author(s) Examples

View source: R/SpatCorrImage.R

Description

Create the neighbor indices on a group of subregions.

Usage

1
neighbors_in_regions(region_idx, nb_idx, nb_dist)

Arguments

region_idx

a list of voxels indices for multiple regions. The length is the number of regions.

nb_idx

matrix with the neighbor indices of each voxel in each row

nb_dist

matrix with the distances between neighbors and the voxel in each row

Value

a list object contains of multiple list objects for neighbor indices and distances for different regions. For each region, the list object contions two matrices: idx and dist. idx contains the neighbor indices of each voxel in each row. dist contains the distances between neighbors and the voxel in each row.

Author(s)

Jian Kang <jiankang@umich.edu>

Examples

1
2
3
4
5
6
7
dim_img = c(10,10,10)
grids <- lapply(1:3,function(i) seq(-round(dim_img[i]/2)+1,round(dim_img[i]/2),length=dim_img[i]))
nb <- find_image_neighbors(grids)
region_mask_3 <- create_sphere_mask(grids,radius=3)
region_mask_2 <- create_sphere_mask(grids,radius=2)
region_idx <- list(which(region_mask_3&(!region_mask_2)),which(region_mask_2))
nb_regions <- neighbors_in_regions(region_idx,nb$idx,nb$dist)

kangjian2016/SpatCorrImage documentation built on Oct. 22, 2021, 1:21 a.m.