morphology.Rd
Apply imaage morphological operations
morphology(
input,
operation,
radius,
type = "binary",
value = 1,
shape = "ball",
radiusIsParametric = FALSE,
thickness = 1,
lines = 3,
includeCenter = FALSE
)
input image
operation to apply
"close" Morpholgical closing
"dilate" Morpholgical dilation
"erode" Morpholgical erosion
"open" Morpholgical opening
radius of structuring element
type of morphology
"binary" Binary operation on a single value
"grayscale" Grayscale operations
value to operation on (type='binary' only)
shape of the structuring element ( type='binary' only )
"ball" spherical structuring element
"box" box shaped structuring element
"cross" cross shaped structuring element
"annulus" annulus shaped structuring element
"polygon" polygon structuring element
used parametric radius boolean (shape='ball' and shape='annulus' only)
thickness (shape='annulus' only)
number of lines in polygon (shape='polygon' only)
include center of annulus boolean (shape='annulus' only)
antsImage is output
fi <- antsImageRead(getANTsRData("r16"), 2)
mask <- getMask(fi)
dilatedBall <- morphology(mask,
operation = "dilate", radius = 3,
type = "binary", shape = "ball"
)
erodedBox <- morphology(mask,
operation = "erode", radius = 3,
type = "binary", shape = "box"
)
openedAnnulus <- morphology(mask,
operation = "open", radius = 5,
type = "binary", shape = "annulus", thickness = 2
)
out <- morphology(mask, operation = "open", radius = 5, type = "binary", shape = "polygon")
out <- morphology(mask, operation = "open", radius = 5, type = "binary", shape = "cross")
out <- morphology(mask, operation = "close", radius = 5, type = "binary", shape = "polygon")
out <- morphology(mask, operation = "erode", radius = 5, type = "binary", shape = "polygon")
out <- morphology(mask, operation = "dilate", radius = 5, type = "binary", shape = "polygon")
testthat::expect_error(morphology(mask, operation = "open", radius = 5, shape = "hey"))