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 | alcu/sms-master | unpadn.m | .m | sms-master/irt/utilities/unpadn.m | 818 | utf_8 | efcd912abfb2bb3205ef2bc3c72ff01c | function out = unpadn(mat, newdim)
%|function out = unpadn(mat, newdim)
%| pad old to newdim, preserving 'center point'
if nargin == 1 && streq(mat, 'test'), unpadn_test, return, end
if nargin < 2, error(mfilename), help(mfilename), end
olddim = size(mat);
if any(newdim > olddim), error('must be smaller'), end
idx ... |
github | alcu/sms-master | isvar.m | .m | sms-master/irt/utilities/isvar.m | 1,046 | utf_8 | 1c4ab9cfce881a1a785ede660f1a49a3 | %|function tf = isvar(name)
%|
%| determine if "name" is a variable in the caller's workspace.
%|
%| if argument is of the form 'name.field' or 'name.field1.field2' etc.
%| then this uses isfield(st, 'field') recursively as needed
%|
%| Copyright 2000-01-01, Jeff Fessler, University of Michigan
%| modified 2010-04-21 t... |
github | alcu/sms-master | dft_sym_check.m | .m | sms-master/irt/utilities/dft_sym_check.m | 1,133 | utf_8 | 0c88b2192a03b4a602be0b1e654d48c9 | function dft_sym_check(xk, varargin)
%|function dft_sym_check(xk)
%| see if array xk (usually containing DFT coefficients)
%| obeys the conjugate symmetry conditions expected
%| for its (inverse) DFT to be real.
if nargin < 1, help(mfilename), error(mfilename), end
if nargin == 1 && streq(xk, 'test'), dft_sym_check_... |
github | alcu/sms-master | dsingle.m | .m | sms-master/irt/utilities/dsingle.m | 320 | utf_8 | 131f14ecc3813385227fdb653e79b58b | function [varargout] = dsingle(varargin)
%function y = dsingle(x)
% truncate a (possibly) double precision value to single precision,
% then convert back to "double" using double6:
% y = double6(single(x));
for ii=1:nargin
varargout{ii} = dsingle1(varargin{ii});
end
function y = dsingle1(x)
y = double6(single(x));
|
github | alcu/sms-master | ir_bspline_basis.m | .m | sms-master/irt/utilities/ir_bspline_basis.m | 1,613 | utf_8 | 71dcabbbdc1bd0ec7eef85f60eea1750 | function out = ir_bspline_basis(t, k, ti)
%function out = ir_bspline_basis(t, k, ti)
%|
%| Return B-spline basis of order k >= 0, for knots ti, at locations t.
%| This is useful for didactic plotting and small problems
%| but is not efficient (compute or memory) for large problems.
%|
%| in
%| t [M 1] values at which... |
github | alcu/sms-master | jf_equal.m | .m | sms-master/irt/utilities/jf_equal.m | 4,616 | utf_8 | 7ce82f61e30ea40f34cec3863cecd53c | function yn = jf_equal(a, b, varargin)
%|function yn = jf_equal(a, b, varargin)
%|
%| verify that the two arguments are equal.
%| if not, print informative error message.
%| See also: equivs
%| note: to compare objects, use jf_equal(struct(a), struct(b))
%|
%| option
%| 'what' 'warn' 'fail' 'silent'
%| default: ... |
github | alcu/sms-master | hist_equal.m | .m | sms-master/irt/utilities/hist_equal.m | 2,486 | utf_8 | 6c2519a67e007b658b934393abf3cc25 | function [nk, center] = hist_equal(data, ncent, varargin)
%|function [nk, center] = hist_equal(data, ncent, varargin)
%|
%| fast histogram of multidimensional data into equally-spaced bins
%| todo: accumarray?
%|
%| in
%| data [N M] data values to be binned (M-dimensional)
%| ncent [1 M] # of centroids for each dim... |
github | alcu/sms-master | fwhm1.m | .m | sms-master/irt/utilities/fwhm1.m | 2,232 | utf_8 | 6c1ec1b60ba8ca217fcc0a6eaa5c6ff0 | function [fw, hr, hl] = fwhm1(psfs, varargin)
%|function [fw, hr, hl] = fwhm1(psfs, options)
%|
%| compute fwhm of point-spread function centered at pixel imid
%| and half-right width and half-left width (fw = hr + hl)
%|
%| in
%| psfs [np nc] column psf(s)
%|
%| option
%| imid [1] which pixel is the middle (default:... |
github | alcu/sms-master | ndgrid_jf.m | .m | sms-master/irt/utilities/ndgrid_jf.m | 1,825 | utf_8 | 81141c55ae5b933826ba00a65b23fcc3 | function out = ndgrid_jf(otype, varargin)
%function out = ndgrid_jf('cell', varargin)
%function out = ndgrid_jf('mat', varargin)
%| version of ndgrid where output is cell array (default) or large matrix
%| think:
%| [out{1} ... out{M}] = ndgrid_cell(in{1}, ..., in{M});
%| also supported is ndgrid_jf('mat'|'cell', {in1... |
github | alcu/sms-master | kde_pmf_width.m | .m | sms-master/irt/utilities/kde_pmf_width.m | 1,562 | utf_8 | dd7297e5a902121f9b1a4d8ec9a62a79 | function dx = kde_pmf_width(x, varargin)
%|function dx = kde_pmf_width(x, varargin)
%|
%| Determine bin width for kde_pmf1,2
%|
%| in
%| x [N 1] iid realizations of random variable pairs (x,y)
%|
%| option
%| 'type' 'silverman' to choose dx based on rule-of-thumb
%| using inter-quartile range (p48 of 1986 book)
%|... |
github | alcu/sms-master | arg_get.m | .m | sms-master/irt/utilities/arg_get.m | 954 | utf_8 | 59f03a8b702fe06e405e10e515fb5741 | function [arg, ii] = arg_get(list, what, default)
%function [arg, ii] = arg_get(list, what, default)
% extract an argument (e.g., nx or pixel_size, etc.)
% from a list (vertically concatenated strings)
% e.g., as generated by arg_pair() or strvcat()
% the *first* match is used.
% Copyright 2005, Jeff Fessler, The Univ... |
github | alcu/sms-master | filtmat.m | .m | sms-master/irt/utilities/filtmat.m | 3,762 | utf_8 | f0327a52412e81316e1dac6e5babedd8 | function [mat, nexp] = filtmat(arg0, arg1, arg2, arg3, arg4)
%function mat = filtmat('1d', kernx, nx)
% 1d nonperiodic
%function mat = filtmat({'1d' 'per'}, kernx, nx)
% 1d periodic
%function mat = filtmat('2d,mul,sep', kernx, kerny, [nx ny])
% 2d multiplicatively separable nonperiodic
%function mat = filtmat('3... |
github | alcu/sms-master | remove_spaces.m | .m | sms-master/irt/utilities/remove_spaces.m | 793 | utf_8 | 44dcf5c3a35ebc4ce3ddd6e590aab8a4 | function arg = remove_spaces(arg)
%|function arg = remove_spaces(arg)
%| replace extra spaces at ends of matrix string array with zeros.
%| also add extra '0' at end to be sure to null terminate string
%| Copyright May 2000, Jeff Fessler, University of Michigan
if nargin < 1, help(mfilename), error(mfilename), end
... |
github | alcu/sms-master | interp1_lagrange.m | .m | sms-master/irt/utilities/interp1_lagrange.m | 1,201 | utf_8 | 09cf3435bbf5c9b0a2e2c60d2ea18220 | function y = interp1_lagrange(xi, yi, x)
%|function y = interp1_lagrange(xi, yi, x)
%|
%| Lagrange (1D) interpolation: polynomial of order length(xi)
%|
%| in
%| xi [n 1], yi [n 1], x [m 1]
%| out
%| y [m 1] if yi is empty, then "y" is the m,n interpolation matrix
%|
%| Copyright 2003-5-13, Jeff Fessler, University ... |
github | alcu/sms-master | arg_pair.m | .m | sms-master/irt/utilities/arg_pair.m | 1,519 | utf_8 | b0dfe2defa2a10ffaf1901c3a4bb22e6 | function arg = arg_pair(varargin)
%|function arg = arg_pair(varargin)
%|
%| construct AsciiArg pairs from input arguments
%| for building arguments akin to .dsc file
%| example: arg = arg_pair('system', 2, 'nx', 128, ...)
%|
%| Copyright May 2000, Jeff Fessler, University of Michigan
if nargin == 1 && streq(varargi... |
github | alcu/sms-master | upsample_rep.m | .m | sms-master/irt/utilities/upsample_rep.m | 629 | utf_8 | 3db6e5ee1beac6a80b0a8880a17d5c3d | function y = upsample_rep(x, m)
%function y = upsample_rep(x, m)
% upsample a 2D image a factor of m by simple replication
if nargin == 1 && streq(x, 'test'), upsample_rep_test, return, end
if nargin < 1, help(mfilename), error(mfilename), end
if nargin < 2, m = [2 2]; end
y = upsample1_rep(x, m(1));
y = upsample1_r... |
github | alcu/sms-master | max_percent_diff.m | .m | sms-master/irt/utilities/max_percent_diff.m | 1,971 | utf_8 | 0b4ab863976402c87de0914aa0e5a0a0 | function d = max_percent_diff(s1, s2, varargin)
%|function d = max_percent_diff(s1, s2, [options])
%|
%| compute the "maximum percent difference" between two signals: s1, s2
%| options
%| 1 use both arguments as the normalizer
%| string print this
%|
%| Copyright 2000-9-16, Jeff Fessler, University of Michigan
if ... |
github | alcu/sms-master | bspline_1d_coef.m | .m | sms-master/irt/utilities/bspline_1d_coef.m | 5,198 | utf_8 | 9bc2d9c0359293a99564442103415254 | function coef = bspline_1d_coef(fn, varargin)
%|function coef = bspline_1d_coef(fn, varargin)
%|
%| Given f[n], uniformly spaced samples of a 1D signal f(t),
%| compute the bspline coefficients so that the following model interpolates:
%| f(t) = \sum_{k=0}^{N-1} coef[k] b(t - k)
%|
%| in
%| fn [N,(L)] 1d signal(s) of... |
github | alcu/sms-master | ir_dctmtx.m | .m | sms-master/irt/utilities/ir_dctmtx.m | 802 | utf_8 | 44653be06318cf836a96ab9d73447c6b | function out = ir_dctmtx(siz)
%|function out = ir_dctmtx(siz)
%|
%| 1D or 2D DCT orthonormal matrix
%|
%| Reference:
%| Jain, Fundamentals of Digital Image Processing, p. 150.
if nargin ~= 1, help(mfilename), error(mfilename), end
if streq(siz, 'test'), ir_dctmtx_test, return, end
ndim = numel(siz);
switch(ndim)
ca... |
github | alcu/sms-master | downsample1.m | .m | sms-master/irt/utilities/downsample1.m | 1,243 | utf_8 | 369f7422aa823211d70adf0860f3cf47 | function y = downsample1(x, down, varargin)
%|function y = downsample1(x, down, varargin)
%| downsample by factor m along first dimension by averaging
%|
%| in
%| x [n1 (Nd)]
%| down integer downsampling factor
%| option
%| 'warn' 0|1 warn if noninteger multiple (default: 1)
%| out
%| y [n1/down (Nd)]
%|
%| Copyri... |
github | alcu/sms-master | ir_display_struct.m | .m | sms-master/irt/utilities/ir_display_struct.m | 1,779 | utf_8 | 7c7455f2167bace79f65a6f53bb34375 | function ir_display_struct(ob, varargin)
%function ir_display_struct(ob, varargin)
%|
%| display a structure concisely
%|
%| option
%| 'pre' prefix
%|
%|
if nargin < 1, help(mfilename), error(mfilename), end
if streq(ob, 'test'), ir_display_struct_test, return, end
arg.pre = ' ';
arg = vararg_pair(arg, varargin);
... |
github | alcu/sms-master | fwhm2.m | .m | sms-master/irt/utilities/fwhm2.m | 3,909 | utf_8 | 331d73b8b740a9f57509efcb1a44f4b1 | function [fw, angle, rad] = fwhm2(psf, varargin)
%|function [fw, angle, rad] = fwhm2(psf, [options])
%|
%| compute 2d fwhm of point-spread function using contourc()
%|
%| in
%| psf [nx ny] 2D psf image
%|
%| option
%| 'dx' pixel size (default 1)
%| 'dy' pixel size (default dx)
%| 'level' default 0.5 (for "half" ma... |
github | alcu/sms-master | poisson.m | .m | sms-master/irt/utilities/poisson.m | 1,181 | utf_8 | 8e0d9705c577cbea395c4ff374a6db08 | function data = poisson(xm, seed, varargin)
%|function data = poisson(xm, seed, [options])
%|
%| option
%| 'factor' see poisson2.m
%|
%| Generate Poisson random vector with mean xm.
%| For small, use poisson1.m
%| For large, use poisson2.m
%| see num. rec. C, P. 222
%|
%| Copyright 1997-4-29, Jeff Fessler, University ... |
github | alcu/sms-master | nrms.m | .m | sms-master/irt/utilities/nrms.m | 1,109 | utf_8 | 042ba79752bcb9662b4db291ca79144b | function n = nrms(x, xtrue, arg)
%|function n = nrms(x, xtrue, arg)
%| normalized rms error
%| in
%| x [[Nd] Nrep] multiple x's for one xtrue
%| xtrue [[Nd]]
%| arg use '2' to do along 2nd dim for same size
%| out
%| scalar
%| vector if x and xtrue have same size and arg = 2
if nargin == 1 && streq(x, 'test'), nrms... |
github | alcu/sms-master | fld_read.m | .m | sms-master/irt/utilities/fld_read.m | 12,384 | utf_8 | 949270fc5eea294da1196f45881314b2 | function [data, coord, dims] = fld_read(file, varargin)
%|function [data, coord, dims] = fld_read(file, options)
%| Read data from AVS format .fld file.
%|
%| options
%| 'raw' 0|1 1: return raw data class (default), 0: return doubles
%| 'slice' int specify which slice to read from 3D file. (0 ... nz-1)
%| 'chat' 0|1 ... |
github | alcu/sms-master | outer_sum.m | .m | sms-master/irt/utilities/outer_sum.m | 1,359 | utf_8 | 69c4a2a90d18ddf41881a913a8b870b9 | function ss = outer_sum(xx,yy)
%|function ss = outer_sum(xx,yy)
%|
%| compute an "outer sum" x + y'
%| that is analogous to the "outer product" x * y'
%|
%| in
%| xx [nx 1]
%| yy [1 ny]
%| more generally: xx [(dim)] + yy [L,1] -> xx [(dim) LL]
%| out
%| ss [nx ny] ss(i,j) = xx(i) + yy(j)
%|
%| Copyright 2001, Jeff F... |
github | alcu/sms-master | hist_bin_int.m | .m | sms-master/irt/utilities/hist_bin_int.m | 3,676 | utf_8 | 5ef626bda38ef55053a8c12220fe8ca5 | function [nk center] = hist_bin_int(data, varargin)
%|function [nk center] = hist_bin_int(data, varargin)
%|
%| fast histogram of multidimensional data into equally-spaced bins
%| todo: time this vs accumarray
%|
%| in
%| data [N M] data values to be binned (M-dimensional)
%| must be integer valued >= 1
%|
%| opt... |
github | alcu/sms-master | stackpick.m | .m | sms-master/irt/utilities/stackpick.m | 1,295 | utf_8 | d556fae93130a2ff478217d92ef038c3 | function y = stackpick(x, ii)
%|function y = stackpick(x, ii)
%| pick one (or more) of the last "slices" of a multi-dimensional array
%| think x(:,:,...,:,ii)
%| This is useful in conjunction with stackup().
%| Copyright 2005-6-18, Jeff Fessler, University of Michiga
if nargin == 1 && streq(x, 'test'), stackpick_test... |
github | alcu/sms-master | bspline_1d_interp.m | .m | sms-master/irt/utilities/bspline_1d_interp.m | 4,024 | utf_8 | aeff151b8ab4888a0d126ef7666f70d5 | function ft = bspline_1d_interp(fn, ti, varargin)
%|function ft = bspline_1d_interp(fn, ti, varargin)
%|
%| given f[n], the "unit spaced" samples of a continuous signal f(t),
%| perform b-spline interpolation at sample locations t_i using the model:
%| f(t) = \sum_{k=0}^{N-1} coef_k b(t - k)
%| where the coefficients... |
github | alcu/sms-master | ticker.m | .m | sms-master/irt/utilities/ticker.m | 3,188 | utf_8 | d37224bdcbb9b5731efdb04eb3ef9d42 | function ticker(varargin)
%|function ticker(varargin)
%|
%| This utility is used in functions that might take a long time
%| to provide a status update so the user knows it is working.
%| "ticker print" to make output print to command window (default)
%| "ticker waitbar" to display using waitbar
%| ticker(waittime) to... |
github | alcu/sms-master | downsample3.m | .m | sms-master/irt/utilities/downsample3.m | 1,726 | utf_8 | 80f0c157a98c90470017f7acf690c3dc | function y = downsample3(x, m)
%|function y = downsample3(x, m)
%| downsample by averaging by integer factors
%| m can be a scalar (same factor for both dimensions)
%| or a 3-vector
%| in
%| x [nx ny nz]
%| m [1] or [1 3]
%| out
%| y [nx/m ny/m nz/m]
%| function modified to 3D space by: Taka Masuda
if nargin == 1 &&... |
github | alcu/sms-master | embed.m | .m | sms-master/irt/utilities/embed.m | 2,266 | utf_8 | 108e1a6cc7480bee8cb65d3ab148f405 | function ff = embed(x, mask, varargin)
%|function ff = embed(x, mask, varargin)
%| embed x in nonzero elements of (logical) mask
%| in
%| x [np (L)] the "nonzero" pixels (lexicographically stacked)
%| mask [(Nd)] logical array, np = sum(mask)
%| option
%| '*dim' {0|1} 0: [(N) (L)] (default); 1: return [(N) *L]
%| o... |
github | alcu/sms-master | lloyd_max_hist.m | .m | sms-master/irt/utilities/lloyd_max_hist.m | 4,356 | utf_8 | 2557953b284dd10d47d6d87fbd822e28 | function centers = lloyd_max_hist(data, centers, MM, tol, max_iter, chat)
%|function centers = lloyd_max_hist(data, centers, MM, tol, max_iter, chat)
%|
%| "improved" version of the lloyd-max algorithm for scalar quantizer design
%| that saves computation by histogramming the data first.
%| Before using this, try usi... |
github | alcu/sms-master | num2list.m | .m | sms-master/irt/utilities/num2list.m | 390 | utf_8 | 0076ebb4ee93b833462e21640099a15d | function varargout = num2list(x)
%function varargout = num2list(x)
%
% convert a numeric vector input into a comma separated list of output values
% DOES NOT WORK!
if nargin < 1, num2list_test, help(mfilename), error(mfilename), end
%nargout
%nargout = numel(x)
%varargout = cell(size(x));
for ii=1:numel(x)
varargou... |
github | alcu/sms-master | cpu.m | .m | sms-master/irt/utilities/cpu.m | 1,725 | utf_8 | 27808bbfc5ecd102b70225051d68de73 | function out = cpu(arg, varargin)
%|function out = cpu(arg, varargin)
%|
%| cpu etic
%| cpu etoc printarg
%| tic/toc elapsed time
%|
%| cpu etic
%| cpu tic
%| cpu toc
%| cpu toc printarg
%| work like tic/toc except they use cpu time instead of wall time.
%|
%| also:
%| If printarg begins with a ':' then caller_name p... |
github | alcu/sms-master | kde_pmf1.m | .m | sms-master/irt/utilities/kde_pmf1.m | 4,795 | utf_8 | 3f239349a0b6c199cab6908bd89d81e7 | function [pmf xs] = kde_pmf1(x, varargin)
%|function [pmf xs] = kde_pmf1(x, varargin)
%|
%| Compute an empirical probability mass function (PMF) using interpolation
%| that is similar to a kernel density estimate.
%| This routine is useful for making PMFs (interpolated / smoothed) histograms
%| for computing entropy ... |
github | alcu/sms-master | poly_string.m | .m | sms-master/irt/utilities/poly_string.m | 1,452 | utf_8 | 5efc7525a6d221ad41a8e377311fd06c | function [str, d1, d2] = poly_string(order, varargin)
%function [str, d1, d2] = poly_string(order, [options])
% make a string with all the terms in a 2d polynomial
% up to given order, e.g. [1+0*x x y ...]
% also return partial derivatives w.r.t. x and y
% in
% order
% options
% maxdegree maximum of sum of degrees (de... |
github | alcu/sms-master | run_mfile_local.m | .m | sms-master/irt/utilities/run_mfile_local.m | 2,046 | utf_8 | f7e03aaa6ba17509f0d9ad9c7d4cf7d6 | function run_mfile_local(arg, varargin)
%|function run_mfile_local(arg)
%| run an mfile in a local environment so that workspace variables
%| are untouched. useful for tests.
%| arg can be a cell with many mfiles to run
%| options
%| 'draw' 1|0 1 to draw after each test (default: 0)
%| 'pause' 1|0 1 to pause after e... |
github | alcu/sms-master | minmax.m | .m | sms-master/irt/utilities/minmax.m | 2,326 | utf_8 | cdf69beeced912f2887f4a8f16933b53 | function r = minmax(x, varargin)
%function r = minmax(x, dim)
% Return mininum and maximum of values of input x.
% Default is to examine the entire array.
% Specify a dimension dim otherwise.
% If dim is a string, print...
% Copyright 2003, Jeff Fessler, University of Michigan
if nargin < 1, help(mfilename), error(mf... |
github | alcu/sms-master | masker.m | .m | sms-master/irt/utilities/masker.m | 884 | utf_8 | de844e9fcd7044d558d79c5644951dc9 | function y = masker(x, mask)
%|function y = masker(x, mask)
%| extract from x the nonzero elements within (logical) mask
%| in
%| x [(Nd) (L)] image(s)
%| mask [(Nd)] logical array, np = sum(mask)
%| out
%| y [np (L)] concise columns
%|
%| See also: embed
%|
%| Copyright 2004-9-28, Jeff Fessler, University of Michig... |
github | alcu/sms-master | truncate_precision.m | .m | sms-master/irt/utilities/truncate_precision.m | 924 | utf_8 | 0f0d50a4e0af0fded1105d0ee262b6d8 | function y = truncate_precision(x, digits, varargin)
%|function y = truncate_precision(x, digits, [option])
%|
%| truncate x to "digits" signficant digits of precision
%| option
%| 'type' floor (default) | round | ceil
%|
%| Copyright 2008-11-05, Jeff Fessler, University of Michigan
if nargin == 1 && streq(x, 'test... |
github | alcu/sms-master | jf.m | .m | sms-master/irt/utilities/jf.m | 4,442 | utf_8 | 1d7f14c6111af255339f61d684d3f5be | function out = jf(varargin)
%|function out = jf(varargin)
%| various personalization routines
%| 'mv var_old var_new'
%| 'ncore' # of cores this machine has
%| add optional 2nd argument to over-ride, e.g., jf('ncore', 4)
%| 'whos'
%| 'clf'
%| 'nobar' preclude toolbar and menubar from figures to render faster!
%| 'no... |
github | alcu/sms-master | ir_project_simplex.m | .m | sms-master/irt/utilities/ir_project_simplex.m | 1,197 | utf_8 | 7893825d0f47f9fb58091d2bc0db2bf0 | function x = ir_project_simplex(y)
%|function x = ir_project_simplex(y)
%|
%| project an n-dim vector y to the simplex Dn
%| Dn = { x : x n-dim, 1 >= x >= 0, sum(x) = 1}
%|
%| (c) Xiaojing Ye
%| xyex19@gmail.com
%|
%| Algorithm is explained as in the linked document
%| http://arxiv.org/abs/1101.6081
%| or
%| http://u... |
github | alcu/sms-master | ir_odwt2.m | .m | sms-master/irt/utilities/ir_odwt2.m | 6,502 | utf_8 | a130ae050bcc9904f3e37aaa550652ef | function [coef codes] = ir_odwt2(x, varargin)
%|function [coef codes] = ir_odwt2(x, varargin)
%|
%| 2D orthonormal discrete wavelet transform (ODWT) of 2D image x.
%| Also provides the adjoint, which is the inverse ODWT.
%|
%| in
%| x [N M] image
%|
%| option
%| 'level' int default: 1
%| 'wname' char default: 'haar'
... |
github | alcu/sms-master | streq.m | .m | sms-master/irt/utilities/streq.m | 686 | utf_8 | 450bda5cc228936f2f8f88c03d1c5513 | function tf = streq(a, b, n)
%|function tf = streq(a, b [,n])
%|
%| return 1 if two strings "a" and "b" are equal
%| (optionally checking only up to 1st n chars)
%| caution: whereas strcmp allows comparisons of cell arrays,
%| this routine allows only two strings.
%|
%| Jeff Fessler
if nargin == 1 && strcmp(a, 'test... |
github | alcu/sms-master | vararg_pair.m | .m | sms-master/irt/utilities/vararg_pair.m | 6,074 | utf_8 | 4e8a72331a91a7486d098a62afb2b108 | function [opt, extra] = vararg_pair(opt, varargs, varargin)
%|function [opt, extra] = vararg_pair(opt, varargs, [options])
%|
%| Process name / value pairs, replacing the "default" field values
%| of the opt structure with the user-specified values.
%| This allows flexible argument order and "named arguments" somewha... |
github | alcu/sms-master | reshapee.m | .m | sms-master/irt/utilities/reshapee.m | 1,255 | utf_8 | 203da0142afea972cf8d708e085ea2d1 | function y = reshapee(x, varargin)
%|function y = reshapee(x, varargin)
%|
%| reshape function that allows possibly one null argument, and all
%| other arguments can be vectors, unlike matlab that requires scalars.
%| example: reshape(rand(2*3*5,7), [2 3], [], 7) will become [2 3 5 7]
%|
%| in
%| x [(*dim)]
%| vararg... |
github | alcu/sms-master | sinc_periodic.m | .m | sms-master/irt/utilities/sinc_periodic.m | 1,401 | utf_8 | 6ded04b3754f67a5d4372c05ed651386 | function x = sinc_periodic(t, K)
%|function x = sinc_periodic(t, K)
%| periodic sinc function, obtained by replicates of a sinc:
%| x(t) = \sum_l sinc(t - l K) = ... = sin(pi*t) / tan(pi*t/K) / K for K even.
%| This function is bandlimited and its samples are an impulse train.
%| It is closely related to the Dirichle... |
github | alcu/sms-master | poisson2.m | .m | sms-master/irt/utilities/poisson2.m | 1,861 | utf_8 | 5445163bb4f713ca1acc3b929698dc69 | function data = poisson2(xm, varargin)
%|function data = poisson2(xm, [options])
%|
%| in
%| 'xm' float
%|
%| option
%| 'seed' int seed for rng()
%| 'factor' double a value < 1 for rejection method
%|
%| Generate Poisson random column vector with mean xm.
%| Uses rejection method - good for large values of xm.
... |
github | alcu/sms-master | min_cos_quad.m | .m | sms-master/irt/utilities/min_cos_quad.m | 3,179 | utf_8 | 27cc84604461ab9b4aeb93bca086ac8f | function t = min_cos_quad(m, p, b, c, niter)
%|function t = min_cos_quad(m, p, b, c, niter)
%|
%| find the minimizer of the sinusoid + quadratic form:
%| f(t) = m * (1-cos(t-p)) + b*t + c/2 t^2
%|
%| This is useful for certain phase-related optimization transfer problems.
%|
%| Copyright 2003-11-9, Jeff Fessler, Univ... |
github | alcu/sms-master | ir_struct_find_field.m | .m | sms-master/irt/utilities/ir_struct_find_field.m | 1,254 | utf_8 | 931cc673b7e57430dcd0758c6d1d0b3a | function [out ok] = ir_struct_find_field(ss, field)
%|function [out ok] = ir_struct_find_field(ss, field)
%|
%| Look recursively through the fields of a structure for a given field.
%| Objects like Fatrix and fatrix2 are converted to structs too for this.
%|
%| Returns ss.(field) or ss.?.(field) or ss.?.?.(field) etc... |
github | alcu/sms-master | kde_pmf2.m | .m | sms-master/irt/utilities/kde_pmf2.m | 6,300 | utf_8 | ab62e809502eea382a6f01bf2e37be4b | function [pmf xs ys] = kde_pmf2(x, y, varargin)
%|function [pmf xs ys] = kde_pmf2(x, y, varargin)
%|
%| Compute a 2D empirical joint probability mass function (PMF)
%| using interpolation that is similar to a kernel density estimate.
%| This joint PMF (interpolated / smoothed histogram) is useful for
%| computing joi... |
github | alcu/sms-master | rms.m | .m | sms-master/irt/utilities/rms.m | 779 | utf_8 | 8e6f3ae3104ee31f7fea466a6a2d8f84 | function [rhat, s] = rms(x)
%|function [rhat, s] = rms(x)
%| function [r, s] = rms(err)
%| in
%| x: NxM error vectors
%| out
%| r: Mx1 estimate of rms error
%| s: Mx1 estimate of std. dev. of that estimate
if nargin < 1, help(mfilename), error(mfilename), end
if streq(x, 'test'), rms_test, return, end
N = nrow(x)... |
github | alcu/sms-master | stackup.m | .m | sms-master/irt/utilities/stackup.m | 1,653 | utf_8 | 258aada4c6220aa3ba3d2b64cdd35b72 | function ss = stackup(varargin)
%|function ss = stackup(x1, x2, ...)
%|
%| stack up 2D arrays to make 3D array
%| or stack up 3D arrays to make 4D array
%| This generalizes how [a; b] "stacks up" 1D vectors to make a 2D array.
%| This is useful in conjunction with stackpick().
%| It is akin to cat(ndims(x1)+1, x1, x2... |
github | alcu/sms-master | bspline_1d_synth.m | .m | sms-master/irt/utilities/bspline_1d_synth.m | 7,643 | utf_8 | 9211b4f0a910dff26ec64ab9859a9c5c | function ft = bspline_1d_synth(coef, ti, varargin)
%|function ft = bspline_1d_synth(coef, ti, varargin)
%|
%| Given c[n], the b-spline coefficients for the following model:
%| f(t) = \sum_{k=0}^{N-1} coef_k b(t - k),
%| and given sorted sample locations ti, synthesize signal samples f(t_i).
%|
%| in
%| coef [N (L)] ... |
github | alcu/sms-master | strum_test.m | .m | sms-master/irt/utilities/strum_test.m | 2,235 | utf_8 | c462d966b83de02e9b682fa0ead74f11 | function strum_test
%|function strum_test
%| test strum object
%| Copyright 2006-1-19, Jeff Fessler, University of Michigan
dat.a = 'x';
dat.b = 'y';
imp10 = @(st) st.b;
imp11 = @(st, arg) [st.a arg];
imp12 = @(st, arg1, arg2) sum(arg1) + sum(arg2);
list = { ...
'fun10', @strum_test_fun10, '()'; ...
'fun11', @st... |
github | alcu/sms-master | highrate_centers.m | .m | sms-master/irt/utilities/highrate_centers.m | 1,963 | utf_8 | 97ce42064c1088889bda22226347fa87 | function centers = highrate_centers(data, L, M)
%|function centers = highrate_centers(data, L, M)
%| According to high-rate scalar quantization theory (Gersho, T-IT, 1979),
%| the density of MMSE quantization cell centroids should be f^{k/(k+2)},
%| for k-dimensional data distributed with pdf f.
%| This m-file design... |
github | alcu/sms-master | padn.m | .m | sms-master/irt/utilities/padn.m | 1,368 | utf_8 | 0e6e93516aba2748ee63b838b85f26da | function out = padn(mat, newdim)
%|function out = padn(mat, newdim)
%| pad input matrix to newdim, preserving 'center point'
%| using this avoids matlab's padarray.m which is in image proc toolbox
if nargin < 1, help(mfilename), error(mfilename), end
if streq(mat, 'test'), padn_test, return, end
% default: round to... |
github | alcu/sms-master | reale.m | .m | sms-master/irt/utilities/reale.m | 1,974 | utf_8 | f3caf767d930e1c501d34ea2da29e880 | function y = reale(x, arg2, arg3)
%|
%| y = reale(x)
%| y = reale(x, tol)
%| y = reale(x, 'warn', 'message')
%| y = reale(x, 'error')
%| y = reale(x, 'report')
%| y = reale(x, 'prompt')
%| y = reale(x, 'disp')
%|
%| return real part of complex data (with error checking).
%| checks that imaginary part is negligible (or ... |
github | alcu/sms-master | equivs.m | .m | sms-master/irt/utilities/equivs.m | 2,276 | utf_8 | 7558c811be366947ee50f7e6155b9ea8 | function out = equivs(var1, var2, varargin)
%|function out = equivs(var1, var2, command)
%| verify that var1 and var2 are equivalent to within single precision accuracy
%| if not, print error message. an alternative to isequal().
%| See also: jf_equal
%| option
%| 'thresh' threshold (default: 1e-6)
%| 'format' forma... |
github | alcu/sms-master | ir_dwt_filters.m | .m | sms-master/irt/utilities/ir_dwt_filters.m | 1,879 | utf_8 | 796732b13b21d924af0060dda4d70904 | function [lo hi] = ir_dwt_filters(wname, varargin)
%|function [coef codes] = ir_odwt1(x, varargin)
%|
%| filters for discrete wavelet transform DWT
%|
%| in
%| 'wname' char default: 'haar'
%|
%| option
%| 'usemat' 0|1 default: 0. (if 1 then use matlab wfilters)
%| 'ortho' 0|1 default: 1 (make normalized)
%| 'abs' 0|1... |
github | alcu/sms-master | jf_rm_toolbox.m | .m | sms-master/irt/utilities/private/jf_rm_toolbox.m | 892 | utf_8 | 81c39e54ce0f7b93c85f4faa5c889d2b | function jf_rm_toolbox
% remove matlab toolboxes from path
% for testing my toolbox with vanilla matlab
rm aero
rm aeroblks
rm bioinfo
rm comm
rm commblks
rm compiler
rm control
rm curvefit
rm database
rm des
rm distcomp
rm dspblks
rm eml
rm emlcoder
rm filterdesign
rm finance
rm fixedpoint
rm fuzzy
rm geoweb
rm ident... |
github | alcu/sms-master | jf_prctile.m | .m | sms-master/irt/utilities/private/jf_prctile.m | 1,066 | utf_8 | 4f9221f4120fbff5aa6add943c5a1ac9 | function y = jf_prctile(pn, x, p, dim)
% mimic matlab's prctile which is in the "stats" toolbox
if streq(x, 'test'), jf_prctile_test, y = []; return, end
if nargin < 3, help(mfilename), error(mfilename), end
% work with permuted dimensions if needed
if nargin > 3 && ~isempty(dim)
order = [dim:ndims(x) 1:dim-1];
x =... |
github | alcu/sms-master | jf_color_order.m | .m | sms-master/irt/utilities/private/jf_color_order.m | 984 | utf_8 | 009a5177b58c46e4e5ed781f43bdf930 | function out = jf_color_order(pn, varargin)
%function out = jf_color_order(pn, varargin)
% set color order to start with yellow then cyan etc., for black background
if ~length(varargin)
out = jf_color_order_bw;
return
end
out = [];
switch varargin{1}
case 'revert'
set(0, 'DefaultAxesColorOrder', 'default')
retu... |
github | alcu/sms-master | jf_struct_recurse.m | .m | sms-master/irt/utilities/private/jf_struct_recurse.m | 1,824 | utf_8 | d7849c16991e5a735db1c20c9bfe3a79 | function out = jf_struct_recurse(pn, st, varargin)
%|function out = jf_struct_recurse(pn, st, varargin)
%|
%| Recursively descend a structure and examine its (numeric) members
%|
% Copyright 2010-04-05, Jeff Fessler, University of Michigan
if nargin < 1, help(mfilename), error(mfilename), end
arg.type = 'minmax_nan... |
github | alcu/sms-master | display.m | .m | sms-master/irt/utilities/@strum/display.m | 1,333 | utf_8 | 6dc919bfa1a95d0a08d0e95ab1232ed0 | function display(ob)
%function display(ob)
% "display" method for this class
name = inputname(1);
printm('"%s" is an object of class "%s":', name, class(ob))
ob = struct(ob);
ir_display_struct(ob);
if ~isempty(ob.meth) && ~isempty(ob.docs)
printf('\n methods with comments:')
display_method(ob.meth, ob.docs)
end
re... |
github | alcu/sms-master | strum.m | .m | sms-master/irt/utilities/@strum/strum.m | 3,362 | utf_8 | 0cb6f8e9273c021dec2ada612358ef36 | function ob = strum(data, methods, varargin)
%|function ob = strum(data, methods, [options])
%|
%| Construct a "strum" object. This acts like an ordinary matlab "struct"
%| except that it also can contain user-defined "methods."
%| For example, if x is a fieldname of the structure, then ob.x will return
%| the corre... |
github | alcu/sms-master | subsref_mm.m | .m | sms-master/irt/utilities/@strum/subsref_mm.m | 3,299 | utf_8 | 0759e96b1c0200abb8e0d65139da7015 | function varargout = subsref(ob, args)
%function varargout = subsref(ob, args)
% handle subscript references like ob.ref or ob.ref(arg[s])
% Copyright 2006-1-19, Jeff Fessler, University of Michigan
% 2011-10-25 modified by Madison McGaffin to support multiple outputs
st = struct(ob);
varargout = cell(nargout,1);
if... |
github | alcu/sms-master | mat_write.m | .m | sms-master/irt/utilities/arch/mat_write.m | 2,632 | utf_8 | a893a9a496d886773d54df7231831e59 | function mat_write(file, data, varargin)
%function mat_write(file, data,
% ['-check', '-nocheck', '-type', datatype, '-name', varname])
%
% Save matlab "data" to "file", first checking if "file" exists!
% If file suffix is .fld, then save as AVS .fld file in xdr_float.
%
% datatype can be 'xdr_float' 'xdr_int' ...
% ... |
github | alcu/sms-master | qpwls_precon.m | .m | sms-master/irt/wls/qpwls_precon.m | 5,123 | utf_8 | 908045fe64996174938f92f41d941ca6 | function M = qpwls_precon(type, sys, C, mask, varargin)
%|function M = qpwls_precon(type, sys, C, mask, varargin)
%| usage:
%| M = qpwls_precon('circ0', {T}, C, mask);
%| M = qpwls_precon('circ0', {A, W}, C, mask);
%|
%| build a preconditioner for QPWLS problems;
%| approximations to inv([A'WA + C'C])
%|
%| in
%| typ... |
github | alcu/sms-master | pwls_art.m | .m | sms-master/irt/wls/pwls_art.m | 3,522 | utf_8 | faea06efabbaae283fd280a75757ad99 | From smalone@engin.umich.edu Wed Jul 15 23:51:01 1998
To: "Prof. Fessler" <fessler@eecs.umich.edu>
Subject: MATLAB ART Algorithm
Prof. Fessler,
I have two ART algorithms for you to look at.
Like the two PWLS+SOR algorithms, one MATLAB function has G'*W*G as a
precomputed input argument and the other is without th... |
github | alcu/sms-master | ir_hct_dgrad.m | .m | sms-master/irt/wls/ir_hct_dgrad.m | 2,773 | utf_8 | 6e959f8bea5db75de1d4f2cbc20bd86c | function [grad out com] = ir_hct_dgrad(x, A, yi, wi, varargin)
%|function [grad out com] = ir_hct_dgrad(x, A, yi, wi, varargin)
%|
%| compute gradient of WLS data-fit term using hct binary
%| for UM testing only
%|
%| in
%| option
%| (many - see below)
%|
%| Jeff Fessler, 2012-06-17
if nargin == 1 && streq(x, 'test'... |
github | alcu/sms-master | qpwls_pcg2.m | .m | sms-master/irt/wls/qpwls_pcg2.m | 4,102 | utf_8 | aa687f6d60490c2994b5796f74c175fd | function [xs, info] = qpwls_pcg2(x, T, bb, C, varargin)
%|function [xs, info] = qpwls_pcg2(x, T, bb, C, [options])
%|
%| quadratic penalized weighted least squares via
%| preconditioned conjugate gradients (PCG) algorithm
%| cost: Psi(x) = (y-Ax)'W(y-Ax)/2 + x'C'Cx/2
%| = -x'b + x'Tx/2 + x'C'Cx/2, where T = A'WA, b ... |
github | alcu/sms-master | qpwls_qn.m | .m | sms-master/irt/wls/qpwls_qn.m | 2,199 | utf_8 | 950d9e08b6b6dfb0553136aa8429a095 | function [xs, Ps] = qpwls_qn(x, G, W, yy, C, P, niter)
%function [xs, Ps] = qpwls_qn(x, G, W, yy, C, P, niter)
%
% quadratic penalized weighted least squares (QPWLS) via
% (preconditioned) quasi-Newton (QN) algorithm
% cost(x) = (y-Gx)'W(y-Gx) / 2 + x'C'Cx / 2
% in
% x [np,1] initial estimate
% G [nn,np] system mat... |
github | alcu/sms-master | qpwls_pcg1.m | .m | sms-master/irt/wls/qpwls_pcg1.m | 6,494 | utf_8 | ec1a47614605fc4671c56339c97f5484 | function [xs, info] = qpwls_pcg1(x, A, W, yi, C, varargin)
%|function [xs, info] = qpwls_pcg1(x, A, W, yi, C, [options])
%|
%| quadratic penalized weighted least squares (QPWLS) via
%| preconditioned conjugate gradients (PCG) algorithm
%| cost(x) = (y-Ax)'W(y-Ax) / 2 + x'C'Cx / 2
%|
%| in
%| x [np 1] initial estimat... |
github | alcu/sms-master | pwls_sqs_os.m | .m | sms-master/irt/wls/pwls_sqs_os.m | 4,191 | utf_8 | 6b197dad846005c3379cede039c1d1a3 | function [xs, info] = pwls_sqs_os(x, Ab, yi, R, varargin)
%|function [xs, info] = pwls_sqs_os(x, Ab, yi, R, [options])
%|
%| penalized weighted least squares estimation / image reconstruction
%| using separable quadratic surrogates algorithm with
%| (optionally relaxed) ordered subsets. (relaxation ensures convergen... |
github | alcu/sms-master | qpwls_bb1.m | .m | sms-master/irt/wls/qpwls_bb1.m | 5,870 | utf_8 | ec9a3eda5e8154f08cac635506779cfe | function [xs, info] = qpwls_bb1(x, A, W, yi, C, varargin)
%|function [xs, info] = qpwls_bb1(x, A, W, yi, C, [options])
%|
%| quadratic penalized weighted least squares (QPWLS) via
%| preconditioned (todo) Barzilai and Borwein gradient method.
%| cost(x) = (y-Ax)'W(y-Ax) / 2 + x'C'Cx / 2
%|
%| in
%| x [np 1] initial ... |
github | alcu/sms-master | pwls_pcg1.m | .m | sms-master/irt/wls/pwls_pcg1.m | 7,580 | utf_8 | a64997e6145be968fbbebe41db5f3d40 | function [xs, info] = pwls_pcg1(x, A, W, yi, R, varargin)
%|function [xs, info] = pwls_pcg1(x, A, W, yi, R, [options])
%|
%| penalized weighted least squares (PWLS)
%| with convex non-quadratic regularization,
%| minimized via preconditioned conjugate gradient algorithm.
%| cost(x) = (y-Ax)'W(y-Ax)/2 + R(x)
%|
%| in
... |
github | alcu/sms-master | qpwls_psd.m | .m | sms-master/irt/wls/qpwls_psd.m | 3,317 | utf_8 | d2983170e45b5a9604a3e1cb862e6b57 | function [xs, info] = qpwls_psd(x, A, W, yi, C, varargin)
%|function [xs, info] = qpwls_psd(x, A, W, yi, C, [options])
%|
%| quadratic penalized weighted least squares (QPWLS) via
%| preconditioned steepest descent (PSD) algorithm
%| cost(x) = (y-Ax)'W(y-Ax) / 2 + x'C'Cx / 2
%|
%| in
%| x [np 1] initial estimate
%| ... |
github | alcu/sms-master | pwls_sor.m | .m | sms-master/irt/wls/pwls_sor.m | 3,878 | utf_8 | edcdc3e411ad60eac6a1758e57fe4f86 | From smalone@engin.umich.edu Wed Jul 15 13:37:52 1998
To: "Jeffrey A. Fessler" <fessler@eecs.umich.edu>
Subject: Re: pwls_sor
Prof. Fessler,
I'm sending along two of my pwls_sor routines. Both compute one iteration
of the routine. One uses precomputed diag[G'*W*G]. The other does not.
I could combine the two, if y... |
github | alcu/sms-master | qpwls_pcg1.m | .m | sms-master/irt/wls/arch/qpwls_pcg1.m | 3,314 | utf_8 | fd3f754f50a8b368040d6e09fdf1914c | function [xs, info] = qpwls_pcg1(x, G, W, yi, C, varargin)
%function [xs, info] = qpwls_pcg1(x, G, W, yi, C, [options])
%
% quadratic penalized weighted least squares via
% preconditioned conjugate gradients (PCG) algorithm
% cost(x) = (y-Gx)'W(y-Gx)/2 + x'C'Cx/2
% in
% x [np,1] initial estimate
% G [nd,np] system m... |
github | alcu/sms-master | pwls_sps.m | .m | sms-master/irt/wls/arch/pwls_sps.m | 2,077 | utf_8 | 5d799707ddebdbd6ef6a44aa3df5f359 | function xs = pwls_sps(x, Gt, wi, yi, P, niter, pixmax, ldenom, gi)
%function xs = pwls_sps(x, Gt, wi, yi, P, niter, pixmax, ldenom, gi)
%
% penalized weighted least squares image reconstruction
% using separable paraboloidal surrogates algorithm
% cost function: J(x) = (y-Gx) W (y-Gx) / 2 + x' C' C x / 2
% Inputs req... |
github | alcu/sms-master | strvcat.m | .m | sms-master/irt/freemat/strvcat.m | 272 | utf_8 | 90fa0731122679f089828dfb7fbde41a | %| function out = strvcat(varargin)
%|
%| (for freemat)
function out = strvcat(varargin)
% for compatability with matlab, remove empty arguments
tmp = {};
for ii=1:length(varargin)
if ~isempty(varargin{ii})
tmp = {tmp{:}, varargin{ii}};
end
end
out = char(tmp{:});
|
github | alcu/sms-master | isequal.m | .m | sms-master/irt/freemat/isequal.m | 915 | utf_8 | 1ba0cf9dd50bfe69854faa7414ad7595 | function out = isequal(a,b)
%function out = isequal(a,b)
% needed for freemat 4.0
if nargin < 2, help(mfilename), error(mfilename), end
out = false;
% check that class type matches
if ~isnumeric(a) || ~isnumeric(b)
if ~streq(class(a), class(b)), return, end
end
if ischar(a)
out = streq(a, b);
return
end
if isce... |
github | alcu/sms-master | strmatch.m | .m | sms-master/irt/freemat/pre-4.0/strmatch.m | 1,059 | utf_8 | 0347fe3860ac2aebcfb853e5e41ad8bd | function out = strmatch(str, strs, type)
%function out = strmatch(str, strs, type)
% return matching row indices
if nargin == 1 && streq(str, 'test'), strmatch_test, return, end
if nargin < 3, help(mfilename), error(mfilename), end
if ~streq(type, 'exact'), error('only "exact" done'), end
if iscell(strs)
nstr = len... |
github | alcu/sms-master | subsasgn.m | .m | sms-master/irt/freemat/pre-3.6/subsasgn.m | 787 | utf_8 | 5f5fd80e8d836587f9c46393402aaae1 | function out = subsasgn(a, s, b)
%function out = subsasgn(a, s, b)
if nargin == 1 && streq(a, 'test'), subsasgn_test, return, end
if nargin < 3, help(mfilename), error(mfilename), end
out = a;
% out = builtin('subsasgn', varargin{:}); % seems to recurse
% a.s = b;
if length(s) == 1 && streq(s(1).type, '.')
out.(s(... |
github | alcu/sms-master | penalty_mex.m | .m | sms-master/irt/freemat/pre-3.5/penalty_mex.m | 5,279 | utf_8 | 4c050f4d3802c7d66298ca64a07c6839 | function out = penalty_mex(arg, varargin)
%function out = penalty_mex(arg, varargin)
% m-file interface to penalty_mex.mex*
% Usage for penalty_mex:
% d = function('diff1,forw1', x, offsets, [lastdim]);
% d = C * x
% offsets is int32 array such as [1 nx nx-1 nx+1].
% Usually lastdim is absent, and x is treated as s... |
github | alcu/sms-master | myiswt2.m | .m | sms-master/irt/penalty/myiswt2.m | 2,208 | utf_8 | f29f4f2652fb13bafdd45302978ef924 | function a = myiswt2(swc, lo_r, hi_r)
% ISWT2 Inverse discrete stationary wavelet transform 2-D.
% ISWT2 performs a multilevel 2-D stationary wavelet
% reconstruction using either a specific orthogonal wavelet
% ('wname', see WFILTERS for more information) or specific
% reconstruction filters (Lo_r and Hi_r).
%
... |
github | alcu/sms-master | Reg1.m | .m | sms-master/irt/penalty/Reg1.m | 23,615 | utf_8 | 75da01050a9ea5d61d2d880d6d7ae318 | function R = Reg1(kappa, varargin)
%|function R = Reg1(kappa, [options])
%|
%| Build roughness penalty regularization "object" based on Cdiff1() objects,
%| for regularized solutions to inverse problems.
%| This version supercedes Robject() by providing its capabilities while
%| also providing options that use less m... |
github | alcu/sms-master | penalty_displace.m | .m | sms-master/irt/penalty/penalty_displace.m | 3,585 | utf_8 | daae8a09db6bcc8839e0e437f74deb52 | function displace = penalty_displace(offsets, sizes)
%|function displace = penalty_displace(offsets, sizes)
%|
%| Convert scalar offsets to vector displacements, i.e.,
%| find d1,d2,... such that d1*1 + d2*n1 + d3*n1*n2 + ... = offset.
%| Example: if offset = n1, then [d1 d2 d3] = [0 1 0]
%| Assumes that d <= floor(n... |
github | alcu/sms-master | Cdiff1_tune.m | .m | sms-master/irt/penalty/Cdiff1_tune.m | 3,013 | utf_8 | 3ecb396069b71348797f5bbf64a0bf07 | function type_diff = Cdiff1_tune(isize, varargin)
%function type_diff = Cdiff1_tune(isize, [options])
%|
%| "Auto-tune" function for Cdiff1() that selects the fastest overall method
%|
%| in
%| isize [] vector of object dimensions (N), e.g., [64 64]
%|
%| option:
%| 'offset' [int] offset (default: 1)
%| 'order' 1 or... |
github | alcu/sms-master | huber_pot.m | .m | sms-master/irt/penalty/huber_pot.m | 383 | utf_8 | 7074ef88c04edbf2d8a674143a224881 | function h = huber_pot(t, d)
%| function h = huber_pot(t, d)
%| huber potential function
if nargin < 1, help(mfilename), error(mfilename), end
if nargin < 2, huber_pot_test, return, end
h = t.^2 / 2;
ii = abs(t) > d;
h(ii) = d * abs(t(ii)) - d.^2/2;
function huber_pot_test
t = linspace(-9,9,101);
delta = 4;
plot(t, ... |
github | alcu/sms-master | ir_hct_rgrad.m | .m | sms-master/irt/penalty/ir_hct_rgrad.m | 4,672 | utf_8 | 328fac6e04b83f7ce893fd9b056ef097 | function [grad out com] = ir_hct_rgrad(x, varargin)
%|function [grad out com] = ir_hct_rgrad(x, varargin)
%|
%| compute 3D regularizer gradient using hct binary
%| for UM testing only
%|
%| in
%| x in xyz order
%| option
%| (many - see below)
%|
%| Notes: because hct2 uses 'zxy' order, it is essential to use Reg1
%| ... |
github | alcu/sms-master | qpwls_psf.m | .m | sms-master/irt/penalty/qpwls_psf.m | 13,114 | utf_8 | e610d68a9b49f03e6281558a0c2d46f4 | function [psf, var, fwhm, mtf, con] = qpwls_psf(A, C, beta, mask, W, varargin)
%|function [psf, var, fwhm, mtf, con] = qpwls_psf(A, C, beta, mask, W, [option])
%|
%| Compute FFT-approximate PSF
%| for quadratically-penalized shift-invariant unweighted least-squares
%| uses psf = [A'WA + beta C'C]^{-1} A'W y, where us... |
github | alcu/sms-master | C2sparse.m | .m | sms-master/irt/penalty/C2sparse.m | 4,020 | utf_8 | bccb4c431c640ab2b5479d543ee2188c | function [C, wjk] = C2sparse(type, kappa, nbrs, chat, dist_power)
%function [C, wjk] = C2sparse(type, kappa, nbrs, chat, dist_power)
%
% create 2D penalty matrix C with 2nd-order pixel neighborhood
% that performs 1st-order finite differences.
% R = beta * C'*D(wjk)*C is the penalty Hessian (in quadratic case)
% in:
%... |
github | alcu/sms-master | potential_shift.m | .m | sms-master/irt/penalty/potential_shift.m | 1,363 | utf_8 | 99ba645443a4bfba020e125120157dd1 | function pot_new = potential_shift(pot_orig, vector)
%function pot_new = potential_shift(pot_orig, vector)
%
% Change pot_orig([Cx]_k) to shifted form: pot_new( [Cx]_k - vector_k )
%
% out
% inline functions:
% pot.potk(pot, C*x) potential function value
% pot.wpot(pot, C*x) potential 'weights' (aka half-quad. curvatu... |
github | alcu/sms-master | reg_offset_xyz_to_zxy.m | .m | sms-master/irt/penalty/reg_offset_xyz_to_zxy.m | 1,657 | utf_8 | 9596eb6b6022420c7d50c90ab4e21aee | function offset_zxy = reg_offset_xyz_to_zxy(offset_xyz, dim_xyz)
%|function offset_zxy = reg_offset_xyz_to_zxy(offset_xyz, dim_xyz)
%|
%| convert usual offsets for xyz image ordering
%| to offsets appropriate for zxy image ordering
%|
%| in
%| offset_xyz [1 noffset]
%| dim_xyz [3]
%|
%| out
%| offset_zxy [1 noffset]... |
github | alcu/sms-master | Robject.m | .m | sms-master/irt/penalty/Robject.m | 8,093 | utf_8 | b296c5415462af0d48b30953df27f765 | function R = Robject(kappa, varargin)
%function R = Robject(kappa, [options])
%
% Build roughness penalty regularization "object" based on C = Cdiff() object,
% for regularized solutions to inverse problems.
%
% General form of nonquadratic penalty function:
% R(x) = \sumk w_k \pot([Cx]_k), where [Cx]_k = \sum_j c_{kj... |
github | alcu/sms-master | Cdiff1.m | .m | sms-master/irt/penalty/Cdiff1.m | 19,004 | utf_8 | e85e378261250a5e825e21d69604e79b | function ob = Cdiff1(isize, varargin)
%|function C1 = Cdiff1(isize, [options])
%|
%| Construct Cdiff1 object that can compute C1 * x and the adjoint C1' * d
%| for a "finite differencing" matrix C1 for roughness penalty regularization.
%| This object provides the finite difference in only a *single* direction,
%| so ... |
github | alcu/sms-master | Csparse.m | .m | sms-master/irt/penalty/Csparse.m | 5,746 | utf_8 | d6e181cab286d0f68dcd0c0bcc173df6 | function [C, ugibb] = Csparse(arg0, arg1, arg2, arg3)
%function C = Csparse('b2info', kappa, mask, chat)
%function C = Csparse('center', Cscale, mask, chat)
%function C = Csparse('maskleak', mask, chat)
%function C = Csparse('maskleak3', [beta_xy beta_z], mask, chat)
%function C = Csparse('maskbar', mask, chat)
%funct... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.