sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e2d1027bb77096ab116e0cf31aaac31cfa62192d696b4875726389983c6c6412
MATLAB
1,975
64
% fit_runFitWater.m % Georg Oeltzschner, Johns Hopkins University 2019. % % USAGE: % [fitParams, resBasisSet] = fit_runFitWater(dataToFit, basisSet, fitModel, fitOpts); % % DESCRIPTION: % This function performs spectral fitting of the water data in dataToFit, using % the water basis function in basisSet, using a set o...
3cbe681b4133e2a247cda380e48169e66398d565f5aedd0e4915a13f583f8925
MATLAB
1,977
48
% STD_UNIFORMSETINDS - Check uniform channel distribution across datasets % % Usage: % >> boolval = std_uniformsetinds(STUDY); % Inputs: % STUDY - EEGLAB STUDY % % Outputs: % boolval - [0|1] 1 if uniform % % Authors: Arnaud Delorme, SCCN/UCSD, CERCO/CNRS, 2010- % Copyright (C) Arnaud ...
6e436d8f7ae5a9659dd3f895424111c6f99252f72e7232b6eec4b78931287307
MATLAB
1,977
65
clear all % add bids repo bidsPath = '/Users/shahzad/GitHubCodes/CPP_BIDS'; addpath(genpath(fullfile(bidsPath,'src'))); addpath(genpath(fullfile(bidsPath,'lib'))); tsvFileName = 'sub-007_ses-001_task-mainExperiment2_run-013_events_touched.tsv'; tsvFileFolder = '/Users/shahzad/Files/fMRI/visTacMotionDir/raw/sub-007/s...
a0c6526265a56a3b17dd0fe5077f5fa875b06d5d988a6dfc21d44602b3319a99
MATLAB
1,977
53
% MATTOCELL - convert matrix to cell array % % Usage: >> C = mattocell( M ); % % Author: Arnaud Delorme, CNL / Salk Institute, Jan 25 2002 % % Note: this function overload the nnet toolbox function mattocell, % but does not have all its capacities. You can delete the current % function if you have the toolbox. % Co...
011554c1f0c0990f45294e74e33bffb2541e8eecaf518c52a956cd25c96c2956
MATLAB
1,978
64
function varargout = ft_notice(varargin) % FT_NOTICE prints a notice message on screen, depending on the verbosity % settings of the calling high-level FieldTrip function. % % Use as % ft_notice(...) % with arguments similar to fprintf, or % ft_notice(msgId, ...) % with arguments similar to warning. % % You can s...
57dc8736c0cbf93fa8efe9fa559cf5799a66cb88212f5f5f625b5f608fa42bbd
MATLAB
1,978
119
function demo_sigstar % demo function for sigstar % % function demo_sigstar % % No input or output arguments. % % % rows=2; cols=3; clf subplot(rows,cols,1) barData=[2,1.2,1.9,1,2,3]; H=bar(barData); set(H,'FaceColor',[0.5,1,0.5]) groups={[3,6],[1,2],[5,4]}; %overlay random data hold on for ii=1:length(barData) ...
eeef5175e45a40993d4855c73ab3377be37b36672d6835ed5121f7d98a057fad
MATLAB
1,978
70
% create file names of spm-analyze files for fMRI session w/ multiple vols % % INPUT % fn - filename % selectedVolumes - indices of all volumes to be considered % Inf for all volumes % (uses spm_select, only possible, if files already exist!) % % OUTPUT % nifti_flag - 1 to make nift...
b321d22057c28561a2a985572032620d0fb8c43d63362a40fc8293e41fc87135
MATLAB
1,979
56
% inherited from "05b fsaverage transfer mapping.m" % This script creates and saves lookups to transfer to/from subject surfaces and fsaverage (both orig and DENSE) %% Part 1: create subject fsaverage transfers % define subjects={'fsaverage'}; % DID NOT RE-RUN, BUT INCLUDE HERE FOR COMPLETENESS! subjects=arrayfun(@...
0355ad4e986073c86fcdaddc569bfa9dc112c4cea2406d8c06493abe4ddd3c92
MATLAB
1,980
79
function p = MS_fnn(y,de,tau,th,kth); % function nfnn = MS_fnn(y,de,tau,th,kth) % % determine the number of false nearest neighbours for the time % series y embedded in dimension de with lag tau. % % for each pair of values (de,tau) the data y is embeded and the % nearest neighbour to each point (excluding the immediat...
230c2dabea98a87bf9aa43dc38e3e12b8a7ec75111aad64a7789563e68f88849
MATLAB
1,980
52
function TS_ConvertToTable(hctsaFile) % TS_ConvertToTable Converts a file using the old structure array format -> table % %---INPUTS: % hctsaFile, an hctsa file to convert % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail...
4cd8ae8157c9d1d9142a791d00b8d413ed58147ba3fe54c412f8134f4de28b93
MATLAB
1,980
58
function this = MrDimInfo_update_and_validate_properties_from(this) % Unit test for MrDimInfo methods update_and_validate_properties_from % % Y = MrUnitTest() % run(Y, 'MrDimInfo_update_and_validate_properties_from') % Y.MrDimInfo_update_and_validate_properties_from(TestParameter) % % This is a method of class Mr...
a9639a259e29e8c9069c3c7bc8182664d4fe1b8dc034ac83732561476e04f11d
MATLAB
1,980
59
function [logp, yhat, res] = tapas_rs_precision(r, infStates, ptrans) % Calculates the log-probability of response speed y (in units of ms^-1) according to the precision % model introduced in: % % Vossel, S.*, Mathys, C.*, Daunizeau, J., Bauer, M., Driver, J., Friston, K. J., and Stephan, K. E. % (2013). Spatial Attent...
51e089e231af57bb3ea130c33bccad1fa3d98fdb0f184a4f9df8324ac4b24879
MATLAB
1,981
52
function ImportFromSonicVisualizer_Callback(hObject, eventdata, handles) HZ_IN_KHZ = 1000; [svname, svpath] = uigetfile('*.csv','Select Sonic visualizer box layer'); sv_table = readtable([svpath svname],'Delimiter', ','); [audioname, audiopath] = uigetfile({ '*.wav;*.ogg;*.flac;*.UVD;*.au;*.aiff;*.aif;*.aifc;*.m...
5e00f1000bf8958773fbaedb112abfdef1123a455f6d46cc5cf4017216ac4948
MATLAB
1,981
66
function [info ] = mrs_readLcmodelPRINT( fileName ) %MRS_READLCMODELPRINT reads the LCmodel output file .print, which contains the %all infos about the modelling process. % % [info ] = mrs_readLcmodelPRINT( fileName ) % % INPUT : % fileName = name of LCModel output .print file % % OUTPUT: % info = stores some interest...
f8ee82508a6f53bfbf25157fa311c4c40e179420896c231e586db7dd30ee85e4
MATLAB
1,981
58
classdef BatchNorm < dagnn.ElementWise properties numChannels epsilon = 1e-5 opts = {'NoCuDNN'} % ours seems slightly faster end properties (Transient) moments end methods function outputs = forward(obj, inputs, params) if strcmp(obj.net.mode, 'test') outputs{1} = vl_nnbnor...
2cdf88c6df9e2aee81562d8f6c918c9b4977279e4daed81241aeadd6874af8d3
MATLAB
1,982
43
function [maxdisplacement, pathlength, meanspeed, instantspeed, travelpath, displacement] = displace(pt,xvals, yvals) %displace(pt, xvals, yvals) % This function calculates the euclidean distance between a two sets of x/y % coordinates. Specifically written to calculate the distance between a series of coordinates ...
52606e8891c85aeec79a84bd30afb6cc70c4d3576c1efd668cd009665fbc9e30
MATLAB
1,982
60
%% [RDF] = Wrapper_BFR_LBV(totalField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % totalField : total field map (background + tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of each dimension ...
b1e626eca486afc217f68a985ce243a6974cab03c3eecd6c28d3054833881829
MATLAB
1,983
49
% ERPREGOUTFUNC - sub function of ERPREGOUT used to regress % out the ERP from the data % % Usage: % totdiff = erpregout(fact, data, erp); % % Inputs: % fact - factor % data - [float] 1-D data (time points). % erp - [float] 1-D data (time points). % % Outputs: % totdif - residua...
140a9da6f44457f85596eb1a89f70bba5955c65470e19202f3bf8a6c800f2a9a
MATLAB
1,985
86
function combinePlots(plotPathsToCombine, outputFilePath, Params) %COMBINEPLOTS Summary of this function goes here % Detailed explanation goes here if isfield(Params, 'oneFigure') if ~isgraphics(Params.oneFigure) Params.oneFigure = figure(); end else F1 = figure; end numDivs = length(plot...
2755a84be36d6ef01ceaf40fa451c6e9ba9e56f3e1113a1a7bd23c895fb4a54c
MATLAB
1,986
47
% EEG_MS2F - convert epoch latency in ms to nearest epoch frame number % % Usage: % >> outf = eeg_ms2f(EEG,ms); % Inputs: % EEG - EEGLAB data set structure % ms - epoch latency in milliseconds % Output: % outf - nearest epoch frame to the specified epoch latency % % Author: Scott Makeig...
2b53aa31f1016e6e00641781cec39d4fa43b6f3eb3bfe46855105d13ec0cd555
MATLAB
1,986
76
function maxCh=fear_getMaxDeltaCh(basename,varargin) % basename='~/data/Fear/triple/karmeliet190901/karmeliet190901'; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) %% param.nCh=basicMetaData.nCh; param.candCh=64+(1:60); param.lfp=fear_...
6b1adff17d991f2dc53c5d4715911a559eeba77cbd44fe0b18174acb81aa778d
MATLAB
1,986
68
function [realblock, treal, tincong, vios] = blockhmat_withvios(A) %Finds indices of block transitions for the true block transition and %aligned to incongruent. Also outputs violation trial indices. tot_trials = [0; cumsum(A.ntrials)]; [~, A.reward] = convertreward(A.reward); realblock = nan(length(A.ntrials), max...
d91eb61a2166da1c36270d32ece42c48df28a66d812ca9cc090ba385a6522d98
MATLAB
1,986
53
function saveStatistics(statsOutLoc, cohort, task, timepoint, params, homerPruneMat, sciAvgs, pspAvgs, motionWindows, channelsRetained, snrMat, saveFlags) % Saves the calculated statistics and quality metrics from all subjects to % files, including Homer pruning matrices, SCI averages, PSP averages, and % motion...
3a5e9a24e0fe639dc36c2caa028a082e9842aa0fdc3f209723919369d6705ef4
MATLAB
1,987
60
% run all of the preprocessing. save this for transparancy epoch = 'reward'; decodertype = 'psth'; savename = strcat('~/projects/dynamics/data/maggie/preprocess_mlb_ofc_',epoch,'_',decodertype,'.mat') run_preprocess_decode_mlb_allofc(savename, epoch, decodertype) epoch = 'reward'; decodertype = 'none'; savename = st...
4ac72df540c85862a2373042d58e1e206cc279ed933e264a1de2dacf7604477c
MATLAB
1,987
58
function c = tapas_beta_obs_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the beta observation model for responses in the unit interval % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
9d9d4b05c583cce35ce8b88e24ec3d4d12348927741638524fe9c8c1e664c8a8
MATLAB
1,987
57
function phiFaceAverage = linearMean(phi) % This function gets the value of the field variable phi defined % over the MeshStructure and calculates the arithmetic average on % the cell faces, for a uniform mesh. % % SYNOPSIS: % phiFaceAverage = arithmeticMean(phi) % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ...
b6b36806dcbaee8cd6bda86dee90fd8405272f4e436e3e564d5bd4f91f4f75a9
MATLAB
1,988
64
load('anatExt_table.mat') load('anatExt_decodAccu.mat') anat_lS1=decodAccu(:,3); anat_lhMT=decodAccu(:,1); anat_rhMT=decodAccu(:,2); anat_lMTt=decodAccu(:,6); anat_rMTt=decodAccu(:,7); ext_lS1=decodAccu(:,10); ext_lhMT=decodAccu(:,8); ext_rhMT=decodAccu(:,9); ext_lMTt=decodAccu(:,13); ext_rMTt=decodAccu(:,14); %%% %...
e03ded058b687e6ceb4406baf0848e8252e07a4975c46ee950bd86c1bcd9a5dd
MATLAB
1,988
51
function [K,dK] = covWarp(cov, p, dp, Dp, hyp, x, z) % Apply a covariance function to p(x) rather than x i.e. warp the inputs. % % This function doesn't actually compute very much on its own, it merely does % some bookkeeping, and calls another covariance function to do the actual work. % % The function computes: % ...
ac6d1c38ace8a95e8b57db5a7e46d0ff987a0c66ffde06640ccc7fae2ec41ff6
MATLAB
1,989
62
function [ opts ] = tapas_huge_parse_inputs( opts, varargin ) % Parse name-value pair type arguments into a struct. % % INPUTS: % opts - Struct containing all valid names as field names and % corresponding default values as field values. % % OPTIONAL INPUTS: % Name-value pair arguments. % % OUTPUTS: % ...
171373942351bbaa9ac945b2ab5a2db01c2bb337bada57203fad146f802f2d67
MATLAB
1,990
55
function QSARreadyCurated34STARDataPadelheader = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % QSARREADYCURATED34STARDATAPADELHEADER = IMPORTFILE(FILENAME) Reads data % from text file FILENAME for the default selection. % % QSARREADYCURATED34STARDATAPADELHE...
8751532ec8695b209206f17a842be8f66279c1e6c6900fe0cda84b4d72d950b8
MATLAB
1,991
40
% STD_FINDOUTLIERCLUST - determine whether an outlier cluster already exists % for a specified cluster. If so, return the outlier cluster index. % If not, return zero. This helper function is called by % POP_CLUSTEDIT, STD_MOVEOUTLIER, STD_RENAMECLUST. % Copyright (...
98eb21fed9fbbe4cb1102a5c21457f70516652f68eae406264412cebe0ff66dd
MATLAB
1,991
54
% Playing around with MOR density results %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Setup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Add paths baseloc="C:\Users\dk818\OneDrive - Imperial College London\NCORE\miFCdFC"; % For outputs str='\Outputs'; outputpath=strc...
d3437a6244090a1d438eb0d31455d7b55cfdb5664707973dbd59e38e3275e061
MATLAB
1,991
57
function phiFaceAverage = arithmeticMean(phi) % This function gets the value of the field variable phi defined % over the MeshStructure and calculates the arithmetic average on % the cell faces, for a uniform mesh. % % SYNOPSIS: % phiFaceAverage = arithmeticMean(phi) % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % ...
6f1803ff4c99cd17782b107d7534779f4afd892e59f0ab03f5f2ff5a466c11d0
MATLAB
1,993
65
function obj = orthogonalise(obj) N = numel(obj.data); D = prod(obj.lat); EUU = obj.ULU + D * obj.iAu; EZZ = obj.ZZ + N * obj.iAz; % --------------------------------------------------------------------- % Orthogonalise [U, iU] = ortho_matrix(EZZ,EUU); EUU = iU' * EUU * iU; EZ...
b8401904ba367d398419b4544de4018c57edd573a95a951b5c828d43a3330b17
MATLAB
1,993
68
function [parsedData,figHandle]=parseEPhys(ePhys,varargin) % assume continuous recording of ePhys data along with multiple oPhys % measurements. You sould have as many ttlE epoch as oPhys measurment files % input ePhys is a struct with fields data, ttl and fps % Options % 'savePath' ,[] % 'plotFigure' ,true %% OPT...
d4488e389133fc55bf3d3ca9014c56a60b0b2caa34fbb278496a713d200ded51
MATLAB
1,993
41
%% Modify the events of datasets for creating STUDY designs % load the epoched tutorial dataset eeglab_path = fileparts(which('eeglab.m')); % get EEGLAB path [ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab; % start EEGLAB pop_editoptions( 'option_storedisk', 0); % Change option to process multiple datasets EEG = pop_loadse...
d6ac8bf4d794aa34c77065091624788c6ac4002645a7c39607791ccd507d48e2
MATLAB
1,993
63
function [frame,summary]=h5frame(fpath,iframe,varargin) % % HELP % Load one frame from a movie. % SYNTAX %[frame,summary]= h5frame() - use 1 if no arguments are allowed %[frame,summary]= h5frame(fpath) - use 2, etc. %[frame,summary]= h5frame(fpath,iframe) - use 3, etc. %[frame,summary]= h5frame(fpath,iframe,'optionName...
0dae8009a5cfb8b9bd9e6e9fdbcc6fbea66def80bc99a684ac383c14a5ffa507
MATLAB
1,994
50
% colorLogRemap: lookup of the original color map table according to a "log-like" curve. % The log-like curve contains a linear part and a logarithmic part; the size of the parts % depends on the range (loLev,upLev) % % Arguments: % oriCmap original colormap, provided as a N*3 matrix % loLev ...
40108d3fc5750448cde542496f1d7275290ce1557366f27e90d57d42d5049b00
MATLAB
1,994
74
function c = tapas_logrt_linear_whatworld_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the linear log-reaction time response model according to as % developed with Louise Marshall and Sven Bestmann % %%%%%%%%%%%%%%%%%%%%%%...
f5d72842f2a1afbba70767c090975e2c09ac4c21dd8efeb60b45095ca303fd1e
MATLAB
1,994
78
function maxCh=fear_getMaxGammaCh(basename,varargin) % basename='~/data/Fear/triple/karmeliet190901/karmeliet190901'; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) %% param.nCh=basicMetaData.nCh; param.candCh=128+(1:60); param.lfp=fea...
20fb7e02f7d31d466a346e02b10a3bee21ca783a1b37c78af505c9e7ea059dad
MATLAB
1,995
65
function nPhysioRegressors = tapas_physio_count_physio_regressors(physio) % Returns number of physiological regressors created, given model % specification; % NOTE: only reproducible numbers (data-independent) are % returned, i.e. session-specific movement spikes and %-variance explained % PCA-components are not inclu...
6d2b9b284f2236ff8ea165a260797fc3b49e2214c26a7e89530c72fdf02b122a
MATLAB
1,995
64
% fit_runFit.m % Georg Oeltzschner, Johns Hopkins University 2019. % % USAGE: % [fitParams, resBasisSet] = fit_runFit(dataToFit, basisSet, fitModel, fitOpts); % % DESCRIPTION: % This function performs spectral fitting of the data in dataToFit, using % the basis set in basisSet, using a set of options defined in fitOpt...
f3030e0d2fc5efb50c7e061e6ac68bebf7d3e1ed39740745baa05b2b0b96505b
MATLAB
1,995
49
%% sepia_configuration_unwrap % % Description: a script contains all the spatial phase unwrapping method names and related function names % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 11 March 2020 % Date modified: 28 June 2020 % % DO NOT change the variable name % DO NOT change the order of the ent...
43a1bb8d6e756fdc001d5f903eece666622fbf13668427e4a87daad3f171dc39
MATLAB
1,997
65
function [verbose, msg] = tapas_physio_log(msg, verbose, warningLevel) % writes message into verbose.process_log, prints it, and labels it as % warning, if necessary % % [verbose, msg] = tapas_physio_log(msg, verbose, isWarning) % % IN % msg message string % verbose physio.verbose structure, including...
c48b78721e1b7d51314fab36c67dd9e9d1ca5f8ac684903585120d0ab5be7c84
MATLAB
1,997
48
function [] = adjust_orientation (plate_orientation) %% adjust_orientation adjusts x/y coordinates of tracked worms (in cm) % based on the direction of the gradient (to left vs to right) global info global tracks global vals plate_orientation(plate_orientation>0)=-1; %Value = 1, gradient R -> L, flip orientation pla...
35b8c7a37ce9e86d704354d89d05f70e0f3da5b605ebb5293efdf077feec4d02
MATLAB
1,998
56
function [rez]=check_template(DATA,st,T,ops) M_clust = length(unique(st(:,3))); nt0 = ops.nt0; Nchan = batch = length(unique(rez.st(:,end-1))); Nrank = 3;%default value for projection hard coded [~,W, ~, ~,~] = SVD_template(T, Nrank,rez.ops.Chan_criteria) ; %calculate the mean of each template irunm = zeros(1,M_cl...
555374fbe8ca7112c9e91d4f86f9cba6f8bdc20a6b35914bae0794de9f829ac2
MATLAB
2,000
59
function [output]=bpFilter2D(input,low,high,varargin) % perform spatial filtering using one or two gaussian filtered images. % [output]=bpFilter2D(input,low,high,varargin) % e.g. DC removal > [output]=bpFilter2D(input,inf,1,'parallel',false); %% Gather options options.parallel=true; options.loop=1; %apply the filter ...
fe78d0a6fabad8947588ef23801fb92cc579dec60e634bc1384d0f7127a7faf4
MATLAB
2,000
63
%% [RDF] = Wrapper_BFR_PDF(totalField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % totalField : total field map (background + tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of each dimension ...
8da545ce5212bcb59198f947e0d9af5e2f6089aecad94ff812509d10b8c0f712
MATLAB
2,001
66
function [edgeMat, nodes, edgeIdx] = shrinkMat(data, preEdgeIdx) % SHRINKMAT Extracts upper-triangular edge values from correlation matrices. % % [edgeMat, nodes, edgeIdx] = shrinkMat(data) % [edgeMat, nodes, edgeIdx] = shrinkMat(data, preEdgeIdx) % % Arguments: % data - 2D (nodes x nodes) or 3D (nodes x no...
37534091e83824be2c0c3ba1e33c0d3dbffc4f64f9605c102aa97865e811ddbd
MATLAB
2,002
84
function Result = rest_nextpow2_one35(n) %Compute the min length for FFT according to AFNI's algorithm, By Xiao-Wei Song %------------------------------------------------------------------------------------------------------------------------------ % Copyright(c) 2007~2010 % State Key Laboratory of Cognitive Neuros...
8896ba940505168e0a93856a63fdba3fdd8aecc283dda5ff14a6e171f1b0c8f5
MATLAB
2,002
72
function S=BrikInfo_2_niml_writesimple(Info, S) % % [S]=BrikInfo_2_niml_writesimple(Info, [S]) % %Purpose: % Converts some fields in the BRIK header structure % to a structure used in function afni_niml_writesimple % %Input Parameters: % Info: Brick header structure like one output by BrikInfo % S: If specifed add ...
cc8370dc9a3c2f5b02c4f37c71360c1c52c1c35c80f6f2334ee61a4c696076aa
MATLAB
2,002
80
function ft_deface(file_in, file_other, write_mask) % MRI defacing % % ft_deface(file_in, file_other, write_mask) % % Inputs: % file_in - file name of input image. % file_other - file names (cell array) of other images. % write_mask - save binary. % % This function defaces an MRI image using the SPM function s...
f79f8f4dc27f0fd58765559780f0f1f238603cf00ef9a6727f000fb75bc3fb11
MATLAB
2,002
50
function anatomy_signficance_saveFig(params, plotInfo, groupInfo, chAss_isargAtlas) % saves figure in plotInfo.fig to different folders based on significance and anatomical assignments % output dir = slicesActivity_selected % for example: ...\slicesActivity_selected\Yeo7_networks\Attention_hiGamma_not_sgnf --- % (c) J...
1ed0622a36b11133b01cea6cfb8b27ba31da7e919dc67623b764d978adb764c0
MATLAB
2,003
61
function bnd = read_asa_bnd(fn) % READ_ASA_BND reads an ASA boundary triangulation file % converting the units of the vertices to mm % Copyright (C) 2002, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: y...
1280c31635f85ea341c5f53c229e8538f3390264ec35715cb5a69980ee015052
MATLAB
2,004
56
function f = SAVEDATA(hh,data,dataname) % function f = SAVEDATA(hh,data,dataname) % % <hh> is 1/2/3/4/5 (lh/rh/subcortex/func1pt8mm/cerebellum) % <data> is V x QUANTITIES % <dataname> is a string label % % Save the <data> to a "freesurfer" directory location. % Relies on some variables from the caller workspace (from ...
35575e64d795ab2f93acf9914cac7d786149c7b38ccfadfb2118ea397bf2b613
MATLAB
2,005
54
% NAN_MEAN - Average, not considering NaN values % % Usage: same as MEAN % Author: Arnaud Delorme, CNL / Salk Institute, 16 Oct 2002 % Copyright (C) 2001 Arnaud Delorme, Salk Institute, arno@salk.edu % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and details. % % Redistribution and...
e6b24a1236afdb0714c92a9df42c7836db3e9bd3f6c64fe997f7ed0a8203d326
MATLAB
2,005
68
function [displacement,speed,locoRestTTL,figHandle]=getMouseSpeed(data,Fs,varargin) % [displacement,speed,locoRestTTL,figH]=getMouseSpeed(data,Fs) % data correspond to the number of ticks from the rotary encoder % assume rotatory encoder 600 ticks/360° and 12cm diam wheel % output in cm/s % speed is kept the same lengt...
10c99635b897529d237606cf9bb052397d58d80c9a3f55ff00b710714244a711
MATLAB
2,006
62
function T = readSurf(white,pial,topo) % function rsa_readSurf(file,varargin) % Reads surfaces for each subject and returns an array of structures with % the corresponding surfaces. Only GIFTI input files formats are supported % for now. % % INPUTS % white: Nx1 cell array of white surfaces (left or right sided) ...
100412af7f5cf60e5a979c5ac86c54dda9aa7b1b430292ed40cf06e61ffa61d1
MATLAB
2,007
49
function getTriggers_switching_EI_IE(params) % determines trials where there was a switch from internal to external task (and vice versa) % determines trials which contained the selected keyword (in params.thisCategory) % MUST match trials 'tr' with the same keyword in trials(tr).stim_cond % saves result into respectiv...
959e297c7cb9272dead2ab0485e25daf6ff3f7a8dc2ddd964122f9e84e51404b
MATLAB
2,007
68
function obj = loadobj(s) % LOADOBJ Initialize a DagNN object from a structure. % OBJ = LOADOBJ(S) initializes a DagNN objet from the structure % S. It is the opposite of S = OBJ.SAVEOBJ(). % If S is a string, initializes the DagNN object with data % from a mat-file S. Otherwise, if S is an instance of `dagnn....
046e5517cc37b6afea6cd9d8486b7de069af3784783e94a5de3c8386d15d3d7c
MATLAB
2,008
47
function betas = betaCorrespondence(); % % betaCorrespondence.m is a simple function which should combine % three things: preBeta: a string which is at the start of each file % containing a beta image, betas: a struct indexed by (session, % condition) containing a sting unique to each beta image, postBeta: a % str...
5481eed04537efddcbb64ef81b42ffe137802411a26a1b87e35dbc9a2309e27c
MATLAB
2,008
65
function [m0, l0, a0, b0] = tapas_rdcm_get_prior_all(DCM) % [m0, l0, a0, b0] = tapas_rdcm_get_prior_all(DCM) % % Returns prior parameters on model parameters (theta) and noise precision % (tau) for the full connectivity model. Necessary for the sparse version % of rDCM. % % Input: % DCM - model struc...
6765aebf927a4b98597466c94a792eb8eebc0d9d402f68726bbb9ea6941408fa
MATLAB
2,009
60
%% Figure 2 main YOURDATAPATH = ''; %% Get data for all panels mouseInfoAll = {{'cfa17', '200825'}, ... {'cfa17', '200827'}, ... {'cfa19', '200820'}, ... {'cfa19', '200826'}, ... {'cfa20', '201114'}, ... {'cfa20', '201118'}, ... {'cfa22', '220605'}, ... {'cfa22', '220611'}, ... {'cfa24'...
c961e91e76515438c0750b09da690fc5f91769a61b2db08b7223bf8fcbf05acb
MATLAB
2,010
55
function [ obj ] = bold_grad_fd( obj, n ) % Calculate jacobian matrix of predicted fMRI BOLD signal with respect to % DCM parameters using forward difference method. % % This is a protected method of the tapas_Huge class. It cannot be called % from outside the class. % % Author: Yu Yao (yao@biomed.ee.ethz.ch) % Copy...
e67ff94be99e6f74c4c89ec596f55ad649e6d075257d6784365aaed13a059936
MATLAB
2,010
62
function newSegmentation = grow_region(this, startingSegmentation, threshold, nIter) % Iterative region growing using starting segmentation and threshold. % % Y = MrImage() % Y.grow_region(startingSegmentation, threshold, nIter) % % This is a method of class MrImage. % % IN % startingSegmentation MrImage-objec...
ee168a331d580041b271867711c9c87d53722fabbca52888bea24b8a8112ebfb
MATLAB
2,010
58
%APPEND_PDFS Appends/concatenates multiple PDF files % % Example: % append_pdfs(output, input1, input2, ...) % append_pdfs(output, input_list{:}) % append_pdfs test.pdf temp1.pdf temp2.pdf % % This function appends multiple PDF files to an existing PDF file, or % concatenates them into a PDF file if the output fi...
f5f2e5f51bae7dfeecc9a0053f8e5c88156bf91093acaf369c46579e1bdad6ca
MATLAB
2,010
71
function nbrs=surfing_volume_nbrs(voldef,nn) % Linear indices of neighbouring voxels in volume % % NBRS=SURFING_VOLUME_NBRS(VOLDEF,NN) % INPUTS: % VOLDEF: spm volume definition from spm_vol, or AFNI filename or header % information, or 1x3 vector with number of voxels in x,y,z % NN nearest neighbou...
ac08204ee6b0fde14aa9dd2875fbdc4652f32629a56a4a4da3fd53bfeca1203f
MATLAB
2,011
106
%%%%%%% % CODE BELOW WAS TAKEN FROM % https://gist.github.com/zahlenteufel/0ea490a1b28b7cc62492 % Generate the points clf subplot(2,1,1); axis equal mu1 = [5 4]'; sigma1 = [2 -0.8; -0.8 1]; mu2 = [0 1]'; sigma2 = [1 -0.06;-0.06 0.5]; chol(sigma1); chol(sigma2); % verifica definida positiva P1 = 0.3; P...
20f0f3704b504ff77613ed29ad57e28d860469d4cd99f6965485e21931ccf2cd
MATLAB
2,012
56
function [ obj ] = bold_grad_cd( obj, n ) % Calculate jacobian matrix of predicted fMRI BOLD signal with respect to % DCM parameters using central difference method. % % This is a protected method of the tapas_Huge class. It cannot be called % from outside the class. % % Author: Yu Yao (yao@biomed.ee.ethz.ch) % Copy...
63c1a23b24c4361e951405806633ce6e7e08c9ba7d455f80709bdf2d57d8d40d
MATLAB
2,012
51
function TMStargetT1_run (T1Dir,ROIDir,MatDir,OutDire) % TMStarget GUI by Gong-Jun JI %----------------------------------------------------------- % Copyright(c) 2016; GNU GENERAL PUBLIC LICENSE % Laboratory of Cognitive Neuropsychology, Department of Medical Psychology, Anhui Medical University % Written by G...
3e8aa00709de85355eb33a0531e0f1ef2c60328201c557db4590c925fb80f500
MATLAB
2,013
66
%isimatrix - Test if parameter is a matrix of integers (>= 2 columns). % % USAGE % % test = isimatrix(x,test1,test2,...) % % x parameter to test % test1... optional list of additional tests % % EXAMPLES % % % Test if x is a matrix of integers % isimatrix(x) % % % Test if x is a ma...
3b79b4c339b62c60d99d8b1c126be47c5ccf87c3794cf5b06848488247f21f7a
MATLAB
2,014
65
function arrayIndices = sample2index(this, samplingPoints, iDims) % Returns voxel samplingPoints corresponding to label (coordinate) samplingPoints % % Y = MrDimInfo() % arrayIndices = sample2index(this, samplingPoints) % % Inverse operation to get_samplingPoints % % This is a method of class MrDimInfo. % % IN % ...
2abfec3c9c4a54bcb9057be7aa6dcaa0b93c015b0b2daa89c62f734a566be9d8
MATLAB
2,016
64
function getTriggers_ssep_LR(params) % determines & saves trigger times and class labels % (c) Jiri, May16 disp('triggering on left / right hand ...'); %% per session: load, get trigger times and assign labels, save for sess = 1:size(params.storage.analyzedSess,2) t_trigger = []; clz_label = []; clz...
38c83e188a758db9157d155437fe82fd6141707f636e9cf7af34db1d2032c6e9
MATLAB
2,016
55
% POP_RUNSCRIPT - Run Matlab script % % Usage: >> pop_runscript; % >> pop_runscript( filename ); % % Input: % filename - [string] name of the file. % % Author: Arnaud Delorme, SCCN / INC / UCSD, August 2009 % Copyright (C) Arnaud Delorme, August 2009 % % This file is part of EEGLAB, see http://www.eeglab.org ...
fe211ce5d61103a89910a8e3ee9989dd2f445e8ba300a0a320ace4b3b922ead7
MATLAB
2,016
73
function [output_file]=Neuropixel_AP_preProcessing(name, data_file, channels, start_point, end_point) % input: % name: string, name of subject % data_file: full path to ap.bin file % channels: a vector with all channels to include (1:384) % start_point: start point in seconds % end_p...
61e276f5222116bb41a27ded73db57408f3221aa4684398cec6412b4a94ff57e
MATLAB
2,018
51
function elec = bis2fieldtrip(mgridfile, mrifile) % BIS2FIELDTRIP reads BioImage Suite .mgrid files and converts them % into a FieldTrip-compatible elec datatype structure and converts electrode % positions from BioImage Suite mgrid that are in 'xyz' to head coordinates % of the corresponding MRI volume % % Use as %...
b3b96b424450662a2159423414e3ab6daf57c0b9440cea977e74d95c3c68ab81
MATLAB
2,019
38
%% DistractedDataScript % Script for analyzing hand-labeled distracted data % Warning : the bool_distracted only contains values inside the nest zone. px2cm = 0.169; truncatedTimes_s = 10; neural_data_rate = 20; numTank = 21; load('NNBtankList.mat'); output_table = table(strings(numTank, 1), zeros(numTank, 1), zeros(...
d430354af6a8ded814114ac251656039095190ea18632a21163bad6b26f45dad
MATLAB
2,021
69
function [m0, l0, a0, b0] = tapas_rdcm_get_prior(DCM) % [m0, l0, a0, b0] = tapas_rdcm_get_prior(DCM) % % Returns prior parameters on model parameters (theta) and noise precision % (tau) for the particular connectivity pattern % % Input: % DCM - model structure % % Output: % m0 - ...
dbde8c88eaeb26064c99dd2c4df93037f93efccd365d20de4edb37c4786fdb9e
MATLAB
2,021
73
function this = read_recon6_image_data(this, obj) % Reads from ImageData format of Recon 6 (Zurich Recon Repository) % % Y = MrDataNd() % Y.read_recon6_image_data(inputs) % % This is a method of class MrDataNd. % % IN % % OUT % % EXAMPLE % read_recon6_image_data % % See also MrDataNd % Author: Saskia Bollman...
6e7d247e337a2d6ca3fbddd0995dc2e8ddedb6e93d01e010c25beabf8ea0360a
MATLAB
2,022
65
%% [r2s,t2s,m0] = Wrapper_R2s_Trapezoidal(magn,mask,matrixSize,voxelSize,algorParam,headerAndExtraData) % % Input % -------------- % localField : local field map (tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of each dimension of th...
132633cc1b1b4ee88f6c3cfe22ecf36bc0891317c267d8877c254ce3bd411acc
MATLAB
2,024
63
function [C] = iem_trialwise_interp(data,angs,angspace,foldvar,angspace2,exclusion,recenter) % [C] = iem_trialwise_interp(data,angs,angspace,foldvar,angspace2,exclusion,recenter) nChan = length(angspace); nChan2 = length(angspace2); ntime = size(data,3); nsens = size(data,2); ntrl = size(data,1); ...
3fcf89cbd6c33cc1f51377eb6f66f07eb06968890f5544b631bcc2f05c851d31
MATLAB
2,024
54
function applicationDimensions = convert_application_dimensions(this, ... applicationDimensions) % converts chars of applicationDimensions to indices, and returns error, if % % dimension index as default, if char is not a valid label for any dimension % % Y = MrDimInfo() % applicationDimensions = convert_appli...
2d4ced5e31141ae2503479576a2889a49eba9b62e401b1bd5c67d4344b026f5b
MATLAB
2,025
58
function pathExamples = tapas_physio_get_path_examples(pathPhysioPublic) % Returns GitLab-internal or TAPAS-public PhysIO Examples folder, based on % location of public PhysIO directory % % pathExamples = tapas_physio_get_path_examples(pathPhysioPublic) % % IN % pathPhysioPublic location of public PhysIO folder,...
bbc59645b8e2d827c2d2117fde1874d5f06f8c61c658c8bc5645310d10a372e7
MATLAB
2,025
103
function roi = findROI(im) roi = getInitialROI(im); time_series = getTimeSeriesBinaryMask(im, roi); subplot(2,3,1); imagesc(roi); subplot(2,3,4); plot(time_series); roi = getXCROI(im, time_series, 3); time_series = getTimeSeriesBinaryMask(im, roi); subplot(2,3,2); imagesc(roi); subplot(2,3,5); p...
9b6d7c509d0eec39676b5b7a0946495850b4f9aa6bc52f217ab858d59bccc706
MATLAB
2,026
56
function [stop, reason] = stopifclosedfigure(problem, x, info, last) %#ok<INUSL> % Create an interactive stopping criterion based on a figure closing % % function stopfun = stopifclosedfigure() % % Use on the options structure passed to a Manopt solver, e.g.: % % problem = ... % manopt problem structure with manifold...
328c30934a9beaab57dc8ea6a70e4c9dd290c3bdb0e89d69207e0f2ed5cebb1f
MATLAB
2,027
57
% EEG_HIST - history for EEGLAB dataset. % % Usage: % >> EEGOUT = eeg_hist( EEGIN, command ); % % Inputs: % EEGIN - input dataset % command - [string] eeglab command % % Author: Arnaud Delorme, SCCN/INC/UCSD, Dec 2003 % % See also: EEGH, EEGLAB % Copyright (C) 2003 Arnaud Delorme, SCCN/INC/UCSD, arno@salk.edu ...
46fc9c9d666619c39bde5bb05327982c5e29a235fc07d490d8c0a38ade487b76
MATLAB
2,027
69
% load in and visualize snapshots NT = NetworkObj('../test/circlenuchexresv.net',struct('dim',2)); NT.setCumEdgeLen(1:NT.nedge); %% load snapshot data resdir = '../test/'; filename = [resdir 'test.mesh.txt']; MSH = MeshObj(filename); snapfile = [resdir 'test.snap.txt']; [field,snaptimes,vels] = loadSnapshotFVM(snapf...
836eae7564d02d4264025536e57e015639336132274735dc8290b109bd3393ef
MATLAB
2,027
67
% FORMATTING clear all close gcf global warpFactorLevel vigilance bias learningRate maxNumCategories maxNumIterations sampleInterval resample load Default.mat; warpFactorLevel = 3; % Set to 3 by default addpath(pwd); % GENERATE FIGURE h0 = figure('Units','normalized', ... 'CloseRequestFcn','callback1', ... ...
e6bb7489bb8ba529c63705899edbcc2295817c219278058abefe43e48c468ad4
MATLAB
2,027
67
function S = randsym(n, N) % Generates random symmetric matrices with normal entries. % % function S = randsym(n) % function S = randsym(n, N) % % S is an n-by-n-by-N array where each slice S(:, :, i) for i = 1..N is a % random symmetric matrix with upper triangular entries distributed % independently following a norm...
2e67398a57755b7af47a01421b47b9bb85227dd748ba838e502deca984efc8cc
MATLAB
2,028
62
function im = bbox_draw(im,boxes,c,t) % copied from Ross Girshick % Fast R-CNN % Copyright (c) 2015 Microsoft % Licensed under The MIT License [see LICENSE for details] % Written by Ross Girshick % -------------------------------------------------------- % source: https://github.com/rbgirshick/fast-rcnn/blob/master/ma...
47cd3f958b5f66c5c3e6bb3ee17d44928c1cdea04bf800abd6a46e3328e3cfb6
MATLAB
2,028
73
function affineTrafo = make_affineTransformation_reference(~, varargin) % create a affineTransformation reference object for unit testing % % Y = MrUnitTest() % Y.make_affineTransformation_reference(do_save, fileName) % % This is a method of class MrUnitTest. % % IN % % OUT % % EXAMPLE % make_affineTransformation...
ddc6e73759f0af86fcbb978f31b8c05f848863e1a214ee7031146aed765c56a9
MATLAB
2,029
71
function [nd] = unDecimate(data, columnsWanted) % deterimntes amount of time between samples and interpolates data % input of data must have time in the first column % currently takes one column at a time % can run a for loop to go through matrix on outside - see below % [nd] = unDecimate(data, columnsWanted...
3f57422c2f1e5adee338d939317063794c41c77adc333ecfa2265de5118e5abf
MATLAB
2,032
60
function elec = read_asa_elc(fn) % READ_ASA_ELC reads electrodes from an ASA electrode file % converting the units to mm % Copyright (C) 2002-2013, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: you can ...
45ebd784bf5998e67500a312891fbe70fc1ba461dd302b298e914f146dd45cbe
MATLAB
2,032
49
function plotBinnedCount(expInfoAll, subjectsToInspect, probeInfo, dayBins) probeSNUni = unique(expInfoAll.probeSN); days = cell2mat(expInfoAll.daysSinceImplant); clear qm_av for ss = 1:numel(subjectsToInspect) subjectIdx = contains(expInfoAll.subject,subjectsToInspect(ss)); probes = u...
484cd9874fb0201d020a6a1a29e3bd40293e7b49c4012834d688c9ccd98da706
MATLAB
2,032
90
function [err, Bstrct] = WaverBasisOption (BasisFunc, N_Basis, BasisOpt) % % [err,] = WaverBasisOption () % %Purpose: % % % %Input Parameters: % % % %Output Parameters: % err : 0 No Problem % : 1 Problems % % % %Key Terms: % %More Info : % % % % % Author : Ziad Saad % Date : Fri Jul 18 14:35:24 EDT 2...
e02e2f54099404478f569c7b57897c7d8d02095e4dd0b3e23d8abf89b70b4b9e
MATLAB
2,032
63
function count = fwriteVAXG(fid, A, precision) % FWRITEVAXG(FID, A , PRECISION) writes the elements of 'A' to the % specified file in VAXG format, translating MATLAB ® values to the specified % precision. COUNT is the number of elements successfully written. % % FID is an integer file identifier obtained from FOPEN...
10b21d4bfb872ef6b21386a8efe6f8e66be7f9a4c7a7f306979ac7ccc64647f8
MATLAB
2,033
60
function display = OpenWindow(display) %display = OpenWindow([display]) % %Calls the psychtoolbox command "Screen('OpenWindow') using the 'display' %structure convention. % %Inputs: % display A structure containing display information with fields: % screenNum Screen Number (default is ...
48acee0f839639e4d583e871f3926095f4bea039d5781885fcdb19ab0bc1279f
MATLAB
2,033
60
function img = fillSmallHoles(img, options) %FILLSMALLHOLES Fill small holes in a binary image. % % DESCRIPTION: % fillSmallHoles fills small holes in a binary image by using % bwareaopen on the negative of the image, and then adding the filled % components to the binary image. % % See also: % http...
9a900143add91468ddd5109dd94374be67ceabd137485b53733c1ca5666f95b1
MATLAB
2,033
57
%% cal voxels in Mst % Mst clusters from unsmoothed data % dim is 2.6 mm iso clear % sub-pil001 and sub-pil002 have no localizer %'sub-011' have no hMT;'sub-013' no (rhMT rMTt),'sub-014' no MTt %'sub-008' have only right mst - !! do manually subjectList= {'sub-001','sub-002','sub-003','sub-004','sub-005','sub-006','su...
a63d6f3603d2c71ade0571a1acfb810b34690ed79ffe0fbdd3e4f257e1334d27
MATLAB
2,033
57
function [dat] = read_bucn_nirsdata(filename, hdr, begsample, endsample, chanindx) % READ_BUCN_NIRSDATA reads ASCII-formatted NIRS data acquired with the % UCL-BIRKBECK machine and postprocessed by the Paris group. The first line % contains the channel labels and the rest of the file contains per line a % time sample....