Skip to content

Instantly share code, notes, and snippets.

View haehn's full-sized avatar
🤠

Daniel Haehn haehn

🤠
View GitHub Profile
@haehn
haehn / index.html
Last active October 10, 2023 18:43
CS460 Assignment 4 Starter Code
<html>
<head>
<style>
html, body {
background-color:#000;
margin: 0;
padding: 0;
height: 100%;
@haehn
haehn / 06_createFish.html
Created October 6, 2023 19:57
CS460.org createFish with Matrix
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Default WebGL!</title>
<style>
html, body {
background-color:#000;
margin: 0;
padding: 0;
@haehn
haehn / index_bonus2.html
Created October 5, 2023 01:42
CS460 createRectangle
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Default WebGL!</title>
<style>
html, body {
background-color:#000;
margin: 0;
padding: 0;
@haehn
haehn / index.html
Created October 3, 2023 22:19
CS460 Moving Yellow Rectangle
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Default WebGL!</title>
<style>
html, body {
background-color:#000;
margin: 0;
padding: 0;
@haehn
haehn / index.html
Last active September 29, 2023 15:57
CS460 Fall 2023 Hello Rectangle in Vanilla WebGL!
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Default WebGL!</title>
<style>
html, body {
background-color:#000;
margin: 0;
padding: 0;
script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://boostlet.org/dist/boostlet.min.js";
script.onload = run;
document.head.appendChild(script);
eval(script);
function run() {
canvas = viewer.canvas.children[0]; // TODO needs to be generic and executed with Boostlet.init
@haehn
haehn / test.js
Created June 6, 2023 15:56
NiiVue SAM WIP
// 1. hide crosslines
nv.setCrosshairColor([0,0,0,0]);
nv.opts.crosshairWidth=0;
nv.updateGLVolume();
// 2. grab REAL pixels
c = document.getElementById('viewer')
ctx = c.getContext("webgl2")
@haehn
haehn / sam.js
Created May 12, 2023 02:38
SegmentAnything for Cornerstone.js (JS injection!)
//
// VISIT DANIELHAEHN.COM !
//
// Thanks to Alireza Seghi and Kevin Wang for all the help!
//
//
//
// GET EMBEDDING FOR CANVAS
element = cornerstone.getEnabledElements()[0];
@haehn
haehn / gist:9c36c57f2c845eb8791331628896ef5b
Created November 8, 2022 01:41
robot.js from class Fall 2022
Robot = function(x, y, z) {
//
// HEAD, NECK, TORSO
//
var fromhelper = HELPER.cylinderSkeletonMesh(3, 5, 'blue')
var geometry = fromhelper[0];
var material = fromhelper[1];
var bones = fromhelper[2];
@haehn
haehn / stack.html
Last active April 15, 2022 01:09
Cornerstone.js DICOM Stack+Brush
<html>
<head>
<script src="https://unpkg.com/cornerstone-core/dist/cornerstone.min.js
"></script>
<script src="https://unpkg.com/cornerstone-wado-image-loader"></script>
<script src="https://unpkg.com/dicom-parser"></script>
<script src="https://unpkg.com/cornerstone-math"></script>
<script src="https://unpkg.com/cornerstone-tools"></script>
<script src="https://unpkg.com/hammerjs"></script>
<script>