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 | dgallichan/retroMoCoBox-master | kaiser_bessel.m | .m | retroMoCoBox-master/mirt_nufft/kaiser_bessel.m | 4,471 | utf_8 | 916a66564a3b0df803c631e4c9e4e2eb | function [kb, alpha, kb_m] = kaiser_bessel(x, J, alpha, kb_m, K_N)
%function [kb, alpha, kb_m] = kaiser_bessel(x, J, alpha, kb_m)
%function [kb, alpha, kb_m] = kaiser_bessel(x, J, 'best', 0, K_N)
%|
%| generalized Kaiser-Bessel function for x in support [-J/2,J/2]
%| shape parameter "alpha" (default 2.34 J)
%| order p... |
github | dgallichan/retroMoCoBox-master | kaiser_bessel_xray.m | .m | retroMoCoBox-master/mirt_nufft/kaiser_bessel_xray.m | 2,171 | utf_8 | 20c7fd23b0117fae5747e6138c3e10be | function [proj, J, alpha, kb_m, d] = kaiser_bessel_xray(r, J, alpha, kb_m, d)
%function [proj, J, alpha, kb_m, d] = kaiser_bessel_xray(r, J, alpha, kb_m, d)
%
% X-ray transform of generalized Kaiser-Bessel function,
% See (A7) in lewitt:90:mdi, JOSA-A, Oct. 1990.
%
% in
% r [?] radial locations in projection space (un... |
github | dgallichan/retroMoCoBox-master | kaiser_bessel_ft.m | .m | retroMoCoBox-master/mirt_nufft/kaiser_bessel_ft.m | 3,151 | utf_8 | 6f98db03e05169cc58b92332cc9d7ccb | function y = kaiser_bessel_ft(u, J, alpha, kb_m, d)
%function y = kaiser_bessel_ft(u, J, alpha, kb_m, d)
%|
%| Fourier transform of generalized Kaiser-Bessel function,
%| in dimension d (default 1).
%| shape parameter "alpha" (default 2.34 J)
%| order parameter "kb_m" (default 0)
%| See (A3) in lewitt:90:mdi, JOSA-A, ... |
github | dgallichan/retroMoCoBox-master | ifftn_fast.m | .m | retroMoCoBox-master/mirt_nufft/ifftn_fast.m | 2,123 | utf_8 | e1539751dadf29425fe2ac030ef33830 | function ys = ifftn_fast(xs)
%function ys = ifftn_fast(xs)
%|
%| For some reason, matlab's ifftn routine is suboptimal
%| for the case of 2D FFTs, at least on some machines.
%| The improvement herein was found by Hugo Shi.
%|
%| Note: matlab's ifft() and ifftn() handle an optional second "N" argument in
%| different w... |
github | dgallichan/retroMoCoBox-master | nufft1_build.m | .m | retroMoCoBox-master/mirt_nufft/nufft1_build.m | 6,831 | utf_8 | 47a9e904b7cd7d0d576d315e52313b71 | function st = nufft1_build(J, varargin)
%function st = nufft1_build(J, [option])
%| Build 1D LS-NUFFT interpolation coefficients by brute force.
%|
%| in
%| J neighborhood size: [-J/2,J/2]
%| option
%| om [M 1] frequency locations, if not provided build fine table
%| N # of signal values (default: 2^8)
%| K # of DF... |
github | dgallichan/retroMoCoBox-master | nufft_scale.m | .m | retroMoCoBox-master/mirt_nufft/nufft_scale.m | 1,855 | utf_8 | 85f3432ea98708b0e91e36ac16ca3ea4 | function sn = nufft_scale(Nd, Kd, alpha, beta, Nmid)
%function sn = nufft_scale(Nd, Kd, alpha, beta, Nmid)
%|
%| Compute scaling factors for NUFFT
%|
%| in
%| Nd,Kd
%| alpha {d}
%| beta {d}
%|
%| option
%| Nmid [d] midpoint: floor(Nd/2) or default (Nd-1)/2
%|
%| out
%| sn [[Nd]] scaling factors
%|
%| Copyright 2004-... |
github | dgallichan/retroMoCoBox-master | ir_nufft_dpswf1.m | .m | retroMoCoBox-master/mirt_nufft/ir_nufft_dpswf1.m | 2,639 | utf_8 | 238aa4d64a5b027e5055bb1bcbc6a5f7 | function [out, eig1] = ir_nufft_dpswf1(varargin)
%function [out, eig1] = ir_nufft_dpswf1(varargin)
%|
%| Compute discrete prolate spheroidal wave function (DPSWF) in 1D
%|
%| required
%| 'J' # of filter taps
%| 'N' signal length
%|
%| optional
%| 'K' over-sampled FFT length (default: 2*N)
%| 'M' midpoint (default N if... |
github | dgallichan/retroMoCoBox-master | nufft_scale_kb.m | .m | retroMoCoBox-master/mirt_nufft/nufft_scale_kb.m | 1,180 | utf_8 | 027e7bb1e6b1c8aa70e489b2a73fecde | function sn = nufft_scale_kb(Nd, Jd, Kd, kb_alf, kb_m)
%function sn = nufft_scale_kb(Nd, Jd, Kd, kb_alf, kb_m)
%|
%| Compute KB scaling factors for NUFFT
%|
%| in
%| N,J,K [d]
%| kb_alf [d]
%| kb_m [d]
%|
%| out
%| sn [[Nd]] scaling factors
%|
%| Copyright 2004-7-8, Jeff Fessler, University of Michigan
if nargin == ... |
github | dgallichan/retroMoCoBox-master | nufft_sinc.m | .m | retroMoCoBox-master/mirt_nufft/nufft_sinc.m | 693 | utf_8 | 51c5bf16e936950dae19908de3b34bdd | function y = nufft_sinc(x)
%function y = nufft_sinc(x)
%|
%| my version of "sinc" function, because matlab's sinc() is in a toolbox
%|
%| Copyright 2001-12-8, Jeff Fessler, University of Michigan
if nargin < 1, help(mfilename), error(mfilename), end
if streq(x, 'test'), nufft_sinc_test, return, end
iz = find(x == 0)... |
github | dgallichan/retroMoCoBox-master | nufft_diric.m | .m | retroMoCoBox-master/mirt_nufft/nufft_diric.m | 2,037 | utf_8 | 46ddc947f04f975f49e2a7da6668abb1 | function f = nufft_diric(k, N, K, use_true_diric)
%function f = nufft_diric(k, N, K, use_true_diric)
%|
%| "regular fourier" Dirichlet-function WITHOUT phase
%| nufft_diric(t) = sin(pi N t / K) / ( N * sin(pi t / K) )
%| \approx sinc(t / (K/N))
%|
%| caution: matlab's version is different: sin(N * x / 2) / (N * sin(x... |
github | dgallichan/retroMoCoBox-master | dtft_adj.m | .m | retroMoCoBox-master/mirt_nufft/dtft_adj.m | 2,517 | utf_8 | 31b874b3af4d26d5ed53c997b68ffe65 | function x = dtft_adj(X, omega, Nd, n_shift, useloop)
%function x = dtft_adj(X, omega, Nd, n_shift, useloop)
%|
%| Compute adjoint of d-dim DTFT for spectrum X at frequency locations omega
%|
%| in
%| X [M L] dD DTFT values
%| omega [M d] frequency locations (radians)
%| n_shift [d 1] use [0:N-1]-n_shift (default [... |
github | dgallichan/retroMoCoBox-master | reshaper.m | .m | retroMoCoBox-master/mirt_nufft/utilities/reshaper.m | 866 | utf_8 | eca2b6fd3688f8bc29d23216d3ed047a | function y = reshaper(x, dim)
%|function y = reshaper(x, dim)
%|
%| reshape function that is more flexible, allowing for "multiples".
%| example: reshape(rand(2*3*5,7), [2 3 5]) will become [2 3 5 7]
%|
%| in
%| x [*dim (Ld)]
%| dim short row or column
%| if dim is '2d' then y is 2d with first n-1 dims collapsed
%|
... |
github | dgallichan/retroMoCoBox-master | isvar.m | .m | retroMoCoBox-master/mirt_nufft/utilities/isvar.m | 2,049 | utf_8 | 95c208f05b1d72fa8f70e65b03e56437 | function tf = isvar(name, varargin)
%function tf = isvar(name, varargin)
%|
%| Cetermine 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>
%|
%| To have isvar always return false wh... |
github | dgallichan/retroMoCoBox-master | Gsparse.m | .m | retroMoCoBox-master/mirt_nufft/utilities/Gsparse.m | 9,511 | utf_8 | 88325d1b1557607a4099ea68f56a0a8f | function ob = Gsparse(arg1, varargin)
%function ob = Gsparse(file.wtf | sparse | cell, options)
%|
%| Construct Gsparse object, either from a sparse matrix itself,
%| or from the arguments that would be passed to matlab's sparse() command,
%| or from an Aspire binary .wtf file.
%|
%| The Gsparse object overcomes some ... |
github | dgallichan/retroMoCoBox-master | outer_sum.m | .m | retroMoCoBox-master/mirt_nufft/utilities/outer_sum.m | 1,334 | utf_8 | 56ea45f930f9bf8085077c48ad0f140e | 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 | dgallichan/retroMoCoBox-master | embed.m | .m | retroMoCoBox-master/mirt_nufft/utilities/embed.m | 2,239 | utf_8 | 93a4f48fe164cfe452800ab236fdfdc2 | 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]
%| out... |
github | dgallichan/retroMoCoBox-master | streq.m | .m | retroMoCoBox-master/mirt_nufft/utilities/streq.m | 661 | utf_8 | 438e9e1ab3ee87a3c9f9d0f788a63803 | 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 | dgallichan/retroMoCoBox-master | vararg_pair.m | .m | retroMoCoBox-master/mirt_nufft/utilities/vararg_pair.m | 7,356 | utf_8 | 276d4ffde0fc17cd8bcda01e8ae3ea0f | 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" somewhat ... |
github | dgallichan/retroMoCoBox-master | reshapee.m | .m | retroMoCoBox-master/mirt_nufft/utilities/reshapee.m | 1,230 | utf_8 | 7fb83246b60c6a62aa5d784aea01f407 | 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 | dgallichan/retroMoCoBox-master | reale.m | .m | retroMoCoBox-master/mirt_nufft/utilities/reale.m | 1,939 | utf_8 | b81be6ac3a7aeceac32fe3bd312e4303 | function y = reale(x, arg2, arg3)
%| Return real part of complex data (with error checking).
%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')
%|
%| Checks th... |
github | dgallichan/retroMoCoBox-master | eigs.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/eigs.m | 795 | utf_8 | d31c4b50c3e8022449cea1aec13b29ce | function out = eigs(ob, varargin)
% compute largest magnitude eigenvalue of object by calling eigs,
% which in turn probably uses the power method.
% this may be slow for big objects because it is iterative.
warn 'todo: i could not get this to work'
% A = Gdft('mask', true(8,6));
% eigs(A, 1)
if numel(varargin) ~= 1... |
github | dgallichan/retroMoCoBox-master | fatrix2.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/fatrix2.m | 7,820 | utf_8 | c5ac97129a1bdc133ece91155792c95e | function ob = fatrix2(varargin)
%function ob = fatrix2('odim', odim, 'mask', mask, 'arg', arg, [options])
%|
%| Construct fatrix2 object, a matrix generalization for representing
%| any linear operator. The 'f' might stand for 'fake' or 'function-based'
%| or 'fancy' or maybe a last name?
%| The caller can provide a ... |
github | dgallichan/retroMoCoBox-master | build_gram.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/build_gram.m | 1,839 | utf_8 | d236c359232c2ec12cbb0801f5d81203 | function [T, reuse] = build_gram(ob, W, reuse, varargin)
%|function [T, reuse] = build_gram(ob, W, reuse, varargin)
%| build "gram matrix object" T = A' W A
%| in
%| ob the system matrix A
%| W typically diag(wi), having size [1 1]*size(ob,1)
%| reuse stuff returned by previous call that can be reused
%| the nex... |
github | dgallichan/retroMoCoBox-master | subsref.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/subsref.m | 1,717 | utf_8 | 14052c7ad7ab1d7eb34e5252162d0ec4 | function out = subsref(ob, args)
%function out = subsref(ob, args)
% handle subscript references like ob.ref or ob(ref,:)
% Copyright 2002-2-20, Jeff Fessler, University of Michigan
out = fatrix2_subsref1(ob, args(1)); % handle first subscript
if numel(args) > 1 % handle multiple subscripts, e.g., ob.field()
out = ... |
github | dgallichan/retroMoCoBox-master | mtimes.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/mtimes.m | 3,108 | utf_8 | bc5af329700b2259257046f831811dfb | function y = mtimes(ob, x)
%function y = mtimes(ob, x)
% A * x
% A' * y
% y' * A
% x' * A'
% B * A (calls private/fatrix2_mtimes2)
% etc
if isnumeric(ob)
if isscalar(ob) % scalar * object
y = fatrix2_scalar_times(ob, x);
else % row_vector(s) * object
y = (x' * ob')'; % trick: x <-> ob
end
return
end
if ~isnu... |
github | dgallichan/retroMoCoBox-master | block_diag.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/block_diag.m | 3,627 | utf_8 | 67530ea7678d0958a6a8f5af96d0efba | function ob = block_diag(varargin)
%|function ob = block_diag(block1, ..., blockM)
%|
%| Construct fatrix2 object from fatrix2 objects
%| block_diag(A_1, A_2, ..., A_M)
%|
%| in
%| blocks{:} fatrix2 blocks
%|
%| options
%|
%| out
%| ob [nd np] nd = sum_m nrow(A_M), np = sum_m ncol(A_m)
%|
%| Copyright 2012-09-09, Je... |
github | dgallichan/retroMoCoBox-master | fatrix2_block_sum.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/private/fatrix2_block_sum.m | 3,532 | utf_8 | 2852a1d0317715372c36d9a70105f132 | function ob = fatrix2_block_sum(blocks)
%| ob = fatrix2_block_sum(blocks)
%| called for ob1 + ob2 + ...
% find at least one fatrix2 in the collection
ib = [];
for ii=1:numel(blocks)
if isa(blocks{ii}, 'fatrix2')
ib = ii;
break
end
end
if isempty(ib), fail 'no fatrix2? bug', end
bb = blocks{ib}; % reference bloc... |
github | dgallichan/retroMoCoBox-master | fatrix2_kroni.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/private/fatrix2_kroni.m | 2,925 | utf_8 | 3741c0da2fb3d2b85c38bd3bae3fac06 | function ob = fatrix2_kroni(Mkron, ob)
%function ob = fatrix2_kroni(Mkron, ob)
%|
%| Construct fatrix2_block object of form kron(eye(Mkron), ob)
%| i.e., a kronecker product of identity matrix with object.
%|
%| in
%| Mkron natural number
%| ob fatrix2
%|
%| out
%| ob fatrix2 equivalent to kron(eye(Mkron), ob)
%|
%... |
github | dgallichan/retroMoCoBox-master | fatrix2_vertcat.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/private/fatrix2_vertcat.m | 5,871 | utf_8 | d4da7ba38958974e229d84aad5e8055c | function ob = fatrix2_vertcat(blocks, varargin)
%function ob = fatrix2_vertcat(blocks, [options])
%| vertcat: B = [A1; A2; ...]
%|
%| in
%| blocks {cell} cell array of the (fatrix2) blocks
%|
%| option
%| 'dim_cat' dimension along which to concatenate odims
%| all other odims must match
%| default is ndim+1 if *al... |
github | dgallichan/retroMoCoBox-master | fatrix2_do_back.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/private/fatrix2_do_back.m | 660 | utf_8 | 5cf4ff779a40686003ba5f2b760564b3 | function x = fatrix2_do_back(ob, y)
%function x = fatrix2_do_back(A, y)
%|
%| implement 'back' function: A' * x
%| in array mode, accounting for idiag, odiag, scale
%|
%| trick: conj() of idiag odiag scale already done in ctranspose.m
y = fatrix2_apply_diag(y, ob.odiag); % [odim *L]
x = ob.handle_back(ob.arg, y); % [... |
github | dgallichan/retroMoCoBox-master | fatrix2_mtimes2.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/private/fatrix2_mtimes2.m | 4,479 | utf_8 | bb743a219a09097755e01c6166ccfa7a | function ob = fatrix2_mtimes2(ob1, ob2, varargin)
%function ob = fatrix2_mtimes2(ob1, ob2, options)
%|
%| Construct fatrix2 object that is the product of two objects:
%| ob = ob1 * ob2.
%| Requires size(ob1,2) == size(ob2,1) as in matrix multiplication.
%|
%| in
%| ob1 *atrix any object that can do "mtimes" and "size... |
github | dgallichan/retroMoCoBox-master | fatrix2_subsref_colon.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/private/fatrix2_subsref_colon.m | 2,533 | utf_8 | 984e937cde23c07d725fc3435bcc1f42 | function out = fatrix2_subsref_colon(ob, sub2, varargin)
%function out = fatrix2_subsref_colon(ob, sub2, varargin)
%
% handle subscript references like ob(:,sub2)
% This will called from ../subsref with (ob, subs{2})
%
% Copyright 2010-12-02, Jeff Fessler, University of Michigan
if streq(sub2, ':') % ob(:,:)
% do by... |
github | dgallichan/retroMoCoBox-master | fatrix2_block.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/private/fatrix2_block.m | 7,261 | utf_8 | 097056cd31dfee1081dd5d26a3c99cf1 | function ob = fatrix2_block(blocks, varargin)
%function ob = fatrix2_block(blocks, options)
%|
%| Construct fatrix2_block object, a meta-object composed of fatrix2 blocks,
%| such as block_diag(A_1, A_2, ..., A_M)
%| See fatrix2_block_test.m for example usage.
%|
%| in
%| blocks {cell} cell array of the blocks
%|
%| o... |
github | dgallichan/retroMoCoBox-master | fatrix2_horzcat.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/private/fatrix2_horzcat.m | 2,655 | utf_8 | ab2e298b6f4b24fb3cb6a6853b592b88 | function ob = fatrix2_horzcat(blocks, varargin)
%function ob = fatrix2_horzcat(blocks, [options])
%|
%| horzcat: B = [A1, A2, ...]
%|
%| in
%| blocks {cell} cell array of the (fatrix2) blocks
%|
%| option
%| 'dim_cat' dimension along which to concatenate idims
%| all other idims must match
%| default is ndim+1 if ... |
github | dgallichan/retroMoCoBox-master | fatrix2_do_forw.m | .m | retroMoCoBox-master/mirt_nufft/utilities/@fatrix2/private/fatrix2_do_forw.m | 589 | utf_8 | 14f532a201ab0e95830a4fb2d94d5255 | function y = fatrix2_do_forw(ob, x)
%function y = fatrix2_do_forw(A, x)
%|
%| implement 'forw' function: A * x
%| in array mode, accounting for idiag, odiag, scale
x = fatrix2_apply_diag(x, ob.idiag); % [idim *L]
y = ob.handle_forw(ob.arg, x); % [odim *L]
y = fatrix2_apply_diag(y, ob.odiag); % [odim *L]
if ~isequal(... |
github | dgallichan/retroMoCoBox-master | interp1_table1_import.m | .m | retroMoCoBox-master/mirt_nufft/table/interp1_table1_import.m | 413 | utf_8 | 0e4818f872ba8ea210db56495b187e58 | function interp1_table1_import
libname = 'interp1_table1.a';
type11r = ['double[K1] r_ck, double[K1] i_ck, int32 K1, ' ...
'double[J1*L1+1] r_h1, int32 J1, int32 L1, ' ...
'double[M] p_tm, int32 M, double[M] &r_fm, double[M] &i_fm'];
myimport(libname, 'interp1_table1_real_per', 'void', type11r);
function myimport... |
github | dgallichan/retroMoCoBox-master | nufft_interp_zn.m | .m | retroMoCoBox-master/mirt_nufft/private/nufft_interp_zn.m | 2,182 | utf_8 | 54fe4ac12919ea5c4977912942a0217f | function zn = nufft_interp_zn(alist, N, J, K, func, Nmid)
%function zn = nufft_interp_zn(alist, N, J, K, func, Nmid)
%|
%| Compute the "zn" terms for a conventional "shift-invariant" interpolator
%| as described in T-SP paper. Needed for error analysis and for user-
%| defined kernels since I don't provide a means to... |
github | dgallichan/retroMoCoBox-master | newfft_approx_for.m | .m | retroMoCoBox-master/mirt_nufft/private/newfft_approx_for.m | 1,766 | utf_8 | 8b742fbe48ee293d6785b5c5bc93bd0b | function X = newfft_approx_for(st, x, om)
%function X = newfft_approx_for(st, x, om)
%|
%| (approximate) forward NUFFT
Nd = st.Nd;
Kd = st.Kd;
dims = size(x);
dd = length(Nd);
if ndims(x) < dd, fail 'input signal has too few dimensions', end
if any(dims(1:dd) ~= Nd), fail 'input signal has wrong size', end
% the u... |
github | dgallichan/retroMoCoBox-master | newfft_table_init.m | .m | retroMoCoBox-master/mirt_nufft/private/newfft_table_init.m | 5,764 | utf_8 | e855392a9bae1abea60c2f1a27527235 | function st = newfft_table_init(st, varargin)
%function st = newfft_table_init(st, varargin)
%|
%| Initialize structure for d-dimension NUFFT using table-based interpolator,
%| This should be called only by newfft for its 'table0' or 'table1' mode!
%| Note: default oversample factor is 2^11 or 2^13
%|
%| in
%| st str... |
github | dgallichan/retroMoCoBox-master | nufft_T.m | .m | retroMoCoBox-master/mirt_nufft/private/nufft_T.m | 2,089 | utf_8 | 47b3c952386506f8086e1d69330d6f14 | function T = nufft_T(N, J, K, tol, alpha, beta, use_true_diric)
%function T = nufft_T(N, J, K, tol, alpha, beta, use_true_diric)
%|
%| Precompute the matrix T = [C' S S' C]\inv used in NUFFT.
%| This can be precomputed, being independent of frequency location.
%|
%| in
%| N # signal length
%| J # of neighbors
%| K ... |
github | dgallichan/retroMoCoBox-master | nufft_offset.m | .m | retroMoCoBox-master/mirt_nufft/private/nufft_offset.m | 1,137 | utf_8 | 7d76fe312b688a192a002cb1e71c0c6a | function k0 = nufft_offset(om, J, K)
%function k0 = nufft_offset(om, J, K)
%|
%| offset for NUFFT
%| in
%| om [M,1] omega (radians), typically in [-pi, pi) (not essential!)
%| J # of neighbors used for NUFFT interpolation
%| K FFT size
%|
%| out
%| k0 [M,1] prepared for mod(k0 + [1:J], K) (+ 1 for matlab)
%|
%| Copy... |
github | dgallichan/retroMoCoBox-master | fontScale.m | .m | retroMoCoBox-master/generaltools/fontScale.m | 563 | utf_8 | 380e56f9e12368325ead5805937ba2af | function fontScale(scale)
% function fontScale(scale)
H = gcf;
allText = findall(H, 'type', 'text');
allAxes = findall(H, 'type', 'axes');
allFont = [allText; allAxes];
fontSize = get(allFont,'FontSize');
if ~iscell(fontSize)
fontSize = num2cell(fontSize);
end
newFontSize = LocalScale(fontSize, scale, 2... |
github | dgallichan/retroMoCoBox-master | SliceBrowser2.m | .m | retroMoCoBox-master/generaltools/SliceBrowser2.m | 15,785 | utf_8 | 03ae451743aa6e6d2217b505a2bedd75 | % ======================================================================
%> SLICEBROWSER2 M-file for SliceBrowser2.fig
%> SliceBrowser2 is an interactive viewer of 3D volumes,
%> it shows 3 perpendicular slices (XY, YZ, ZX) with 3D pointer.
%> Input: a) VOLUME - a 3D matrix with volume data
%> ... |
github | dgallichan/retroMoCoBox-master | imab_overwrite.m | .m | retroMoCoBox-master/generaltools/imab_overwrite.m | 7,896 | utf_8 | 47678303e0ee236d7a93a21e518b9532 | function imab_overwrite(filename, data, clims, bSep, noCols, cmap)
% function imab_overwrite(filename, data, clims, bSep, noCols, cmap)
%
% Just output the 2D, 3D or 4D data as quickly as possible to a file
%
% Concatenates the slice dimension from left to right, and the time
% dimension from top to bottom.
%
% bSep i... |
github | dgallichan/retroMoCoBox-master | process_options.m | .m | retroMoCoBox-master/generaltools/process_options.m | 4,394 | utf_8 | 483b50d27e3bdb68fd2903a0cab9df44 | % PROCESS_OPTIONS - Processes options passed to a Matlab function.
% This function provides a simple means of
% parsing attribute-value options. Each option is
% named by a unique string and is given a default
% value.
%
% Usage: [var1, var2, ...... |
github | dgallichan/retroMoCoBox-master | imab.m | .m | retroMoCoBox-master/generaltools/imab.m | 7,510 | utf_8 | 90e14b6f83c05e31442f0617cfc92c13 | function [img handle] = imab(data, clims, bSep, noCols)
% function [img handle] = imab(data, clims, bSep, noCols)
%
% Just show the 2D, 3D or 4D data as quickly as possible
%
% Concatenates the slice dimension from left to right, and the time
% dimension from top to bottom.
%
% When Mosaiced, lowest slice is in bottom... |
github | dgallichan/retroMoCoBox-master | squash.m | .m | retroMoCoBox-master/generaltools/squash.m | 560 | utf_8 | dd64926e00cbcc01236f85d2e8457b13 | function [xr, mask] = squash(x, m)
% function [ret, mask] = squash(x)
%
% performs ret = reshape(x,prod(size(x)),1);
%
% [ret, mask] = squash(x, m)
% masks and then squashes, returns the mask
% m can be a mask or a threshold
%
% see unsquash
[xr, dims]=sq(x);
if(nargin > 1)
if(size(m)==1),
coords = find(sq(... |
github | dgallichan/retroMoCoBox-master | load_nii_ext.m | .m | retroMoCoBox-master/niftitools/load_nii_ext.m | 5,314 | utf_8 | d42d976b0a88dd8b32917c88256482db | % Load NIFTI header extension after its header is loaded using load_nii_hdr.
%
% Usage: ext = load_nii_ext(filename)
%
% filename - NIFTI file name.
%
% Returned values:
%
% ext - Structure of NIFTI header extension, which includes num_ext,
% and all the extended header sections in the header extension.
% ... |
github | dgallichan/retroMoCoBox-master | rri_orient.m | .m | retroMoCoBox-master/niftitools/rri_orient.m | 1,986 | utf_8 | d900d68efd72ce15b9cf672e400aefc7 | % Convert image of different orientations to standard Analyze orientation
%
% Usage: nii = rri_orient(nii);
% Jimmy Shen (jimmy@rotman-baycrest.on.ca), 26-APR-04
%___________________________________________________________________
function [nii, orient, pattern] = rri_orient(nii, varargin)
if nargin > 1
... |
github | dgallichan/retroMoCoBox-master | save_untouch0_nii_hdr.m | .m | retroMoCoBox-master/niftitools/save_untouch0_nii_hdr.m | 8,594 | utf_8 | 7e8b1b327e1924837820f75780d52d01 | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function save_nii_hdr(hdr, fid)
if ~isequal(hdr.hk.sizeof_hdr,348),
error('hdr.hk.sizeof_hdr must be 348.');
end
write_header(hdr, fid);
return; % save_nii_hdr
%---------------------------------------------------------------... |
github | dgallichan/retroMoCoBox-master | rri_zoom_menu.m | .m | retroMoCoBox-master/niftitools/rri_zoom_menu.m | 737 | utf_8 | d8151523470b0fba970eb1d98ba56030 | % Imbed a zoom menu to any figure.
%
% Usage: rri_zoom_menu(fig);
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
%--------------------------------------------------------------------
function menu_hdl = rri_zoom_menu(fig)
if isnumeric(fig)
menu_hdl = uimenu('Parent',fig, ...
'Label','Zoom on', ..... |
github | dgallichan/retroMoCoBox-master | rri_select_file.m | .m | retroMoCoBox-master/niftitools/rri_select_file.m | 16,599 | utf_8 | e349954ca803370f62ceeabdbab5912e | function [selected_file, selected_path] = rri_select_file(varargin)
%
% USAGE: [selected_file, selected_path] = ...
% rri_select_file(dir_name, fig_title)
%
% Allow user to select a file from a list of Matlab competible
% file format
%
% Example:
%
% [selected_file, selected_path] = ...
% rri_select_... |
github | dgallichan/retroMoCoBox-master | clip_nii.m | .m | retroMoCoBox-master/niftitools/clip_nii.m | 3,306 | utf_8 | a70bdbed5a0813312d4c83f94b99a710 | % CLIP_NII: Clip the NIfTI volume from any of the 6 sides
%
% Usage: nii = clip_nii(nii, [option])
%
% Inputs:
%
% nii - NIfTI volume.
%
% option - struct instructing how many voxel to be cut from which side.
%
% option.cut_from_L = ( number of voxel )
% option.cut_from_R = ( number of voxel )
% option.cut_from_P ... |
github | dgallichan/retroMoCoBox-master | affine.m | .m | retroMoCoBox-master/niftitools/affine.m | 16,110 | utf_8 | 768d2303e551a9584685bdb01abf6f8b | % Using 2D or 3D affine matrix to rotate, translate, scale, reflect and
% shear a 2D image or 3D volume. 2D image is represented by a 2D matrix,
% 3D volume is represented by a 3D matrix, and data type can be real
% integer or floating-point.
%
% You may notice that MATLAB has a function called 'imtransform.m' fo... |
github | dgallichan/retroMoCoBox-master | load_untouch_nii_img.m | .m | retroMoCoBox-master/niftitools/load_untouch_nii_img.m | 14,756 | utf_8 | 688b2a42f8071c6402a037c7ca923689 | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function [img,hdr] = load_untouch_nii_img(hdr,filetype,fileprefix,machine,img_idx,dim5_idx,dim6_idx,dim7_idx,old_RGB,slice_idx)
if ~exist('hdr','var') | ~exist('filetype','var') | ~exist('fileprefix','var') | ~exist('machine','var')
error('U... |
github | dgallichan/retroMoCoBox-master | load_untouch_nii.m | .m | retroMoCoBox-master/niftitools/load_untouch_nii.m | 6,159 | utf_8 | fd44ac94b02142369bf7831460f4694f | % Load NIFTI or ANALYZE dataset, but not applying any appropriate affine
% geometric transform or voxel intensity scaling.
%
% Although according to NIFTI website, all those header information are
% supposed to be applied to the loaded NIFTI image, there are some
% situations that people do want to leave the origi... |
github | dgallichan/retroMoCoBox-master | collapse_nii_scan.m | .m | retroMoCoBox-master/niftitools/collapse_nii_scan.m | 6,755 | utf_8 | 8a781978fa395a9d412a7b5ea57d9f68 | % Collapse multiple single-scan NIFTI files into a multiple-scan NIFTI file
%
% Usage: collapse_nii_scan(scan_file_pattern, [collapsed_fileprefix], [scan_file_folder])
%
% Here, scan_file_pattern should look like: 'myscan_0*.img'
% If collapsed_fileprefix is omit, 'multi_scan' will be used
% If scan_file_folder is... |
github | dgallichan/retroMoCoBox-master | rri_orient_ui.m | .m | retroMoCoBox-master/niftitools/rri_orient_ui.m | 5,384 | utf_8 | e1196b81940d9f93fbdb43c33799e587 | % Return orientation of the current image:
% orient is orientation 1x3 matrix, in that:
% Three elements represent: [x y z]
% Element value: 1 - Left to Right; 2 - Posterior to Anterior;
% 3 - Inferior to Superior; 4 - Right to Left;
% 5 - Anterior to Posterior; 6 - Superior to Inferior;
% e.g.:
% Standard RAS Or... |
github | dgallichan/retroMoCoBox-master | load_untouch0_nii_hdr.m | .m | retroMoCoBox-master/niftitools/load_untouch0_nii_hdr.m | 8,093 | utf_8 | 3de9ff6a1da47b56ae680e7660eaa041 | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function hdr = load_nii_hdr(fileprefix, machine)
fn = sprintf('%s.hdr',fileprefix);
fid = fopen(fn,'r',machine);
if fid < 0,
msg = sprintf('Cannot open file %s.',fn);
error(msg);
else
fseek(fid,0,'bof');
hdr =... |
github | dgallichan/retroMoCoBox-master | load_nii.m | .m | retroMoCoBox-master/niftitools/load_nii.m | 6,785 | utf_8 | f5f4f200a0931b9e13806cb6ba40e012 | % Load NIFTI or ANALYZE dataset. Support both *.nii and *.hdr/*.img
% file extension. If file extension is not provided, *.hdr/*.img will
% be used as default.
%
% A subset of NIFTI transform is included. For non-orthogonal rotation,
% shearing etc., please use 'reslice_nii.m' to reslice the NIFTI file.
% It will... |
github | dgallichan/retroMoCoBox-master | unxform_nii.m | .m | retroMoCoBox-master/niftitools/unxform_nii.m | 1,181 | utf_8 | a77d113be34b09d588b2eb326a3c65c8 | % Undo the flipping and rotations performed by xform_nii; spit back only
% the raw img data block. Initial cut will only deal with 3D volumes
% strongly assume we have called xform_nii to write down the steps used
% in xform_nii.
%
% Usage: a = load_nii('original_name');
% manipulate a.img to make array... |
github | dgallichan/retroMoCoBox-master | load_untouch_nii_hdr.m | .m | retroMoCoBox-master/niftitools/load_untouch_nii_hdr.m | 8,522 | utf_8 | 2d4bc8c8ffb83b37daf1e8dd87c108e6 | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function hdr = load_nii_hdr(fileprefix, machine, filetype)
if filetype == 2
fn = sprintf('%s.nii',fileprefix);
if ~exist(fn)
msg = sprintf('Cannot find file "%s.nii".', fileprefix);
error(msg);
end
else
... |
github | dgallichan/retroMoCoBox-master | save_nii_ext.m | .m | retroMoCoBox-master/niftitools/save_nii_ext.m | 977 | utf_8 | b60a98ab7537a883dc3ffef3175f19ae | % Save NIFTI header extension.
%
% Usage: save_nii_ext(ext, fid)
%
% ext - struct with NIFTI header extension fields.
%
% NIFTI data format can be found on: http://nifti.nimh.nih.gov
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
function save_nii_ext(ext, fid)
if ~exist('ext','var') | ~exist('fid','var')
... |
github | dgallichan/retroMoCoBox-master | view_nii_menu.m | .m | retroMoCoBox-master/niftitools/view_nii_menu.m | 14,415 | utf_8 | 32dd591fa1070721f0255f47f6e02510 | % Imbed Zoom, Interp, and Info menu to view_nii window.
%
% Usage: view_nii_menu(fig);
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
%--------------------------------------------------------------------
function menu_hdl = view_nii_menu(fig, varargin)
if isnumeric(fig)
menu_hdl = init(fig);
retur... |
github | dgallichan/retroMoCoBox-master | load_nii_hdr.m | .m | retroMoCoBox-master/niftitools/load_nii_hdr.m | 10,031 | utf_8 | e95839e314863f7ee463cc2626dd447c | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function [hdr, filetype, fileprefix, machine] = load_nii_hdr(fileprefix)
if ~exist('fileprefix','var'),
error('Usage: [hdr, filetype, fileprefix, machine] = load_nii_hdr(filename)');
end
machine = 'ieee-le';
new_ext = 0;
if fin... |
github | dgallichan/retroMoCoBox-master | save_untouch_slice.m | .m | retroMoCoBox-master/niftitools/save_untouch_slice.m | 19,660 | utf_8 | c2d89b14023939eb6397c630026c3ddf | % Save back to the original image with a portion of slices that was
% loaded by "load_untouch_nii". You can process those slices matrix
% in any way, as long as their dimension is not altered.
%
% Usage: save_untouch_slice(slice, filename, ...
% slice_idx, [img_idx], [dim5_idx], [dim6_idx], [dim7_idx])
%
% slice ... |
github | dgallichan/retroMoCoBox-master | load_nii_img.m | .m | retroMoCoBox-master/niftitools/load_nii_img.m | 12,328 | utf_8 | b1b9dd2838a8f217b10fefdc8a931d5e | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function [img,hdr] = load_nii_img(hdr,filetype,fileprefix,machine,img_idx,dim5_idx,dim6_idx,dim7_idx,old_RGB)
if ~exist('hdr','var') | ~exist('filetype','var') | ~exist('fileprefix','var') | ~exist('machine','var')
error('Usage: [img,hdr] = ... |
github | dgallichan/retroMoCoBox-master | bresenham_line3d.m | .m | retroMoCoBox-master/niftitools/bresenham_line3d.m | 4,493 | utf_8 | c19f06df423676afeb59762ac55c0c2f | % Generate X Y Z coordinates of a 3D Bresenham's line between
% two given points.
%
% A very useful application of this algorithm can be found in the
% implementation of Fischer's Bresenham interpolation method in my
% another program that can rotate three dimensional image volume
% with an affine matrix:
% http... |
github | dgallichan/retroMoCoBox-master | make_nii.m | .m | retroMoCoBox-master/niftitools/make_nii.m | 6,849 | utf_8 | 3c7c8b81655c111a9ce4b82086bde4f5 | % Make NIfTI structure specified by an N-D matrix. Usually, N is 3 for
% 3D matrix [x y z], or 4 for 4D matrix with time series [x y z t].
% Optional parameters can also be included, such as: voxel_size,
% origin, datatype, and description.
%
% Once the NIfTI structure is made, it can be saved into NIfTI fil... |
github | dgallichan/retroMoCoBox-master | verify_nii_ext.m | .m | retroMoCoBox-master/niftitools/verify_nii_ext.m | 1,676 | utf_8 | db3d32ecba688905185f5ed01b409fd1 | % Verify NIFTI header extension to make sure that each extension section
% must be an integer multiple of 16 byte long that includes the first 8
% bytes of esize and ecode. If the length of extension section is not the
% above mentioned case, edata should be padded with all 0.
%
% Usage: [ext, esize_total] = verif... |
github | dgallichan/retroMoCoBox-master | get_nii_frame.m | .m | retroMoCoBox-master/niftitools/get_nii_frame.m | 4,310 | utf_8 | d40741446b1af0bebe1f14472585cf85 | % Return time frame of a NIFTI dataset. Support both *.nii and
% *.hdr/*.img file extension. If file extension is not provided,
% *.hdr/*.img will be used as default.
%
% It is a lightweighted "load_nii_hdr", and is equivalent to
% hdr.dime.dim(5)
%
% Usage: [ total_scan ] = get_nii_frame(filename)
%
% filen... |
github | dgallichan/retroMoCoBox-master | flip_lr.m | .m | retroMoCoBox-master/niftitools/flip_lr.m | 3,484 | utf_8 | a0b2d0189d90339a841863efeb60681a | % When you load any ANALYZE or NIfTI file with 'load_nii.m', and view
% it with 'view_nii.m', you may find that the image is L-R flipped.
% This is because of the confusion of radiological and neurological
% convention in the medical image before NIfTI format is adopted. You
% can find more details from:
%
% http... |
github | dgallichan/retroMoCoBox-master | save_nii.m | .m | retroMoCoBox-master/niftitools/save_nii.m | 9,379 | utf_8 | e8bbf428b69307f4798cfbf3d456d26a | % Save NIFTI dataset. Support both *.nii and *.hdr/*.img file extension.
% If file extension is not provided, *.hdr/*.img will be used as default.
%
% Usage: save_nii(nii, filename, [old_RGB])
%
% nii.hdr - struct with NIFTI header fields (from load_nii.m or make_nii.m)
%
% nii.img - 3D (or 4D) matrix of NIFTI... |
github | dgallichan/retroMoCoBox-master | rri_file_menu.m | .m | retroMoCoBox-master/niftitools/rri_file_menu.m | 3,974 | utf_8 | 1ec91620ceb4108dde9a63945380028f | % Imbed a file menu to any figure. If file menu exist, it will append
% to the existing file menu. This file menu includes: Copy to clipboard,
% print, save, close etc.
%
% Usage: rri_file_menu(fig);
%
% rri_file_menu(fig,0) means no 'Close' menu.
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
%---------... |
github | dgallichan/retroMoCoBox-master | reslice_nii.m | .m | retroMoCoBox-master/niftitools/reslice_nii.m | 9,799 | utf_8 | 3124773494b774f14bd2c42213f01b09 | % The basic application of the 'reslice_nii.m' program is to perform
% any 3D affine transform defined by a NIfTI format image.
%
% In addition, the 'reslice_nii.m' program can also be applied to
% generate an isotropic image from either a NIfTI format image or
% an ANALYZE format image.
%
% The resliced NIfTI fi... |
github | dgallichan/retroMoCoBox-master | save_untouch_nii.m | .m | retroMoCoBox-master/niftitools/save_untouch_nii.m | 6,471 | utf_8 | 5fdf845fdafd6d503228b3df91f9095c | % Save NIFTI or ANALYZE dataset that is loaded by "load_untouch_nii.m".
% The output image format and file extension will be the same as the
% input one (NIFTI.nii, NIFTI.img or ANALYZE.img). Therefore, any file
% extension that you specified will be ignored.
%
% Usage: save_untouch_nii(nii, filename)
%
% nii -... |
github | dgallichan/retroMoCoBox-master | view_nii.m | .m | retroMoCoBox-master/niftitools/view_nii.m | 141,368 | utf_8 | 16ca1f605e4232fe569c72ba5b85efad | % VIEW_NII: Create or update a 3-View (Front, Top, Side) of the
% brain data that is specified by nii structure
%
% Usage: status = view_nii([h], nii, [option]) or
% status = view_nii(h, [option])
%
% Where, h is the figure on which the 3-View will be plotted;
% nii is the brain data in NIFTI format;
% option is... |
github | dgallichan/retroMoCoBox-master | mat_into_hdr.m | .m | retroMoCoBox-master/niftitools/mat_into_hdr.m | 2,608 | utf_8 | d53006b93ff90a4a5561d16ff2f4e9a6 | %MAT_INTO_HDR The old versions of SPM (any version before SPM5) store
% an affine matrix of the SPM Reoriented image into a matlab file
% (.mat extension). The file name of this SPM matlab file is the
% same as the SPM Reoriented image file (.img/.hdr extension).
%
% This program will convert the ANALYZE 7.5 SPM Reor... |
github | dgallichan/retroMoCoBox-master | xform_nii.m | .m | retroMoCoBox-master/niftitools/xform_nii.m | 18,107 | utf_8 | 29a1cff91c944d6a93e5101946a5da4d | % internal function
% 'xform_nii.m' is an internal function called by "load_nii.m", so
% you do not need run this program by yourself. It does simplified
% NIfTI sform/qform affine transform, and supports some of the
% affine transforms, including translation, reflection, and
% orthogonal rotation (N*90 degree... |
github | dgallichan/retroMoCoBox-master | make_ana.m | .m | retroMoCoBox-master/niftitools/make_ana.m | 5,455 | utf_8 | 2f62999cbcad72129c892135ff492a1e | % Make ANALYZE 7.5 data structure specified by a 3D or 4D matrix.
% Optional parameters can also be included, such as: voxel_size,
% origin, datatype, and description.
%
% Once the ANALYZE structure is made, it can be saved into ANALYZE 7.5
% format data file using "save_untouch_nii" command (for more detail,... |
github | dgallichan/retroMoCoBox-master | extra_nii_hdr.m | .m | retroMoCoBox-master/niftitools/extra_nii_hdr.m | 7,830 | utf_8 | 853f39f00cbf133e90d0f2cf08d79488 | % Decode extra NIFTI header information into hdr.extra
%
% Usage: hdr = extra_nii_hdr(hdr)
%
% hdr can be obtained from load_nii_hdr
%
% NIFTI data format can be found on: http://nifti.nimh.nih.gov
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
function hdr = extra_nii_hdr(hdr)
switch hdr.dime.datatype
ca... |
github | dgallichan/retroMoCoBox-master | rri_xhair.m | .m | retroMoCoBox-master/niftitools/rri_xhair.m | 2,208 | utf_8 | b3ae9df90d43e5d9538b6b135fa8af20 | % rri_xhair: create a pair of full_cross_hair at point [x y] in
% axes h_ax, and return xhair struct
%
% Usage: xhair = rri_xhair([x y], xhair, h_ax);
%
% If omit xhair, rri_xhair will create a pair of xhair; otherwise,
% rri_xhair will update the xhair. If omit h_ax, current axes will
% be used.... |
github | dgallichan/retroMoCoBox-master | save_untouch_nii_hdr.m | .m | retroMoCoBox-master/niftitools/save_untouch_nii_hdr.m | 8,514 | utf_8 | 582f82c471a9a8826eda59354f61dd1a | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function save_nii_hdr(hdr, fid)
if ~isequal(hdr.hk.sizeof_hdr,348),
error('hdr.hk.sizeof_hdr must be 348.');
end
write_header(hdr, fid);
return; % save_nii_hdr
%---------------------------------------------------------------... |
github | dgallichan/retroMoCoBox-master | expand_nii_scan.m | .m | retroMoCoBox-master/niftitools/expand_nii_scan.m | 1,310 | utf_8 | 430b7a8f7dcd7efb4a9b88a06c9b1f17 | % Expand a multiple-scan NIFTI file into multiple single-scan NIFTI files
%
% Usage: expand_nii_scan(multi_scan_filename, [img_idx], [path_to_save])
%
% NIFTI data format can be found on: http://nifti.nimh.nih.gov
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
function expand_nii_scan(filename, img_idx, newpath)
... |
github | dgallichan/retroMoCoBox-master | load_untouch_header_only.m | .m | retroMoCoBox-master/niftitools/load_untouch_header_only.m | 7,045 | utf_8 | ebd914e3826a6bb8f5f203c0ae31b2e2 | % Load NIfTI / Analyze header without applying any appropriate affine
% geometric transform or voxel intensity scaling. It is equivalent to
% hdr field when using load_untouch_nii to load dataset. Support both
% *.nii and *.hdr file extension. If file extension is not provided,
% *.hdr will be used as default.
% ... |
github | dgallichan/retroMoCoBox-master | bipolar.m | .m | retroMoCoBox-master/niftitools/bipolar.m | 2,145 | utf_8 | 295f87ece96ca4c5dff8dce4cd912a34 | %BIPOLAR returns an M-by-3 matrix containing a blue-red colormap, in
% in which red stands for positive, blue stands for negative,
% and white stands for 0.
%
% Usage: cmap = bipolar(M, lo, hi, contrast); or cmap = bipolar;
%
% cmap: output M-by-3 matrix for BIPOLAR colormap.
% M: number of shades in the color... |
github | dgallichan/retroMoCoBox-master | save_nii_hdr.m | .m | retroMoCoBox-master/niftitools/save_nii_hdr.m | 9,270 | utf_8 | f97c194f5bfc667eb4f96edf12be02a7 | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function save_nii_hdr(hdr, fid)
if ~exist('hdr','var') | ~exist('fid','var')
error('Usage: save_nii_hdr(hdr, fid)');
end
if ~isequal(hdr.hk.sizeof_hdr,348),
error('hdr.hk.sizeof_hdr must be 348.');
end
if hdr.h... |
github | yabinzhangJohn/SNS_matlab-master | gbvs_fast.m | .m | SNS_matlab-master/gbvs/gbvs_fast.m | 344 | utf_8 | 6d5d89d6ae8e562d122b2bd42b61ca1c | %%
%% Use this instead of gbvs() if you want slightly less predictive maps
%% computed in a fraction of the time.
%%
%%
function out = gbvs_fast( img )
params = makeGBVSParams;
params.channels = 'DO';
params.gaborangles = [ 0 90 ];
params.levels = 3;
params.verbose = 0;
params.tol = 0.003;
params.salmapmaxsize = 24;
... |
github | yabinzhangJohn/SNS_matlab-master | simpledistance.m | .m | SNS_matlab-master/gbvs/algsrc/simpledistance.m | 1,000 | utf_8 | 7601020cf6132b30bb5e12b37c5cca80 | %
% gives you a matrix where
% d( ix(i,j) , ix(ii,jj) ) = distance^2 between (i,j) & (ii,jj)
%
% cyclic_type
% 1 => cyclic boundary rules
% 2 => non-cyclic boundaries
function d = simpledistance( dim , cyclic_type )
d = 0;
ix = indexmatrix( dim );
N = prod( dim );
d = zeros( N , N );
for i=1:d... |
github | yabinzhangJohn/SNS_matlab-master | initGBVS.m | .m | SNS_matlab-master/gbvs/algsrc/initGBVS.m | 1,772 | utf_8 | 80b4a14216cdb4a6623632d45cb45253 | %
% some constants used across different calls to gbvs()
%
function [grframe,param] = initGBVS(param, imgsize)
mymessage(param,'initializing....\n');
% logical consistency checking of parameters
if ( min(param.levels) < 2 )
mymessage(param,'oops. cannot use level 1.. trimming levels used\n');
param.levels = ... |
github | yabinzhangJohn/SNS_matlab-master | graphsalinit.m | .m | SNS_matlab-master/gbvs/algsrc/graphsalinit.m | 1,026 | utf_8 | d0c5ae5c9508ada12afe34373f253647 |
% this function creates the weight matrix for making edge weights
% and saves some other constants (like node-in-lattice index) to a 'frame'
% used when the graphs are made from saliency/feature maps.
%
% edge types (by default, instantiate fully connected graph.
% use inter/intra-type = 1 to connect only to neares... |
github | yabinzhangJohn/SNS_matlab-master | principalEigenvectorRaw.m | .m | SNS_matlab-master/gbvs/algsrc/principalEigenvectorRaw.m | 570 | utf_8 | d15fddf0262de69dc5f1e33f6cb66149 |
%
% computes the principal eigenvector of a [nm nm] markov matrix
%
% j harel 6/06
function [v,iter] = principalEigenvectorRaw( markovA , tol )
if ( sparseness(markovA) < .4 )
markovA = sparse(markovA);
end
D = size(markovA,1);
df = 1;
v = ones(size(markovA,1),1)/D;
oldv = v;
oldoldv = v;
iter = 0;
while ( ... |
github | yabinzhangJohn/SNS_matlab-master | graphsalapply.m | .m | SNS_matlab-master/gbvs/algsrc/graphsalapply.m | 1,997 | utf_8 | 20466eca0d9435bee34c034d85300563 |
function [Anorm,iters] = graphsalapply( A , frame , sigma_frac, num_iters , algtype , tol )
%
% this function is the heart of GBVS.
% * it takes a feature map, forms a graph over its locations, which is either a lattice of a hierachy ("multiresolution")of lattices,
% connects the nodes with weighted edges, an... |
github | yabinzhangJohn/SNS_matlab-master | formMapPyramid.m | .m | SNS_matlab-master/gbvs/algsrc/formMapPyramid.m | 942 | utf_8 | ab71c2f7b30de2dd2114c41e63b96d9b |
%
% for each delta in deltas , adds map
% delta binary orders smaller to A
% stacks dimensions of maps in A
%
function [ Apyr , dims ] = formMapPyramid( A , deltas )
my_eps = 1e-12;
num_deltas = length(deltas);
max_delta = max(deltas);
num_pyr = 1 + num_deltas;
dim = [ size(A) num_pyr ];
Apyr = zeros( dim ... |
github | yabinzhangJohn/SNS_matlab-master | mycombnk.m | .m | SNS_matlab-master/gbvs/util/mycombnk.m | 630 | utf_8 | 1cc3c3c12e6cf6986a9509ab746d8918 | % so that stats toolbox is not used
function cmbs = mycombnk( nums , k )
N = length(nums);
T = N^k;
cmbs = zeros( T , k );
for j=T:-1:1
n = j;
for jj=1:k
b = mod(n,N);
n = n - b;
n = n / N;
cmbs( j , k-jj+1 ) = nums(b+1);
cmbs( j , : ) = sort( cmb... |
github | yabinzhangJohn/SNS_matlab-master | rocScoreSaliencyVsFixations.m | .m | SNS_matlab-master/gbvs/util/rocScoreSaliencyVsFixations.m | 526 | utf_8 | e5a2c4980a96dfc87e0018a551b6e829 |
function a = rocScoreSaliencyVsFixations( salmap , X , Y , origimgsize )
%
% outputs ROC Area-Under-Curve Score between a saliency map and fixations.
%
% salmap : a saliency map
% X : vector of X locations of fixations in original image coordinates
% Y : vector of Y locations of fixat... |
github | yabinzhangJohn/SNS_matlab-master | heatmap_overlay.m | .m | SNS_matlab-master/gbvs/util/heatmap_overlay.m | 931 | utf_8 | 9df2560dbfba7350571c360e65fcc5b1 |
% img = image on which to overlay heatmap
% heatmap = the heatmap
% (optional) colorfunc .. this can be 'jet' , or 'hot' , or 'flag'
function omap = heatmap_overlay( img , heatmap, colorfun )
if ( strcmp(class(img),'char') == 1 ) img = imread(img); end
if ( strcmp(class(img),'uint8') == 1 ) img = double(img)/255; en... |
github | yabinzhangJohn/SNS_matlab-master | rocSal.m | .m | SNS_matlab-master/gbvs/util/rocSal.m | 1,883 | utf_8 | 4da4a7460eecf4abed33162ffacf5737 |
function a = rocSal( salmap , mask )
% ROC area agreement between saliency map (salmap) and fixations (mask)
% == good measure of HOW WELL salmap 'predicts' fixations
%
% - mask is the same size as salmap and
% contains number of fixations at each
% map location ( 0,1,2,..etc. )
%
% - gives the ROC score of ... |
github | yabinzhangJohn/SNS_matlab-master | rgb2dkl.m | .m | SNS_matlab-master/gbvs/util/rgb2dkl.m | 9,700 | utf_8 | f8290800ec3e1639d9f094795edd292a |
function dkl = rgb2dkl(rgb)
sz = size(rgb);
im = shiftdim(rgb,2);
im = reshape(im,[3 prod(sz(1:2))]);
im = im';
im = rgb2dkl_v(im);
im = im';
im = reshape(im,[3 sz(1:2)]);
dkl = shiftdim(im,1);
function dkl = rgb2dkl_v(rgb)
% bunch of constants used for RGB -> DKL conversion:
lut_rgb = [
0.024935, 0.0076954,... |
github | yabinzhangJohn/SNS_matlab-master | makeFixationMask.m | .m | SNS_matlab-master/gbvs/util/makeFixationMask.m | 765 | utf_8 | 1b9e0662a52cf312dba5c9bea9427371 |
function mask = makeFixationMask( X , Y , origimgsize , salmapsize )
%
% this maps (X,Y) fixation coordinates to fixation mask
%
% given fixation coordinates X and Y in original image coordinates,
% produces mask of same size salmapsize where each location contains
% an integer count of the fixations lying at that lo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.