Description Usage Arguments Details Value Author(s) Examples
View source: R/plotBasicNetwork.R
takes an object output from renderSurfaceFunction and a list of centroids and plots the centroid network over the rendering object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
centroids |
input matrix of size N 3D points ( in rows ) by 3 ( in columns ), for N nodes. |
brain |
input rendering object which is output of renderSurfaceFunction. or a function derived from renderSurfaceFunction. |
weights |
edge weights, a symmetric matrix of size N. Weights should be non-negative. |
edgecolors |
a color(map) for edges. If a color map function, weights will be transformed
to the range [0,1], which is compatible with functions returned by |
backgroundColor |
background color. |
nodecolors |
a color or color vector for nodes. |
nodetype |
sphere or other node type supported by RGL. |
edgeContrast |
a vector of length 2, specifying the contrast range for edge colors.
Weights are normalized to the range [0,1].
The normalized weights can be rescaled with this parameter, eg |
quantileTransformWeights |
quantile transform the weights. |
lwd |
line width for drawing edges. |
minRadius |
minimum node radius. Ignored if the radius is specified explicitly with |
maxRadius |
maximum node radius. The node radius between |
radius |
a constant radius or vector of length nrow(centroids). If not specified, node radius is determined by the sum of edge weights connected to the node. |
showOnlyConnectedNodes |
boolean, if |
If edgecolors
is not specified, a heat-like color palette is used. Weights
can be quantile transformed or clipped at a given quantile in order to improve
contrast.
If weights are not specified, only the nodes are plotted.
None
Avants BB, Duda JT, Cook PA
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ## 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")
mnit = thresholdImage(mnit, 1, 2 )
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, edgecolors = "red" )
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.