Learn R Programming

ANTsR (version 0.3.3)

plotBasicNetwork: Simple plotBasicNetwork function.

Description

takes an object output from renderSurfaceFunction and a list of centroids and plots the centroid network over the rendering object

Usage

plotBasicNetwork(centroids, brain, weights = NA, edgecolors = 0, nodecolors = "blue", nodetype = "s", scaling = c(0, 0), lwd = 2, radius = NA, showOnlyConnectedNodes = TRUE)

Arguments

centroids
input matrix of size number of 3D points ( in rows ) by 3 ( in columns )
brain
input rendering object which is output of renderSurfaceFunction or a function derived from renderSurfaceFunction
weights
edge weights
edgecolors
a color(map) for edges
nodecolors
a color(map) for nodes
nodetype
sphere or other node type
scaling
controls functional range
lwd
line width
radius
for nodes
showOnlyConnectedNodes
boolean

Value

None

Examples

Run this code

## Not run: 
# # more complete example
#   mnit<-getANTsRData("mni")
#   mnit<-antsImageRead(mnit)
#   mnia<-getANTsRData("mnia")
#   mnia<-antsImageRead(mnia)
#   mnit<-thresholdImage( mnit, 1, max(mnit) )
#   mnit<-iMath(mnit,"FillHoles")
#   cnt<-getCentroids( mnia, clustparam = 0 )
#   aalcnt<-cnt[1:90,1:3]
#   brain<-renderSurfaceFunction( surfimg =list( mnit ) , alphasurf=0.1 ,smoothsval = 1.5 )
#   testweights<-matrix( rep( 0, 90*90 ) ,nrow=90)
#   testweights[31,37]<-1  # ant cingulate to hipp
#   testweights[31,36]<-2  # ant cingulate to post cingulate
#   testweights[11,65]<-3  # broca to angular
#   plotBasicNetwork( centroids = aalcnt , brain , weights=testweights )
#   id<-rgl::par3d('userMatrix')
#   rid<-rotate3d( id , -pi/2, 1, 0, 0 )
#   rid2<-rotate3d( id , pi/2, 0, 0, 1 )
#   rid3<-rotate3d( id , -pi/2, 0, 0, 1 )
#   rgl::par3d(userMatrix = id )
#   dd<-make3ViewPNG(  rid, id, rid2,  paste('network1',sep='') )
#   rgl::par3d(userMatrix = id )
# # another example
# mni<-getANTsRData("mni")
# mni<-antsImageRead(mni)
# mnit<-thresholdImage( mni, 1, max(mni) )
# mnit<-iMath(mnit,"FillHoles")
# mniseg = kmeansSegmentation( mni, 3 )$segmentation
# wmbkgd = thresholdImage( mniseg, 3, 3 ) %>% iMath( "GetLargestComponent" ) %>% iMath( "FillHoles" )
# wmbkgd = smoothImage( iMath( wmbkgd, "MD", 1 ), 2.0 )
# brain<-renderSurfaceFunction( surfimg =list( wmbkgd ) , alphasurf=0.8 ,smoothsval = 1.0 )
# data( powers_areal_mni_itk )
# coords = powers_areal_mni_itk[,1:3]
# id<-rgl::par3d('userMatrix')
# rid<-rotate3d( id , -pi/2, 1, 0, 0 )
# rid2<-rotate3d( id , pi/2, 0, 0, 1 )
# rid3<-rotate3d( id , -pi/2, 0, 0, 1 )
# rgl::par3d(userMatrix = id )
# handMat2 = t( matrix(  c(-0.9998656511 , 0.01626961,  0.00198165 ,   0 ,-0.0163816363, -0.99584705 ,-0.08955579   , 0, 0.0005163439, -0.08957647,  0.99597979 ,   0,  0.0000000000,  0.00000000,  0.00000000  ,  1),  ncol = 4) )
# loccolor = as.character( powers_areal_mni_itk$Color )
# loccolor[ loccolor == "Peach" ] = "sienna1"
# loccolor[ loccolor == "Cyan" ] = "cyan"
# loccolor[ loccolor == "Orange" ] = "orange"
# loccolor[ loccolor == "Purple" ] = "darkorchid1"
# loccolor[ loccolor == "Pink" ] = "deeppink"
# loccolor[ loccolor == "Red" ] = "red"
# loccolor[ loccolor == "Gray" ] = "gray74"
# loccolor[ loccolor == "Teal" ] = "turquoise4"
# loccolor[ loccolor == "Blue" ] = "blue"
# loccolor[ loccolor == "Yellow" ] = "yellow"
# loccolor[ loccolor == "Black" ] = "black"
# loccolor[ loccolor == "Brown" ] = "brown"
# loccolor[ loccolor == "Pale blue" ] = "steelblue1"
# loccolor[ loccolor == "Green" ] = "green"
# tt = plotBasicNetwork( centroids = coords, brain, nodecolors = loccolor, radius=3 )
# dd<-make3ViewPNG(  handMat2, id, rid2, tempfile( fileext='.png' ) )
# rgl::par3d(userMatrix = id )
# ## End(Not run)

Run the code above in your browser using DataLab