Skip to content

Instantly share code, notes, and snippets.

View tractatus's full-sized avatar

Daniel Fürth tractatus

View GitHub Profile
library(rstan)
gaussianMM<-'
data {
int K;
int N;
real x[N];
}
parameters {
@tractatus
tractatus / tensorflow GPU OSX build.txt
Created March 20, 2017 16:31
tensorflow GPU OSX build
brew install python3
brew install coreutils
brew tap caskroom/cask
brew cask install cuda
nano ~/.bash_profile
#paste in the following
void createWeb::run(cv::Mat& sourceImage, cv::Mat& dstImage){
int tiers;
int height = sourceImage.rows;
int width = sourceImage.cols;
int maxdim = (width > height ? width : height);
tiers = (int)log2(maxdim/256);
if((maxdim/pow(2, tiers))>256){
@tractatus
tractatus / readroi.R
Created September 7, 2017 14:17
readroi ImageJ to R
## readroi.R - Read ImageJ files in to R
## Copyright (C) 2011 David C. Sterratt <david.c.sterratt@ed.ac.uk>
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
@tractatus
tractatus / edit_seg_in_script.R
Last active December 7, 2017 22:55
setting segmentation filter in a script
#just change the numbers here.
# alim = area limits of the soma, lower and upper
# threshold.range = where in intesnity to look for neurons, lower and upper.
# eccentricity = the roundness of neurons, lower means rounder.
# Max = the maximum intensity to do 8 bit rendering on (just for display purposes).
# Min = the minimum intensity to do 8 bit rendering on (just for display purposes).
# brain.threshold = the intensity where you find the autofluorescent outline of the brain section.
# resize = resizing parameter to match atlas and your brain section.
# blur = blurring (higher = more) to apply to the contour of the brain if you have damaged tissue etc.
# downsample = how much to downsample the image to reduce image processing speed.
@tractatus
tractatus / ameet.R
Last active July 12, 2018 15:54
Ameet_Berkeley
library(wholebrain)
#set folder path
folder<-'/Users/ameetrahane/Lab/Widlbrecht_Lab/brain-tissue-analysis/sectioned_test_1'
setwd(folder)
subfolders <- list.dirs(path = ".", full.names = TRUE, recursive = TRUE)
data <- data.frame()
#map to atlas coordinates
#set cutting thickness in millimeters
distance.between.sections <- 0.1
@tractatus
tractatus / Stationary Wavelet Experimental
Created September 4, 2018 18:32
RUn this code to get access to experimental imgSWT function
imgSWT <- function(input, filter=NULL, scales=6, cell.bodies = 3, processes = 5, family='db2', sigma=10, processLength=12, alim=c(200, 500), pch=21, bg="white", cex=2, lwd=2, illustrator=F, output='waveletoutput') {
file <- as.character(input)[1]
family <- as.character(family)[1]
outputfile <- as.character(output)[1]
scales<-as.integer(scales)
cellBodies<-as.integer(cell.bodies)
processes <- as.integer(processes)
sigmaR<-as.integer(sigma)
processLength<-as.integer(processLength)
areaSize<-alim
library(wholebrain)
#set folder path
folder<-'/Users/danielfurth/Desktop/an_example_animal/section001'
#find out how many images we have and their location
images<-get.images(folder)
length(images)
#stitch this image
################################
# (c) Daniel Fürth, 2016
# Spatial Transcriptomics with WholeBrain
################################
#set the anterior poster coordinate of brin section in millimeter
coordinate.for.section<- -0.42
#set filter for Cy3 spots
feature.filter <-structure(list(alim = c(120, 1000), threshold.range = c(14L, 255
@tractatus
tractatus / Stitch WholeBrain Perkin-Elmer
Last active November 26, 2018 19:17
Stitch WholeBrain Perkin-Elmer
#' Sticthing on a Perkin-Elmer instrument
#'
#' This function allows you to stitch image tiles from Perkin Elmer Harmony software contained in a single folder.
#' @param folder a path to a folder containing image tiles in TIFF format and XML file for metadata.
#' @param digits number of significant digits to round up the position X,Y reported by Harmony XML metadata (this is used for matching).
#' @return a character vector with images that have been stitched.
#' @keywords perkin-elmer
#' @export
#' @examples
#' stitch.perkin.elmer('./Images')