This file contains hidden or 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
distSkel=MIJ.getCurrentImage; | |
% transform to a list | |
[xx,yy,zz]=meshgrid(1:size(distSkel,1),1:size(distSkel,2),1:size(distSkel,3)); | |
% find the non zero values inside objects | |
nonZeroPts=find(distSkel>0); | |
skelList=[xx(nonZeroPts) yy(nonZeroPts) zz(nonZeroPts)]; |
This file contains hidden or 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
setBackgroundColor(0,0,0) | |
newImage("Untitled", "8-bit black", 512, 512, 1); | |
makeRectangle(236, 86, 65, 218); | |
run("Invert"); | |
//setTool("polygon"); | |
makePolygon(80,368,244,275,255,305,91,395); | |
run("Clear", "slice"); | |
run("Invert"); | |
makePolygon(252,285,282,286,285,436,248,434); | |
run("Clear", "slice"); |
This file contains hidden or 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
import timeit | |
import tipl.spark.SparkGlobal as SG | |
t=timeit.Timer('CLTest.main(["-boxsize=200"])',setup='import tipl.spark.CL as CLTest') | |
perfStats=t.repeat(20,2) |
This file contains hidden or 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
simplelay=importdata('simple_layer.csv',',',1); | |
disp(simplelay.colheaders) | |
%% parse the data in matlab | |
% A tiny piece of code to find which column the given header is in | |
findColumn=@(idstrut,colName) find(not(cellfun('isempty',strfind(idstrut.colheaders,['"' colName '"'])))); | |
% a function to return all of the data in that column | |
getColumn=@(idstrut,colName) idstrut.data(:,findColumn(idstrut,colName)); | |
%% show the data |
This file contains hidden or 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
% calculate nearest neighbor | |
function [nndist,nntheta] = findnn(xcol,ycol) | |
colIndex=1:length(xcol); | |
nndist=zeros(1,length(xcol)); | |
nntheta=zeros(1,length(xcol)); | |
for i=colIndex | |
curX=xcol(i); | |
curY=ycol(i); | |
[mindist,minind]=min(sqrt((xcol(find(colIndex~=i))-curX).^2+(ycol(find(colIndex~=i))-curY).^2)); | |
This file contains hidden or 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
spacinglay=importdata('spacing_layer_grid.csv',',',1); | |
disp(spacinglay.colheaders) | |
%% parse the data in matlab | |
% A tiny piece of code to find which column the given header is in | |
findColumn=@(idstrut,colName) find(not(cellfun('isempty',strfind(idstrut.colheaders,['"' colName '"'])))); | |
% a function to return all of the data in that column | |
getColumn=@(idstrut,colName) idstrut.data(:,findColumn(idstrut,colName)); | |
%% calculate the nearest neighbor distance and angle | |
[nndist,nnangle]=findnn(getColumn(spacinglay,'x'),getColumn(spacinglay,'y')); |
This file contains hidden or 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
imagejdata=importdata('analyzeParticlesOutput.txt','\t',1) | |
disp(imagejdata.colheaders) | |
%% parse the data in matlab | |
% A tiny piece of code to find which column the given header is in | |
% note imagej exports do not need the extra quotation marks like R does | |
findColumn=@(idstrut,colName) find(not(cellfun('isempty',strfind(idstrut.colheaders,[ colName ])))); | |
% a function to return all of the data in that column | |
getColumn=@(idstrut,colName) idstrut.data(:,findColumn(idstrut,colName)); | |
%% calculate the nearest neighbor distance and angle |
This file contains hidden or 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
aligndata=importdata('align_a.csv',',',1) | |
disp(aligndata.colheaders) | |
%% parse the data in matlab | |
% A tiny piece of code to find which column the given header is in | |
findColumn=@(idstrut,colName) find(not(cellfun('isempty',strfind(idstrut.colheaders,['"' colName '"'])))); | |
% a function to return all of the data in that column | |
getColumn=@(idstrut,colName) idstrut.data(:,findColumn(idstrut,colName)); | |
This file contains hidden or 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
simplelay=importdata('simple_layer.csv',',',1); | |
disp(simplelay.colheaders) | |
%% parse the data in matlab | |
% A tiny piece of code to find which column the given header is in | |
findColumn=@(idstrut,colName) find(not(cellfun('isempty',strfind(idstrut.colheaders,['"' colName '"'])))); | |
% a function to return all of the data in that column | |
getColumn=@(idstrut,colName) idstrut.data(:,findColumn(idstrut,colName)); | |
%% show the data |
This file contains hidden or 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
require("ggplot2") # for plots | |
require("plyr") # for processing dataframes | |
# the function to find nearest neighbors | |
# requires data with x, y, and val columns (val is a unique identifier) | |
find.nn<-function(in.df) { | |
ddply(in.df,.(val),function(c.group) { | |
cur.val<-c.group$val[1] | |
cur.x<-c.group$x[1] | |
cur.y<-c.group$y[1] | |
all.butme<-subset(in.df,val!=cur.val) |