sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cf76d367d46cf5852389a884b43d733134d01ea0f13cf6fbe41c1fca9a54deeb
MATLAB
906
31
function plotMouseROIsCCF(dorsalMaps, allFOVs) % Plots the ROI centroids colored by areas % Figure allenMapSMc(dorsalMaps) % Creates figure by itself % Paper ready figure/axis formatting% Paper ready figure/axis formatting panelwidth = 2.25; panelheight = 3; leftoffset = 0.5; bottomoffset = 0.5; formatFigure(gcf, pan...
20dab410e69f4426272a81ba62a044bd1f1cc365d77704e440eb8262b50cbec7
MATLAB
907
38
function [thetahat kappa] = circ_vmpar(alpha,w,d) % r = circ_vmpar(alpha, w, d) % Estimate the parameters of a von Mises distribution. % % Input: % alpha sample of angles in radians % [w number of incidences in case of binned angle data] % [d spacing of bin centers for binned data, if suppl...
c5e28c2c7c6c4e5983cd9e2f52b778c05d148fb4b63ca06fa081c5f572eac770
MATLAB
907
35
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% cor2mni %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function mni = cor2mni(cor, T) % function mni = cor2mni(cor, T) % convert matrix coordinate to mni coordinate % % cor: an Nx3 matrix...
cc96a778e6660133bfeae98b4ae337cd214972bf7eff7505b34578cc05c8fd67
MATLAB
908
22
function lead_sm = LeG_alignElecs(lead,d) %"lead" is xyz coordinates (patient space mm) of contacts of a lead with %deepest first (ground truth). "d" is intercontact spacing of contacts in %mm. Spacing is adjusted between contacts to match "d". Next contact is %placed "d" away from last in direction of average vect...
d77c9cf0e9be418a571c0effa32602cc9220412aac0cb1aba9804bd1d49996c9
MATLAB
908
27
function data=createdatamatc(data,E,Fs,win) % Helper function to create an event triggered matrix from univariate % continuous data % Usage: data=createdatamatc(data,E,Fs,win) % Inputs: % data (input time series as a column vector) - required % E (events to use as triggers) - required % Fs (sampling ...
aa9b0e8eb78ff2c3f65e9fc98c93d63b54086a044918d0872c00464b5be35003
MATLAB
909
32
function A_normalized = normalize_matrix(A, normalization_method, a_norm) % This function normlizes the columns of A % A: the matrix to be normalized % normalization_method: 'L2 norm' or 'unit abs'; % a_norm: norm % Set defaut value for 'normalizationMethod' if ~exist('normalization_method', 'var') normalization_...
96ba95b1c32f79ab843b503b180b69a42bfb32e1be15f16defc17bd18f5199fc
MATLAB
910
26
function [P bins] = ProbDist2D(x, nbins); %PROBDIST2D % Usage: [P bins] = [P bins] = ProbDist2D(x, nbins); % % This function calculates the discrete probability distribution for a % variable that is in a two dimensional phase space. Because the variable % exists in a two dimensional phase space, we have to bin in x...
a723e773b1662b4139b3cf2f8aed95aa060c50c76dd57c116402816d622d177a
MATLAB
910
21
% This make.m is for MATLAB and OCTAVE under Windows, Mac, and Unix try Type = ver; % This part is for OCTAVE if(strcmp(Type(1).Name, 'Octave') == 1) mex libsvmread.c mex libsvmwrite.c mex train.c linear_model_matlab.c ../linear.cpp ../tron.cpp ../blas/*.c mex predict.c linear_model_matlab.c ../lin...
c4f448967b0c61795750ec9fbfd7475ff98bbe4e2b52b6660b224db9fc7cc78a
MATLAB
910
24
function estimate = estimateWMmask(signal,tensor) thres1 = 9/27; thres2 = 0.25; t3 = 0.8; % thres1 = 9/27; % thres2 = 0.25; % t3 = 1; % % thres1 = 16/27; % thres2 = 0.5; idxb0 = find(squeeze(squeeze(tensor(1,1,:)+tensor(2,2,:)+tensor(3,3,:))) < 101); idxb1 = setdiff(1:size(tensor,3),idxb0); me...
0bddb08396735341c96347aa068c14f81d92f80e62729c4db7b59dabb49ee8fe
MATLAB
911
52
function [new_item,new_item2, order] = sort_cells(varargin) % Sorts two matrices by ordering the maximums of the first and using that % order to rearrange both % #1 = max, #2 = min if nargin == 3 item=varargin{1}; item2=varargin{2}; num=varargin{3}; elseif nargin == 1 item=varargin{1}; item2=varar...
4278db573b3ed71af2727266e95c4d6cd88056f2f1aa5ca6acef2a86ad05fb8b
MATLAB
911
24
function [adfreq, n, ts, fn, ad] = plx_ad_v(filename, ch) import CMBHOME.PLX2Mat.* % plx_ad_v(filename, channel): Read a/d data from a .plx file % % [adfreq, n, ts, fn, ad] = plx_ad_v(filename, ch) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 0-based channel number % % a/...
ee5287611084fc4c485d277d0ac4a5bb0cb2ca2407a8250ee9b4d470267dfdc6
MATLAB
911
30
function CBIG_waitUntilFinished(progressFile, noJobs) % CBIG_waitUntilFinished(progressFile, noJobs) % % This is a helper function that holds off the next jobs until submitted % jobs are finished. This is useful when the next batch of jobs depend on % this submitted batch. % % Input: % - progressFile: % Text...
e71471829b0203c3cf0b870c4acbf86e2c5c12d3c0ea1cc94ebcfea1a6e15b3a
MATLAB
912
19
function [data]=Trinh_addTriggerChannelBack(data,channels_to_interpolate,data_trigger) % extracted from Giac_EEGinterpolate % adds trigger channel back into the data % created for adding Trigger Channel for MUSICOM WP4.1 % 12/10/22 Trinh Nguyen (IIT) for ch_to_add = 1: length(channels_to_interpolate) tmp_ch...
2fe3c297c445bcf0e90776683f9205a763ae3996ecec7e446cdaeaadb5cb172f
MATLAB
913
25
function [order] = vertices_to_cw_polygon(x, y) % VERTICES_TO_CW_POLYGON Sort a set of 2D points by angle around their % centroid, so that they form a simple (non-self-intersecting) polygon. % % order = VERTICES_TO_CW_POLYGON(x, y) returns the permutation "order" % such that x(order), y(order) traces the points in...
cbf25d0194b9a28457c44869bb88425122b094e462de985efe194a459b893486
MATLAB
913
34
function ea_fsl_reslice(input, reference, output, interp, verbose) % Reslice images which are in the same space but with different resolutions % using flirt. % Overwrite the input image if no output name specified. if ~exist('output', 'var') output = input; end % Set default interp method to trilinear % Can choos...
ef451fcad3547ce46726e46bc78385d6a20ee793562c566764d9eaec3856b005
MATLAB
913
23
% length() - length of memory mapped underlying array % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free So...
1ba677a4cc68708d5d79ab93770be7f735ecaf46cd00e35df810bb60599f5958
MATLAB
914
36
function data = readNPY(filename) % Function to read NPY files into matlab. % *** Only reads a subset of all possible NPY files, specifically N-D arrays of certain data types. % See https://github.com/kwikteam/npy-matlab/blob/master/tests/npy.ipynb for % more. % [shape, dataType, fortranOrder, littleEndian, tot...
4987b85a19063b47ef21abf53a29ef978b3c904a9ff763a07f09289ec7961fe2
MATLAB
914
34
function s = cvx_where %CVX_WHERE Returns the location of the CVX system. % CVX_WHERE returns a string containing the base directory of the CVX % modeling framework. Within that directory are some useful % subdirectories and files: % functions/ new functions % examples/ sample cvx models %...
7ac0dbb18eddd88ac6711076877d98dc7d14604473cdae75e914d8e00127c0ba
MATLAB
914
14
function paramBC = qualityParamValuesForUnitMatch(ephysMetaDir, rawFile, ephysKilosortPath, gain_to_uV, kilosortVersion) % defaults paramBC = bc.qm.qualityParamValues(ephysMetaDir, rawFile, ephysKilosortPath, gain_to_uV, kilosortVersion); % unit match specific paramBC.detrendWaveform = 0; % If this is set to 1, each ...
a1533c3387866b9249609aaf1c8ec6a1fbe2a50c69deff1c1b10a6a984b60d9f
MATLAB
914
33
function [edges,idx,edgemap]=uniqedges(elem) % % [edges,idx,edgemap]=uniqedges(elem) % % return the unique edge list from a surface or tetrahedral mesh % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % elem: a list of elements, each row is a list of nodes for an element. % elem can have 2, 3 or ...
a21f3126f250718556ced8b95001f900b7447146377d8ef35184a3a2473c16e9
MATLAB
914
35
function nedge=savegts(v,f,fname,edges) % % nedge=savegts(v,f,fname,edges) % % save a surface mesh to GNU Triangulated Surface Format (GTS) % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2011/02/23 % % input: % v: input, surface node list, dimension (nn,3) % f: input, surface face element list, dimens...
037eb8aa2ba1ac17184a2e369d7d439b775312c97e38d8183d73056e833079dd
MATLAB
915
37
function self = ShiftTrain(self, delta) % Circularly shifts ALL spike trains by a given amount % % input: % self: The original object, with self.cel set the cell desired to be % shuffled. % % % parameters: % delta: Amount to shift the spike trains by. Can be positive or ...
37edc6696e8b1e6a34ce89d852d8ba65cb93ac29125efa3053d3fc2eed0b724c
MATLAB
915
27
%% Figure 8 analysis YOURDATAPATH = ''; % Load ROIs and border classifier data fileList = searchFilesRecursive(YOURDATAPATH, 'allROIs.mat'); load(fullfile(fileList.folder, fileList.name)) % Using only cue-modulated allROIs = allROIs([allROIs.modCue] == 1); % Using only cells within the 5 main areas areas = {'M2', 'M1'...
5491b0f4e962aea9ecc7a5cb2f205ab3f1c4ec0e191c263877abf46c0eee6f41
MATLAB
915
43
function lfband(fit,varargin) % adds confidence bands around the plot of a locfit() fit. % % for 2-d fits, produces separate surface plots of upper and % lower confidence limits. % % Bands are based on 95% pointwise coverage, using a single % (i.e. global) estimate of sigma^2. xfit = lfmarg(fit); % placing 'band','g'...
f2e2837bed2e029dfbf1a3100486004a4a1682cec451c28e559989dbcb3df21a
MATLAB
915
31
function settingFileFullPath = getSettingFileFullPath(functionName) % settingFileFullPath % % Returns the full path of the settings file. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Version History % % 1.0.0.0: % - Initial release. % % 1.1.0.0: % - Updated to support...
43e2ff875978b4b9064cc5aad65603b7fc6344c1a7f258e377025f98f1ab4869
MATLAB
916
26
function d2=ea_options2tdhandles(tdhandles,d2) try allbackdrops=get(tdhandles.tdbackdrop,'String'); [~,bdix]=ismember(d2.backdrop,allbackdrops); set(tdhandles.tdbackdrop,'Value',bdix); if get(tdhandles.tdbackdrop,'Value')>length(allbackdrops) || get(tdhandles.tdbackdrop,'Value')<1 set(tdhan...
5d35046026a0fcd06f05ada2be3d044de463868e7db5be9fc1555f8622103b7f
MATLAB
916
27
function Correct_all5D(headpath,fileexpnum) %give this function the path of the folder you want to start in as headpath %then give it the starter or the regex before the numbering starts %iterates through all files and does the motion corretion using %ADP_Motion_Correction5D cd(headpath); filelist=dir; for k=1...
7853e8833d7c41c226e4e68a5757b222dfa3f0388612e907407fe1c9d268a2d3
MATLAB
916
30
%GetNextField - Get next field from a Batch object (iterator mode). % % This is a helper class to easily read and parse batch files. % % USAGE % % [b,field] = GetNextField(b); % % b batch object % Copyright (C) 2007 by Michaël Zugaro % % This program is free software; you can redistribute it and/or...
279fdd78fef116f55dbe8713a6b6eab9c0a9888c93da19a559bca9c781783eb5
MATLAB
917
29
function allROIs = getLogProbsAllROIsGMM(allROIs, model, metricField) % Computes log probabilities for all neurons under area-agnostic GMM % components % Get metrics z-scored for all neurons switch metricField case 'PCs' metrics = cat(1, allROIs.PCs); metrics = metrics ./ std(metrics); % z-score ...
3c90926bf4de24ad52d890f4928945fa6d184272d5902e67d9f232088e462c71
MATLAB
918
46
function pval = circ_medtest(alpha,md) % % [pval, z] = circ_medtest(alpha,w) % Tests for significance of the median. % H0: the population has median angle md % HA: the population has not median angle md % % Input: % alpha sample of angles in radians % md median to test for % % Output: %...
554399b14106f1d76e5d4ae9dab7425662e4ec459d79fc98dedf1c0d4e333333
MATLAB
919
23
function x = sym( x ) % SYM Symmetrize. % SYM(X), where X is a matrix, returns the symmetric or Hermitian part % of X; that is, SYM(X) = 0.5 * ( X + X' ). If X is an array, SYM(X) % symmetrizes each of the submatrices X(:,:,k). X must satisfy % size(X,1) = size(X,2). % % SYM(X) is useful in CVX when...
4229f5e1678af2fb13b1bf315df7e8d67c71c67bd675db7c386bfd1078c04c3a
MATLAB
920
42
function load_scope(files,refresh_rate,sample_frequency) close all shot_size=round(sample_frequency/refresh_rate); ring=zeros(shot_size*20,1)'; fig = figure('Position',[500,500,800,600],... 'NumberTitle','off',... 'Name','Scope',... 'doublebuffer','on',... 'HandleVisibility','on',... '...
65e3e5ae3fb67a4a11c1e3c00d407aa6b09f9d5ce001db7fcc13c500a7627f9a
MATLAB
920
24
function binnedGrid = binVals2D(values, positions, xEdges, yEdges) % Computes a cell array of binned values based on their 2D locations and % the geometry of a grid nX = length(xEdges) - 1; nY = length(yEdges) - 1; binnedGrid = cell(nY, nX); % grid is formatted like an image % Iterate all points and assign them to a ...
b2cdeca3c74c2d840628327f29d86514bd5db1ca3c16253723db255931b46932
MATLAB
920
35
function fwrite3(fid, val) % % fwrite3.m % % Original Author: Bruce Fischl % CVS Revision Info: % $Author: nicks $ % $Date: 2007/01/10 22:55:09 $ % $Revision: 1.2 $ % % Copyright (C) 2002-2007, % The General Hospital Corporation (Boston, MA). % All rights reserved. % % Distribution, usage and copying of thi...
e2427173b798a8af8118d9c0e6a970271245b3ffd66f187940482efc2974e1df
MATLAB
920
45
function x = cvx_r2c( x, dim ) % % Quick exit for complex quantities % if ~isreal( x ), error( 'Matrix must be real.' ); end % % Determine expansion dimension % sx = size( x ); if nargin < 2, dim = [ find( sx > 1 ), 1 ]; dim = dim( 1 ); elseif ~isnumeric( dim ) || dim <= 0 || dim ~= floor( dim ), er...
1c23ed49dd964f44220731d88d7c027cd9bfefddb29d11461fc5110c53af0264
MATLAB
921
27
% Functions enabling use of multiple colormaps per figure. % % version 2.3, 3/2007 % % freezeColors - Lock colors of plot, enabling multiple colormaps per figure. % unfreezeColors - Restore colors of a plot to original indexed color. % % demo/html % freezeColors_pub.html - Published demonstration. % % te...
1c7c7365cbec2fdbe0c2ee52949756040bb36c68b784f05fc6f67505afa27eec
MATLAB
921
43
function vol=volzAdj1(vol,adjv,env) % Usage ... y=volzAdj1(vol,adjvec,env) vdim=size(vol); if nargin<3, env=ones(vdim(end),1); end; if length(env)==1, env=(1-[1:vdim(end)]/(vdim(end)/env)); plot(env) elseif length(env)==2, tmpenv=(1-[1:vdim(end)]/(vdim(end)/env(1))); tmpenv=exp(tmpenv*env(2)); env=tmpenv; ...
60d3ce08a9cd629aad0110c115c6fbe1ea2161e6c4ec910508c6c838f8c41155
MATLAB
921
39
function frame = getnext(vr) %FRAME=GETNEXT(VR) % This method is a shortcut for % if (next(vr)) % frame = getframe(vr); % else % frame = []; % end % % Although this method can be more convenient than calling NEXT and GETFRAME % separately, there is no way to distinguish between a zero-si...
7625a8b31248fbb330b31358faa56ab71fcd25efbd98aab9c4a7e82a24389583
MATLAB
921
34
function surf2parcel = surface_to_parcel(surf_data, parcellation) % % Usage: % surf2parcel = surface_to_parcel(surf_data, parcellation) % % Description: % Map surface data to a parcellation (authors : @MICA-MNI, @saratheriver) % % Inputs: % surf_data (double array) - Surface vector, size = [v x 1]. % parcellati...
1b24bcfb23dc5c050891368e98fb04893a2b95852e33beb27ab37f20cacc5b87
MATLAB
922
26
function s = cvx_subsref_check( nin, nin_norm, S ) if nin < nin_norm, s = 'Not enough input arguments'; elseif nin == nin_norm, if ~isa( S, 'struct' ), s = 'Subscript argument to SUBSREF and SUBSASGN must be a structure.'; else Sf = fieldnames( S ); if length( Sf ) ~= 2, ...
b99b96a7ab6814e83df20be37e7dc04b6b6b69e29ed1e804009a20fab38568ab
MATLAB
922
31
function uid = root(tree) % XMLTREE/ROOT Root Method % FORMAT uid = root(tree) % % tree - XMLTree object % uid - UID of the root element of tree % % Return the uid of the root element of the tree. % % See also XMLTREE % By construction, root is necessarily the element whos UID is 1. % However, xml_parser should...
feee994e54a8628475d15b40128eb8965d84d31a9875add0c4ecdd020a09a50c
MATLAB
922
34
function ops = align_iterative_modified(data, ops) fracImgPreAlign = getOr(ops, 'fracImgPreAlign', 1/2); maxImgPreAlign = round(size(data,3) * fracImgPreAlign); ops.mimg = pick_reg_init(data); dsold = zeros(size(data,3), 2); err = zeros(ops.NiterPrealign, 1); %% tempSubPixel = ops.SubPixel; ops.SubPixel = Inf; for i...
39ea7e71ced820a469b886ccb505ae073e50aa835c0b8b027b122e9c993039e3
MATLAB
923
30
function data=createdatamatpb(data,E,Fs,win) % % Helper function to create an event triggered matrix from a single % channel of data. % Usage: data=createdatamatpb(data,E,Fs,win) % Inputs: % data (input time series as a single vector) - required % E (events to use as triggers) - required % Fs (samp...
9b8cdbd442180de9b53f625cd931f5b7abfafeed26ca97c62b68b4a74a422537
MATLAB
923
30
function s = semedian(x,varargin) %semedian - Compute standard error of the median. % % USAGE % % s = semedian(x) % % x vector or matrix over which the error should be computed % Copyright (C) 2013 by Michaël Zugaro % % This program is free software; you can redistribute it and/or modify % it unde...
58b9bad6430bb41d1681286f289dece87df4891c1352475b8cc5873de8653b83
MATLAB
924
29
function outpoints = mni2tal_brett(inpoints) % Converts coordinates from MNI brain to best guess % for equivalent Talairach coordinates % FORMAT outpoints = mni2tal(inpoints) % Where inpoints is N by 3 or 3 by N matrix of coordinates % (N being the number of points) % outpoints is the coordinate matrix with Talairach ...
b28d2a94f1e059612e4cc5d201eddb06c1459c7eea6d57edeb3eed9dac4f1a37
MATLAB
924
36
function val=jsonopt(key,default,varargin) % % val=jsonopt(key,default,optstruct) % % setting options based on a struct. The struct can be produced % by varargin2struct from a list of 'param','value' pairs % % authors:Qianqian Fang (q.fang <at> neu.edu) % % input: % key: a string with which one look up a value fro...
d75be38d6cd8afce52e7a14d2980c20a664605ae4b1590e3e8d9895c2b6755d9
MATLAB
924
33
function pred=ea_predict_Bmap(bmap,connfile,sk,usemask) if ~exist('sk','var') sk=''; end if ~exist('usemask','var'); usemask=''; end [pth,fn,ext]=fileparts(bmap); b1=ea_load_nii(bmap); intercept=ea_load_nii(fullfile(pth,[fn,'_intercept',ext])); if exist(fullfile(pth,[fn,'_deviation',ext]),'file') dev=ea_l...
afcb2f32d1f1be770398c9ce060f0f8a7572286bce59dd6676172c932e167295
MATLAB
925
14
% Chapter 7: Statistical estimation % % counting_problem_poisson.m - Section 7.1.1: Counting problems with Poisson distribution % ML_covariance_est.m - Section 7.1.1: Covariance estimation for Gaussian variables % probbounds.m - Section 7.4.3: Probability bounds example with Voronoi diagram % e...
4ec5ffc685885ed95b5e0459ad04f611f3e33058ab73612f79dbc22ce57903d8
MATLAB
926
31
function child = children(tree,uid) % XMLTREE/CHILDREN Return children's UIDs of node uid % FORMAT child = children(tree,uid) % % tree - a tree % uid - uid of the element % child - array of the UIDs of children of node uid %__________________________________________________________________________ % % Re...
bae8fbf8880c16a104541aae0f2bace3603e1d4a9ab3a80080853421424da51c
MATLAB
926
35
function cleanimg=deislands3d(img,sizelim) % % cleanimg=deislands3d(img,sizelim) % % remove isolated islands for 3D image (for each slice) % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % img: a 3D volumetric image % sizelim: maximum island size (in pixels) for each x/y/z slice % % output: % c...
768df46abcf9d3d04b872082724670370f45be3dbf4c9b6481eab2c72c67e326
MATLAB
928
26
function handles = refreshspine(handles) roi_cent = handles.roi_seed; spId = []; if ~isempty(handles.dendrite) for k = 1:length(handles.dendrite) dend_outline = handles.dendrite(k).dend_outline; if ~isempty(dend_outline) in_dendr = inpolygon(roi_cent(:,1), roi_cent(:,2), dend_outline(:,1...
7e0f86c490eae8776b7820d193720f5069481086cd853f86e68ae6d3b7a55d57
MATLAB
928
24
function [event] = PL2EventTs(filename, channel) % PL2EventTs(filename, channel): read event timestamps from a .pl2 file % % [event] = PL2EventTs(filename, channel) % [event] = PL2EventTs(filename, 1) % [event] = PL2EventTs(filename, 'KBD2') % % INPUT: % filename - if empty string, will...
d9d80dff2cce09893cd019f7593c6efbae4b58d9535b60dd6af7afe634e4fa28
MATLAB
928
40
function slicebw=ea_centralcomponent(slicebw,mask,options) %% determine mask center: [yy,xx]=find(mask); maskcenter=[mean(xx),mean(yy)]; stats=ea_conncomp(slicebw); if stats.NumObjects>1 maxdist=10000; for i=1:stats.NumObjects if length(stats.PixelIdxList{i})>10 sliceobj=slicebw; ...
5eb1f9a2e04cd6a1bedb31ca7418cd5ce80275721f0c2d54c5c796e686e5a6df
MATLAB
929
30
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % demo script for mesh generation from binary volumetric image %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% preparation % user must add the path of iso2mesh to matlab path list % addpath('../'); % user need t...
b51b1a143ca0e5ae683b5eba583d1bd177df8785531769982c7cbf0fc9f95775
MATLAB
929
34
function disp(obj) % Display a file_array object % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: disp.m 4136 2010-12-09 22:22:28Z guillaume $ if numel(struct(obj))>1, fprintf(' %s object: ', class(obj)); sz =...
593465b83f6ed39d83aed959ae3dc1c9df8abfb1621813b0bd51f8499fc3faf4
MATLAB
930
40
function [hF, tl] = fig(layout, position, color) % Set tick dir out for all figures, sets for system for consistency set(groot,'defaultAxesTickDir', 'out'); set(groot,'defaultAxesTickDirMode', 'manual'); set(groot,'defaultAxesYColor', [0,0,0]); set(groot,'defaultAxesXColor', [0,0,0]); % Figure out how to turn "Box" o...
a0ed59e91b8eb1ffe20c94bb7d4a1bbfe09f9eace67628d49046bf579656b0d7
MATLAB
930
41
function [r mu] = circ_axialmean(alphas, m, dim) % % mu = circ_axialmean(alpha, w) % Computes the mean direction for circular data with axial % correction. % % Input: % alpha sample of angles in radians % [m axial correction (2,3,4,...)] % [dim statistic computed along this dimension, 1] % % ...
2f1161e764df3c2acfaacb05660ce646ff9f0f75ebb03becf410dbd0b983841c
MATLAB
931
29
% 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...
8eb129ad0b8575d31483c120c9ac7a64a3d5285afa4384138ce83c77d11752e9
MATLAB
931
34
function [ y, symm ] = cvx_s_hermitian( m, n, symm ) %#ok %CVX_S_HERMITIAN Complex Hermitian matrices. This is no longer used by %cvx_create_structure, but it is used by cvx_sdpt3. if m ~= n, error( 'Hermitian structure requires square matrices.' ); end nsq = n * n; c = 0 : n - 1; c = c( ones( 1, 2 * n ), : );...
b13b223785339ea42579f97c5333a90d68860b8cfa36af18f165cc66942e739f
MATLAB
931
35
%% Demo of the KDRANGEQUERY function. %% %% Guy Shechter %% guy at jhu dot edu %% June 2004 %% Generate a set of 1000 reference datapoints in R^2 ReferencePts = rand(1000,2); %%% Build the k-d Tree once from the reference datapoints. [tmp, tmp, TreeRoot] = kdtree( ReferencePts, []); %%% and find all the poi...
3e3e54070066271c77fd9abcd5d2858cf170e4f1861bf60699d6b294405abb9e
MATLAB
932
38
function [ real_matrix , perm_matrix ] = subfun_GenerateNetworkCalcMatrix_PermMatrix( Par_parcels , Net_parcels ) % %% merge and delete 0 value parcels = [Par_parcels Net_parcels]; parcels(parcels(:,1)==0,:) = []; parcels(parcels(:,2)==0,:) = []; Max_label = [max(Par_parcels),max(Net_parcels)]; %% calc real matrix rea...
4700d62e02c13f3737ad6dadbb4f3530ad4451a65c41af6cc104b85a8c548f86
MATLAB
932
36
function savetetgenele(elem,fname) % % savetetgenele(elem,fname) % % save a mesh tetrahedral element list to tetgen .ele format % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % elem: tetrahedral element list, dimension (ne,4) % columns beyound the 4rd column are treated as % marke...
7bff5cf3c1a141194c4e294e0d9416dc30450e686cf5ba9a4dd566e049a60a43
MATLAB
932
22
function z = ldivide( x, y ) %Disciplined convex programming information for LDIVIDE: % For DCP purposes, the LDIVIDE division operator X.\Y is equivalent to % (1./X).*Y. The left-hand term must be constant and non-zero; and if the % right-hand term is nonlinear, t constant must also be real. % %Disciplined geom...
89cb356a61383a83a85ec85988565b2ba4704ead9a94619371d3cfd0201f0c76
MATLAB
932
31
function [N,C]=check_consistency(data1,data2,sp) % Helper routine to check consistency of data dimensions % Usage: [N,C]=check_consistency(data1,data2,sp) % Inputs: % data1 - first dataset % data2 - second dataset % sp - optional argument to be input as 1 when one of the two data sets is % spikes times stored as...
f18a1572cdb73d203742338cc11f79589da956bf6506f2453f43efabfb467de3
MATLAB
932
15
function [] = NETCDFdisplay(filename) %NETCDFDISPLAY % [] = NETCDFdisplay(filename) displays information about specified SOFA file % SOFA API - function netcdf/NETCDFdisplay % Copyright (C) 2012 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon the...
2c06b278cabd1cf39f96279f5adb3b0ada326d44f0cfbcbf3cbef1a130c688ea
MATLAB
933
41
%%******************************************************** %% Arrow: %% %% Fx = Arrow(pblk,f,x,options); %% %% if options == 0; %% Fx = Arr(F)*x %% if options == 1; %% Fx = Arr(F)^{-1}*x %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%********...
ee7e7650ffb5a1fb158c149e223feca0b61d693ace85d86243fcf1896a1dded4
MATLAB
933
27
function sz = cvx_size_check( varargin ) %CVX_SIZE_CHECK Verifies size compatability. % SZ = CVX_SIZE_CHECK( ARG1, ..., ARGN ) verifies that the arguments are % compatible in size in the same sense as required by the + operator. % That is, any arguments that are not scalars must be of the same size. % No typ...
650c1fdb38abfbe6967f3a3df87d17264f3a2153cb45321269b5d6beabdd9a3b
MATLAB
934
33
%% Figure 1 main YOURDATAPATH = ''; %% Load ROI data and Allen CFF fileList = searchFilesRecursive(YOURDATAPATH, 'infoFOVs.mat'); load(fullfile(fileList.folder, fileList.name)) fileList = searchFilesRecursive(YOURDATAPATH, 'allROIs.mat'); load(fullfile(fileList.folder, fileList.name)) load('allenDorsalMap.mat'); %% P...
6938ff154a66e13b2f3f5f75a188855e47f584c2b083b447fefc42e18ad3966b
MATLAB
934
30
function res = PFNpc_integ2(params,inputs,inits) % This one doesn't have any effect of MS on tau. Compare to PFNpc_integ.m % params = array where first row is AF, second row is OF % inputs = array where: % [ AF directions; % AF speeds; % OF directions; % OF speeds; % time ] % Calculate single...
1a6d79b7275d9bb7e7b453ede18fa19cbdfd76799247a6f75ef6552b7471791b
MATLAB
935
26
function [P bins] = ProbDist2D(x, nbins); %PROBDIST2D % Usage: [P bins] = [P bins] = ProbDist2D(x, nbins); % % This function calculates the discrete probability distribution for a % variable that is in a two dimensional phase space. Because the variable % exists in a two dimensional phase space, we have to b...
4da08bf8232ffc0be7ba8a323939ef77c6f3c1a21a24c546c26fa4f61994e36e
MATLAB
935
23
function ea_exportfiducials(options, filename) % Save fiducials as comma separated value file in patient folder % Last Revision: 10/04/2018 % Thushara Perera (c) 2018 Bionics Institute % Input: % - lead dbs options struct % - filename with extension *.fcsv for Slicer or *.csv for Excel % Output: % - fiducial ...
8ad0fa72374f144453ba03ae75bd63a8294ecdfdefab401cfdb3d62da200cced
MATLAB
935
38
% Local Regression and Likelihood, Figure 8.3. % % Discrimination/Classification, iris data for different % smooting paramters. % % Note that the iris.mat file contains the full iris dataset; % only Versicolor and Virginica are used in this example. % % The `Species' variable contains species names. `Specn' has % them ...
e62b908bf6f3d881e368abdecd9da01409339cbf0a06c7c14c6701b341686bb3
MATLAB
935
23
function binnedmatrix = toy_simulation(Network_opts,Assembly_opts) % creating matrix binnedmatrix=poissrnd(Network_opts.meanspikebin,[Network_opts.nneurons Network_opts.nbins]); allassemblyneurons = unique([Assembly_opts.assembly_neurons{:}]); nonassemblyneurons = setdiff(1:Network_opts.nneurons,allassemblyneu...
5cfe00b39f94a677ff51a92a68ab62241134440544a45787caa65aceb94180cb
MATLAB
937
32
function data=change_row_to_column(data) % Helper routine to transform 1d arrays into column vectors that are needed % by other routines in Chronux % % Usage: data=change_row_to_column(data) % % Inputs: % data -- required. If data is a matrix, it is assumed that it is of the % form samples x channels/trials and it is ...
b9748e85f398c02bbb8dec9a7ab252b15dba38df17b075834788f4d66c6c96be
MATLAB
937
31
function DownsampleRecordingTo1000Hz(animal, srate, numchans) %Inputs/Requirements: animal ID, sampling rate (25000kHz here), total number of channels %LFP\Full folder in animal's analysis directory (exp_dir) must contain full %LFP files for each channel. %Output: LFP\LFP1000 folder containing downsampled LFP f...
c93a0b98ab916e7c504dc7d2d9be98cb88bd25428113789a5d4e35ead03f913a
MATLAB
937
30
function outmap = cifti_diminfo_make_series(nummaps, start, step, unit) %function outmap = cifti_diminfo_make_series(nummaps, start, step, unit) % Create a new series diminfo struct. % % Only the nummaps argument is required. if nargin < 2 || isempty(start) start = 0; end if narg...
d547d3239c731882569566c488ca763461df68a1014ea797b6f499021f7f1845
MATLAB
937
31
%% Entropy Demo 2 % This demo goes through calculating the entropy using a single discrete % time series. % Data Type: Discrete % Number of Variables: 1 % Information Analysis: Entropy % Trial Based or Single Trial: Single Trial % Significance Testing: N/A % Delays: N/A % Generate the data nData = 100; data = randi(...
2267e00cb3f27c9a0ac7a4848256f1b356bb8801601dba42cfdd05a45bedb2a8
MATLAB
939
28
function bn = bacon_numbers(A,u) % BACON_NUMBERS Compute the Bacon numbers for a graph. % % bn = bacon_numbers(A,u) computes the Bacon numbers for all nodes in the % graph assuming that Kevin Bacon is node u. % allocate storage for the bacon numbers % the ipdouble call allocates storage that can be modified in...
9a48c388a810f5266bfad0db162f0a1f00156434a3328f36a546d2f9cd8d676a
MATLAB
939
32
function vals=ea_corrsignan(vals,ps,obj) allvals=cat(1,vals{:}); allps=cat(1,ps{:}); nnanidx=~isnan(allvals); numtests=sum(nnanidx); switch lower(obj.multcompstrategy) case 'fdr' pnnan=allps(nnanidx); % pvalues from non-nan value entries [psort,idx]=sort(pnnan); pranks=zeros(length(psort),...
d3d8b22e75146bf5c0286c9a3ba8b275f9b3720530196d87a9b3a00faafd94b3
MATLAB
939
30
function y = base64(action,x) % Base64 binary-to-text encoding/decoding scheme % FORMAT y = zstream('encode',x) % x - data stream to encode (uint8) % y - Base64-encoded data stream (uint8) % FORMAT y = zstream('decode',x) % x - data stream to decode (uint8) % y - Base-64 decoded data stream ...
0f294d9b846df4b140b1880279b82b344efbcc6f87aa6ac1bb415be12ee32643
MATLAB
941
33
function [eig_vec, eig_val] = calc_network_eigenmode(network, num_modes) % calc_network_eigenmode.m % % Calculate the eigenvectors (eigenmodes) and eigenvalues of the input % network % % Inputs: network : symmetric connectivity matrix [N x N] % N = number of row/columns % num_modes : numb...
994b569252032184521c43a75fe9a78ab283ab7f48fcb027371d085dd2c85271
MATLAB
941
29
function out=ea_query_sim_connectomematrix(seedmap,connectomename,outputfname) % Function to create invert map as used in Li & Hollunder 2021 Biol. Psychiatry s=ea_load_nii(seedmap); seed=s.img(:); out=s; out.fname=outputfname; C=matfile([ea_space([],'connectomes'),'fMRI',filesep,connectomename,filesep,'AllX.mat'],'W...
b5790bd6b6352315d01e34924c517495c6b144f208b7ad10d6a49dfec66d90d5
MATLAB
941
25
function embedded = embed(timeseries, lag, D) %EMBED Time-series lag embedding. % EMBEDDED = EMBED(TIMESERIES, LAG_SAMPLES, DIMENSION) takes a scalar % (M x 1) time series and returns a vector time series of dimension % ((M - lag_samples*(dimension-1)) x dimension) time series by lag % embedding the...
6b3f1d784e3df5a1228f2879862570a9d24f3c107e235efd1da1a13ada20830b
MATLAB
942
36
%%*************************************************** %% min sum_k bk*yk %% s.t. sum yk*Hk <= 0 %% y1 = 1 %% Hk = -hankel(ek) if 1 <= k <= n %% = -hankel(0,e(k-n+1)) if n+1 <= k <=2*n-1 %% %% [blk,At,C,b] = sdphankel(n); %%*************************************************** function [blk,At,C,b] = sdp...
7af8fd166c051085d244b635df775baff94df3d723fcc44e98f2708f2cba4a2d
MATLAB
942
51
% % 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 ...
a9ed0753b8ab57aca2d9e1059761c0cc1d5e8425d2828599b7df60c5c71d3fb7
MATLAB
942
22
function ClincFreq_Norm2MNI_T1_clinc(indat,inroi,outdir,outname,voxelsize,pth) [patdat,namdat,extdat] = fileparts(indat); % [patroi,namroi,extroi] = fileparts(inroi); % load([pth,filesep,'Norm2T1_segment.mat']); load([pth,filesep,'Norm2T1_clincal.mat']); pathspm = which('spm.m'); [patspm,namspm,extspm] = fileparts(pat...
290a150b383a7ba204c1f4f98e6a0d53693a6ddde9f31f4cf08e88edb7e0ab7e
MATLAB
943
38
function setXYLim(ax, setX, setY, spacers) % Makes the axis limits for X and Y fit the data plotted if nargin < 4 spacers = [0, 0, 0, 0]; % No space between axis and data end % Allocate for XY data locs = []; for ob = ax.Children' % Switch on what kinds of objects we could get if isprop(ob, 'Position') ...
6fd08dfcdf286d8bf156267b1842ceeeb6e7407e24820ff115e5ac2f2efa37c0
MATLAB
943
33
function vr = close(vr) %VR=CLOSE(VR) % Closes video VR and releases any system resources necessary to access it % (e.g. threads, file handles, etc.). Do NOT just clear a videoReader % object without first closing its handle: % % % BAD code--typically will leak system resources % vr = videoReader(...); % ....
03ef9eff603b9c53243e51f47e6d59fd3db2fed30d3b6d959d081b41193e212a
MATLAB
944
37
function value = get(tree,uid,parameter) % XMLTREE/GET Get Method (get object properties) % FORMAT value = get(tree,uid,parameter) % % tree - XMLTree object % uid - array of uid's % parameter - property name % value - property value % % Get object properties of a tree given their UIDs. % % See also XML...
10ac7190f6022ad98427589fc709cd68403cf87858ac510634cdd08ca5f4da33
MATLAB
944
35
function a = autocorr(x,Q,dim) %AUTOCORR Perform autocorrelation via FFT % % IOSR.DSP.AUTOCORR(X) performs autocorrelation via FFT on vector X. For % matrices, the autocorrelation is performed on each column. For N-D % arrays, the autocorrelation is performed on the first non-singleton % dimension. % % IOSR...
299b9b109af1710c29d596337b2649325a1274cfa3a103f259162a07e2e91a23
MATLAB
944
42
function [signals, PC, V, data] = pca1(data) % PCA1: Perform PCA using covariance. % % Usage: % [signals, PC, V] = pca1(data) % % data (in) - MxN matrix of input data % (M dimensions, N trials) % signals - MxN matrix of projected data % PC - each column is a principal component % V ...
3fd2f5877eaf2acc215f225b6b9b4aeca80bc47f40be5dd551fe774cb0f69a13
MATLAB
944
38
function [ catabledim ] = bz_FindCatableDims( tryarrays ) %UNTITLED Summary of this function goes here % Detailed explanation goes here % %INPUT % tryarrays cell array of arrays you'd like to try to concatenate % %OUTPUT % catabledims dimensions along which you can concatenate % %DLevenstein 2018 %% %Remove any...
5af7369c68353b429bc1d86354262ce5e696acb39ea225daffee6522a0ad5005
MATLAB
944
40
function [diffData2] = circDiff(data,dim,type) % function [diffData] = circDiff(data,dim,type) % % computes the difference between each point accounting for the % fact that the values are circular. % INPUTS: % data - circular data type vector or matrix % dim - dimension to operate on, default=1 % type - 'deg' or '...
91b0df804eb481b489499cb39364f26a5456698c07f8492da7fec66d8be36c29
MATLAB
944
20
%% invPolyArcLength3 - Numerically calculate the parameter (t) of parameterized [0,1] -> R^3 polynomial % *given* an arc length (measured from 0) i.e. find the corresponding t to an arc length % (e.g. given in [mm] from the origin) or in other words numerically invert polyArcLength3 % % Andreas Husch % Centre Hospitali...
c24a2beb3dd7da6feeb54fad4720bbe14d5cfe9ddd6e0bc73c982a811b76b8fd
MATLAB
944
26
function ea_Amap(varargin) % creates a simple weighted average map ("weighted average" map in Horn % 2017 AoN). Supply empty regressor var to create unweighted average % map. % ea_Amap(fis,regressor,outputname,mask,sk) % sk can be 'k','s','sk' % for smoothing and normalization options. Mask onl...
283ac7e957ee3b42512c7b82a7fc3add946d21b041d5ffede8d2fdff82c92f77
MATLAB
945
38
function lx = makeLocationMap( dims , nam , N ) Nmaps = size(dims,1); lx = zeros(N , 2^13 + 3 ); px = {}; for i = 1 : Nmaps px{i}.r = partitionindex( dims(1,1) , dims(i,1) ); px{i}.c = partitionindex( dims(1,2) , dims(i,2) ); end for i = 1 : Nmaps for j = 1 : dims(i,1) for k = 1 : di...
31decf7a15c97d4fe24a383f7d99495f90b7dd818d71fe9673bf22b63e6e364b
MATLAB
946
26
function itd = azimuth2itd(azimuth,f) %AZIMUTH2ITD Convert azimuth in degrees to ITD % % ITD = IOSR.AUDITORY.AZIMUTH2ITD(AZIMUTH,F) converts the azimuth AZIMUTH % in degrees at frequency F to interaural time difference according to % Kuhn's model [1]. % % References % % [1] Kuhn, G.F. (1977), Model for the...
49b8c7a67a5c84882e1d19cabeb9af5062eb0efb5f792e26eec3e80f52bc78d2
MATLAB
946
30
function flag=deletemeshfile(fname) % % flag=deletemeshfile(fname) % % delete a given work mesh file under the working directory % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % fname: specified file name (without path) % % output: % flag: not used % % -- this function is part of iso2mesh toolbox (h...
016f9701e8dfedb935bf5ae4ea1520f68e4b4b348a03705c398483abf062c5c9
MATLAB
947
34
% Section 4.6.3: Find the fastest mixing Markov chain on a graph % Boyd & Vandenberghe "Convex Optimization" % Joëlle Skaf - 09/26/05 % % The 'fastest mixing Markov chain problem' is to find a transition % probability matrix P on a graph E that minimizes the mixing rate r, where % r = max{ lambda_2, -lambda_n } with la...
2cae875e5ec2ff66ad62a25b163715e668874d4f4d1bffbec2e992ec20101e2e
MATLAB
948
29
%%*************************************************************** %% convertRcone: convert rotated cone to socp cone %% %% [blk,At,C,b,T] = convertRcone(blk,At,C,b); %% %%*************************************************************** function [blk,At,C,b,T] = convertRcone(blk,At,C,b) T = cell(size(blk,1),1); for p =...