View README.md

Simple canvas-based color converter

To answer this StackOverflow question I wrote this — a small solution based on a never-rendered <canvas> element. It fills a 1-pixel canvas with the provided fill-style, and then reads the RGBA values of that pixel. It will work with any CSS color -- name, rgba(), hex, or even something more exotic like a gradient or pattern. Invalid colors are always returned as transparent black. Transparent colors are treated as painted on a newly-cleared canvas.

It's been tested in modern-ish versions of IE, Chrome, Safari, and Firefox. The API is:

color_convert.to_hex(color)   # Converts color to a hex-based RGB triple; to_hex('red') returns '#ff0000'
color_convert.to_rgba(color)  # Converts color to an rgba() string; to_rgba('red') returns 'rgba(255,0,0,1)'
View A Slicing Thing.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
font: 300 11px "Helvetica Neue", Helvetica, Arial, sans-serif;
fill: #bbb;
}
.node:hover {
View coins_login.rb
#!/usr/bin/env ruby
require 'mechanize'
require 'pp'
def coins_login(agent, username, password)
page = agent.get "https://chronus.mrn.org/cas/login.php?rp=https%3A%2F%2Fchronus.mrn.org%2Fmicis%2Findex.php%3Fsubsite%3Dasmt"
uname_match = page.body.match /name="([^"]+)" placeholder="Username/
uname_field = uname_match[1]
pw_match = page.body.match /name="([^"]+)" placeholder="Pa\$\$w0rd/
View upload_gating_files
#!/bin/bash
GATING_DIR=${GATING_DIR:-/usr/g/service/log/gating}
DEST_BASE=${DEST_BASE:-/mri-upload/ge_physio}
MAX_AGE_MINUTES=${3:-120}
study=$1
ppt=$2
if [[ "${study}" == "" ]] || [[ "${ppt}" == "" ]] || [[ "${study}" == "-h" ]]; then
View link_tree
View seba-vid-extend.rb
#!/usr/bin/env ruby
require 'tmpdir'
require 'fileutils'
fix_file = ARGV[0]
vid_file = ARGV[1]
out_file = ARGV[2]
FIXATION_FRAMES=10
VID_FRAMES=25
View convert_tarred_dicoms
#!/bin/bash
in_file="$1"
out_file="$2"
out_base=$(dirname "${out_file}")
tmp_dir=$(mktemp -d -p "${out_base}")
if [ $? -ne 0 ]; then
echo "Can't make a temporary directory in ${out_base}" >&2
View mask_scramble.py
#!/usr/bin/env python
import sys
import argparse
from PIL import Image
import numpy as np
def scramble_ary(img_ar, mask_ar):
"""
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Circley</title>
<style type="text/css">
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 500px;
position: relative;