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 | uoguelph-mlrg/vlr-master | reslice_nii.m | .m | vlr-master/utils/nii/nifti_DL/reslice_nii.m | 9,817 | utf_8 | 05783cd4f127a22486db67a9cc89ad2a | % 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 | uoguelph-mlrg/vlr-master | save_untouch_nii.m | .m | vlr-master/utils/nii/nifti_DL/save_untouch_nii.m | 6,494 | utf_8 | 50fa95cbb847654356241a853328f912 | % 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 | uoguelph-mlrg/vlr-master | view_nii.m | .m | vlr-master/utils/nii/nifti_DL/view_nii.m | 139,608 | utf_8 | 74f9dea7539a45a7993beb22becf2fa2 | % 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 | uoguelph-mlrg/vlr-master | mat_into_hdr.m | .m | vlr-master/utils/nii/nifti_DL/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 | uoguelph-mlrg/vlr-master | xform_nii.m | .m | vlr-master/utils/nii/nifti_DL/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 | uoguelph-mlrg/vlr-master | make_ana.m | .m | vlr-master/utils/nii/nifti_DL/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 | uoguelph-mlrg/vlr-master | extra_nii_hdr.m | .m | vlr-master/utils/nii/nifti_DL/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 | uoguelph-mlrg/vlr-master | rri_xhair.m | .m | vlr-master/utils/nii/nifti_DL/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 | uoguelph-mlrg/vlr-master | save_untouch_nii_hdr.m | .m | vlr-master/utils/nii/nifti_DL/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 | uoguelph-mlrg/vlr-master | expand_nii_scan.m | .m | vlr-master/utils/nii/nifti_DL/expand_nii_scan.m | 1,333 | utf_8 | 748da05d09c1a005401c67270c4b94ab | % 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 | uoguelph-mlrg/vlr-master | load_untouch_header_only.m | .m | vlr-master/utils/nii/nifti_DL/load_untouch_header_only.m | 7,068 | utf_8 | 8996c72db42b01029c92a4ecd88f4b21 | % 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 | uoguelph-mlrg/vlr-master | bipolar.m | .m | vlr-master/utils/nii/nifti_DL/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 | uoguelph-mlrg/vlr-master | save_nii_hdr.m | .m | vlr-master/utils/nii/nifti_DL/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 | uoguelph-mlrg/vlr-master | makediffeos.m | .m | vlr-master/spm/deform/makediffeos.m | 1,338 | utf_8 | 8bde1c01636201ff1d3eba506055a424 | % MAKEDIFFEOS
% Calling the functions mni2ptx_old and ptx2mni_old re-computes a transformation
% matrix which is expensive to compute and can easily be saved as a mat file.
% The purpose of this function is to pre-compute those transforms (T) for use by
% the new mni2ptx and ptx2mni to transform between mni and ptx qui... |
github | uoguelph-mlrg/vlr-master | spmdeform_old.m | .m | vlr-master/spm/deform/spmdeform_old.m | 2,052 | utf_8 | d3c51e0733a8e7cddb779f509aba4d00 | % SPMDEFORM
% This function calls SPM's deform tool to warp 3D image arrays (varargin)
% according to the transformation file xform
% (this is given as a filename: the xform estimated by SPM previously).
% This requires saving the images as nii temporarily.
% The xform filename is used as a temporary directory.
% All ... |
github | uoguelph-mlrg/vlr-master | spmdeform.m | .m | vlr-master/spm/deform/spmdeform.m | 423 | utf_8 | 3eebf56e73afeae5fd1c65139b9ec6d5 | % SPMDEFORM
% This function is a wrapper for spm_diffeo('push',...)
% as implemented in 'push_def(Def,mat,job)' line 514 of spm_deformations.m
%
% Outputs will match the ordering of varargin.
function [varargout] = spmdeform(T,so,varargin)
for v = 1:numel(varargin)
Vi = single(varargin{v});
[Vo,c] = spm_diffeo('p... |
github | uoguelph-mlrg/vlr-master | ptx2mni_old.m | .m | vlr-master/spm/deform/ptx2mni_old.m | 619 | utf_8 | e6c7c39fde2c210383721dde6decea7e | % MNI2PTX
% This function uses spmdeform to warp MNI space inputs (varargin) to pt space,
% using the deformation specified by imglutname('ixform',N,n) -- i.e. for pt 'n'
function [varargout] = ptx2mni_old(N,n,varargin)
xform = imglutname('ixform', N,n,1); % xform
templatei = imglutname('FLAIR', N,n,1)... |
github | uoguelph-mlrg/vlr-master | ptx2mni.m | .m | vlr-master/spm/deform/ptx2mni.m | 452 | utf_8 | 23f5f8dabeb2d1e65ca92e57f5f024a1 | % MNI2PTX
% This function uses spmdeform to warp MNI space inputs (varargin) to pt space,
% using the deformation specified by imglutname('ixform',N,n) -- i.e. for pt 'n'
function [varargout] = ptx2mni(N,n,varargin)
xform = load(imglutname('ptx2mni',N,n,1)); % xform
varargout = cell(size(varargin));
[varargout{:}]... |
github | uoguelph-mlrg/vlr-master | mni2ptx_old.m | .m | vlr-master/spm/deform/mni2ptx_old.m | 621 | utf_8 | 742c3e27fbd491cf0bd197258a15bbf4 | % MNI2PTX
% This function uses spmdeform to warp pt space inputs (varargin) to MNI space,
% using the deformation specified by imglutname('xform',N,n) -- i.e. for pt 'n'
function [varargout] = mni2ptx_old(N,n,varargin)
xform = imglutname('xform', N,n,1); % xform
templatei = imgname ('mni:FLAIR',n,1);... |
github | uoguelph-mlrg/vlr-master | makealldiffeos.m | .m | vlr-master/spm/deform/makealldiffeos.m | 1,308 | utf_8 | 5e4adae5fe7bf236717ea96909cff8c2 | % MAKEALLDIFFEOS
% This function pre-computes transformation matrices used by SPM to transform
% between native (ptx) and MNI space. The matrices are expensive to compute, so
% a hack-ish parallelization is used which spawns background matlab instances to
% complete more quickly.
function [] = makealldiffeos()
Ni = 1... |
github | uoguelph-mlrg/vlr-master | mni2ptx.m | .m | vlr-master/spm/deform/mni2ptx.m | 454 | utf_8 | 1045489efa2143f0fd053b4114acd6bc | % MNI2PTX
% This function uses spmdeform to warp pt space inputs (varargin) to MNI space,
% using the deformation specified by imglutname('xform',N,n) -- i.e. for pt 'n'
function [varargout] = mni2ptx(N,n,varargin)
xform = load(imglutname('mni2ptx',N,n,1)); % xform
varargout = cell([1,numel(varargin)]);
[varargout... |
github | uoguelph-mlrg/vlr-master | plot_synthetic_histmatch.m | .m | vlr-master/figs/plot_synthetic_histmatch.m | 2,817 | utf_8 | 05c6dd57705544c06fafe4df3068a4c4 | function [] = plot_synthetic_histmatch()
V = 100^3;
src = {'uniform','unimodal','bimodal','trimodal'};
clr = rainbow6; clr = clr([1,2,3,4],:);
tar = {'uniform','unimodal','bimodal','trimodal'};
for s = 1:numel(src), X{s} = data(V,src{s}); end
for t = 1:numel(tar), [T{t},pt{t}] = data(V,tar{t}); end
% plot original
figu... |
github | uoguelph-mlrg/vlr-master | plot_y_sep_objectives.m | .m | vlr-master/figs/plot_y_sep_objectives.m | 1,807 | utf_8 | f14d5c607b2797686db85c29af628b50 | function [] = plot_y_sep_objectives()
for t = 1:3
switch t
case 1
Y = {[0.1,0.15,0.18,0.25,0.29,0.36,0.48,0.72],...
[0.43,0.52,0.62,0.67,0.75,0.78,0.85]};
case 2
Y = {[0.1,0.15,0.18,0.25,0.29,0.36,0.41,0.49],...
[0.51,0.54,0.61,0.75,0.78,0.85]};
case 3
Y = {[0.1,0.1... |
github | uoguelph-mlrg/vlr-master | plot_converge.m | .m | vlr-master/figs/plot_converge.m | 1,017 | utf_8 | 0406c0d850fce9df00497c72c958846d | function [] = plot_converge()
% define the hyperparameters
h = hypdef_final;
h.name.cv = 'nocv';
h.sam.fresh = 0;
h = hypfill(h);
% load the training data
[h,Y,C] = gettrainingdata(h);
ivec = true([1,size(Y,2)]);
idx.i.train = ivec;
idx.s.train = ivec;
idx.i.valid = ivec;
idx.s.valid = ivec;
[Y,C,idx] = dataregfun(h.... |
github | uoguelph-mlrg/vlr-master | plot_mri_spin_echo.m | .m | vlr-master/figs/plot_mri_spin_echo.m | 2,679 | utf_8 | 82104048b23837d3f74016d6488f1c8e | function [] = plot_mri_spin_echo()
figure;
N = 100;
clr.RF = darken(red(1),0.5);
clr.psi = blu(1);
clr.T2 = lighten(blu(1),0.5);
clr.T1 = lighten([1.0,0.5,0.0],0.5);
t2 = linspace(0,2,3*N);
t1 = linspace(-1,+1,N);
curv = 0.02*linspace(1,0,1.5*N);
tz = zeros(1,N);
p090 = 1*sinc(3*t1);
p180 = 2*sinc(3*t1);
RF ... |
github | uoguelph-mlrg/vlr-master | show_registration.m | .m | vlr-master/figs/show_registration.m | 692 | utf_8 | 18bac7c912cfcd4f18ac18431b2bcebd | function [] = show_registration()
x = {[200,135,23],[130,69,52]};
[I] = getimg([5,9,19]);
for i = 1:2
compareslice(I(i,:),x{i},i);
end
function [I] = getimg(idx)
for i = 1:numel(idx)
I{1,i} = flip(imrotate(readnicenii(imgname('h17:FLAIR',idx(i),1)),180));
I{2,i} = readnicenii(imgname('mni:FLAIR',idx(i),1));
end
... |
github | uoguelph-mlrg/vlr-master | show_m08_revise_manuals.m | .m | vlr-master/figs/show_m08_revise_manuals.m | 1,090 | utf_8 | 0beaf6df06394b4c0d6a2bd94643bbe5 | function [] = show_m08_revise_manuals()
% n.b. THIS IS VERY EXPENSIVE FUNCTION
% Thanks Harvard for interpolating to 0.5mm in all dimensions
% 1GB for each image, you tryna prove something?
[I,GO,GR] = getimg(1);
%compareslice(I,GO,GR,[500,900],128,0,'m08rev-01-d0-z128');
compareslice(I,GO,GR,[500,900],146,2,'m08rev-01... |
github | uoguelph-mlrg/vlr-master | plot_mle_challenges.m | .m | vlr-master/figs/plot_mle_challenges.m | 699 | utf_8 | c205d0f67ec567e31d8e430bf1aa2f1a | function [] = plot_mle_challenges()
% challenge 1: separable classes
Y = [clip(0.25+0.05*randn(32,1),[0.0,0.5]);
clip(0.75+0.05*randn(32,1),[0.5,1.0])];
C = [0*ones(32,1),1*ones(32,1)];
B{1} = 1e6*[-0.5,1];
B{2} = 50*[-0.5,1];
plotone(Y,C,B,'chmle-sep.eps');
% challenge 2: no lesions
Y = [0.5+0.1*randn(64,1)];
C... |
github | uoguelph-mlrg/vlr-master | plot_B_reparam.m | .m | vlr-master/figs/plot_B_reparam.m | 961 | utf_8 | 84c36c6c335bb603bfeed44643e110ea | function [] = plot_B_reparam()
% vary threshold (t)
B{1} = 16*[-0.4,1.0];
B{2} = 16*[-0.5,1.0];
B{3} = 16*[-0.6,1.0];
leg = {'$\tau=0.4$','$\tau=0.5$','$\tau=0.6$'};
plotone(B,leg,'reparam-t.eps');
% vary sensitivity (s)
B{1} = 8*[-0.5,1];
B{2} = 16*[-0.5,1];
B{3} = 32*[-0.5,1];
leg = {'$s=8$','$s=16$','$s=32$'};
p... |
github | uoguelph-mlrg/vlr-master | show_plot_simflair.m | .m | vlr-master/figs/show_plot_simflair.m | 2,193 | utf_8 | 09bd8ad8592c94531857a09a1c290cef | function [] = show_plot_simflair()
% get the TE/TR/TI data
si = [1,2,3,4,5,6, 8,9,10,11,12]; % no TERI data from Harvard
[names,~,~,~,TERI,~] = arrayfun(@scanparams,si,'un',0);
TERI = cat(1,TERI{:});
mri = cat(1,repmat({'ir'},[9,1]),'se','se');
S = size(TERI,1);
z = 90;
%yrng = [0,3.5];
yrng = [0.5,2];
noise = 0.03... |
github | uoguelph-mlrg/vlr-master | show_bias.m | .m | vlr-master/figs/show_bias.m | 574 | utf_8 | 45beaa0401ea9d4417ef4f30eeaa535d | function [] = show_bias()
cmap = inferno;
idx = 11;
z = 20;
mm = [300,800];
I{1} = niceimg(readnii(imgname('h17:FLAIR' ,idx,1)),z,mm,cmap);
I{2} = niceimg(readnii(imgname('h17:FLAIRm',idx,1)),z,mm,cmap);
I{3} = niceimg(readnii(imgname('h17:bias', idx,1)),z,[0,3],cmap);
for i = 1:numel(I)
timshow(I{i},0);
print(the... |
github | uoguelph-mlrg/vlr-master | show_tpfpfn_raw_thropt.m | .m | vlr-master/figs/show_tpfpfn_raw_thropt.m | 1,803 | utf_8 | 00ebc2e216b774c3f7dcb3870793f78d | function [varargout] = show_tpfpfn_raw_thropt(I,G,thr)
cmap = inferno;
key = 'mni96-mni';
N = 96;
savename = ['data/misc/',key,'-thr.mat'];
if nargin < 2 % load images
load(['data/misc/',key,'-I.mat']);
load(['data/misc/',key,'-G.mat']);
M = brainfun;
for i = 1:numel(I)
I{i} = I{i}.*double(M... |
github | uoguelph-mlrg/vlr-master | show_tikzfigs.m | .m | vlr-master/figs/show_tikzfigs.m | 5,105 | utf_8 | a5bef0d8a20858662445e8250999d862 | function [] = show_tikzfigs(x,todo)
if nargin < 1, h = hypdef_final; x = load(h.save.name,'h','o'); end
if nargin < 2, todo = {'slice','lr','hist'}; end
for t = 1:numel(todo)
switch todo{t}
case 'slice', tikzslice(x);
case 'lr', tikzsigmoids;
case 'hist', tikzhists;
end
end
close all;
function [] =... |
github | uoguelph-mlrg/vlr-master | plotypmf.m | .m | vlr-master/figs/utils/plotypmf.m | 584 | utf_8 | 8353f266614455f0139ef8eca2420a88 | % PLOTYPMF
% This function plots he histogram of the data in Y
% stratified by image (dim 2), and coloured by scanner.
function [] = plotypmf(Y,h,leg)
if nargin < 3, leg = 0; end % dont pring legend by default
if max(Y(:)) > 1
Y = bsxfun(@rdivide,Y,max(Y));
end
n = 1:size(Y,2)/h.Ni:size(Y,2);
N = 128;
u = linspace(0... |
github | uoguelph-mlrg/vlr-master | textableres.m | .m | vlr-master/figs/utils/textableres.m | 1,327 | utf_8 | 9814f3665631e44d9b5e61ddc390fd28 | function [] = textableres(h,o,fname,names)
if nargin < 3
fname = fullfile(h.save.figdir,resultsname('tab'));
end
if ~iscell(o)
N = 1;
o = {o};
fmt = 'rcccc';
toprows = {'Scanner','LL','SI','Pr','Re'};
else
N = numel(o);
fmt = sprintf('rc%s',repmat('ccc',[1,N]));
R1 = cellfun(@(s)sprintf('\\\\multicolumn... |
github | uoguelph-mlrg/vlr-master | copythesisresults.m | .m | vlr-master/figs/utils/copythesisresults.m | 3,355 | utf_8 | 6290dbad00e0cf51f1fcc6372fd08fe7 | % COPYTHESISRESULTS
% Since by default, cross validation batches print results to a unique folder,
% this function collects a few used directly in the thesis and copies them into
% the thesis figure directory. Since MATLAB copying is slow, the (windows)
% command line copy is used
function [] = copythesisresults()
tod... |
github | uoguelph-mlrg/vlr-master | boxplotcompare.m | .m | vlr-master/figs/utils/boxplotcompare.m | 2,272 | utf_8 | ba6b99358ef30a59f867d14fd663a401 | function [] = boxplotcompare(h,metrics,mlabs,llthr,savename,leg,pfun,tn)
% clean up inputs
if nargin < 3, mlabs = metrics; end
if nargin < 4, llthr = []; end
if nargin < 5, savename = ''; end
if nargin < 6, leg = {}; end
if nargin < 7, pfun = []... |
github | uoguelph-mlrg/vlr-master | textable.m | .m | vlr-master/figs/utils/textable.m | 856 | utf_8 | 9b0bd7f2063ffe6f5f47623cfa55776a | function [str] = textable(part, varargin)
switch part
case 'top'
titles = varargin{1};
cols = varargin{2};
str = ['\\begin{tabular}{',cols,'}\n\\toprule\n',...
linestr(titles),'\\midrule\n'];
case 'line'
data = varargin{1};
fmt = varargin{2};
str = linestr(data,fmt);
case 'botto... |
github | uoguelph-mlrg/vlr-master | roianalysis.m | .m | vlr-master/paper/roianalysis.m | 1,270 | utf_8 | 8b6bbe8da991e2698ea15920d628ae14 | function [] = roianalysis(M)
if nargin < 1
h = hypdef_final;
load(h.save.name,'h');
M = makecvmasks(h);
end
printvolumes(M,'t1');
printvolumes(M,'t0');
printvolumes(M,'t0v1');
roi = 't0';
[hs.lam,name.lam] = defhypset('lam');
[hs.psu,name.psu] = defhypset('psu');
performanceroi(hs.lam,M,roi);
performanceroi(hs.ps... |
github | uoguelph-mlrg/vlr-master | paperresults.m | .m | vlr-master/paper/paperresults.m | 2,738 | utf_8 | 44f0ce18dbaec28a4ae91453e8d1d348 | function [] = paperresults()
% ------------------------------------------------------------------------------
% statusupdate(50); statusupdate('stats results'); statusupdate();
% paperstats;
% ------------------------------------------------------------------------------
% statusupdate(50); statusupdate('param results'... |
github | uoguelph-mlrg/vlr-master | hypdef_final.m | .m | vlr-master/exp/hyp/hypdef_final.m | 1,284 | utf_8 | 59ca4e247bc6c5abf898ff0a666a8d6d | % HYPDEF_FINAL(h)
% This function defines all model hyperparameters for the segmentation pipeline.
% Default values shown.
% Some shorthands used here are expanded by hypfill.
% DO NOT EDIT!
function [h] = hypdef_final(h)
% flag-like names
h.name.key = 'e-default'; % h.name.key = 'LPA';
h.name.data = 'mni96';... |
github | uoguelph-mlrg/vlr-master | fig_exseg.m | .m | vlr-master/exp/hyp/fig_exseg.m | 1,822 | utf_8 | 2e7e70111e6a83addaaceadfcb70b35b | function [] = fig_exseg(h,o,tn)
if nargin < 2, load(h.save.name,'h','o'); end
if nargin < 3, tn = {'fig','seg'}; end
i = 45; z = 50;
[Z,names] = getdata(h,o,i,z);
for n = 1:numel(Z)
figure;
timshow(Z{n},0,'w500');
if strcmp(names{n},'P')
hold on;
area([0,0,0],[0,0,0],'facecolor',grn(1));
area([0,0,0... |
github | uoguelph-mlrg/vlr-master | hypdef_baseline.m | .m | vlr-master/exp/hyp/hypdef_baseline.m | 1,191 | utf_8 | 64fe8979e01ebaaad5a0daa969d168ca | % HYPDEF_BASELINE(h)
% This function defines all model hyperparameters for the segmentation pipeline.
% Default values shown.
% Some shorthands used here are expanded by hypfill.
% EXP: baseline
% DO NOT EDIT!
function [h] = hypdef_baseline(h)
% flag-like names
h.name.key = 'e-base'; % h.name.key = 'LPA';
h.na... |
github | uoguelph-mlrg/vlr-master | fig_final.m | .m | vlr-master/exp/hyp/fig_final.m | 974 | utf_8 | 881ce3321cdb99e411f80b8aa914fcdf | function [] = fig_final(todo)
if nargin < 1, todo = {'sum','lpa','man','exseg','thr'}; end
h = hypdef_final;
load(h.save.name,'h','o');
for i = 1:numel(todo)
switch todo{i}
case 'sum'
load(h.save.name,'t');
summarizeresults(h,o,t);
copythesisresults;
case 'lpa'
fig_lpa({'beta','compare... |
github | uoguelph-mlrg/vlr-master | fig_lpa.m | .m | vlr-master/exp/hyp/fig_lpa.m | 1,725 | utf_8 | dbe07fc926bb248a8d1d8284f590fa46 | function [] = fig_lpa(todo,hvlr)
if nargin < 1, todo = {'beta','compare'}; end
if nargin < 2
h{1} = hypdef_final;
else
h{1} = hvlr;
end
h{2} = getfield(load(fullfile('data','misc','mni96-LPA-loso.mat'),'h'),'h');
names = {'VLR','LPA'};
metrics = {{'si','pr','re'},{'$SI$','$Pr$','$Re$'}};
test = @(x1,x2)signrank([... |
github | uoguelph-mlrg/vlr-master | defhypset.m | .m | vlr-master/exp/hyp/defhypset.m | 3,814 | utf_8 | f498d6cca92ced1a2f4fcd9254a4f18d | % DEFHYPSET(HYPSET)
% This function defines various sets of hyperparameter combinations for
% comparison.
function [h,names,params] = defhypset(hypset)
switch hypset
case 'ovb' % add regularizations 'one at a time' vs baseline
params = {'e[P--L--A--F--]','\texttt{base}';
'e[P1-L--A--F--]','$V = 1$'... |
github | uoguelph-mlrg/vlr-master | fig_thropt.m | .m | vlr-master/exp/hyp/fig_thropt.m | 1,643 | utf_8 | 6c6c50f80f95a26187fcb04219169eb8 | function [] = fig_thropt(h,fresh)
if nargin < 1, h = hypdef_final; end
if nargin < 2, fresh = 0; end
thr = 0:0.01:1;
Qx = getsampledles(h,fresh);
load(h.save.train,'Cx');
for t = 1:numel(thr)
for i = 1:h.Ni
[si(i,t),pr(i,t),re(i,t)] = performance(Qx{i} > thr(t), Cx{i} > 0.5);
end
statusbar(numel(thr),t,h.Ni/... |
github | uoguelph-mlrg/vlr-master | fig_hypcompare.m | .m | vlr-master/exp/hyp/fig_hypcompare.m | 1,072 | utf_8 | 015b990716a749bcb33130c900e56eac | function [] = fig_hypcompare(todo)
if nargin < 1, todo = {'ovb','cv','ystd','lam'}; end
metrics = {{'si','pr','re'},{'$SI$','$Pr$','$Re$'}};
tests = deftests();
for i = 1:numel(todo)
switch todo{i}
case {'cv','ovb','lam'}
[h,names] = defhypset(todo{i});
boxplotcompare(h,metrics{:},[],[todo{i},'-box'... |
github | uoguelph-mlrg/vlr-master | fig_ystd.m | .m | vlr-master/exp/ystd/fig_ystd.m | 2,726 | utf_8 | 1436bffa348c8b423d76324c930b2272 | function [] = fig_ystd(todo)
if nargin < 1, todo = {'ypmf','tpmf','Z1','Z2'}; end %
matfile = 'D:/DATA/WML/thesis/mni96-ystd.mat';
[h,names] = defhypset('ystd-full');
for i = 1:numel(todo)
switch todo{i}
case 'ypmf'
load(matfile,'Y','h');
doplotypmf(Y,h,names);
case 'tpmf'
load(matfile,'h')... |
github | uoguelph-mlrg/vlr-master | exp_ystd.m | .m | vlr-master/exp/ystd/exp_ystd.m | 629 | utf_8 | f76231fb93b9d6c841465223687c7125 | function [] = exp_ystd()
[Y0,C,h,names] = init;
for s = 1:numel(h)
Y{s} = standardize(Y0,[],h{s}.std.type,h{s}.std.args{:});
J{1,s} = jsepdiff(Y{s},C);
J{2,s} = jsepconv(Y{s},C); % long compute time
statusbar(numel(h),s,h{s}.Ni/3,1);
end
save('D:/DATA/WML/mat/mni96-ystd.mat','h','names','Y','C','J','-v7.3');
f... |
github | uoguelph-mlrg/vlr-master | mapupdate.m | .m | vlr-master/exp/toy/mapupdate.m | 786 | utf_8 | 741300df956139c5b4a4283457c5f8a8 | % MAPUPDATE(Y,C)
% This function computes the map update for a given B, Y, C, lam combination
% for one voxel data (not in parallel).
function [B] = mapupdate(B,Y,C,lam,alpha)
Y = Y(:)';
C = C(:)';
% transform the features by the class
Y1 = [ones(size(Y));Y];
Y1(:,~C) = -Y1(:,~C);
% compute the update
s1 = 1./(1+exp(B... |
github | uoguelph-mlrg/vlr-master | exp_toyreg.m | .m | vlr-master/exp/toy/exp_toyreg.m | 5,490 | utf_8 | f87f98b4f46be0feef67cc955bade8b8 | function [] = exp_toyreg(todo)
if nargin < 1
todo = {'tab-pmf','plt-pmf','plt-lam','plt-psu','srf-lam'};%,'srf-psu'};
end
[D,R] = data;
if any(strcmp('tab-pmf',todo)), tab_distribs(R); end
if any(strcmp('plt-pmf',todo)), plt_distribs(D,R); end
if any(strcmp('plt-lam',todo)), plt_lambdas(D); end
if any(strcmp('plt-ps... |
github | uoguelph-mlrg/vlr-master | standardize.m | .m | vlr-master/vlr/standardize.m | 1,523 | utf_8 | 8a6def5228954a8f30f929a71f83d8e7 | % STANDARDIZE
% This function standardizes the data in Yn, selected by the mask M
% The standardization type is a string, and additional required
% parameters should be passed to to varargin
% If M is empty, then stdfun operates along the 1st dimension of Y only.
function [Ynt] = standardize(Yn,M,type,varargin)
% defi... |
github | uoguelph-mlrg/vlr-master | maketrainingdata.m | .m | vlr-master/vlr/maketrainingdata.m | 2,621 | utf_8 | fde7f464133f1e5f8761d90c9928ec78 | % MAKETRAININGDATA(h)
% This function loads and preprocesses all training data specified by h.
% On completion, these data are saved to file to save time.
% If a save file already exists with the specified name, it is loaded.
function [h,Y,C] = maketrainingdata(h)
[h,N] = init(h);
Y = nan(N.v,h.Ni*N.a,'single'); % gra... |
github | uoguelph-mlrg/vlr-master | arbiter.m | .m | vlr-master/vlr/arbiter.m | 2,380 | utf_8 | d162d6e034a1db167ab37fffd16b831f | % ARBITER
% This function runs one entire cross validation
% of the segmentation model:
% 1. Load the experiment hyperparameters
% 2. Load training data
% 3. For all cross valiation folds:
% 3.1. Define the training-testing indices
% 3.2. Fit the VLR model
% 3.3. Inference & post processing on test images
% 3.... |
github | uoguelph-mlrg/vlr-master | hypdef.m | .m | vlr-master/vlr/hypdef.m | 1,254 | utf_8 | 3dcbe6c806a1204b2a79a8ffa6030897 | % HYPDEF(h)
% This function defines all model hyperparameters for the segmentation pipeline.
% This version (vs _final and _baseline) is for experimenting with parameters.
% Some shorthands used here are expanded by hypfill.
function [h] = hypdef(h)
% flag-like names
h.name.key = 'test'; % h.name.key = 'LPA';
h... |
github | uoguelph-mlrg/vlr-master | performancebat.m | .m | vlr-master/vlr/performancebat.m | 3,466 | utf_8 | d1db4ab8ae539f5c6d787eb4031b03be | % PERFORMANCEBAT
% This function analyzes the performance of the VLR model using the fitted
% parameter images in o.B{idx.c} -- i.e. one cross validation fold.
% To do this efficiently, several MATLAB instances are spawned to compute
% the anaysis in parallel. The function called by the spawns is performancei.
% Data f... |
github | uoguelph-mlrg/vlr-master | hypfill.m | .m | vlr-master/vlr/hypfill.m | 2,415 | utf_8 | fb649bd4b03098223811ef61e8d2d42d | % hypdef(h)
% This function fills in the repetitive parameters and info related to one VLR
% cross validation run.
% hypdef must be called first.
function [h] = hypfill(h)
% load scanner parameters
[names,short,N,vsize,tERI,Y4] = arrayfun(@scanparams,h.scan.idx,'un',0);
h.scan.names = names;
h.scan.short = short;
h.... |
github | uoguelph-mlrg/vlr-master | performancetest.m | .m | vlr-master/vlr/performancetest.m | 2,061 | utf_8 | de5a6bc62a657262ddfaf21306189f8b | % PERFORMANCETEST
% This function analyzes the performance of *any* segmentation model,
% provided the initial segmentations (can be probabilistic) are saved as nii.
% These segmentations are loaded using imglutname with the key specified.
% Segmentations are thresholded using either the default threshold specified
% i... |
github | uoguelph-mlrg/vlr-master | thropt.m | .m | vlr-master/vlr/thropt.m | 1,430 | utf_8 | 2cb09e1e33ebe69e6a070f0a6d030c18 | % THROPT
% This function uses fminsearch to optimize the threshold (thr) applied to
% probabilistic predictions of the lesion class (all data vectorized).
% The objective is to maximize the mean similarity index on the training data.
function [thr] = thropt(h,Y,C,B,nidx)
% compute the probabilistic output
statusupdat... |
github | uoguelph-mlrg/vlr-master | performancebati.m | .m | vlr-master/vlr/performancebati.m | 1,490 | utf_8 | dc10dc2d865b4ef8736f05a83956e80c | % PERFORMANCEBATI
% This function analyzes the performance of the VLR model using the fitted
% parameter images in o.B{idx.c} -- i.e. one cross validation fold.
% This function does not require additional matlab spawns, unlike
% performancebat, and rolls the functionality of performancebat and performancei
% together i... |
github | uoguelph-mlrg/vlr-master | maketestingdata.m | .m | vlr-master/vlr/maketestingdata.m | 996 | utf_8 | c34b3073ca9d12ed634fe2fccc77522e | % MAKETESTINGDATA(h)
% This function loads and preprocesses all testing data specified by h.
% On completion, these data are saved to file to save time.
% If a save file already exists with the specified name, it is loaded.
function [Y,C] = maketestingdata(h)
Y = {}; % graylevel data
C = {}; % labels
% for all subject... |
github | uoguelph-mlrg/vlr-master | performance.m | .m | vlr-master/vlr/performance.m | 671 | utf_8 | 24c84d58883a8b0981a234e047311af5 | % PERFORMANCE
% This function computes the performance metrics, and TP/FP/FN images for one
% comparison of Ce (estimated) and Ct (true)
function [si,pr,re,ll,lle,TP,FP,FN] = performance(Ce,Ct,x)
% TP/FP/FN images
TP = Ce & Ct;
FP = Ce & ~Ct;
FN = ~Ce & Ct;
% TP/FP/FN voxel counts
nTP = sum(TP(:));
nFP = sum(FP(:)... |
github | uoguelph-mlrg/vlr-master | gettrainingdata.m | .m | vlr-master/vlr/gettrainingdata.m | 739 | utf_8 | 06e258e3bcb061bf489b93f145eb055a | % GETTRAININGDATA
% This function either:
% - preps the training data from scratch (h.sam.fresj = 1)
% - loads the training data from file (h.sam.fresj = 0)
% and returns the results in
% h (some metadata changed) and
% Y and C both size: [V,N], for V voxels, and N subjects
function [h,Y,C,Yx,Cx] = gettrainingdata(... |
github | uoguelph-mlrg/vlr-master | postpro.m | .m | vlr-master/vlr/postpro.m | 418 | utf_8 | d6b9925cda1df5ec30733c99cbf56010 | % POSTPRO
% This function computes the post-processing for a single image C:
% 1. thresholding
% 2. minimum lesion size (converted here from voxels to pixel count); 26 connect
function [C] = postpro(h,C,x,thr)
% defaults:
if nargin < 3, x = [1,1,1]; end % assumed voxel size = [1,1,1]
if nargin < 4, thr = h.pp.t... |
github | uoguelph-mlrg/vlr-master | vlrmap.m | .m | vlr-master/vlr/vlrmap.m | 2,674 | utf_8 | 91ca7fb933695293f8b4ed78452712b6 | % VLRMAP
% This function estimates a [V,2] matrix of beta parameters (B) for V parallel
% logistic regression models.
% The training data are specified in Y (size: [V,N,K]) and C (size: [V,N,1])
% V is the number of voxels
% N is the number of training examples
% K is the number of features (must be K=1 here for effici... |
github | uoguelph-mlrg/vlr-master | performancei.m | .m | vlr-master/vlr/performancei.m | 1,664 | utf_8 | 25e09ad92ee8d56309df6d3f984a9ad0 | % PERFORMANCEI
% This function computes the performance analysis for a number of images,
% selected by ivec (indices in 1:h.Ni).
% This function expects the file tpmname('c',c,'.mat') to exist, and contain the
% variables h, B, thr, where B is in MNI space.
% B is warped to patient space using mni2ptx, inference is com... |
github | uoguelph-mlrg/vlr-master | summarizeresults.m | .m | vlr-master/vlr/summarizeresults.m | 4,432 | utf_8 | 501834c662830166d93fe722b75d5345 | % SUMMARIZERESULTS
% This function creates various figures, and a table which summarize
% the performance of a segmentation model.
% These can be compiled in a PDF report using the 'pdf' option,
% so long as the necessary template is available (specific to the CV type)
function [] = summarizeresults(h, o, t, todo)
doa... |
github | uoguelph-mlrg/vlr-master | uber.m | .m | vlr-master/vlr/uber.m | 1,822 | utf_8 | 812d50f4223eb9ed3338967b1b050ce6 | % UBER
% This function literally runs all scripts necessary to generate the thesis.
% It would probably take days to run and will almost certainly crash somewhere.
% Please explore for the desired set of results to re-create.
% [ ] not re-run
% [x] checked and re-run
function [] = uber()
def; % adjust some figure defa... |
github | uoguelph-mlrg/vlr-master | gausssep.m | .m | vlr-master/vlr/ops/gausssep.m | 855 | utf_8 | 1717f9ffcef50feed23b76944f34d396 | % [G] = gausssep(sig)
%
% GAUSSSEP generates N 1D Gaussian probability density functions having the
% standard deviations specified in the vector sig. Each element in sig
% corresponds to a dimension. Can be used for separate 1D convolutions.
%
% Inputs:
% sig - N-vector corresponding to the standard deviatio... |
github | uoguelph-mlrg/vlr-master | gauss.m | .m | vlr-master/vlr/ops/gauss.m | 1,197 | utf_8 | 8aff4cbc002952e74befd8a0c6c12d5f | % [G] = gauss(sig)
%
% GAUSS generates an N-D Gaussian probability density function having the
% standard deviations specified in the vector sig. Each element in sig
% corresponds to a dimension. Guaranteed to have unit norm.
%
% Inputs:
% sig - N-vector corresponding to the standard deviations requested for ... |
github | uoguelph-mlrg/vlr-master | ICC.m | .m | vlr-master/vlr/ops/ICC.m | 6,497 | utf_8 | 8eeda47d684e52b93442490c92158ed0 | function [r, LB, UB, F, df1, df2, p] = ICC(M, type, alpha, r0)
% Intraclass correlation
% [r, LB, UB, F, df1, df2, p] = ICC(M, type, alpha, r0)
%
% M is matrix of observations. Each row is an object of measurement and
% each column is a judge or measurement.
%
% 'type' is a string that can be one of the six pos... |
github | uoguelph-mlrg/vlr-master | ksd.m | .m | vlr-master/vlr/ops/ksd.m | 5,483 | utf_8 | 22cbdf897669a121d77594881d415175 | % This function is equivalent to ksdensity, except that repetitive overhead is
% removed (which otherwise accounts for ~0.5 the runtime).
% Some hard-coded parameters: [0,1] input data range and support
function [px] = ksd(X,xi,kfcn,wid)
% minimal function calls...
N = numel(X(:));
kcut = 3;
px = compute_pdf_cdf(xi, ... |
github | uoguelph-mlrg/vlr-master | biny.m | .m | vlr-master/vlr/ops/biny.m | 2,682 | utf_8 | e82b021467cd0a70f67cb2b0a2106653 | % [YB,U] = biny(Y,varargin)
%
% BINY re-bins data to evenly spaced bins using user specified min-max
% specifications for both input and output data ranges, and the number of
% bins. Input data outside the input range is saturated (set to min or
% max value, before continuing).
%
% Args:
% Y - ND array of re... |
github | uoguelph-mlrg/vlr-master | nyulstd.m | .m | vlr-master/vlr/ops/nyulstd.m | 485 | utf_8 | de3af2d9825e38d6f8071262867569d6 | % NYULSTD
% Graylevel standardization proposed by Nyul et al (1999).
% Graylevels in y are piecewise linearly matched so that
% evenly spaced input quantiles match the output quantiles specified in 'qo'.
% The number of quantiles is taken from numel(qo).
function [yt] = nyulstd(y,qo)
N = numel(qo);
qi = quantile(y(:),... |
github | uoguelph-mlrg/vlr-master | binsphere.m | .m | vlr-master/vlr/ops/binsphere.m | 193 | utf_8 | ecf9f2a1a63288adda757af89f91062c | % BINSPHERE
% make a binary sphere-ish 3D image of radius R (in pixels)
function [V] = binsphere(R)
[x,y,z] = ndgrid(-R:R);
SE = strel(sqrt(x.^2 + y.^2 + z.^2) <=R);
V = double(SE.getnhood()); |
github | uoguelph-mlrg/vlr-master | kernelshifts.m | .m | vlr-master/vlr/ops/kernelshifts.m | 412 | utf_8 | 684453bc04e03db9a74336ad51cf2910 | % KERNELSHIFTS
% Returns the shift amounts (relative to center element)
% of all other nonzero kernel elements (i.e. binary to [x1,x2,x3] coordinates)
function [dx] = kernelshifts(K)
cx = round([size(K,1),size(K,2),size(K,3)]/2);
ksize = size(K);
x = cell([numel(ksize),1]);
dx = zeros([0,numel(ksize)]);
for i = 1:num... |
github | uoguelph-mlrg/vlr-master | op23.m | .m | vlr-master/vlr/ops/op23.m | 1,308 | utf_8 | cb939bcc0c2644e0edd425bfd07effea | % [IF] = op23(I,filtfun,W)
%
% OP23 filters a 3D image I using the 2D image filtering function filtfun in a
% single operation (using reshaping). This speeds up the application of
% nonlinear filters on 3D volumes by not processing slices in serial.
%
% Inputs:
% I - 3D image volume for filtering.
%
% ... |
github | uoguelph-mlrg/vlr-master | pofwxy.m | .m | vlr-master/vlr/ops/wprobs/pofwxy.m | 1,942 | utf_8 | 0910a4197ff0a8ad2d9916de41df59dd | % [pXYW,U] = pofwxy(Y,X,W,op,varargin)
%
% POFWXY computes the weighted conditional probability of X given Y using
% the user specified weighted conditional probability operator.
% This implementation uses a relatively fast sort-lookup technique.
%
% Inputs:
% Y - N-D data which is binned, then for each bin, th... |
github | uoguelph-mlrg/vlr-master | wstd.m | .m | vlr-master/vlr/ops/wprobs/wstd.m | 220 | utf_8 | 03578ce41c95f7e4c9027ef77fcb7de7 | % [mu] = wstd(Y,X)
%
% WSTD gives the standard deviation of Y, weighted by X
%
% Jesse Knight 2016
function [sig] = wstd(Y,X,wm)
if nargin == 2
wm = wmean(Y,X);
end
sig = sqrt(sum(((Y(:)-wm).^2).*X(:)) / sum(X(:))); |
github | uoguelph-mlrg/vlr-master | wmean.m | .m | vlr-master/vlr/ops/wprobs/wmean.m | 151 | utf_8 | f907f4b7682d3d2eb7c13bebfa12b557 | % [mu] = wmean(Y,X)
%
% WMEAN gives the mean of Y, weighted by X
%
% Jesse Knight 2016
function [mu] = wmean(Y,X)
mu = sum(Y(:).*X(:)) / sum(X(:));
|
github | uoguelph-mlrg/vlr-master | pofwy.m | .m | vlr-master/vlr/ops/wprobs/pofwy.m | 981 | utf_8 | cf9fab4b86f13881388aabe995319507 | % [pYW,U] = pofwy(Y,W,varargin)
%
% POFWY is a weighted histogram (normalized for unit norm).
% This implementation uses a relatively fast data-removal technique.
%
% Inputs:
% Y - N-D data for which to compute the probability distribution.
% W - N-D (same size) weights for each value in Y.
%
% varargin: pass... |
github | uoguelph-mlrg/vlr-master | pofxy.m | .m | vlr-master/vlr/ops/wprobs/pofxy.m | 1,790 | utf_8 | f5b8573203f927209f8bdd4ac0c34b4a | % [pXY,pY,U] = pofxy(Y,X,op,varargin)
%
% POFXY computes the conditional probability of X given Y - p(X|Y),
% "p of given y", using the user specified conditional probability operator.
% This implementation uses a relatively fast sort-lookup technique.
%
% Inputs:
% Y - N-D data which is binned, then for each b... |
github | uoguelph-mlrg/vlr-master | pofy.m | .m | vlr-master/vlr/ops/wprobs/pofy.m | 974 | utf_8 | a40253c6b020f79cbfa044cbb2671e5a | % [pY,YU,U] = pofy(Y,varargin)
%
% POFY is an anaolgue to the hist function - p(Y), "p of y" - with different
% control over the parameters; also serves as a template for other
% conditional probability functions: pofxy, pofwy, pofxwy.
%
% Inputs:
% Y - N-D data for which to compute the probability distribution.... |
github | uoguelph-mlrg/vlr-master | alphatrim.m | .m | vlr-master/vlr/ops/alpha/alphatrim.m | 1,401 | utf_8 | 8300b8cb6e2a64f533ba806289c76cbd | % [idx, ytrims] = alphatrim(Y, trims, mask)
%
% ALPHATRIM computes a mask for an N-D array indicating values which are
% within the specified alpha-"trims" (on the interval [0,1]).
% An additional mask can be specified by the user to further refine the
% alpha-trim data; however the output indices may contain v... |
github | uoguelph-mlrg/vlr-master | alphaclip.m | .m | vlr-master/vlr/ops/alpha/alphaclip.m | 372 | utf_8 | fc6099fab820eda592b7e0c9fd7cb389 | % ALPHACLIP
% This function calls alphatrim, then clips the data in Y
% according to the computed limits.
% A mask can be used for the alpha computation, but then ignored for the clip.
function [Yclip] = alphaclip(Y, trims, mask)
if nargin == 3
[~, ytrims] = alphatrim(Y, trims, mask);
elseif nargin == 2
[~, ytrims... |
github | uoguelph-mlrg/vlr-master | clip.m | .m | vlr-master/vlr/ops/alpha/clip.m | 194 | utf_8 | 114ba2c3f9af8c549c9f80d6eca381f1 | % [X] = clip(X,mm);
%
% CLIP truncates the data in X to the range mm so that no values are outside
% this range.
%
% Jesse Knight 2016
function [X] = clip(X,mm)
X = max(mm(1),min(mm(2),X)); |
github | uoguelph-mlrg/vlr-master | momi.m | .m | vlr-master/vlr/ops/alpha/momi.m | 211 | utf_8 | 0293bb4e29d850d0ed39f0cd653512b7 | % [X,mm] = momi(X);
%
% MOMI normalizes the data in X to the range [0,1] using the max-min
% of the data.
%
% Jesse Knight 2016
function [X,mm] = momi(X)
mm = [min(X(:)),max(X(:))];
X = (X-mm(1))./diff(mm); |
github | Brain-Modulation-Lab/bml-master | bml_timealign.m | .m | bml-master/sync/bml_timealign.m | 8,001 | utf_8 | 1b05fa067b77138fcbfa7e7c64991951 | function [slave_delta_t, max_corr, master, slave] = bml_timealign(cfg, master, slave)
% BML_TIMEALIGN aligns slave to master and returns the slave's delta t
%
% Use as
% slave_delta_t = bml_timealign(master, slave)
% slave_delta_t = bml_timealign(cfg, master, slave)
% [slave_delta_t, max_corr] = bml_... |
github | Brain-Modulation-Lab/bml-master | bml_annot2coord.m | .m | bml-master/sync/bml_annot2coord.m | 1,787 | utf_8 | afdf2310f69c8d9b32bb7079222ebb29 | function coord = bml_annot2coord(annot, Fs)
% BML_ANNOT2COORD gets s1,t1,s2,t2 coordinates from annot and Fs
%
% Use as
% coord = bml_annot2coord(annot, Fs)
%
% annot - ANNOT table with 'starts', 'ends' and optionally 'Fs' variables
% (all other vars ignored)
% Fs - numeric, exact sampling frequency of retu... |
github | Brain-Modulation-Lab/bml-master | inpolyhedron.m | .m | bml-master/anat/inpolyhedron.m | 22,474 | utf_8 | 3bab4b4d7bfb720f1c2d2e1ce95779ba | function IN = inpolyhedron(varargin)
%INPOLYHEDRON Tests if points are inside a 3D triangulated (faces/vertices) surface
%
% IN = INPOLYHEDRON(FV,QPTS) tests if the query points (QPTS) are inside
% the patch/surface/polyhedron defined by FV (a structure with fields
% 'vertices' and 'faces'). QPTS is an N-by-3 se... |
github | Brain-Modulation-Lab/bml-master | fast_wavtransform.m | .m | bml-master/timefreq/private/fast_wavtransform.m | 3,461 | utf_8 | b467542a7bf46f12e7e87fdecb046f7a | function Y=fast_wavtransform(fq,TS,sr,width)
% Y=fast_wavtransform(fq,TS,sr,width)
%
%uses multiplication in the fourier domain (rather than convolution) to
% speed compution on LARGE datasets;
%error will occur if length of a given wavelet is longer than the input
% signal;
%warning: since all computation ... |
github | Brain-Modulation-Lab/bml-master | padarray.m | .m | bml-master/utils/padarray.m | 7,389 | utf_8 | 00ff76c42a05000c70ecfad1e2087fdb | function b = padarray(varargin)
%PADARRAY Pad an array.
% B = PADARRAY(A,PADSIZE) pads array A with PADSIZE(k) number of zeros
% along the k-th dimension of A. PADSIZE should be a vector of
% positive integers.
%
% B = PADARRAY(A,PADSIZE,PADVAL) pads array A with PADVAL (a scalar)
% instead of with zeros.
%
... |
github | Brain-Modulation-Lab/bml-master | toString.m | .m | bml-master/utils/toString.m | 12,967 | utf_8 | e68dc0969f6d1e1b05650c9b17e14f36 | function s = toString(v, varargin)
%TOSTRING creates a string representation of any MATLAB variable
% STRINGREP=RPTGEN.TOSTRING(VARIABLE, CHARLIMIT)
% Copyright 1997-2017 The MathWorks, Inc.
%--------1---------2---------3---------4---------5---------6---------7---------8
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
github | Brain-Modulation-Lab/bml-master | bml_getidx.m | .m | bml-master/utils/bml_getidx.m | 1,222 | utf_8 | 76d9bb4c7bf96f74e77d1ddcf0a1115f | function idx = bml_getidx(element,collection)
% BML_GETIDX gets the first indices of the elements in the collection (or domain)
%
% Use as
% idx = bml_getidx(element,collection)
%
% index 0 for elements not found
%
% Use as
% index = bml_get_index(element,collection)
%
% elements - array or cell
% domain - collect... |
github | Brain-Modulation-Lab/bml-master | linspecer.m | .m | bml-master/utils/linspecer.m | 8,162 | utf_8 | 13346085b958ab6ff2bd20616dfa4473 | % function lineStyles = linspecer(N)
% This function creates an Nx3 array of N [R B G] colors
% These can be used to plot lots of lines with distinguishable and nice
% looking colors.
%
% lineStyles = linspecer(N); makes N colors for you to use: lineStyles(ii,:)
%
% colormap(linspecer); set your colormap to have eas... |
github | Brain-Modulation-Lab/bml-master | checkstrs.m | .m | bml-master/utils/checkstrs.m | 3,194 | utf_8 | ef0e640d970917243b1b5d2587c626ca | function out = checkstrs(in, valid_strings, function_name, ...
variable_name, argument_position)
%CHECKSTRS Check validity of option string.
% OUT = CHECKSTRS(IN,VALID_STRINGS,FUNCTION_NAME,VARIABLE_NAME, ...
% ARGUMENT_POSITION) checks the validity of the option string IN. It
% returns ... |
github | Brain-Modulation-Lab/bml-master | bml_compute_ISI.m | .m | bml-master/spksunit/bml_compute_ISI.m | 623 | utf_8 | b9abb334f0f85327c343fde18039b1ba | function [isits] = bml_compute_ISI(D, fs,ISIFILTER)
%BML_COMPUTE_INSTANTISI Summary of this function goes here
% Author: Witek Lipski
I = isi(D);
isits = zeros(size(D));
k = find(D);
for i=1:length(I)
isits(k(i):(k(i)+I(i))) = I(i);
end
isits = isits/fs;
isits = movmean(isits,[ISIFILTER, ISIFILTER]);
end
% h... |
github | Brain-Modulation-Lab/bml-master | bml_compute_Spikelocked_clusterperm.m | .m | bml-master/spksunit/bml_compute_Spikelocked_clusterperm.m | 6,726 | utf_8 | bac42a07dc26d8ab9ea3c067c41876bb | function Stim = bml_compute_Spikelocked_clusterperm( spkSampRate, IFR,ISITS,D, n_trials, basetimes, trialtimes, respInterval,alpha,minTsig,n_btsp)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
Stim.respInterval = respInterval;
Stim.DispInterval = -1: 1/spkSampRate : Stim.respInterv... |
github | Brain-Modulation-Lab/bml-master | bml_fdr_bh.m | .m | bml-master/stat/bml_fdr_bh.m | 8,817 | utf_8 | 4231e2545caae52ffd58f9a2a2564bcd | % fdr_bh() - Executes the Benjamini & Hochberg (1995) and the Benjamini &
% Yekutieli (2001) procedure for controlling the false discovery
% rate (FDR) of a family of hypothesis tests. FDR is the expected
% proportion of rejected hypotheses that are mistakenly rejected
% (i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.