morphology | R Documentation |
Apply imaage morphological operations
morphology(
input,
operation,
radius,
type = "binary",
value = 1,
shape = "ball",
radiusIsParametric = FALSE,
thickness = 1,
lines = 3,
includeCenter = FALSE
)
input |
input image |
operation |
operation to apply
|
radius |
radius of structuring element |
type |
type of morphology
|
value |
value to operation on (type='binary' only) |
shape |
shape of the structuring element ( type='binary' only )
|
radiusIsParametric |
used parametric radius boolean (shape='ball' and shape='annulus' only) |
thickness |
thickness (shape='annulus' only) |
lines |
number of lines in polygon (shape='polygon' only) |
includeCenter |
include center of annulus boolean (shape='annulus' only) |
antsImage is output
Avants BB
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.