Learn R Programming

ANTsR (version 0.3.3)

morphology: Morphological image operations

Description

Apply imaage morphological operations

Usage

morphology(input, operation, radius, type = "binary", value = 1, shape = "ball", radiusIsParametric = FALSE, thickness = 1, lines = 3, includeCenter = FALSE)

Arguments

input
input image
operation
operation to apply
  • "close" Morpholgical closing
  • "dilate" Morpholgical dilation
  • "erode" Morpholgical erosion
  • "open" Morpholgical opening
radius
radius of structuring element
type
type of morphology
  • "binary" Binary operation on a single value
  • "grayscale" Grayscale operations
value
value to operation on (type='binary' only)
shape
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
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)

Value

antsImage is output

Examples

Run this code

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)

Run the code above in your browser using DataLab