This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% (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,[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% (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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% (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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% (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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pandoc --filter pandoc-citeproc -s main.md -o main.pdf --bibliography=library.bib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% JN Kather, 2015 | |
% Show the RGB gamut in CIELAB space | |
figure(); | |
[X,Y,Z] = meshgrid(linspace(0,1,25)); | |
colors = ([X(:),Y(:),Z(:)]); | |
colorsLAB = rgb2lab(colors); | |
scatter3(colorsLAB(:,1),colorsLAB(:,2),colorsLAB(:,3),100,colors,'filled'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% JN Kather, 2015 | |
% Show a CIELAB color cube composed of 25^3 balls | |
% note: Matlab CIELAB colorspace goes approx. from -108 to +100 as measured | |
% with: colors = rgb2lab(jet(100)); min(colors(:)), max(colors(:)) | |
figure(); | |
[X,Y,Z] = meshgrid(linspace(-108,100,15)); | |
colors = lab2rgb([double(X(:)),double(Y(:)),double(Z(:))]); | |
scatter3(X(:),Y(:),Z(:),100,colors,'filled'); | |
xlabel('L'); ylabel('a'); zlabel('b'); | |
axis equal tight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% JN Kather 2015 | |
% calculate distance from a given point for a cloud of points, 2D | |
% cloud of points | |
Pts = rand(500,2); | |
% calculate distance from P(px|py) | |
px = 0.5; py = 0.5 | |
distance = sqrt((Pts(:,1)-px).^2 + (Pts(:,2)-py).^2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% JN Kather 2015 | |
% calculate distance from a given point for a cloud of points, 3D | |
% cloud of points | |
Pts = rand(10000,3); | |
% calculate distance from P(px|py|pz) | |
px = 0.5; py = 0.5; pz = 0.5; | |
distance = sqrt( (Pts(:,1)-px).^2 + ... | |
(Pts(:,2)-py).^2 + ... |
OlderNewer