binary.segmentation {SAFARI} | R Documentation |
Segmentation Procedure for Binary Images
Description
Identify and segment the regions of interest (ROI) in a reconstructed binary image, while having the option to extract quantitative shape-based features.
Usage
binary.segmentation(
x,
id,
filter = NA,
k = 3,
categories = c("none", "geometric", "boundary", "topological")
)
Arguments
x |
a binary matrix that represents the reconstructed image. |
id |
a named character vector that contains the ID's pertaining to the sample. |
filter |
an integer vector that indicates the filtering procedure. |
k |
an integer that specifies the factor to enlarge the regions. |
categories |
a character string or vector, see |
Details
The argument id
specifies the ID's corresponding to the sample.
A usual example that is used if the argument is an unnamed vector is composed
of the following entries:
-
cohort
: name of cohort the sample belongs to; -
patient.id
: unique identifier for patient the sample belongs to; -
slide.id
: unique identifier for sample.
The argument filter
specifies how the ROI should be filtered. There
are two ways to filter them, either by only specifying a minimum net area or
by additionally specifying the n
largest regions to keep in a two element
vector. The default value is NA
which sets the minimum net area as
one-fourth the largest region.
The argument categories
specifies the shape features to compute. The
default is "none" which computes no features.
Value
A list
object whose components are the following:
-
desc
: adata.frame
of the shape features corresponding to each segmented ROI; -
holes
: an integer matrix that contains the holes within each ROI, labeled according to theregions
; -
id
: a character vector that is identical to theid
argument passed; -
k
: argumentk
passed to function; -
n
: an integer that indicates the number of segmented regions; -
plg.chains
: alist
where each component is the polygonal chain of a segmented ROI; -
regions
: an integer matrix that contains the segmented ROI, labeled from largest to smallest.
Reconstructed Binary Image
To produce a reconstructed binary image, a greyscale scan or an image easily converted to binary, resulting from different modalities, is converted to a matrix representation, usually by standard image processing algorithms.
The resulting matrix is composed of two integer values that help represent the
regions of interest in the scan. Usually, as in the case of pathology
imaging, these are empty regions and tumor tissues, where we refer to the
integer values as categories. We note that the regions of interest must be
represented by 1
's and what we consider the empty regions by 0
's.
Examples
# load libraries
library(SAFARI)
# load sample
data("rBPS")
# segmentation procedure
rBPS <- binary.segmentation(
rBPS,
id = c("NLST", "AA00474", "11030"),
filter = 150,
categories = c("geometric", "boundary", "topological")
)