Skip to content

Instantly share code, notes, and snippets.

View Swarchal's full-sized avatar

Scott Warchal Swarchal

View GitHub Profile
library(raster)
# load images
image_DNA <- raster('~/BBBC007_v1_images/A9/A9 p5d.tif')
image_actin <- raster('~/BBBC007_v1_images/A9/A9 p5f.tif')
import matplotlib.pyplot as plt
from skimage.io import imread
from skimage.feature import match_template
import matplotlib.pyplot as plt
import numpy as np
image = imread("image.jpg")
wally = imread("wally.png")
# select just the red channel
import matplotlib.pyplot as plt
from skimage.io import imread
from skimage.morphology import disk
from skimage.filters import rank
import numpy as np
im_all = imread("/home/scott/Dropbox/wally/ww2.jpg")
all_red = im_all[:, :, 0]
im_wally = imread("/home/scott/Dropbox/wally/wally2.png")
wally_red = im_wally[:, :, 0]
@Swarchal
Swarchal / read_all.R
Created August 7, 2015 08:06
load all csv files in the current directory
path <- paste(getwd(), "\\", sep = "")
files <- list.files(path=path, pattern="*.csv")
for(file in files)
{
perpos <- which(strsplit(file, "")[[1]]==".")
assign(
gsub(" ","",substr(file, 1, perpos-1)),
read.csv(paste(path,file,sep="")))
}
@Swarchal
Swarchal / source_https.R
Last active August 29, 2015 14:15
source() for https (eg. raw.github)
source_https <- function(url, ...) {
# load package
require(RCurl)
# parse and evaluate each .R script
sapply(c(url, ...), function(u) {
eval(
parse(
text = getURL(u, followlocation = TRUE,
cainfo = system.file("CurlSSL",