Learn R Programming

ANTsR (version 0.3.3)

antsrSurf: Render a function onto a surface.

Description

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.

Usage

antsrSurf(x, y, quantlimits = c(0.1, 0.9), colormap = "jet", inflationFactor = 25, rotationParams = c(270, 0, 270), overlayLimits = NA, filename = NA, antspath = NA, verbose = FALSE)

Arguments

x
input antsImage defining the surface on which to render
y
input antsImage list defining the function to render on the surface. these image(s) should be in the same space as surf.
quantlimits
lower and upper quantile limits for overlay
colormap
character, one of: grey, red, green, blue, copper, jet, hsv, spring, summer, autumn, winter, hot, cool, overunder, custom
inflationFactor
number of inflation iterations to run
rotationParams
3 Rotation angles expressed in degrees or a matrix of rotation parameters that will be applied in sequence.
overlayLimits
absolute lower and upper limits for functional overlay. this parameter will override quantlimits. Currently, this will set levels above overlayLimits[2] to overlayLimits[2].
filename
prefix filename for output pngs
antspath
pass the ANTSPATH here otherwise we try to detect it from environment
verbose
prints the command used to call antsSurf

Value

no output

Examples

Run this code

## Not run: 
# ch2i = antsImageRead( getANTsRData("mni") )
# ch2seg = thresholdImage( ch2i, "Otsu", 3 )
# wm   = thresholdImage( ch2seg, 3, 3 )
# wm2 = smoothImage( wm, 1 ) %>% thresholdImage( 0.2, 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( wm2, list( kimg ), inflationFactor=55, quantlimits=c(0.01,0.99),rotationParams = rp )
# 
# # show how to use absolute scales to allow comparison across renderings
# kimg = thresholdImage( ch2seg , 1, Inf )
# nvox = sum( ch2seg > 0 )
# voxvalsmat = cbind(
#     rnorm( nvox, 2.5, 2 ),
#     rnorm( nvox, 3.0, 2 ),
#     rnorm( nvox, 3.5, 2 ) )
# qq = quantile( voxvalsmat, 0.9 )
# for ( mmm in 1:3 )
# {
# kimg[ ch2seg > 0 ] = as.numeric(voxvalsmat[,mmm])
# kimg = smoothImage( kimg, 3 )
# antsrSurf( wm2, list( kimg ), inflationFactor=55, overlayLimits=c( 2.0, qq ),
#     rotationParams = rp, filename=paste('~/Downloads/ztempX',mmm,sep=''),
#     verbose=TRUE )
# }
# 
# fn = 'ADNI_137_S_0158_MR_MPR__GradWarp__N3__Scaled_Br_20070306171702344_S20209_I42985BrainSegmentation.nii.gz'
# img = antsImageRead( fn ) # see antsSurf on github for data
# wm   = thresholdImage( img, 3, 4 )
# # just the surface
# antsrSurf( x=wm, rotationParams = c(270, 0, 90) )
# # surface and one overlay
# wm = thresholdImage(img, 3, 4) %>% iMath("FillHoles")
# wms = smoothImage( wm, 1.0 )
# wmk = weingartenImageCurvature( wms, 1.5, 0 )
# antsrSurf( x=wm, y = list( wmk ), rotationParams = c(270, 0, 90), quantlimits=c(-0.5,0.5) )
# # surface and two overlays
# blob = antsImageRead( "manualBlob.nii.gz" ) %>% smoothImage( 1 )
# antsrSurf( x=wm, y = list( wmk, blob ), colormap=c("red","blue"),
#   rotationParams = c(270, 0, 90),  quantlimits=c(0.1,0.9))
# 
# ## End(Not run)

Run the code above in your browser using DataLab