antsrSurf.Rd
Use a system call to antsSurf
in order to render a function onto
a surface. This requires antsSurf
to be in the environment as well
as ConvertScalarImageToRGB
, both available in Advanced Normalization
Tools software on github.
input antsImage defining the surface on which to render
input antsImage list defining the function to render
on the surface. these image(s) should be in the same space as x
.
input antsImage list mask for each y
function to render
on the surface. these image(s) should be in the same space as y
.
lower and upper quantile limits for overlay
character, one of: grey, red, green, blue, copper, jet, hsv, spring, summer, autumn, winter, hot, cool, overunder, custom
transparency vector for underlay and each overlay, default zero
number of inflation iterations to run
gaussian smooth the overlay by this sigma
3 Rotation angles expressed in degrees or a matrix of rotation parameters that will be applied in sequence.
absolute lower and upper limits for functional overlay.
this parameter will override quantlimits
. Currently, this will set
levels above overlayLimits[2]
to overlayLimits[2]
. Can be a
list of length of y.
a three entry vector where each entry is in the range of 0 to 255 and corresponds to red green and blue color channels. Alternatively, pass a string white or black.
prefix filename for output pngs
pass the ANTSPATH here otherwise we try to detect it from environment
prints the command used to call antsSurf
no output
if (FALSE) { # \dontrun{
myantspath <- Sys.getenv("ANTSPATH")
surf_ex <- file.path(myantspath, "antsSurf")
if (file.exists(surf_ex)) {
ch2i <- antsImageRead(getANTsRData("ch2"))
ch2seg <- thresholdImage(ch2i, "Otsu", 3)
wm <- thresholdImage(ch2seg, 3, 3)
wm2 <- smoothImage(wm, 1) %>% thresholdImage(0.5, Inf)
kimg <- weingartenImageCurvature(ch2i, 1.5) %>% smoothImage(1)
rp1 <- matrix(c(90, 180, 90), ncol = 3)
rp2 <- matrix(c(90, 180, 270), ncol = 3)
rp3 <- matrix(c(90, 180, 180), ncol = 3)
rp <- rbind(rp1, rp3, rp2)
antsrSurf(
x = wm2, y = list(kimg), z = list(wm2 %>% iMath("MD", 3)),
inflationFactor = 255, overlayLimits = c(-0.3, 0.3), verbose = TRUE,
rotationParams = rp, filename = tempfile()
)
fn <- getANTsRData("surf")
img <- antsImageRead(fn) # see antsSurf on github for data
wm <- thresholdImage(img, 3, 4)
wm <- thresholdImage(img, 3, 4) %>% iMath("FillHoles")
wm <- wm %>% thresholdImage(1, 2)
wms <- smoothImage(wm, 1.0)
wmk <- weingartenImageCurvature(wms, 1.5, 0)
# will display to screen
antsrSurf(
x = wm, y = list(wmk %>% smoothImage(1)), z = list(wm %>% iMath("MD", 1)),
rotationParams = c(270, 0, 90), overlayLimits = c(-0.4, 0.4)
)
# surface and two overlays
blob <- antsImageRead(getANTsRData("blob"))
blob[1:266, 1:266, 1:100] <- 0
z <- list(wm %>% iMath("MD", 1), blob %>% smoothImage(1))
antsrSurf(
x = wm, y = list(wmk %>% smoothImage(1), blob), z = z,
colormap = c("jet", "blue"), alpha = c(1, 0.5, 1),
rotationParams = c(270, 0, 90),
overlayLimits = list(c(-0.4, 0.4), c(0.9, 1.001))
)
# separate pos and neg curvature
y <- list(
thresholdImage(wmk, 0.00, Inf),
thresholdImage(wmk, -100, -0.00)
)
z <- list(
y[[1]] %>% iMath("MD", 1),
y[[2]] %>% iMath("MD", 1)
)
antsrSurf(
x = wm, y = y, z = z, smoothingSigma = 0.5, alpha = c(1, 1, 1),
colormap = c("red", "blue"),
inflationFactor = 155, overlayLimits = list(c(0.5, 1.0001), c(0.5, 1.0001)),
verbose = TRUE, rotationParams = rp[1, ]
)
}
} # }