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.

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.

Examples

lesydata = file.path(find.package('LESYMAP'),'extdata') filenames = Sys.glob(file.path(lesydata, 'lesions', '*.nii.gz')) patchinfo = getUniqueLesionPatches(filenames[1:10]) # slower
#> 384 unique patches, 459834 voxels - 1197.5 times more voxels
lesions = imageFileNames2ImageList(filenames[1:10]) patchinfo = getUniqueLesionPatches(lesions) # faster
#> 384 unique patches, 459834 voxels - 1197.5 times more voxels