getUniqueLesionPatches: Compute unique lesion patches

View source: R/getUniqueLesionPatches.R

getUniqueLesionPatchesR Documentation

Compute unique lesion patches

Description

Compute uniqe patches of voxels with the same pattern of lesions in all subjects. Useful to understand the number of patterns that will be analyzed in a lesion dataset. A patch is a group of voxels, not necessarily close to each other, which have the same identical lesion pattern.

Usage

getUniqueLesionPatches(lesions.list, mask = NA,
  returnPatchMatrix = FALSE, thresholdPercent = 0.1,
  binaryCheck = FALSE, showInfo = TRUE)

Arguments

lesions.list

list of antsImages (faster) or filenames (slower)

mask

(default=NA) a mask image to restrict the search for patches. Will be automatically calculated if not provided. Normally the mask restricts the search only to voxels lesioned in >10% of subejcts. To set this proportion use thresholdPercent.

returnPatchMatrix

(default=FALSE) logical, should the matrix of patches be returned. This is used in lesymap to run the analyses.

thresholdPercent

(default=0.1) voxels with lesions in less than this proportion of subjects will not be considered. I.e., 0.1 = 10%.

binaryCheck

(default=FALSE) set this to TRUE to verify that maps are binary.

showInfo

(default=TRUE) logical indicating whether to display information.

Value

List of objects named as follows:

  • patchimg - antsImage with every voxel assigned a patch number

  • patchimg.samples - antsImage mask of one representative voxel for each patch. Can be used to extract the patchmatrix.

  • patchimg.size - antsImage with the patch size at every voxel

  • patchimg.mask - antsImage of the mask used to extract patches. Can be used to put back results when combined with patchindx.

  • patchindx - vector of patch membership for each voxel. Can be used to put back results in an image.

  • npatches - number of unique patches in the image

  • nvoxels - total number of lesioned voxels in patchimg.mask

  • patchvoxels - vector of voxel count for each patch

  • patchvolumes - vector of volume size for each patch

  • patchmatrix - matrix of patches. This is used in lesymap to save time when running repetitive analyses.

Author(s)

Dorian Pustina

Examples

lesydata = file.path(find.package('LESYMAP'),'extdata')

filenames = Sys.glob(file.path(lesydata, 'lesions', '*.nii.gz'))
patchinfo = getUniqueLesionPatches(filenames[1:10]) # slower

lesions = imageFileNames2ImageList(filenames[1:10])
patchinfo = getUniqueLesionPatches(lesions) # faster


dorianps/LESYMAP documentation built on June 1, 2024, 2:12 a.m.