plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | kristinbranson/APT-master | furthestfirst.m | .m | APT-master/external/JAABA/misc/furthestfirst.m | 3,737 | utf_8 | fbbc8c35d87e16e38b8cb6846b197927 | % [mu,idx,mu_idx,Dall,mindists] = furthestfirst(x,k,p1,v1,...)
%
% x: N x D matrix of data to be clustered. N is the number of data
% points, D is the number of dimensions
% k: number of centers
% Optional PVs:
% - Start. Either [1xD], 'mean' (default), or empty. first center. If
% empty, a random point is used ... |
github | kristinbranson/APT-master | nrrdread.m | .m | APT-master/external/JAABA/misc/nrrdread.m | 4,336 | utf_8 | c8da0a11197d4ee17837cf8582dcee34 | function [X, meta] = nrrdread(filename)
%NRRDREAD Import NRRD imagery and metadata.
% [X, META] = NRRDREAD(FILENAME) reads the image volume and associated
% metadata from the NRRD-format file specified by FILENAME.
%
% Current limitations/caveats:
% * "Block" datatype is not supported.
% * Only tested with "... |
github | kristinbranson/APT-master | myscatter.m | .m | APT-master/external/JAABA/misc/myscatter.m | 4,701 | utf_8 | 987c50b581284a7dcc6bfa354ff6c8b4 | % h = myscatter(x,y,scale,color,[ncolors],[cm],['filled'],marker,...)
%
% MYSCATTER Scatter/bubble plot.
% MYSCATTER(X,Y,S,C) displays colored circles at the locations specified
% by the vectors X and Y (which must be the same size). This function
% is similar to the SCATTER function. Instead of plotting ... |
github | kristinbranson/APT-master | weightedkmeans.m | .m | APT-master/external/JAABA/misc/weightedkmeans.m | 22,887 | utf_8 | 680ca9a1d4f1d8cd350e2b71e2d6cf95 | function [idx, C, sumD, D] = weightedkmeans(X, k, varargin)
% similar to MATLAB's kmeans function, but takes weights
if nargin < 2
error('stats:kmeans:TooFewInputs','At least two input arguments required.');
end
if any(isnan(X(:)))
warning('stats:kmeans:MissingDataRemoved','Removing rows of X with missing dat... |
github | kristinbranson/APT-master | PlotInterpColorLine.m | .m | APT-master/external/JAABA/misc/PlotInterpColorLine.m | 1,277 | utf_8 | 541587511d272cf681f55c053ac8b459 | % h = PlotInterpColorLine(x,y,colors,alphas,...)
function h = PlotInterpColorLine(x,y,colors,alphas,varargin)
if nargin < 4,
alphas = [];
end
if ischar(alphas),
varargin = [alphas,varargin];
alphas = [];
end
[usepatch,parent,leftovers] = myparse_nocheck(varargin,'usepatch',true,'Parent',[]);
x = x(:);
y = y(:)... |
github | kristinbranson/APT-master | normalizep.m | .m | APT-master/external/JAABA/misc/normalizep.m | 167 | utf_8 | e9cce530804e49eb193e87b83bb6b912 | % shifts and scales input p so that output all(p >= 0) and sum(p) = 1
function p = normalizep(p)
minp = min(p);
if minp < 0,
p = p - minp;
end;
p = p / sum(p(:));
|
github | kristinbranson/APT-master | label_open_edges.m | .m | APT-master/external/JAABA/misc/label_open_edges.m | 14,148 | utf_8 | 4a4410c31ac0c1f7ebef5e3ed9faa701 | % [BOUNDX,BOUNDY] = LABEL_OPEN_EDGES(RGBI)
%
% Input: RGBI is a RGB image we want to label edges in.
% This program allows the user to input any number of open
% edges. Here is the interactive usage:
% label_open_edges commands:
% LEFT CLICK with the mouse to add a new point.
% RIGHT CLICK with the mouse to add a new ... |
github | kristinbranson/APT-master | onedim2kclass.m | .m | APT-master/external/JAABA/misc/onedim2kclass.m | 4,745 | utf_8 | 642ef9dd4998314e0496727d54b0493c | % [threshx,cost,classorder] = onedim2kclass(x,idx,...)
%
% finds the k-1 thresholds that best separate the input one-dimensional
% data vector x into k classes
%
% input:
%
% x: n x 1 is the n one-dimensional data points
% idx: n x 1 is the integer labels for each data point
%
% optional:
%
% 'issorted': true/false, w... |
github | kristinbranson/APT-master | colorspace.m | .m | APT-master/external/JAABA/misc/colorspace.m | 13,590 | utf_8 | b1a9eb973fa39950345a1df707b5d2c8 | function varargout = colorspace(Conversion,varargin)
%COLORSPACE Convert a color image between color representations.
% B = COLORSPACE(S,A) converts the color representation of image A
% where S is a string specifying the conversion. S tells the
% source and destination color spaces, S = 'dest<-src', or
% alt... |
github | kristinbranson/APT-master | ellipsepixels.m | .m | APT-master/external/JAABA/misc/ellipsepixels.m | 1,357 | utf_8 | 9f89de1015543ab0cd584a2bc8a92f66 | % bw = ellipsepixels(params,bb)
% params: vector of length 5 describing the ellipse, where
% params(1) is the x coordinate of the center
% params(2) is the y coordinate of the center
% params(3) is the major axis length
% params(4) is the minor axis length
% params(5) is the orientation
% bb is a vector of length 4 des... |
github | kristinbranson/APT-master | detectcircles.m | .m | APT-master/external/JAABA/misc/detectcircles.m | 2,813 | utf_8 | 27485ca8e8b5ff67c6f662a5f3abf20e | % [r,x,y,params] = detectcircles(im,...)
% inputs:
% im: image to detect circles in
% parameters:
% cannythresh: thresholds for canny edge detection
% cannysigma: standard deviation for canny edge detection
% binedgesa: bin edges for x-coordinate of center
% bincentersb: bin centers for y-coordinate of center
% bincent... |
github | kristinbranson/APT-master | SelectHistEdges.m | .m | APT-master/external/JAABA/misc/SelectHistEdges.m | 1,984 | utf_8 | 9b0ed7ff5fb1e42ab0874dfa7938d4ad | % [edges,centers] = SelectHistEdges(nbins,lim,binmode)
% It selects edges between bounds set by LIM according to BINMODE,
% which is either 'linear', 'log' (log binning), or 'logabs'
% (log binning in both directions from zero).
function [edges,centers] = SelectHistEdges(nbins,lim,binmode)
switch lower(binmode),
... |
github | kristinbranson/APT-master | mygmm.m | .m | APT-master/external/JAABA/misc/mygmm.m | 2,117 | utf_8 | 3c1ea5f31b21379a08eae44665e594a3 | % [mu,S,priors,post,nll,mix] = mygmm(X,k,...)
% Input:
% X: N x D matrix of N D-dimensional data points
% k: number of clusters
% optional:
% 'Replicates' = 1
% 'CovarType' = 'full'
% 'display' = -1
% 'precision' = .0001
% 'ResetCovar' = 1
% 'MaxIters' = 100
% 'Start' = 'furthestfirst'
% 'distance' = 'sqEuclidean'
% 'w... |
github | kristinbranson/APT-master | nonmaxsuppts.m | .m | APT-master/external/JAABA/misc/nonmaxsuppts.m | 4,755 | utf_8 | 29169f4bda77d8b1e767981e2748ddf4 | % NONMAXSUPPTS - Non-maximal suppression for features/corners
%
% Non maxima suppression and thresholding for points generated by a feature
% or corner detector.
%
% Usage: [r,c] = nonmaxsuppts(cim, radius, thresh, im)
% /
% ... |
github | kristinbranson/APT-master | strsplit_jaaba.m | .m | APT-master/external/JAABA/misc/strsplit_jaaba.m | 295 | utf_8 | eab597669a57da31ac309011e8f01aa7 | % t = strsplit(s,delim)
function t = strsplit_jaaba(s,delim)
if ischar(delim),
i = strfind(s,delim);
else
i = [];
for j = 1:length(delim),
i = union(i,strfind(s,delim{j}));
end
end
i = [0,i,length(s)+1];
n = length(i)-1;
t = cell(1,n);
for j = 1:n,
t{j} = s(i(j)+1:i(j+1)-1);
end
|
github | kristinbranson/APT-master | distancePointToLineSegmentV.m | .m | APT-master/external/JAABA/misc/distancePointToLineSegmentV.m | 1,125 | utf_8 | 6d712b2b4033fa8f85e7efbdda624fcf | function distance = distancePointToLineSegmentV(p, a, b)
% distance = distancePointToLineSegmentV(p, a, b)
% p is a matrix of points (d x n)
% a is a matrix of starts of line segments
% b is a matrix of ends of line segments
% copied from
% http://stupidmatlabhacks.tumblr.com/post/18727965430/distance-from-point-to-th... |
github | kristinbranson/APT-master | ellipsedist_hack.m | .m | APT-master/external/JAABA/misc/ellipsedist_hack.m | 419 | utf_8 | 9b859aefd4cca32b2b293a64da5082b7 | % [d,xi,yi,thetai] = ellipsedist_hack(xc,yc,a,b,theta,u,v)
% compute distance from points (u,v) to ellipse (xc,yc,a,b,theta)
function [d,xi,yi,thetai] = ellipsedist_hack(xc,yc,a,b,theta,u,v,npoints)
if nargin < 8,
npoints = 100;
end
[x,y,theta] = ellipsepoints(a,b,xc,yc,theta,npoints);
[d,i] = min(dist2([x(:),y(:)]... |
github | kristinbranson/APT-master | weighted_mean_cov.m | .m | APT-master/external/JAABA/misc/weighted_mean_cov.m | 259 | utf_8 | fe77bba09af42d3dba048bb83f31027f | % [mu,S] = weighted_mean_cov(x,w)
% x is n x d, w is n x 1
function [mu,S] = weighted_mean_cov(x,w)
%[n,d] = size(x);
z = sum(w);
mu = sum(bsxfun(@times,x,w(:)),1)/z;
diffs = bsxfun(@minus,x,mu);
diffs = bsxfun(@times,diffs,sqrt(w));
S = (diffs'*diffs)/z;
|
github | kristinbranson/APT-master | updateellipse.m | .m | APT-master/external/JAABA/misc/updateellipse.m | 1,299 | utf_8 | 0fab892cf2057b00430a5152230ff7ff | % h = drawellipse(trk,varargin)
% h = drawellipse(x,y,theta,semimaj,semimin,varargin)
% extra arguments will be fed to plot
function varargout = updateellipse(h,x,varargin)
% draw an isosceles triangle with center (x,y)
% with rotation theta
% with height maj*4
% with base min*4
if isstruct(x),
fly = x;
if nargin... |
github | kristinbranson/APT-master | genpath_visible.m | .m | APT-master/external/JAABA/misc/genpath_visible.m | 726 | utf_8 | 86dd233b11d037d118b4d44469008a22 | % p = genpath_visible(d)
% save as genpath, but if any of the path is hidden, the directory is not
% added
function p = genpath_visible(d)
hiddenchar = '.';
p = '';
a = genpath(d);
if isempty(a),
return;
end
% find the first character of each path
i0s = [0,find(a == pathsep)]+1;
if i0s(end) <= length(a),
i0s(end... |
github | kristinbranson/APT-master | split_path_and_filename.m | .m | APT-master/external/JAABA/misc/split_path_and_filename.m | 322 | utf_8 | 7f45dc185c047359ed3caa07f7b38a09 | % [spath,sfilename] = split_path_and_filename(s)
function [spath,sfilename] = split_path_and_filename(s)
i = find(s(1:end-1)=='/',1,'last');
if isempty(i),
% windows?
i = find(s(1:end-1)=='\',1,'last');
if isempty(i),
spath = '';
sfilename = s;
return;
end
end
spath = s(1:i);
sfilename = s(i+1:end)... |
github | kristinbranson/APT-master | unionmany.m | .m | APT-master/external/JAABA/misc/unionmany.m | 419 | utf_8 | 38915dbca1266202b21d8fb4ca4691e3 | % c = unionmany(set1,set2,...,setn,['rows'])
function c = unionmany(varargin)
if ischar(varargin{end}) && strcmpi(varargin{end},'rows'),
rows = {'rows'};
varargin = varargin(1:end-1);
else
rows = {};
end
if length(varargin) < 2,
error('Usage: c = unionmany(a1,a2,...,an) or c = unionmany(a1,a2,...,an,''rows'')... |
github | kristinbranson/APT-master | csvwrite.m | .m | APT-master/external/JAABA/misc/csvwrite.m | 1,283 | utf_8 | 7b11a0105afb0b9182eb0b0dd268c0d4 | % [success,errmsg] = csvwrite(filename,struct,[prefix])
% [success,errmsg] = csvwrite(fid,struct,[prefix])
function [success,errmsg] = csvwrite(f,s,prefix)
errmsg = '';
success = false;
isfilename = ischar(f);
if nargin < 2,
errmsg = 'Usage: csvwrite(filename,struct,[prefix]) or csvwrite(fid,struct,[prefix])';
re... |
github | kristinbranson/APT-master | createsubplots.m | .m | APT-master/external/JAABA/misc/createsubplots.m | 1,353 | utf_8 | e993c747da9f0e2cc14bbefb24f754c3 | % Usage:
% h = createsubplots(nrows,ncols,border)
% h = createsubplots(nrows,ncols,[borderx,bordery])
% h = createsubplots(nrows,ncols,[[sideborderx, middleborderx];[sidebordery, middlebordery]])
% h = createsubplots(...,[hfig]);
function h = createsubplots(n1,n2,border,hfig)
if nargin == 0,
error('usage: createsubp... |
github | kristinbranson/APT-master | mypca.m | .m | APT-master/external/JAABA/misc/mypca.m | 5,419 | utf_8 | 5afe27817ee711bb645d4e6f705128e5 | %% function mypca
% [mu,pc_vec,pc_val,pc_rec,pc_coeff,err] = MYPCA(data,...)
%
% This function performs principal component analysis on the input data. It uses
% the Turk and Pentland trick to speed up computation if the dimensionality is
% larger than the number of samples.
%
% Input:
% data: data is a matrix of an... |
github | kristinbranson/APT-master | padset.m | .m | APT-master/external/JAABA/misc/padset.m | 1,540 | utf_8 | 26081abb61130b2b67eb518fa2f3efe8 | % [x,npadl,npadu] = padset(x,padv,l1,u1,l2,u2,...)
function [x,npadl,npadu] = padset(x,padv,varargin)
% parse arguments
usagestring = 'Usage: padset(x,padv,l1,u1,l2,u2,...)';
nd1 = ndims(x);
if mod(numel(varargin),2) ~= 0 || isempty(varargin),
error(usagestring);
end
isones = cellfun(@(x) x == 1, varargin(1:2:end-1)... |
github | kristinbranson/APT-master | structappend.m | .m | APT-master/external/JAABA/misc/structappend.m | 843 | utf_8 | dfc66a469df4472b8609865c81844968 | % s = structappend(sbase,snew)
% s = structappend(sbase,snew,dim)
function s = structappend(sbase,snew,dim)
if nargin < 3,
if length(sbase) > 1,
dim = argmax(size(sbase));
elseif length(snew) > 1,
dim = argmax(size(snew));
else
dim = 2;
end
end
if isempty(sbase),
s = snew;
else
fnsnew = fieldn... |
github | kristinbranson/APT-master | mod1.m | .m | APT-master/external/JAABA/misc/mod1.m | 160 | utf_8 | 585e8d2eedbb7be512d0c04e2f0dffc1 | % MOD1(x,y) is like MOD(x,y), except that it returns a value between 1
% and y, instead of between 0 and y-1.
function v = mod1(x,y)
v = mod(x-1,y)+1; |
github | kristinbranson/APT-master | hatchfill.m | .m | APT-master/external/JAABA/misc/hatchfill.m | 12,261 | utf_8 | a4fe39a5abf8d7d455b204455ce3894e | function H = hatchfill(A,STYL,ANGLE,SPACING,FACECOL)
%% HATCHFILL Hatching and speckling of patch objects
%% HATCHFILL(A) fills the patch(es) with handle(s) A.
%% A can be a vector of handles or a single handle.
%% If A is a vector, then all objects of A should
%% be part of the same group for predictable resul... |
github | kristinbranson/APT-master | cov2ell.m | .m | APT-master/external/JAABA/misc/cov2ell.m | 416 | utf_8 | 455861e5bc97f7f6da8b5e3e709a0b60 | % inputs
% S are the covariance matrices. S should be 2 x 2 x N, where N is the number of
% covariance matrices.
% outputs:
% a are the semi-major axis lengths
% b are the semi-minor axis lengths
% theta are the orientations
function [a,b,theta] = cov2ell(S)
[lambda,U] = eigs_2x2(S);
a = sqrt(lambda(1,:))*2;
b = sqr... |
github | kristinbranson/APT-master | samplep.m | .m | APT-master/external/JAABA/misc/samplep.m | 449 | utf_8 | df8e57cb9f6aad2515c1205c21888d90 | % sample = samplep(p,n)
% returns n samples, where the probability of i is p(i) for 1 <=i
% <= length(p), 0 otherwise.
function s = samplep(p,n)
% normalize, just in case
p = p(:);
p = normalizep(p);
p(end) = 1;
m = length(p);
% compute the cumulative sum of probabilities
c = cumsum(p);
% choose n random numbers u... |
github | kristinbranson/APT-master | myconv.m | .m | APT-master/external/JAABA/misc/myconv.m | 2,848 | utf_8 | 652070fb23976928050a9b6bd0b41351 | % C = myconv(A,B,...)
% One-dimensional correlation/convolution of vector a with filter B
% Options:
% Type of filtering:
% 'corr': perform correlation [default]
% 'conv': perform convolution
% Output size:
% 'same': output vector C is the central part of the correlation that is
% the same size as A [default]
% 'full':... |
github | kristinbranson/APT-master | axes2cov.m | .m | APT-master/external/JAABA/misc/axes2cov.m | 595 | utf_8 | 51a1341a1f289f0a93fae499a5abbeb3 | %S = axes2cov(a,b,theta)
%
% Input:
% a are the lengths of the semi-major axes
% b are the length of the semi-minor axis
% theta are the angles (ccw from [1,0]? can't remember)
% Output:
% S (2 x 2 x N) is the covariance matrix s.t. two standard deviations
% corresponds to the input ellipse parameters.
function S = ... |
github | kristinbranson/APT-master | ellipseexteriorpixels.m | .m | APT-master/external/JAABA/misc/ellipseexteriorpixels.m | 579 | utf_8 | ec4b8a94441ad9c8f5c3b9fa41bb1888 | % px = ellipseinteriorpixels(im,ell)
function px = ellipseinteriorpixels(im,ell)
[nr,nc,ncolors] = size(im);
% get a bounding box around the ellipse
bb = [ell.y+ell.a*[-1,1],ell.x+ell.a*[-1,1]];
bb([1,3]) = floor(bb([1,3]));
bb([2,4]) = ceil(bb([2,4]));
bb = max(bb,1);
bb(1:2) = min(bb(1:2),nr);
bb(3:4) = min(bb(1:2... |
github | kristinbranson/APT-master | onedimkmeans.m | .m | APT-master/external/JAABA/misc/onedimkmeans.m | 5,525 | utf_8 | 383da6d3ace44528e593c74ccdb9195d | % [mu,cost,idx,threshx] = onedimkmeans(x,k,varargin)
%
% the optimal k-clustering of n 1-dimensional points is computed in
% time O(n^2*k), space O(n^2+n*k)
%
% inputs:
% x: n x 1 vector of one-dimensional data points
% k: number of clusters
% optional:
% 'issorted': true/false, assumes the data is sorted from smalle... |
github | kristinbranson/APT-master | splitext.m | .m | APT-master/external/JAABA/misc/splitext.m | 293 | utf_8 | d366de38695a1c9705f0e2fce8275657 | % [base,ext] = splitext(name)
function [base,ext] = splitext(name)
k = strfind(name,'.');
if isempty(k),
base = name;
ext = '';
return;
end
k = k(end);
j = strfind(name,'/');
if ~isempty(j) && j(end) > k,
base = name;
ext = '';
return;
end
base = name(1:k-1);
ext = name(k:end); |
github | kristinbranson/APT-master | change_value.m | .m | APT-master/external/JAABA/misc/change_value.m | 1,904 | utf_8 | 6d0d132aed5e02b251b9c3c35f9b75fd | %CHANGE_VALUE Change the value assigned to a unique variable in a file
%
% Examples:
% fail = change_value(value)
% fail = change_value(value, variableName)
% fail = change_value(value, variableName, filePath)
%
% Function to change the value assigned to a variable in a text file. The
% assignment must exist alr... |
github | kristinbranson/APT-master | changeaxisunits.m | .m | APT-master/external/JAABA/misc/changeaxisunits.m | 1,482 | utf_8 | 9be4d0879f2cc31559e586e27cc4c915 | % changeaxisunits(factorx,factory)
% changeaxisunits(factorx,factory,hax)
% Changes the units of the x and y axes.
% Suppose the original units of the x axis is frames and the original unit
% of the y-axis is pixels, and we want to change to seconds and
% centimeters, respectively. If a frame is .05 seconds and a pixe... |
github | kristinbranson/APT-master | exportfig.m | .m | APT-master/external/JAABA/misc/exportfig.m | 15,238 | utf_8 | b9ba8df751ba89f023f8ad6d9982bfb0 | function exportfig(varargin)
%EXPORTFIG Export a figure to Encapsulated Postscript.
% EXPORTFIG(H, FILENAME) writes the figure H to FILENAME. H is
% a figure handle and FILENAME is a string that specifies the
% name of the output file.
%
% EXPORTFIG(...,PARAM1,VAL1,PARAM2,VAL2,...) specifies
% parameters th... |
github | kristinbranson/APT-master | structarrayset.m | .m | APT-master/external/JAABA/misc/structarrayset.m | 456 | utf_8 | 2f1b650560014c8ad90a56ac9afb17a4 | % s = structappend(sbase,idx,snew)
function s = structarrayset(sbase,idx,snew)
if isempty(sbase),
s(idx) = snew;
return;
end
fnsnew = fieldnames(snew);
fnsbase = fieldnames(sbase);
fnsmissing = setdiff(fnsnew,fnsbase);
for i = 1:numel(fnsmissing),
fn = fnsmissing{i};
sbase(1).(fn) = [];
end
fnsmissing = setdif... |
github | kristinbranson/APT-master | solve_tril.m | .m | APT-master/external/JAABA/misc/solve_tril.m | 96 | utf_8 | 722a4bcf2ca8abee81d2ff6ea150fa86 | % use the lightspeed version if available -- it is faster
function v = solve_tril(T,b)
v = T\b; |
github | kristinbranson/APT-master | savefig1.m | .m | APT-master/external/JAABA/misc/savefig1.m | 10,975 | utf_8 | fb169a2866e201c57b8e95f22a6eb6a6 | function savefig1(fname, varargin)
% Usage: savefig1(filename, fighdl, format, options)
%
% Saves a pdf, eps, png, jpeg, and/or tiff of the contents of the fighandle's (or current) figure.
% It saves an eps of the figure and the uses Ghostscript to convert to the other formats.
% The result is a cropped, clean pictur... |
github | kristinbranson/APT-master | colormap_image.m | .m | APT-master/external/JAABA/misc/colormap_image.m | 591 | utf_8 | 6d97a0e45bab4e2043ad69719ac46512 | % Irgb = colormap_image(I,c,clim)
function Irgb = colormap_image(I,c,clim)
if nargin < 2 || isempty(c),
c = colormap;
end
if nargin < 3 || isempty(clim),
clim = nan(1,2);
end
if ndims(I) < 2 || ndims(I) > 3,
error('input image must be N x M');
end;
if isnan(clim(1)),
a = min(I(:));
else
a = clim(1);
end
if ... |
github | kristinbranson/APT-master | gmm_lines_2d.m | .m | APT-master/external/JAABA/misc/gmm_lines_2d.m | 1,771 | utf_8 | c1d7b567e90b7bfffdaa7db67e873c84 | % [mu,S,priors] = mygmm(X,k,...)
% Input:
% X: N x D matrix of N D-dimensional data points
% k: number of clusters
% optional:
% 'Replicates' = 1
% 'CovarType' = 'full'
% 'display' = -1
% 'precision' = .0001
% 'ResetCovar' = 1
% 'MaxIters' = 100
% 'Start' = 'furthestfirst'
% 'distance' = 'sqEuclidean'
% 'weights' = []
... |
github | kristinbranson/APT-master | drawfly.m | .m | APT-master/external/JAABA/misc/drawfly.m | 1,180 | utf_8 | 34f047deb5dd0ff05124608a0dcb84c5 | % h = drawfly(trk,varargin)
% h = drawfly(x,y,theta,quartermaj,quartermin,varargin)
% draw triangle corresponding to fly position
% extra arguments will be fed to patch
function varargout = drawfly(x,y,varargin)
% draw an isosceles triangle with center (x,y)
% with rotation theta
% with height maj*4
% with base min*4
... |
github | kristinbranson/APT-master | getstructarrayfield.m | .m | APT-master/external/JAABA/misc/getstructarrayfield.m | 573 | utf_8 | 3de6423d857bdf944dae6ede383f35f5 | % out = getstructarrayfield(s,field)
% s: array of structures
% field: name of a field of every s(i)
% out: concatenation of all s(i).(field)
function out = getstructarrayfield(s,field,varargin)
numericscalar = myparse(varargin,...
'numericscalar',false);
if length(s) == 1,
out = s.(field);
return;
end
out = ... |
github | kristinbranson/APT-master | getframe_invisible.m | .m | APT-master/external/JAABA/misc/getframe_invisible.m | 3,220 | utf_8 | e869da5b0d095f6269297d91c5012cf8 | function img = getframe_invisible(img,sz,GRAYBORDER)
if nargin < 1,
img = get(0,'currentfigure');
if isempty(img),
error('No window open');
end
end
issize = nargin == 2 && ~isempty(sz);
if ~ishandle(img)
error('Input is not a handle');
end
if nargin < 3,
GRAYBORDER = 204;
end
inputType = getInputType(... |
github | kristinbranson/APT-master | filenamesplit.m | .m | APT-master/external/JAABA/misc/filenamesplit.m | 305 | utf_8 | 35f232078a349f952a8c3f76d3dc3e94 | % [path,base] = filenamesplit(name)
function [path,base] = filenamesplit(name)
while 1,
if name(end) == filesep,
name = name(1:end-1);
else
break;
end
end
k = strfind(name,filesep);
if isempty(k),
path = '';
base = name;
return;
end
path = name(1:k(end));
base = name(k(end)+1:end); |
github | kristinbranson/APT-master | SaveFigLotsOfWays.m | .m | APT-master/external/JAABA/misc/SaveFigLotsOfWays.m | 1,473 | utf_8 | bcce4201febdc2b8d27cbb38c692839d | % outfilenames = SaveFigLotsOfWays(hfig,basename)
function outfilenames = SaveFigLotsOfWays(hfig,basename,formats)
if exist('savefig1')
savefigfun = @savefig1;
elseif exist('savefig_pa')
savefigfun = @savefig_pa;
else
savefigfun = @savefig;
end
if nargin < 3,
formats = {'fig','png','pdf','svg'};
... |
github | kristinbranson/APT-master | get_interval_ends.m | .m | APT-master/external/JAABA/misc/get_interval_ends.m | 363 | utf_8 | 8c426868c0ecabd2478dec9ddb724da6 | % [starts,ends] = get_interval_ends(x)
function [starts,ends] = get_interval_ends(x)
if size(x,1) > size(x,2),
isrow = false;
else
isrow = true;
end
x = [false;x(:);false];
% find starts and ends of sequences of 1s
starts = find((x(2:end)~=0) & (x(1:end-1)==0));
ends = find((x(2:end)==0) & (x(1:end-1)~=0));
if isr... |
github | kristinbranson/APT-master | read_array_int.m | .m | APT-master/external/JAABA/misc/read_array_int.m | 561 | utf_8 | ce8a92b3b77795eb5215432fea0a1ed0 |
function A = read_array(filename);
fid = fopen(filename,'r');
dim = fread(fid,1,'uint')
for i = 1:dim
d(i) = fread(fid,1,'uint');
end;
[B,count] = fread(fid,prod(d),'int');
B = reshape(B,fliplr(d));
dim = fread(fid,1,'uint')
if (~feof(fid)) %collection of arrays.
A{1} = B;
ct = 2;
while (~feof(fid))
for ... |
github | kristinbranson/APT-master | mykmeans.m | .m | APT-master/external/JAABA/misc/mykmeans.m | 4,344 | utf_8 | 530479e0a15ac4a94ae37bad2d2ab3be | % KMEANS K-means clustering.
% IDX = KMEANS(X, K) partitions the points in the N-by-P data matrix
% X into K clusters. This partition minimizes the sum, over all
% clusters, of the within-cluster sums of point-to-cluster-centroid
% distances. Rows of X correspond to points, columns correspond to
% variables. KMEANS ... |
github | kristinbranson/APT-master | ellipseinteriorpixels.m | .m | APT-master/external/JAABA/misc/ellipseinteriorpixels.m | 579 | utf_8 | ec4b8a94441ad9c8f5c3b9fa41bb1888 | % px = ellipseinteriorpixels(im,ell)
function px = ellipseinteriorpixels(im,ell)
[nr,nc,ncolors] = size(im);
% get a bounding box around the ellipse
bb = [ell.y+ell.a*[-1,1],ell.x+ell.a*[-1,1]];
bb([1,3]) = floor(bb([1,3]));
bb([2,4]) = ceil(bb([2,4]));
bb = max(bb,1);
bb(1:2) = min(bb(1:2),nr);
bb(3:4) = min(bb(1:2... |
github | kristinbranson/APT-master | uipickfiles.m | .m | APT-master/external/JAABA/misc/uipickfiles.m | 50,525 | utf_8 | 963711ab78a22bac554d4f3ac91a8a9c | function out = uipickfiles(varargin)
%uipickfiles: GUI program to select files and/or folders.
%
% Syntax:
% files = uipickfiles('PropertyName',PropertyValue,...)
%
% The current folder can be changed by operating in the file navigator:
% double-clicking on a folder in the list or pressing Enter to move furthe... |
github | kristinbranson/APT-master | label_edges.m | .m | APT-master/external/JAABA/misc/label_edges.m | 14,088 | utf_8 | 8b1e4f81b0aab1a78aad361dba1a3554 | % [BOUNDX,BOUNDY] = LABEL_EDGES(RGBI)
%
% Input: RGBI is a RGB image we want to label edges in.
% This program allows the user to input any number of closed
% edges. Here is the interactive usage:
% label_edges commands:
% LEFT CLICK with the mouse to add a new point.
% RIGHT CLICK with the mouse to add a new point on... |
github | kristinbranson/APT-master | assignmentallpossible.m | .m | APT-master/external/JAABA/misc/assignmentallpossible.m | 4,063 | utf_8 | dba1e3edd63c8572495fdbfc55c4508e | function [assignment, cost] = assignmentallpossible(distMatrix)
%ASSIGNMENTALLPOSSIBLE Compute solution of assignment problem
% ASSIGNMENTALLPOSSIBLE(DISTMATRIX) computes the optimal assignment for the
% given rectangular distance (or weight) matrix, for example the assignment
% of tracks (in rows) to observati... |
github | kristinbranson/APT-master | gridaxes.m | .m | APT-master/external/JAABA/misc/gridaxes.m | 342 | utf_8 | 42b0f01f126dfa35f2bb4d4623e957f1 | % hax = gridaxes(r0,r1,c0,c1)
function hax = gridaxes(r0,r1,c0,c1)
clf;
nr = length(r0);
nc = length(c0);
hax = zeros(nr,nc);
for r = 1:nr,
top = 1 - r0(r);
height = r1(r) - r0(r);
bottom = top - height;
for c = 1:nc,
left = c0(c);
width = c1(c) - c0(c);
hax(r,c) = axes('position',[left,bottom,wid... |
github | kristinbranson/APT-master | getframe_initialize.m | .m | APT-master/external/JAABA/misc/getframe_initialize.m | 1,788 | utf_8 | 602f2a422928fbf3862cac29121fd305 | function gfdata = getframe_initialize(haxes)
inputType = getInputType(haxes);
if strcmp(inputType,'figure'),
hfig = haxes;
haxes = get(hfig,'children');
if length(haxes) > 1,
haxes = hfig;
%error('Figure has multiple children, please input handle of axes instead of figure');
end
else
hfig = g... |
github | kristinbranson/APT-master | choose_orientations2.m | .m | APT-master/external/JAABA/misc/choose_orientations2.m | 2,438 | utf_8 | 0f971b1ba8d3ce93809819c952e663ae | % theta = choose_orientations2(x,y,phi,wtheta,wphi)
%
% we will set the orientation to theta_t = phi_t + s_t * pi
% we want to choose s_t to minimize
% \sum_t cost(s_t|s_{t-1})
% cost(s_t|s_{t-1}) = [wtheta_t*d(\theta_t,\theta_{t-1}) +
% wphi(||v_t||^2)*d(\theta_t,angle(v_t))]
%
% we will find the ... |
github | kristinbranson/APT-master | samplepnoreplace.m | .m | APT-master/external/JAABA/misc/samplepnoreplace.m | 968 | utf_8 | b02117f7928fa6ebdda62d254de4ed8b | % i'm not sure if this is exactly correct, but it is close enough
function samples = samplepnoreplace(x,k,w,maxiter)
if ~exist('maxiter','var'),
maxiter = k;
end;
maxiter = min(maxiter,k);
if isscalar(x),
n = x;
x = 1:n;
else
n = length(x);
end;
if length(w) ~= n,
error('length of weights must be equivale... |
github | kristinbranson/APT-master | myhist.m | .m | APT-master/external/JAABA/misc/myhist.m | 2,451 | utf_8 | b1823de5a9dfd367af8531f8f945b591 | function [no,xo,idx] = myhist(varargin)
% almost the same as hist, except it can take weights
% Parse possible Axes input
i = find(strcmpi(varargin,'weights'));
if ~isempty(i),
weights = varargin{i(end)+1};
varargin([i,i+1]) = [];
end
error(nargchk(1,inf,nargin,'struct'));
[cax,args,nargs] = axescheck(varargin{:})... |
github | kristinbranson/APT-master | get2ptline.m | .m | APT-master/external/JAABA/misc/get2ptline.m | 2,778 | utf_8 | 856629a8511f431cc73c1b47db603330 | function [position,hline] = get2ptline(varargin)
if nargin < 1,
hax = gca;
hfig = gcf;
else
h = varargin{1};
htype = get(h,'type');
if strcmpi(htype,'figure'),
hfig = h;
hax = get(hfig,'CurrentAxes');
elseif strcmpi(htype,'axes'),
hax = h;
hfig = get(hax,'parent');
else
error('Parent ... |
github | kristinbranson/APT-master | mywaitbar.m | .m | APT-master/external/JAABA/misc/mywaitbar.m | 1,198 | utf_8 | 0497d1e4d2a6140f1b4ec47821e2d6f7 | % slightly more robust version of matlab's waitbar
function varargout = mywaitbar(varargin)
if nargin >= 2 && ischar(varargin{end-1}) && ...
strcmpi(varargin{end-1},'interpreter') && ...
ischar(varargin{end}),
interpreter = varargin{end};
leftovers = varargin(1:end-2);
else
interpreter = 0;
l... |
github | kristinbranson/APT-master | laprint.m | .m | APT-master/external/JAABA/misc/laprint.m | 97,328 | utf_8 | efe2bcc7cf5f0e477f266dc96e24d857 | function laprint(figno,filename,varargin)
%LAPRINT prints a figure for inclusion in LaTeX documents.
% LaPrint creates an eps-file and a tex-file. The tex-file contains
% the annotation of the figure such as titles, labels and texts. The
% eps-file contains the non-text part of the figure as well as the
% position... |
github | kristinbranson/APT-master | cell2str.m | .m | APT-master/external/JAABA/misc/cell2str.m | 248 | utf_8 | 21b92ab601a89bef352265aa69f511b2 | function s = cell2str(c)
s = '';
if isempty(c),
return;
end
sc = cellfun(@cell2str_helper,c,'UniformOutput',false);
s = sprintf('%s_',sc{:});
s = s(1:end-1);
function ms = cell2str_helper(m)
if ischar(m),
ms = m;
else
ms = mat2str(m);
end |
github | kristinbranson/APT-master | assignmentoptimal.m | .m | APT-master/external/JAABA/misc/assignmentoptimal.m | 7,798 | utf_8 | 4a74fc423a09491de8a7ca109ec5d472 | function [assignment, cost] = assignmentoptimal(distMatrix)
%ASSIGNMENTOPTIMAL Compute optimal assignment by Munkres algorithm
% ASSIGNMENTOPTIMAL(DISTMATRIX) computes the optimal assignment for the
% given rectangular distance (or weight) matrix, for example the assignment
% of tracks (in rows) to observations ... |
github | kristinbranson/APT-master | waitforkeypress.m | .m | APT-master/external/JAABA/misc/waitforkeypress.m | 892 | utf_8 | fd47108cf0430aa6d7dfe5db0e953dc5 | % key = waitforkeypress(keys)
function key = waitforkeypress(keys)
keynums = zeros(size(keys));
for i = 1:length(keys),
if length(keys{i}) == 1,
keynums(i) = double(keys{i});
elseif strcmpi(keys{i},'enter') || strcmpi(keys{i},'return'),
keynums(i) = 13;
elseif strcmpi(keys{i},'backspace'),
keynums(i)... |
github | kristinbranson/APT-master | dist2many2one.m | .m | APT-master/external/JAABA/misc/dist2many2one.m | 681 | utf_8 | 5cd9b2473baacda3ef4ba2f5f6dc1996 | % D = dist2many2one( X , mu )
%
% inputs: X is an n x d matrix
% mu is a 1 x d vector
% output: D is a n x 1 vector where D(i) is the squared Euclidean
% distance between X(i,:) and mu.
function D = dist2many2one(X,mu)
% check input sizes
if ndims(X) > 2 | ndims(mu) > 2,
error('input X should be n x d, inp... |
github | kristinbranson/APT-master | mean_cov.m | .m | APT-master/external/JAABA/misc/mean_cov.m | 170 | utf_8 | 323e17fd3f7d2620a9a501f0ae06c25b | % [mu,S] = mean_cov(x)
% x is n x d
function [mu,S] = mean_cov(x)
%[n,d] = size(x);
z = size(x,1);
mu = sum(x,1)/z;
diffs = bsxfun(@minus,x,mu);
S = (diffs'*diffs)/z;
|
github | kristinbranson/APT-master | setdiag.m | .m | APT-master/external/JAABA/misc/setdiag.m | 632 | utf_8 | 27b64d7ed2af7153d23221f68c1809f1 | % M = setdiag(M,v,[k])
% sets diagonal k of square matrix M to v
% by default, k = 0
%
% examples:
% >> setdiag(rand(2),inf)
%
% ans =
%
% Inf 0.0746
% 0.5355 Inf
%
% >> setdiag(rand(2),inf,1)
%
% ans =
%
% 0.6837 Inf
% 0.3338 0.9480
% >> setdiag(rand(3),[1,2,3])
%
% ans =
%
% ... |
github | kristinbranson/APT-master | set_interval_ends.m | .m | APT-master/external/JAABA/misc/set_interval_ends.m | 199 | utf_8 | ce41d5825859108b27b83db610523a49 | % bw = set_interval_ends(t0,t1,n)
function bw = set_interval_ends(t0,t1,n)
if ~exist('n','var')
n = t1(end);
end
bw = false(1,n);
for i = 1:length(t0),
bw(min(t0(i),n):min(t1(i),n)) = true;
end |
github | kristinbranson/APT-master | modrange.m | .m | APT-master/external/JAABA/misc/modrange.m | 446 | utf_8 | 49c9e63434f4f413c393a843ceb74319 | % out = modrange(in, lower, upper)
% this function puts the n-d array in into the range [lower,upper).
% examples:
% modrange(100,100,200) returns 100
% modrange(300,100,200) returns 100
% modrange(3*pi/2,-pi,pi) returns -pi/2
% modrange(1,1,101) returns 1
% modrange(100,1,101) returns 1
% modrange(101,1,101) returns 1... |
github | kristinbranson/APT-master | padgrab.m | .m | APT-master/external/JAABA/misc/padgrab.m | 1,580 | utf_8 | 6ec97b0a4d4d22b30671fba146d48a5e | % [y,npadl,npadu] = padgrab(x,padv,l1,u1,l2,u2,...)
function [y,npadl,npadu] = padgrab(x,padv,varargin)
% parse arguments
usagestring = 'Usage: padgrab(x,padv,l1,u1,l2,u2,...)';
nd1 = ndims(x);
if mod(numel(varargin),2) ~= 0 || isempty(varargin),
error(usagestring);
end
isones = cellfun(@(x) x == 1, varargin(1:2:end... |
github | kristinbranson/APT-master | write_array.m | .m | APT-master/external/JAABA/misc/write_array.m | 348 | utf_8 | 9c52a0788d4590cb92db78ad13a2b183 |
function write_array(filename,A);
fid = fopen(filename,'w');
if (~iscell(A))
B = A;
clear A;
A{1} = B;
end;
for k = 1:length(A)
d = size(A{k});
dim = length(d);
fwrite(fid,dim,'uint')
for i = dim:-1:1,
fwrite(fid,d(i),'uint');
end;
% Z = reshape(A{k}',fliplr(d));
Z = A{k};
fwrite(fid,Z(:),'fl... |
github | kristinbranson/APT-master | saveaspdf_JAABA.m | .m | APT-master/external/JAABA/misc/saveaspdf_JAABA.m | 552 | utf_8 | a43eac0fecdc9c76d64f3452b7f2bc15 | % saveaspdf(fig,filename)
function saveaspdf_JAABA(varargin)
if nargin < 1,
error('Usage: saveaspdf_JAABA(fig,filename)');
end
if ischar(varargin{1}),
fig = gcf;
filename = varargin{1};
args = varargin(2:end);
elseif nargin < 2,
error('Usage: saveaspdf_JAABA(fig,filename)');
else
fig = varargin{1};
file... |
github | kristinbranson/APT-master | myginput.m | .m | APT-master/external/JAABA/misc/myginput.m | 5,089 | utf_8 | 94a8ac305edfb30f3413afec8317583f | function [out1,out2,out3] = myginput(arg1)
% almost the same as matlab's ginput, but does not change the mouse pointer
out1 = []; out2 = []; out3 = []; y = [];
c = computer;
if ~strcmp(c(1:2),'PC')
tp = get(0,'TerminalProtocol');
else
tp = 'micro';
end
if ~strcmp(tp,'none') & ~strcmp(tp,'x') & ~strcmp(tp,'micr... |
github | kristinbranson/APT-master | changelogaxisunits.m | .m | APT-master/external/JAABA/misc/changelogaxisunits.m | 897 | utf_8 | 39e32939b767127eed6377c14a81dca6 | % changeaxisunits(factorx,factory)
% changeaxisunits(factorx,factory,hax)
% Changes the units of the x and y axes.
% Suppose the original units of the x axis is frames and the original unit
% of the y-axis is pixels, and we want to change to seconds and
% centimeters, respectively. If a frame is .05 seconds and a pixe... |
github | kristinbranson/APT-master | ellipseintextpixels.m | .m | APT-master/external/JAABA/misc/ellipseintextpixels.m | 1,537 | utf_8 | ab73bed049e41fec88a6a60dadf438f4 | % [intpx,extpx] = ellipseintextpixels(im,ells,r0,r1,r2)
function [intpx,extpx] = ellipseintextpixels(im,ells,r0,r1,r2,debug)
if ~exist('debug','var'),
debug = false;
end
[nr,nc,ncolors] = size(im);
bw = false(nr,nc);
if r0 < 0,
se0 = strel('disk',-r0);
end
if r1 > 0,
se1 = strel('disk',r1);
end
if r2 > 0,
se... |
github | kristinbranson/APT-master | conic_standard_form.m | .m | APT-master/external/JAABA/misc/conic_standard_form.m | 1,580 | utf_8 | 2f84c68709fc8c4a91675d9033d8370c | % conic_standard_form(A,B,C,D,E,F)
% A * x^2 + B * x * y + C * y^2 + D * x + E * y + F = 0
% returns the rotation theta and translation (x0,y0) required to put the
% equation in the form
% A * x^2 + B*x*y + C * y^2 + D*x + E*y + F = 0
% if not a parabola, then B = D = E = 0 and F = -1
% if a parabola then B = F = 0 and... |
github | kristinbranson/APT-master | ellipse_to_bounding_box.m | .m | APT-master/external/JAABA/misc/ellipse_to_bounding_box.m | 648 | utf_8 | f91748ed77be9425e73afa186e687d48 | % [x1,x2,y1,y2] = ellipse_to_bounding_box(x,y,a,b,theta)
function [x1,x2,y1,y2] = ellipse_to_bounding_box(x,y,a,b,theta)
if abs(cos(theta)) < eps,
x1 = x-b;
x2 = x+b;
y1 = y-a;
y2 = y+a;
elseif abs(cos(theta)) > 1 - eps,
x1 = x-a;
x2 = x+a;
y1 = y-b;
y2 = y+b;
else
phix = ... |
github | kristinbranson/APT-master | ellipsepoints.m | .m | APT-master/external/JAABA/misc/ellipsepoints.m | 1,006 | utf_8 | 12ce3b84477348593ff680a5d176b849 | % [X,Y] = ellipsepoints(a,b,x0,y0,phi)
function [X,Y,theta] = ellipsepoints(a,b,x0,y0,phi,npoints)
if (nargin < 2)||(nargin > 6),
error('Usage: [X,Y,theta] = ellipsepoints(a,b,x0,y0,phi,[npoints])');
elseif nargin == 2
x0 = 0; y0 = 0;
phi = 0;
elseif nargin == 3
phi = x0;
x0 = 0; y0 =... |
github | kristinbranson/APT-master | angledist.m | .m | APT-master/external/JAABA/misc/angledist.m | 211 | utf_8 | ad49edf3920ee8e13173481073f316df | % d = angledist(theta1,theta2,[modpi=false])
function d = angledist(theta1,theta2,modpi)
if nargin < 3 || ~modpi,
d = abs(mod(theta1-theta2+pi,2*pi)-pi);
else
d = abs(mod(theta1-theta2+pi/2,pi)-pi/2);
end
|
github | kristinbranson/APT-master | axisalmosttight.m | .m | APT-master/external/JAABA/misc/axisalmosttight.m | 627 | utf_8 | 0dbf8be1b940482f8424accf5edc7d61 | % axisalmosttight(border,varargin)
function axisalmosttight(border,varargin)
if nargin < 1 || isempty(border),
border = 1/20;
end
if numel(varargin)>=1,
hax = varargin{1};
else
hax = gca;
end
ax = [inf,-inf,inf,-inf];
for i = 1:numel(hax),
axis(hax(i),'tight');
ax1 = axis(hax);
nd = numel(ax1)/2;
if i ... |
github | kristinbranson/APT-master | RescaleToIndex.m | .m | APT-master/external/JAABA/misc/RescaleToIndex.m | 202 | utf_8 | 77dc5367cb572c5d4586a9b2357248f5 | % idx = RescaleToIndex(x,n,l,u)
function idx = RescaleToIndex(x,n,l,u)
if nargin < 3,
l = min(x(:));
end
if nargin < 4,
u = max(x(:));
end
r = u-l;
w = r/n;
idx = max(1,min(floor((x-l)/w)+1,n));
|
github | kristinbranson/APT-master | choose_orientations_larvae.m | .m | APT-master/external/JAABA/misc/choose_orientations_larvae.m | 4,670 | utf_8 | 606d8e4ad09e9885a16e854fdfbb5e49 | % doflip = choose_orientations(spinex,spiney,[movement_weight=.5,[min_segment_length=5]])
%
% chooses whether to flip or not flip the spine in order to minimize:
% \sum_t cost(s_t|s_{t-1})
% cost(s_t|s_{t-1}) = movement_weight*||spine_t(s_t)-spine_{t-1}(s_{t-1})|| +
% (1-movement_weight)*< segmentdi... |
github | kristinbranson/APT-master | choose_orientations.m | .m | APT-master/external/JAABA/misc/choose_orientations.m | 2,758 | utf_8 | b0e537be129bb2f6d162d3a81a8f3cdd | % theta = choose_orientations(x,y,phi,velocity_angle_weight,[max_velocity_angle_weight=1])
%
% we will set the orientation to theta_t = phi_t + s_t * pi
% we want to choose s_t to minimize
% \sum_t cost(s_t|s_{t-1})
% cost(s_t|s_{t-1}) = [(1 - w(||v_t||^2))*d(\theta_t,\theta_{t-1}) +
% w(||v_t||^2)... |
github | kristinbranson/APT-master | thresholdBSE.m | .m | APT-master/external/JAABA/misc/thresholdBSE.m | 8,656 | utf_8 | 1ea2b50b1aa7fb612142db7e7db55d98 | function [eout,thresh] = thresholdBSE(a,mag,varargin)
%COLOREDGE Find edges in intensity image.
% EDGE takes a color image I as its input, and returns a
% binary image BW of the same size as I, with 1's where the function
% finds edges in I and 0's elsewhere.
%
% COLOREDGE uses the Canny method for edge detec... |
github | kristinbranson/APT-master | mysavefig.m | .m | APT-master/external/JAABA/misc/mysavefig.m | 17,566 | utf_8 | a8ef3e29b6d3ec8c4bdaee86b31ff363 | function mysavefig(fname, varargin)
% Usage: savefig(filename, fighdl, format, options)
%
% Saves a pdf, eps, png, jpeg, and/or tiff of the contents of the fighandle's (or current) figure.
% It saves an eps of the figure and the uses Ghostscript to convert to the other formats.
% The result is a cropped, clean pictur... |
github | kristinbranson/APT-master | padgrab2.m | .m | APT-master/external/JAABA/misc/padgrab2.m | 2,010 | utf_8 | 5da7d56b812168f048158e0526a1ab46 | % [y,npadl,npadu] = padgrab(x,padv,l1,u1,l2,u2,...)
%function [y,npadl,npadu] = padgrab(x,padv,varargin)
%BJA: hard-coded for 6 args to get rid of slow varargin cell array and slow padarray()
function [y,npadl,npadu] = padgrab2(x,padv,l1,u1,l2,u2)
% parse arguments
usagestring = 'Usage: padgrab2(x,padv,l1,u1,l2,u2,...... |
github | kristinbranson/APT-master | drawflyo.m | .m | APT-master/external/JAABA/misc/drawflyo.m | 1,097 | utf_8 | a6e75de67e31ba04480c20624e802422 | % h = drawflyo(trk,varargin)
% h = drawflyo(x,y,theta,quartermaj,quartermin,varargin)
% draw triangle corresponding to fly position
% extra arguments will be fed to plot
function varargout = drawflyo(x,y,varargin)
% draw an isosceles triangle with center (x,y)
% with rotation theta
% with height maj*4
% with base min*... |
github | kristinbranson/APT-master | read_array.m | .m | APT-master/external/JAABA/misc/read_array.m | 567 | utf_8 | 4c1bf610e469bfb2b0bd7735b7ec054b |
function A = read_array(filename);
fid = fopen(filename,'r');
dim = fread(fid,1,'uint');
for i = 1:dim
d(i) = fread(fid,1,'uint');
end;
[B,count] = fread(fid,prod(d),'float');
B = reshape(B,fliplr(d));
dim = fread(fid,1,'uint');
if (~feof(fid)) %collection of arrays.
A{1} = B;
ct = 2;
while (~feof(fid))
... |
github | kristinbranson/APT-master | mychmod.m | .m | APT-master/external/JAABA/misc/mychmod.m | 647 | utf_8 | 701b27393b0a3dd0f95490272bc697f6 | function mychmod(varargin)
if nargin < 1,
d = '.';
else
d = varargin{1};
end
if nargin < 2,
args = {'g+rw'};
else
args = varargin(2:end);
end
if ~exist(d,'file'),
error('File/directory %s does not exist',d);
end
mychmod1(d,args);
function mychmod1(d,args)
try
cmd = ['chmod ',sprintf('%s ',args{:}),'... |
github | kristinbranson/APT-master | drawellipse.m | .m | APT-master/external/JAABA/misc/drawellipse.m | 1,310 | utf_8 | cc64b5fd3f6bae1d2cb507ebc0dfedf1 | % h = drawellipse(trk,varargin)
% h = drawellipse(x,y,theta,semimaj,semimin,varargin)
% extra arguments will be fed to plot
function varargout = drawellipse(x,varargin)
% draw an isosceles triangle with center (x,y)
% with rotation theta
% with height maj*4
% with base min*4
if isstruct(x),
fly = x;
if nargin == ... |
github | kristinbranson/APT-master | coloredge.m | .m | APT-master/external/JAABA/misc/coloredge.m | 8,629 | utf_8 | c2548ec88967b3ca40fe707671259c74 | function [eout,thresh] = coloredge(a,varargin)
%COLOREDGE Find edges in intensity image.
% EDGE takes a color image I as its input, and returns a
% binary image BW of the same size as I, with 1's where the function
% finds edges in I and 0's elsewhere.
%
% COLOREDGE uses the Canny method for edge detection:
%... |
github | kristinbranson/APT-master | weighted_mean.m | .m | APT-master/external/JAABA/misc/weighted_mean.m | 192 | utf_8 | 7c33eba2895e678d1ce67c4852f00aed | % mu = weighted_mean(x,w)
% x is n x d, w is n x 1
function mu = weighted_mean(x,w)
%[n,d] = size(x);
z = sum(w);
x((isnan(x)|isinf(x)) & (w(:)==0)) = 0;
mu = sum(bsxfun(@times,x,w(:)),1)/z; |
github | kristinbranson/APT-master | houghcirclepeaks.m | .m | APT-master/external/JAABA/misc/houghcirclepeaks.m | 3,246 | utf_8 | 0671ecf09029526e6b5033f774df304d | function peaks = houghcirclepeaks(varargin)
%HOUGHCIRCLEPEAKS Identify peaks in 3-D accumulator for Hough
%transform.
% PEAKS = HOUGHCIRCLEPEAKS(H,NUMPEAKS) locates peaks in the Hough
% transform matrix, H, generated by the HOUGHCIRCLES
% function. NUMPEAKS specifies the maximum number of peaks to
% identify. ... |
github | kristinbranson/APT-master | avitosbfmf.m | .m | APT-master/external/JAABA/filehandling/avitosbfmf.m | 9,802 | utf_8 | 0e97f525b7ef82e892958cc62067ad61 | % [sbfmfnames,rois] = avitosbfmf(...)
%
% Inputs an AVI movie and converts to an SBFMF movie.
% Also allows user to specify regions of interest,
% in which case each region of interest is saved to a
% different SBFMF.
%
% Usage:
% The parameters to avitosbfmf can be specified as pairs
% consisting of a string speci... |
github | kristinbranson/APT-master | get_readframe_fcn.m | .m | APT-master/external/JAABA/filehandling/get_readframe_fcn.m | 14,902 | utf_8 | 4ff3930c23e2888f632b1834e42ec6af | % [readframe,nframes,fid,headerinfo] = get_readframe_fcn(filename)
% get_readframe_fcn inputs the name of a video, opens this video, and creates a
% function that can be used for random access to frames in the video. it can
% input files of type fmf, sbfmf, and avi. if videoio is installed on your
% machine, then get_r... |
github | kristinbranson/APT-master | mmfwritertrans.m | .m | APT-master/external/JAABA/filehandling/mmfwritertrans.m | 5,005 | utf_8 | b987e35729188c46a0e67cd46ea236a0 | %mmf writer
function [keyframes,nframes]=mmfwritertrans(inputfile,outputfile,obj,firstframe,lastframe)
%obj=VideoReader(inputfile);
foutput=fopen(outputfile,'wb');
%load text
ftexto=fopen('/groups/visitors/home/albam/Desktop/mmfreader/text.text');
texto=[];
for i=1:15
linea=fgets(ftexto);
texto=[texto linea];
end
%w... |
github | kristinbranson/APT-master | read_ann2.m | .m | APT-master/external/JAABA/filehandling/read_ann2.m | 4,317 | utf_8 | eb81a2de46e46899b9f194914954e5dc | % [param1,param2,...] = read_ann2(filename,'param1','param2',...)
%
% params:
%
% trx: trajectories
%
% version, bg_type, n_bg_std_thresh, n_bg_std_thresh_low, bg_std_min,
% bg_std_max n_bg_frames, min_nonarena, max_nonarena, arena_center_x,
% arena_center_y, arena_radius, do_set_circular_arena, bg_algorithm,
% backgro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.