jlfProp: Propagate Joint Label Fusion (JLF) solutions through a time...

View source: R/jlfPropagation.R

jlfPropR Documentation

Propagate Joint Label Fusion (JLF) solutions through a time series

Description

The JLF initialization is reused throughout a time series with an additional lag argument.

Usage

jlfProp(
  targetI,
  targetIMask,
  atlasList,
  rad = 2,
  labelList = NULL,
  rSearch = 3,
  lagValue = 3,
  verbose = FALSE,
  ...
)

Arguments

targetI

antsImage list to be approximated

targetIMask

mask with value 1

atlasList

list containing antsImages with intensity images

rad

neighborhood radius, default to 2

labelList

optional list containing antsImages with segmentation labels

rSearch

radius of search, default is 3

lagValue

number of prior images to use to fwd propagate JLF solution

verbose

boolean

...

arguments to pass to jointLabelFusion

Value

segmentation of time series

Author(s)

Brian B. Avants

Examples

## Not run: 
set.seed(123)
ref <- ri(1) %>%
  resampleImage(4) %>%
  iMath("Normalize")
mi1 <- ri(2)
mi2 <- ri(3)
mi3 <- ri(4)
mi4 <- ri(5)
mi5 <- ri(6)
refmask <- getMask(ref)
refmask <- iMath(refmask, "MD", 10) # just to speed things up
ilist <- list(mi1, mi2, mi3, mi4, mi5)
seglist <- list()
for (i in 1:length(ilist))
{
  ilist[[i]] <- iMath(ilist[[i]], "Normalize")
  mytx <- antsRegistration(
    fixed = ref, moving = ilist[[i]],
    typeofTransform = c("Affine"), verbose = TRUE
  )
  mywarpedimage <- antsApplyTransforms(
    fixed = ref,
    moving = ilist[[i]],
    transformlist = mytx$fwdtransforms
  )
  ilist[[i]] <- mywarpedimage
  seg <- thresholdImage(ilist[[i]], "Otsu", 3)
  seglist[[i]] <- seg + 1
}
tarlist <- list(
  iMath(ref, "GD", 3),
  iMath(ref, "GD", 2),
  iMath(ref, "GD", 1),
  iMath(ref, "GD", 0),
  iMath(ref, "GE", 1),
  iMath(ref, "GE", 2),
  iMath(ref, "GE", 3)
)
pp <- jlfProp(tarlist, refmask, ilist,
  rSearch = 2,
  labelList = seglist, rad = rep(2, length(dim(ref)))
)

## End(Not run)

stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.