Caret6:Other/JavaScript

From Van Essen Lab

Jump to: navigation, search

Contents

Using Caret6 with Javascript

A JavaScript interpreter is included in Java Version 6 and can be accessed from the command line using the command jrunscript. Caret6 Java classes can be accessed from the scripts by adding the Caret6 JAR file as an argument to jrunscript (jrunscript -classpath <path>/caret6.jar).

Examples

Start the JavaScript interpreter

prompt> jrunscript -classpath /Users/john/caret6_development/distributions/caret6_deploy/caret6/jars/caret6.jar

Read a GIFTI Surface File

js> surfaceFile = new edu.wustl.caret.files.SurfaceFile()
Invalid - SurfaceFile.surf.gii               ### THIS is the result of surfaceFile.toString() automatically performed by interpreter.
js> surfaceFile.readFile("Human.PALS_B12.LEFT_AVG_B1-12.FIDUCIAL_FLIRT.clean.73730.surf.gii")
js> surfaceFile.getNumberOfNodes() 
73730
js> f = surfaceFile.getCoordinate(333)
[F@4bd53f5b
js> f
[F@4bd53f5b
js> f[0] 
-9.00273
js> f[1]    
-56.003452
js> f[2]
10.063049
js>


List all available methods in SurfaceFile

js> surfaceFile = new edu.wustl.caret.files.SurfaceFile()
Invalid - SurfaceFile.surf.gii               ### THIS is the result of surfaceFile.toString() automatically performed by interpreter.
js> surfaceFile.readFile("Human.PALS_B12.LEFT_AVG_B1-12.FIDUCIAL_FLIRT.clean.73730.surf.gii")
js> for (i in surfaceFile) { println(i) } 
getColumnIndexFromName
fitToBoundingBox
getSurfaceType
[... many more ...]

Get information about getCoordinate() method

js> surfaceFile.getCoordinate
float[] getCoordinate(int)

References

Personal tools
Sums Database