remove_small_components: Remove connected objects with volume <27 voxels

Description Usage Arguments Value Examples

View source: R/remove_small_components.R

Description

Remove connected objects with volume <27 voxels

Usage

1
remove_small_components(img, threshold = 0.34, voxel_threshold = 27)

Arguments

img

A probability image from flexconn_predict_with_volume or flexconn_predict, should be object of class nifti or an array

threshold

threshold to apply to image to create a mask ( less than or equal)

voxel_threshold

Threshold of number of voxels to remove if smaller than this number (strict inequality)

Value

An array or object of class nifti

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
user = Sys.getenv("USER")
if (user %in% c("johnmuschelli", "travis") &
Sys.info()["sysname"] == "Darwin"){
reticulate::use_python(
"/Library/Frameworks/Python.framework/Versions/3.5/bin/python3")
} else {
python = system("which python", intern = TRUE)
print(python)
reticulate::use_python(python)
}
set.seed(100)
d = rep(50, 3)
img = array(runif(prod(d), max = 1), dim = d)
cc = remove_small_components(img, threshold = 0.9)

neuroconductor/flexconn documentation built on Sept. 25, 2020, 10:51 a.m.