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
Morpholgical closing
Morpholgical dilation
Morpholgical erosion
Morpholgical opening
radius of structuring element
type of morphology
Binary operation on a single value
Grayscale operations
value to operation on (type='binary' only)
shape of the structuring element ( type='binary' only )
spherical structuring element
box shaped structuring element
cross shaped structuring element
annulus shaped structuring element
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"))