bwconncomp: Label Connected Clusters of Certain Size

Description Usage Arguments Value Examples

View source: R/bwconncomp.R

Description

Get Cluster of certain size from spm_bwlabel

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
bwconncomp(
  infile,
  outfile = NULL,
  retimg = TRUE,
  conn = 26,
  reorient = FALSE,
  spmdir = spm_dir(),
  verbose = TRUE,
  install_dir = NULL
)

Arguments

infile

input filename

outfile

output filename

retimg

Return the image instead of matlab output

conn

Connections to be passed to MATLAB's bwconncomp

reorient

If retimg, then this argument is passed to readNIfTI

spmdir

(character) path for SPM12. If NULL, assumes SPM12 is in matlabpath.

verbose

Print Diagnostics

install_dir

directory to download SPM12

Value

Name of output file or nifti object, depending on retimg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(neurobase)
set.seed(1234)
dims = c(30, 30, 10)
arr = array(rnorm(prod(dims)), dim = dims)
nim = nifti(arr)
mask = datatyper(nim > 1)
## Not run: 
cc = bwconncomp(mask)
tab = table(c(cc))

## End(Not run)

spm12r documentation built on March 4, 2021, 9:11 a.m.