Skip to content

Instantly share code, notes, and snippets.

View jnkather's full-sized avatar

Jakob Nikolas Kather jnkather

View GitHub Profile
@jnkather
jnkather / manuscript-build
Created May 22, 2015 13:06
Markdown to PDF with citations
pandoc --filter pandoc-citeproc -s main.md -o main.pdf --bibliography=library.bib
@jnkather
jnkather / thesis-build
Last active August 29, 2015 14:21
Build a Latex document
#!/bin/bash
cd ~/BitBucket/master-thesis/
pdflatex main.tex
bibtex main
pdflatex main.tex
echo '######### last run #########'
pdflatex main.tex
open main.pdf
open main.log
exit
@jnkather
jnkather / plotPlane.m
Last active August 29, 2015 14:21
Plot a plane through 3 points
% (c) Jakob Nikolas Kather 2015
% contact: http://www.kather.me
% this function plots a plane through the points x,y,z in a 3D plot
function normal = plotPlane(x,y,z)
% plot triangle through x y z, optional
% fill3([x(1),y(1),z(1)],[x(2),y(2),z(2)],[x(3),y(3),z(3)],'b')
@jnkather
jnkather / analyze_pixel_colors_OD.m
Last active August 29, 2015 14:21
Analyze colors of histological image in OD space
% (c) Jakob Nikolas Kather 2015
% contact: http://www.kather.me
% this code uses a histological image and performs the following steps
% - convert to optical density (OD) space (ref: Ruifrok et al. http://www.ncbi.nlm.nih.gov/pubmed/11531144)
% - plot image pixels in OD space
% - color pixels according to their original color
% this script can be used to visualize the color distribution of a given histological image
% get source image
@jnkather
jnkather / hex2rgb.m
Last active August 29, 2015 14:21
Convert hexadecimal color string to RGB values in Matlab
% (c) Jakob Nikolas Kather 2015
% contact: http://www.kather.me
function rgb = hex2rgb(hexString)
if size(hexString,2) ~= 6
error('invalid input: not 6 characters');
else
r = double(hex2dec(hexString(1:2)))/255;
g = double(hex2dec(hexString(3:4)))/255;
b = double(hex2dec(hexString(5:6)))/255;
@jnkather
jnkather / stairstep_array.m
Last active August 29, 2015 14:21
Create a 1D or 2D stairstep array in Matlab
% (c) Jakob Nikolas Kather 2015
% contact: http://www.kather.me
% aim is to create a 1D-stairstep array, i.e. transform
% 1 2 3 4 to
% 1 1 1 2 2 2 3 3 3 4 4 4
matrix = 1:4
newSize = 3
step_matrix = reshape(repmat(matrix,newSize,1),1,[])