A programmatic gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Given the string str, produce a shorter random hash. | |
Different strings could produce the same hash, although | |
this is unlikely. | |
*/ | |
function hash(str) { | |
var i,v0,v1,abc="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
v0=0; | |
for(i=0;i<str.length;i++) { | |
v1=str.charCodeAt(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the box geometry to initialise | |
var box=new THREE.Geometry(); | |
// the trick to make all faces: vectors i, j and k have the coordinates of the triangles in the box | |
var i="011010111111100101000000001011110100".split('').map(c=>(c=='0')?0:1), | |
j="000000011010111111100101011010011010".split('').map(c=>(c=='0')?0:1), | |
k="001011001011001011001011000000111111".split('').map(c=>(c=='0')?0:1); | |
// this function multiplies each of the coordinates by a transformation matrix that turns them | |
// into an arbitrary box |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plot_anat(img,output_file=None,vmax=None): | |
sh=img.get_data().shape | |
midvox=[sh[0]/2,sh[1]/2,sh[2]/2,1] | |
worldmidvox=img.affine.dot(midvox) | |
if vmax is None: | |
data=img.get_data().ravel() | |
data=data[data>data.max()*0.2] | |
vmax=data[range(0,len(data),len(data)/1000)].max() | |
plotting.plot_anat(img,vmax=vmax,cut_coords=worldmidvox[:3],output_file=output_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f()(return { | |
"pixelsPerMeter": 1000000, | |
"tileSources": [ | |
"ftp://bigbrain.loris.ca/BigBrainRelease.2015/2D_Final_Sections/Coronal/Dzi/pm0001o.dzi" | |
] | |
};) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f({ | |
"tileSources": [ | |
{ | |
"width": 6572, | |
"tileSize": 256, | |
"getTileUrl": "function(level,x,y){ return \"ftp://bigbrain.loris.ca/BigBrainRelease.2015/2D_Final_Sections/Coronal/Dzi/pm2886o_files/\"+level+\"/\"+x+\"_\"+y+\".png\"}", | |
"tileOverlap": 0, | |
"height": 5711 | |
} | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post('/api/stop', tokenAuthentication, (req, res) => { | |
console.log('hello', req.body); | |
if( req.isTokenAuthenticated ) { | |
console.log("Stopped by", req.tokenUsername); | |
process.exit(); | |
} else { | |
console.log("Token required"); | |
} | |
res.send(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"pixelsPerMeter": 1000000, | |
"tileSources": [ | |
"ftp://bigbrain.loris.ca/BigBrainRelease.2015/2D_Final_Sections/Coronal/Dzi/pm0001o.dzi" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @desc From https://gomakethings.com/merging-objects-with-vanilla-javascript/ | |
*/ | |
function extend() { | |
// Variables | |
var extended = {}; | |
var deep = false; | |
var i = 0; | |
var length = arguments.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<style> | |
td { | |
width: 100px; | |
border:thin solid lightGrey; | |
} | |
</style> | |
<svg width="100%" height="400px" xmlns="http://www.w3.org/2000/svg"> | |
<g transform="matrix(1,0,0,1,0,0)"> |
OlderNewer