sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
b4829c528cce46fea15499a8490a25308c79afa30602b00f6d48b25e8f5fde50
MATLAB
3,620
107
function [ranovatblb,Mrm1,Mrm2,rm,assumptions] = rm_anova_OPS(data_analysis,group_names,position_analysis,varName) % [ranovatblb,Mrm1,Mrm2,rm,assumptions] = rm_anova_OPS(data_analysis,group_names,position_analysis,varName) % rm ANOVA for OPS results % % inputs: % data_analysis - Original dataset % group_names - N...
be91d0062e0d02547756a458825968da5c4885527d944fa0cc0b3c0dbe77a030
MATLAB
3,622
108
function [allAddr,allTs,ISI,monTime]=loadaerdat(file, path) %function [allAddr,allTs]=loadaerdat(file); % loads events from a .dat file. % allAddr are uint32 (or uint16 for legacy recordings) raw addresses. % allTs are uint32 timestamps (1 us tick). % noarg invocations open file browser dialog (in the case of no i...
0b44fef91cd3b7932757988c49d5d9b91038657171f2ce3a313942b00e7e7695
MATLAB
3,625
91
nodeSpacing = 10; % microns % load mask data % [maskFileName, maskPathName] = uigetfile('*.mat', 'Pick the .mat file with your skeleton object'); % load(strcat(maskPathName, filesep, maskFileName),'mask','bkgndmask','fileName','pathName'); % % %% read file % % % Use this line if your 2 channels are in one file [stac...
5dfb15c4b4996eb53f92a77d66cd715e1a5ad1a280d7db1cdcfe7116afe27197
MATLAB
3,627
122
% This script provides a tutorial application of the Gaussian-Copula Mutual % Information (GCMI) estimator with a 2 category discrete stimulus (face % vs noise images) event-related EEG data set. % This script uses cell mode - cells are delimited by %% lines and can % be run with: % ctrl-enter (windows, linux) or cm...
d7ce3eae2bf22522976589a8a249b2914fca49370492955555acb4ffbbca8348
MATLAB
3,627
94
function imData=read_file(path_to_file,sframe,num2read,options,im_info) % Reads uncompressed multipage .tiff, .hdf5, .avi or .raw files % Usage: my_data=read_file('path_to_data_file, start frame, num to read); % INPUTS: % path_to_file: location of file to be read % sframe: first frame to read (optiona...
6cb9e31a655feafd7f79fcad2b08ba7e42927400e923a95c75de5cf423795d6c
MATLAB
3,631
111
% % BDP BrainSuite Diffusion Pipeline % % Copyright (C) 2019 The Regents of the University of California and % the University of Southern California % % Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi, % David W. Shattuck, and Richard M. Leahy % % This program is free sof...
a4aa390fb792e5b55771f1502f38a5a7a6da2c2c52077b30fecb9e114aa55538
MATLAB
3,644
104
function BWout = interpmask( varargin ) %INTERPMASK Mask interpolation (tweening) via distance maps % % BWq = INTERPMASK(X,BW,Xq) interpolates masks in the logical matrix BW % at query points Xq. The elements of X corresponds to the successive % masks along the last dimension of BW. The output BWq is a logical % ...
aaadc75a9ff6511967a12676098672fb665be0ec84fb862d5ce0c0d2ce26197a
MATLAB
3,644
95
classdef NullModelAnalysisUnit % Holds and executes a single null model analysis, leveraging ConnectomeAnalysisRunner properties AnalysisRunner ConnectomeAnalysisRunner WiringPISimilarity end methods function obj = NullModelAnalysisUnit(randConnMat,randDomDef,randHoldoutOptions...
42c3aa75b6a502799579e8f055e9271e4b220a919a90d362ecdf7f6fb9c3469c
MATLAB
3,648
113
function p = userpath(inArg) %USERPATH User environment path. % USERPATH returns a string specifying the first folder on the search path. % MATLAB adds the userpath to the search path upon startup. % % The default userpath is platform-specific: % Windows: user's "Documents" folder appended with "MATLAB" % ...
0e95ae2d262a74b1bb19091676c18cfc8d9e38c1654c43ab2d683d9deaf05478
MATLAB
3,657
108
function [s_pe, s_ep, prior_pd, post_pd] = spm_cpm_get_ppd(PRF, coords, idx, nsamp, use_parfor) % Sample from the prior (or posterior) of a pRF model and run samples % through the likelihood, to give the prior (or posterior) predictive % density (PPD). % % PRF - estimated PRF % xy - coordin...
8c56e2da62dc6539dad43ed745527d31900d3b1c5ec9950f1da2395abbcffbda
MATLAB
3,667
82
function [markerdat_micro, markerdat_macro] = readstimdata(cfg,micromed_markers) fname_output = fullfile(cfg.datasavedir,['stimdat_',cfg.postfix,'.mat']); if exist(fname_output,'file') && cfg.force == false fprintf('Loading precomputed data: %s\n',fname_output); load(fname_output,'markerdat_micro','markerdat_m...
1e9d59aa5f7f72fb3a25e7521072f7faf7fd7caed4b44e8b7b779a77195d90cc
MATLAB
3,671
61
function experiments = get_experiment_redux(klusta) % function creates the selected experiment plus correlated parameters from % the specified excel file % input variable optional (vector), if not defined: all experiments are selected, % if defined: selected experiments will be used if nargin < 1 klusta = 0; end...
b63aec0173cb17b549802e00ca186e1a9978b09a49e59c58e3e95e3dfe61db2d
MATLAB
3,679
140
function map = perlin3(s,depth,f0,fn) % PERLIN3(OUTSIZE,POWER,F0,FN) % general function to generate 3-D perlin noise maps % this lazy pointwise method is much slower than PERLIN() % but the results are repeatable and can support OUTSIZE(3)>3 % output is double, scaled [0 1] % % OUTSIZE is a...
d38fb03ddd6b6204aace9124504907c7e45139248d998a7c5176c5d03445dfe7
MATLAB
3,684
146
% % [basis, r, rho] = getSampleCorrelationBasis(T, fileName) % % Description: % obtain sample correlation basis % % Input: % T - number of time samples % fileName - file name for caching % numCPU - number of cpu used for parallel processing % isVerbose - verbosity % % Output: % basis - sample...
b67c496a6492b56ca5903fe412a4b147ab93dad4f2f18c2c17b0b24e3e169a52
MATLAB
3,686
68
function [MuseStruct_new] = PET_cut_long_epochs(cfg, MuseStruct_orig, markername, max_epoch_length, new_epoch_length) % Cut epochs into sub-epochs if they are too long. MuseStruct_new = MuseStruct_orig; markerstart = cfg.muse.startmarker.(markername); markerend = cfg.muse.endmarker.(markername); for ipart = ...
8cf1cae4c91d0122973144f32073c0d6453fe3f3e250cd27f0f4eef859e35a9b
MATLAB
3,694
89
function [auroc ciLoUp] = mroc(x,y,varargin) % function [auroc ciLoUp] = mroc(x,y,varargin) % % computes the area under the receiver operating characteristic (ROC) curve % optionally, provides bootstrapped confidence intervals and plots the curve % % note that x and y must exclusively consist of integers! % % results v...
859d26a0de6ad93e21b6ac2ea91c6394ecb21baa6dd8178dad6e8d233e829968
MATLAB
3,702
100
% RANDSUBSPACE Generate k random vectors x that are orthogonal to z but have the same projected % coordinates along the columns of A, i.e. A^T x = A^T z for all x, as well as the % vector norms of x being the same as that of z. % % Inputs % ======== % A : m-by-n matrix for which...
1c51f20903284ba0bffd6070b36ed273b4532b8bcf5ed610ca10c9d90aa25a3c
MATLAB
3,706
152
function [c2_idx] = dbscan2(x, varargin) % dbscan2 - Clustering by two sequential DBSCANs. The first one is applied % to the points in 'x'. The second one is applied to each cluster % recognized by the first DBSCAN. % % After the second DBSCAN, a gaussian mixture classification is applied. % The mean of each po...
83ebbedb02de8b661b56ef53b0df59e08b3dfd364b39199656716e622a042d41
MATLAB
3,707
76
function plotstats(cfg) nrows = 18; ncols = 3; % SpikeTrials_timelocked = readSpikeTrials_MuseMarkers(cfg); SpikeDensity_timelocked = spikeTrialDensity(cfg); for ipart = 1 : size(SpikeDensity_timelocked, 2) fig = figure; orient(fig, 'portrait'); col = 1; for markername = string(fields(Spike...
77950a9985a8ad144960d424f1b2422d595aada1cca2c78fcb65fa12ae9e92c4
MATLAB
3,709
103
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2019 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % modify ...
40516820c0c2f66f1acc64d8c8d9fc1b084268e8ab228e801e5820566f746c09
MATLAB
3,720
111
classdef BrainRegionInformation < handle % BrainRegionInformation % Handles brain region metadata and keeps AnnotationIndex for linkage to BrainSpace3D properties RegionTable table end methods function obj = BrainRegionInformation(tbl) arguments tbl tabl...
92569c2575ed200641ec6c4a67e2d59149f01b0408e103611947f2b44a776f2d
MATLAB
3,721
115
function bwMask = multiROI(figHandle, axHandle) % multiROI: Interactively specify 2D freehand ROI % % Overlays an imfreehand ROI on an image. % Gives the ability to tweak the ROI by adding and % subtracting regions as needed, while updating % the ROI boundaries as an overlay on the image. % Returns a logical matri...
e5189a45e5ff9e3c3d178316d2ec56b81d5cd0ac7f8c6476797f89071579ae83
MATLAB
3,725
80
function [tapers,pad,Fs,fpass,err,trialave,params]=getparams(params) % Helper function to convert structure params to variables used by the % various routines - also performs checks to ensure that parameters are % defined; returns default values if they are not defined. % % Usage: [tapers,pad,Fs,fpass,err,trialave,para...
4ef6117edab5bec89f13a62ee6e868259413889556ed44b6bba461708d5bc3b5
MATLAB
3,733
100
function dtx_plot_patients_seizure % Set parameters if ispc addpath \\lexport\iss01.charpier\analyses\lgi1\Git-Paul\fieldtrip; addpath (genpath('\\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\projects\dtx')); addpath (genpath('\\lexport\iss01.charpier\analyses\lgi1\Git-Paul\EpiCode\external')); ...
b77fc3e701846a50306c73f96b8117fc50ab37d9701c74ae4d770091a2d5ee8a
MATLAB
3,734
105
% Correlate varA with varB accounting for confounds (SPM setup) clear, clc, close all %% Paths / data path_batches = 'D:\Projects\2023_multib\MK_multi_b\Scripts'; cd(path_batches) load('Table_297_subjs_demographics_biomarkers_2024_05_03.mat') n_subjects = size(T_subjects,1); path_stats_grp = 'D:\Proj...
6ebb5ac88537b73aff8587288dc6a0c9110ab700a3058e19e1aabca7a65d4025
MATLAB
3,737
89
function BatchResults = Batch_InterictalDetection(filename,threshold,channel,toDenoise) % USAGE % % BatchResults = Batch_InterictalDetection(filename,threshold,channel,toDenoise) % % Main function for the interictal-like spike detection. Filter the signal, receive % the interictal-like spikes, group t...
ee1be52b813b00774f2e9ea922e415ed1208798e1b80fe5db83641ef083fc2c4
MATLAB
3,737
90
%************************************************************************** % % morse_unfold unfolds aliased images given pinv of sensitivities. % input "data" contains: % a global header in .reference % acquired, aliased k-space in .data as [N_coils, RO, PE1, PE2, echoes, sets] % ...
457a7149a8ac635f2311be81488b38ed059debd782d34c4b9b07e282ec3a4ec3
MATLAB
3,738
106
function h=subaxis(varargin) %SUBAXIS Create axes in tiled positions. (just like subplot) % Usage: % h=subaxis(rows,cols,cellno[,settings]) % h=subaxis(rows,cols,cellx,celly[,settings]) % h=subaxis(rows,cols,cellx,celly,spanx,spany[,settings]) % % SETTINGS: Spacing,SpacingHoriz,SpacingVert % ...
eb854323c51a00b8803f5dc24579d3bf3e4845aab4dd6ac5a13abe37364cd28f
MATLAB
3,740
109
function [DG_point,DG_accepted,DG_line_image,outer_points,inner_points,hilus_points]=trace_Hilus_outline(settings,images_all,composite_img,roi_names,roi_idx,roi_fname,magnification,roi_subfolder,DG_line,DG_out_line) %%% Trace DG outline - Version 4 %%% DG_accepted=0; nuclear_image_roi = images_all.nuclear_img; dc...
1677a7e08f7e0bb0a737f28600077f79f1e7c33adecd4d0274cc02b88badaacb
MATLAB
3,742
89
function CBIG_AuthorTopic_EstimateComponentSmoothness(allKs, maskPath, ... bestSolutionDir, outputDir) % CBIG_AuthorTopic_EstimateComponentSmoothness(allKs, maskPath, .. % bestSolutionDir, outputDir) % % Estimate the smoothness of the estimates for the probability of a % component activating a voxel (Pr(voxel | co...
9c7cc730f214b57c767ed9da17f4fb55c352e073f0cf5d2eb0e62c2e5fb33923
MATLAB
3,747
88
function [StimPowerRamps] = getStimulationPowerSingleRamps(experiment,... CSC, save_data, repeatCalc, folder4stim_props, folder2save) % by Mattia, 01/21 % this script computes the power for individual stimulations of our % "classic" ramp optogenetic stimulations. It assumes a ramp length of 3s % and a total stim t...
10f71f57e022113a28b6d6ecb1e3696ce49f1232677258bd43546b625568b318
MATLAB
3,748
137
function outpict = impatmap(inpict,G,ugl,varargin) % OUTPICT = IMPATMAP(INPICT,PATGROUPS,LEVELS,{OPTIONS}) % Using a sorted collection of grayscale (ostensibly tileable) patterns, % approximate a multilevel grayscale representation of another image. % This is the tool used to apply the output from impatsort(...
dab85aed2456aaaa1b6ecfc2dcc00796aa0fae768eeddb9104776e776fbc7289
MATLAB
3,756
93
function slurm_preictal_project(ielec) restoredefaultpath if ispc addpath (genpath('\\lexport\iss01.charpier\analyses\vn_preictal\scripts\EpiCode\shared')) addpath (genpath('\\lexport\iss01.charpier\analyses\vn_preictal\scripts\EpiCode\external')) addpath (genpath('\\lexport\iss01.charpier\analyses\vn_prei...
54082239b6ecd0ee05e0a02525ea26b5e1e03d379ecbacdfadfb4e99f4ae5341
MATLAB
3,760
70
function mov = denoiseCIinTime(mov, varargin) % denoiseTracesWavelet(fuObj, varargin) % % Function to denoise calcium imaging data in time using wavelet % denoising. To avoid the missing data problem, error frames from burst % errors are filled in using cubic spline interpolation. % % 2020 - Adam Charles %%%%%%%%%%...
b06252b5da83e0258e4679fa5b31c8b6d9adacfd95ad3c879e6bf122adb9b197
MATLAB
3,767
98
function borders = moveBorders(data,options) % move parameter-boundaries to save computing power %function borders=moveBorders(data, options) % this function evaluates the likelihood on a much sparser, equally spaced % grid definded by mbStepN and moves the borders in so that that % marginals below tol are taken away...
6811f10a786ac031d309f8f3ea2a43ce298fddc0a1267a79d9d8883e2ffd8ccb
MATLAB
3,768
94
function [result, SI] = readScanImageTiffLinLab(fileName) % readScanImageTiffLinLab: % Uses ScanImageTiffReader to read in a ScanImage file with the name % fileName % We use this because scanimage.util.opentif is unbearably slow % % Usage: % [result, SI] = readScanImageTiffLinLab(fileName); % - result is a a 5D matrix...
6c30fc158d861e72adc44fecb70c8a146fb92afbd078fddadeab17684db07cf0
MATLAB
3,776
95
function make_movie_fmri(bfpdir,fmridatfile,outgiffile,TR, sc) if ischar(TR) TR=str2double(TR); end %sc is upper and lower limit on the colorscale cmap=bipolarcmapW(100,[-sc,sc],'linear','br'); dfs_refL = readdfs(fullfile(bfpdir,'supp_data/bci32kleft.dfs')); dfs_refL=smooth_cortex_fast(dfs_refL,0.1,1000); nV=leng...
2e453242a7fc3a80b5af6eb78ff8c3f0cdeadf915cae1f02329dcfd2a5e33026
MATLAB
3,779
101
function MBmodel = optimiseMBparams_APLgain_Ctheta(MBmodel, PNactivity) % sigmoid_factor = -0.9; % Sigmoid_derivative = @(x) exp(-sigmoid_factor.*x)./((1.+exp(-sigmoid_factor.*x)).^2) ; % Sigmoid = @(x) 1./(1.+exp(-sigmoid_factor.*x)) ; sigmoid_factor = -1.11; Sigmoid_derivative = @(x) exp(-x./sigmoid_factor)./((1.+ex...
5d5e30708e48942ac758f2cb9dc9c80ce605a10632fa8ccf5d946997aa35c7ec
MATLAB
3,780
128
%Script to create the design matrix A in A*beta = b, where the columns of A are features extracted from layer x of the DQN. function S05_design_matrix_layer_x(subject, game, DQN) root_path = 'YOUR_DATA_PATH'; main_dir = strcat(subject, '/', game) ; sess_no = 5; GLM_name = 'GLMs_Layer_x'; TR = 0.987; load('hrf_15hz...
77ffbea6ad8541ebe7369e5da1bab66c512d70777244eb6fd012b88b14950261
MATLAB
3,791
114
function [] = displayMultiActivityMaps(allMaps, fileprefix, registerF0) % displayMultiActivityMaps: % Usage: % displayMultiActivityMaps(allMaps, fileprefix, registerF0) % allMaps is an array of activityMap objects % Will display 2 figures: % 1. All the maps in allMaps, one per row. % Each row will be an 1 X N montag...
a8017d5ff4d0f525c515b7b74e20c2e875eb9874cd2c88c4678773ea5fa1a682
MATLAB
3,792
130
function outpict = imannrotate(inpict,angle,varargin) % IMANNROTATE(INPICT, ANGLE, {OPTIONS}) % Rotate an image using simple annular shifting to crudely maintain boundary geometry. % This is not intended for any technical purpose requiring accuracy or reversibility. % % INPICT is an I/IA/RGB/RGBA image ...
e8f6deab2121cdc71242066931f7247f8041da6be8d113dfdfd5360761384cfa
MATLAB
3,793
115
function [W] = mc_undist_loop(V) nx=V.nx; ny=V.ny; tim1=V.im1; tim2=V.im2; b00_best=0; b01_best=0; b02_best=0; b10_best=0; b11_best=0; b20_best=0; [X,Y] = meshgrid(1:nx,1:ny); cost_best = 9e99; adjustX_lin = ones(ny,1) * (([1:nx]-(nx+1)/2)/((nx+1)/2)); adjustX_sqr = adjustX_lin .^2; adjustY_lin = (([1:ny]'-(n...
532f08401425942bca43a0d85b93a9ef74c6a44646d20cb94435eb322aacc38b
MATLAB
3,801
73
function wf = getWaveForms(gwfparams) % function wf = getWaveForms(gwfparams) % % Extracts individual spike waveforms from the raw datafile, for multiple % clusters. Returns the waveforms and their means within clusters. % % Contributed by C. Schoonover and A. Fink % % % EXAMPLE INPUT % gwfparams.dataDir = '/path/to/da...
b921cc696dd003a8afae7c1613b4c8a1d0e523fcaff9b141aa38ac8b07bea969
MATLAB
3,802
136
function out = zfdither(img) % ZFDITHER(INPICT) % Apply Zhou-Fang VC dither to an I/RGB image % % The ZF algorithm is a modern variable-coefficient % error-diffusion dither based on the Ostromoukhov algo. % https://www.cs.unc.edu/~xffang/paper/siggraph03.pdf % Zhou-Fang dither implementa...
f4b4dc1c1f21f10d2a7817e5abca9d75c9a3b56de2e439d4b444486bc7b6a914
MATLAB
3,808
110
% % BDP BrainSuite Diffusion Pipeline % % Copyright (C) 2019 The Regents of the University of California and % the University of Southern California % % Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi, % David W. Shattuck, and Richard M. Leahy % % This program is free sof...
36fd74297c3f6df6f832b908cb4a8d8c48cba89833bd3ece2accbbf7a1b530c0
MATLAB
3,813
107
% ========================================================================= % Title: Spectral Feature Extraction from chemogenetics manipulation % experiments % % Author: Gabriele Mancini % Date: 2025-12-10 % % Description: % This script processes experimental LFP and MUA neural data to extract periodic and % aperiodic...
b69a7a7b790d7d6b35b1f836612cd054b6e22cdafd2922c361de4e182cce382d
MATLAB
3,816
95
function plotTimeCourses_new(cfg, LFP, TFR) for ipart = 1 : size(LFP, 2) for markername = string(fieldnames(LFP{ipart}))' cfgtemp = []; cfgtemp.hpfilter = 'yes'; cfgtemp.hpfreq = 1; LFP{ipart}.(markername) = ft_preprocessing(cfgtemp, LFP{ipart}.(markername)); end end f...
29bdd825b6cd3c4b9f73102d7eb8d0d64adb06af3c3bc4da94d6efcc5c4e606a
MATLAB
3,819
115
function outpict = perlin(outsize,varargin) % PERLIN(SIZE, {OPTIONS}) % Generates pseudo-perlin noise fields or volumes. Compared to PERLIN3, % behavior is nonrepeatable, but the execution is much faster. Instead % of generating a perlin noise volume to create a multichannel image, % PERLI...
9bd779f6bba15c6e373a1074da36acae185fab4bad5917c2ca2bae13db79d863
MATLAB
3,819
73
classdef Acquisition properties (Access = public, Hidden, Constant) % Acquisition flags ACQ_FIRST_IN_ENCODE_STEP1 = bitshift(uint64(1), 0) ACQ_LAST_IN_ENCODE_STEP1 = bitshift(uint64(1), 1) ACQ_FIRST_IN_ENCODE_STEP2 = bitshift(uint64(1),...
9d99eac0455ea02537e5880a8284a2f9d36279c5ab45d05e2d3e0f67524918ff
MATLAB
3,821
145
%% Fig.2 % Fig.2 % plot using GraphPad Prism 9. %% Fig.3 % Fig.3a, b, and c % inflated brain surface were ploted using SUMA (https://afni.nimh.nih.gov/Suma). % axial maps (CanlabCore) clear;clc;close all imgname = 'glm_NA-NV_fdr05.nii'; mask = which('gray_matter_mask.img'); img= fmri_data(imgname,mask)...
be0e22adfb78b1853f1a175717b15ec231150377d18ab816aa86dbd9ea3b5785
MATLAB
3,832
68
function hspike_cluster_template(ipatient) %% Analysis script for SLURM cluster % % (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com % %% preamble feature('DefaultCharacterSet', 'CP1252') addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/EpiCode/projects/hspike/ hspike_setpaths; labels = ["BAD__STAR...
9427c4e7de68c0211afce1d7520dbaf896882d8e8f9150e727e4ca8c26f373f6
MATLAB
3,844
106
function h=subaxis(varargin) %SUBAXIS Create axes in tiled positions. (just like subplot) % Usage: % h=subaxis(rows,cols,cellno[,settings]) % h=subaxis(rows,cols,cellx,celly[,settings]) % h=subaxis(rows,cols,cellx,celly,spanx,spany[,settings]) % % SETTINGS: Spacing,SpacingHoriz,SpacingVert % ...
49505022df2c7f5294e1e6f554c8893d038668637cfa015b43ea113022a6ba4d
MATLAB
3,849
125
function transform_data_affine(data_file, data_coord, output_file, ... reg_moving_file, reg_static_file, reg_mat_file, method) % General function to transform nii/dfs using affine matrix estimated using % register_files_affine.m. No sophisticated checks are performed for % file-coordinate checks. % % data_file - f...
6d7182df103d030805211abd2e8ff6dddcfd7e82ba682127f0853816c28038e1
MATLAB
3,864
78
classdef MajorRegionBlockRandomizer % Applies randomization method to each MajorRegion pair block, or to the whole matrix properties RandomizationMethod function_handle UseBlockwiseLogical (1,1) logical end methods function obj = MajorRegionBlockRandomizer(randomizationMethod,...
4305a473505c4056881cd99c0d64eec85cc8db2e2dac44d7c47baae00d5e5065
MATLAB
3,876
161
function inpict = maketileable(inpict,tiling,varargin) % OUTPICT=MAKETILEABLE(INPICT,TILING,{METHOD},{INTERPOLATION},{REVERTSIZE}) % Adjust the geometry of an image so that its height and width % are integer-divisible by given numbers. If dimensions are already % integer-divisible, no adjustments are made. % ...
c5055f47f390ae725a247d00174b50ead9f4d639252b146e4b2a95b89ef59879
MATLAB
3,879
128
% preprocessing for TMS-iEEG % including four parts: % Part 1: Basic preprocessing % Part 2: Split sessions [optional] % Part 3: Detrend % To do: % use more specific names; % add plot: plot them together or seperate figures, with example channels; %% ------------------------------------------------- %% Part 1: Basic...
5820c8eadaf1db119a19d541e9a2e7e8e6d027335538e57f84af305c5607e3bf
MATLAB
3,881
160
function outpict = puttext(BG,thistext,varargin) % OUTPICT = PUTTEXT(INPICT,TEXT,{OPTIONS}) % A simple tool to insert text into an image using image composition. % All text is monospaced and binarized (no antialiasing). % % INPICT is an image of any standard image class. Multiframe images are not supported. % ...
102a38ca1af358e374f75061eb2dae905895f8012b9e9269fee38b177fd460d5
MATLAB
3,884
156
function I = mi_model_gd_vec(x, y, Ym, biascorrect, demeaned) % MI_MODEL_GD_VEC Vectorized MI calculation between multiple Gaussian variables % and a common discrete variable in bits based on ANOVA style model comparison. % I = mi_model_gd_vec(x,y,Ym) returns the MI between the (possibly multidimensional) % ...
6d923a019ec4a773681b64caf2bba566b2c99ae432140601adcd55d9550431d0
MATLAB
3,896
104
function [OPS_object_data] = Circular_object_detection_OPS(OPS_object_data,save_path,position_analysis,centers,radii,lengthpix,Files,idx,ind_mouse,phase) % [OPS_object_data] = Circular_object_detection_OPS(OPS_object_data,save_path,position_analysis,centers,radii,lengthpix,Files,idx,ind_mouse,phase) % Detect circular...
cb148ce657d5b3f17f4bd62ab5b68f7b10001ccf4e95ca68bf9232835ebb14f4
MATLAB
3,897
104
function [vol_reslice, nii] = myreslice_nii(vol, method, X_grid, Y_grid, Z_grid, fileOut, gz) % Reslice the nifti image (VOL) to a grid in world-coordinates i.e. applies the sform transformation % on the image matrix. When [X_grid, Y_grid, Z_grid] is not defined, the image is resliced on a grid % with same resolution a...
7ecd3d6e992ef3932983002765b3a4f02a19d1086610a4e05f3f69b3533bde2b
MATLAB
3,903
86
function MuseStruct = read_nev_Muse(cfg,MuseStruct) % READ_NEV_MUSE crawls and searches through patient directories to % extracts event timings created in the .nev file during the data % acquisition. % It adds each event in MuseStruct so it can be used the same way as the % events created in Muse. The name of the ev...
028d789de1c3001f7ea64fe748fa10221a43dfdf32f2bd05f889b92f8b4d026f
MATLAB
3,904
130
%% Alamar Blue SAP experiment %% clc; close all; clear all; %% Matlab folder matlab_folder = '/Users/sofiaperessotti/Docs/VM_stim/Analysis'; addpath(genpath(matlab_folder)); %% Folders base_folder = '/Users/sofiaperessotti/Library/CloudStorage/OneDrive-ImperialCollegeLondon/PhD_project/Cell_Experiments/SAP_stim/'; ...
3635550069538f7b9e8b99d8b569342457254e5d843d08b649eb9370366e7c56
MATLAB
3,904
113
function plotTimeCoursesExamples(cfg) fig = figure('visible', true); set(fig, 'PaperPositionMode', 'auto'); set(fig, 'position', get(0,'ScreenSize')); % set(fig, 'PaperOrientation', 'landscape'); % set(fig, 'PaperUnits', 'normalized'); % set(fig, 'PaperPosition', [0.2 0.2 0.8 0.8]); ncols = cfg.plot.ncols; icol ...
f17ccc8143c2d567a24bf6859dee1d2835fa04378ca6bd0d6138b6529dee3a55
MATLAB
3,907
140
clc; clearvars; close all % load and define specific parameters load("par.mat") dt=0.001; par.tspan = 0:dt:100; par.opts = odeset('RelTol',1e-6,'AbsTol',1e-8); par.I0=0.20; % KNDy baseline par.k=10; par.je=0.5; antag = 0.5; % interaction strength suppression stim = 0.5; % amplitude of stim sine wave stimB = 2.6; % ma...
cdc4bb57e7c63bd9669b90be128216651bf8f37cf63c6f9ea633edfdf1abc874
MATLAB
3,910
134
function Srf = spm_prf_export_samsrf(PRF, hemi, name) % Exports an estimated PRF to SamSrf format % % PRF - PRF structure (estimated) % hemi - hemisphere ('lh' or 'rh') % name - name for the file % % Outputs: % % Srf.Values - field names of estimated parameters {p x 1} % Srf.Data - vertex-wise estimated parameters...
aba22dcccc413771b6065fc402db7a4e5b000307bb1854d96f198e02cf50af05
MATLAB
3,921
90
% input: structure with a field data arranged as [1 nx ny nz nechoes nsets] % (output of ESPIRiT_unfold) function next = BSS_classic_or_GLM_B1map(input,header) addpath(genpath('/usr/local/romeo_linux_3.2.5/matlab/NIfTI_20140122')) %%% BSS parameters ( requires the conversion siemens to ismrmrd %%% with IsmrmrdParame...
342ba7b3671bd6ff4d2778e89b0e1256a5c8303398803f6a26cdccd107b14a37
MATLAB
3,926
117
%Map values to the surface %load a csv file with the loadings you want to map to surface wd = '/Users/polona/20241126_region2surf_mapping'; csv = cat_io_csv(fullfile(wd,'Y_loadings_sPLS_multi_canonical.csv')); neuromorph = csv(44:numel(csv(:,1)),:); load_cobra = csv(1:43,:); hemi = {'lh.','rh.'}; for hi = 1:numel(he...
ae0dd4eea617d0719f582613d2e6903f199440366ff6d9650c809cac437e422e
MATLAB
3,928
105
function [vol_reslice, nii] = myreslice_nii(vol, method, X_grid, Y_grid, Z_grid, fileOut, gz) % Reslice the nifti image (VOL) to a grid in world-coordinates i.e. applies the sform transformation % on the image matrix. When [X_grid, Y_grid, Z_grid] is not defined, the image is resliced on a grid % with same resolution a...
9a069ff5134bcb61d45538fbe9e90b248138145bea81834627f8a28bdf139d7c
MATLAB
3,930
103
function [quality] = checkspikequality(cfg,force) warning('off','all') ft_warning off ldir = dir2(fullfile(cfg.eegdir,cfg.directory_searchstring)); ldir = ldir([ldir.isdir] == 1); fname = fullfile(cfg.outputdir,[cfg.prefix,'_qualitycheck.mat']); if exist(fname,'file') && force == false load(fname,'quality'); el...
078b10525cca0344fae4b32d9efb29c67addc419c17a131accb483782cef4c07
MATLAB
3,931
110
function CBIG_compute_singleKRR_PFM(feature_file, singleKRR_dir, sub_fold_file, score_ind, outstem, outdir) % CBIG_compute_singleKRR_PFM(feature_file, singleKRR_dir, sub_fold_file, score_ind, outstem, outdir) % % This function computes the predictive network features of single-kernel % ridge regression (under <CBIG_CO...
1e490d6199820cc609cb8dcdefee439420722033a903c8b42f1809ba0f65884d
MATLAB
3,933
101
% Coupling of the KNDy network model with MePD outputs function dx = KNDyXMePDU(t,x,par) dx=zeros(6,1); %% KNDy model parameters d1 = par.d1; % Dyn degradation rate d2 = par.d2; % NKB degradation rate d3 = par.d3; % Firing rate reset rate k1 = par.k1; % Maximum Dyn secretion rate k2 = par.k2; % Maximum NKB secre...
7bf677745eb0dd979106e09a7f71f6c22f6c32564563e2ea6fb2f18c23952666
MATLAB
3,933
97
function [ets,ech]=LLspikedetector(d,sfx,llw,prc,badch) %jon.kleen@ucsf.edu 2016-2023 % Transforms data into linelength then detects events (spikes) surpassing % the designated percentile threshold. Note that this function assumes any % detections in any channel occurring simultaneously are involved in the % same spi...
6672ea8b4b337ce291bd39dec7e4f010637cdbba2e318f351cf70384b9063571
MATLAB
3,934
128
function alltrials=RunTrials(alltrials, data, iti, trans, fc, mmultiply, nd, dotsize, leng, test); % % PARAMETERS prompt = ' <- | -> '; %Text prompt after each trial rand('state',sum(100*clock)); %Initialise the random generator %Set input variable defaults if necessary if fc==...
92455f992c396ee60ebd2fee0ef44d805924bdd8c24e5347c24ebe830ba123ff
MATLAB
3,934
84
function SUAdata_pulses = getPulseSpikeMatrix(experiment, save_data, repeatCalc, ... folder2save, folderSM, folder4stim_props) % by Mattia 10/20 % create a spike matrix (actually a tensor) for pulses stimulations % this script arbitrarily creates a matrix of 100ms centered around the % pulse, and consideres an 8ms...
02f5fb0268caebdd0abe59f4c2bfd1e7e0f7581e443e334f617b5ac46710e6b4
MATLAB
3,946
91
% ------------------------------------------------------------------------------------------------- % (c) 2025 Leon F. Heffer, David J. Sly, James B. Fallon, Rick Minter, Rebecca C. Felsheim, % Mathias Dietz and Stephen J. O’Leary. % % This file is part of a repository that contains the data originally recorded by He...
84af3c7dab5611e6938eb7c63c5b20830c7e0693612823462c793ad7ff20c6e3
MATLAB
3,949
127
function hline = plotMarginal(result,dim,plotOptions) % plots the marginal for a single dimension %function hline = plotMarginal(result,dim,plotOptions) % result should be a result struct from the main psignifit routine % dim is the parameter to plot % 1=threshold,2=width,3=lambda,4=g...
bb9bbc9b13b6ad742593db96e274577d838ef1560b4c2bf5588ef636e304c40a
MATLAB
3,949
135
%% Compare the second dominant mode of SVD on the whole windows and the mode_wake - mode_sleep clc,clear all;close all; sub_folder = ['../data/EEG/']; ls = dir([sub_folder,'ds*mat']); % Focus on the first half hours fs = 100; t_start = 1*fs; t_end = 1800*fs; t = linspace(t_start,t_end,(t_end - t_start + 1)) / fs; % ...
e805913e305a896e217155c889fa2712ec661f7569e79cce196b837eeaac5be2
MATLAB
3,950
90
function [mat opt] = mwa(tspx,tevents,trefevents,winsize,winpos,varargin) % function [mat] = mwa(tspx,tevents,winext,winshift) % % code to compute the area under the ROC curve for two spike count distributions at different time points % and different time intervals % % note that function requires mroc and mnspx in Mat...
7c7214cc120de2202c9c52b67dced222ac4e5b2c38dd4b961c3f6217daf441ee
MATLAB
3,957
94
% Extract mean DWI parameters and GM volume within significant clusters clear, clc, close all %% Load subjects and prune load('Table_297_subjs_demographics_biomarkers_2024_05_03.mat') list_subjs_to_remove = [47,69,135]; T_subjects(list_subjs_to_remove,:) = []; n_subjects = size(T_subjects,1); %% Paths an...
f3115b24c0c22062b22cfc38d3fab291a8da50c547425a248f7f4c3babd1f6f5
MATLAB
3,957
85
function [EEG_integrals, EEG_deltas,indices_integrals,EEG_epoched_AT] = pred_events(EEG, event_name_d, event_name_i, epoch_window) %% Get EEG in right format; epoched with all GLM parameters % % **Usage:** [EEG_integrals, EEG_deltas,indices_integrals] = pred_events(EEG, event_name_d, event_name_i,epoch_window) % % Inpu...
e7907c2c9bf8dd163fc02d196a4bfa6a6cc59aed589a9de4feb8a04efa7bea42
MATLAB
3,963
113
function status = CBIG_check_job_status(job, varargin) % status = CBIG_check_job_status(job, varargin) % % This function checks whether your job is successful. It will first check % whether your jobs are running or not. After they are all finished, it % will check your log file or output file. You can check either, bo...
fd2f79accc54920ddd07a000c761d178ebc70dd7356155a65fe0f56b00034140
MATLAB
3,964
115
function bucket = read_bucket(socket) meta = read_bucket_meta(socket); data = read_bundle(socket, meta.data, meta.data_stats); ref = read_bundle(socket, meta.ref, meta.ref_stats); waveforms = read_waveform(socket, meta.waveform); bucket = gadgetron.types.Bucket(data, ref, waveforms)...
a74c07c2ff50de1dbb822c445517183641bd77422be19587159900546d69017f
MATLAB
3,966
113
%WAVETEST Example Matlab script for WAVELET, using NINO3 SST dataset % % See "http://paos.colorado.edu/research/wavelets/" % Written January 1998 by C. Torrence % % Modified Oct 1999, changed Global Wavelet Spectrum (GWS) to be sideways, % changed all "log" to "log2", changed logarithmic axis on GWS to % a normal a...
49ae03e9af083ea4f9d81b7130aed3c91bc28f155bf7f6ea7dd81ef237aff022
MATLAB
3,971
104
function cohLFP(suffix) % LFP COHERENCE - Compute LFP-LFP coherence for given time and % frequency values. % % Read parameters Params = read_params(suffix); freq = Params.freq_start_1 : Params.freq_step_1 : Params.freq_end_1; time_window = Params.time_1; time_step = time_window / 4;...
624cd9e4ccb3dd4ecb27aceadf6b0bdb57edb7c2f49e5e9ca269b1349cf453f9
MATLAB
3,976
122
function [y,stepList]=nt_destep(x,thresh,guard,depth,minstep); %[y,stepList]=nt_destep(x,thresh,guard,depth,minstep) - remove step glitch from MEG data % % y: step-removed data % stepList: indices of steps % % x: data to clean (time * channels) % thresh: threshold for variance reduction [default: 0.1] % guard: min...
51b10597fd6b50ab2e82503d13e5ff30ae2249e28258b0067e9f46059b2617a9
MATLAB
3,980
144
function out = arborddither(img,kfactor,cmode,indexarray) % ARBORDDITHER(INPICT, {KFACTOR}, {COLORMODE}, {INDEX}) % Multilevel ordered dither with support for arbitrary index arrays % Available presets offer a range of simple dither patterns % As the purpose of this function is image degradation, pr...
ba0418ac34d4beb9de94e6d1e1b300ca7bee0dfddfdf91b71c8310c6b755a291
MATLAB
4,008
105
function [PSD, PSD_slow, PSD_fast, freqs, freqs_slow, freqs_fast, time_slow, time_fast] = ... getPSD_across_timescales(LFP, fs, freq2analyze, slow_freqs, fast_freqs, folder2save, animal_name, save_data) % from Mattia 06.20 % compute power spectra: % 1. down to very low frequencies using multitapers of different len...
fe5b08d94d93d270585ba9f804b734694e2a8c5520b4fbf96c8a2b3233b2e33b
MATLAB
4,009
114
function [newPhi, newVarBound] = ... CBIG_AuthorTopic_ComputeVariationalTerm__N_c(params, newPhi, ... newVarBound, varBoundFlag) % [newPhi, newVarBound] = CBIG_AuthorTopic_ComputeVariationalTerm__N_c( % params, newPhi, newVarBound, varBoundFlag) % % Compute the expectation and variance of the count N_{..c.}^...
c7391a57a987d7de69c6ff0a129b253a277bc17be72a574ac0cef31c9e5fd32d
MATLAB
4,016
118
% Correlate varA with varB accounting for confounds (SPM) clear, clc, close all %% Paths / data path_batches = 'D:\Projects\2023_multib\MK_multi_b\Scripts'; cd(path_batches) % load('Table_demographics_biomarkers_2024_04_09.mat') load('..\Biomarkers\XCPD_analysis\Table_demographics_biomarkers_2024_10_29.ma...
9752d8b3c6e4fa844c0657c34ecd8610dc1971f508b9a7a290b612b4654834c3
MATLAB
4,020
121
%% Load dataset % Decoding data datPath = '/Users/woojaejeong/Desktop/Data/USC/DARPA-NEAT/Code/Decoding/svm/Result/svmDecoding_sentiment_sen_3pc_lepoch_congruency_linear_commonPCA.mat'; wPath = '/Users/woojaejeong/Desktop/Data/USC/DARPA-NEAT/Code/Decoding/svm/Result/senPCAweight.mat'; % Subject index indexPath = '/Us...
afd30536dc37cd8e7545f24409c328c4feeeb6fc997115774bd6162efeb9c166
MATLAB
4,022
109
function [LFP] = rerefLFP(cfg, MuseStruct, force) % READLFP rereferences epoched data according to details in the config. % Use as % [LFP] = rerefLFP(cfg, LFP, force) % % cfg.LFP.demean = 'yes'; % cfg.LFP.baselinewindow = [-0.5 0]; % % This file is part of EpiCode, see % http://www.github.com/step...
bb8dab53dc07da42935d58e7aa1666e7ca53aee77cf4941bd5af289b3d78509d
MATLAB
4,023
110
function outpict = driftds(inpict,numframes,direction,bluramount,blurmode,disableagrad,coloroffset) % DRIFTDS(IMG,NUMFRAMES,DIRECTION,BLURAMOUNT,BLURMODE,DISABLEGRAD,COLOROFFSET) % returns an image sequence consisting of spatially downsampled % copies of the original image. When animated, changing superp...
82a543fb605acd995263c201335ab4295cbc10a6d7844cdef8ad88284d6be8ee
MATLAB
4,026
138
function [Delta490] = DeltaFevent(Ch490,Ch405,Ts,Event,name,varargin) % Smooth and process 490 channel and control channel data for fiber % photometry. %Inputs: % 1--Ch490-GCamp Channel % 2--Ch405-isosbestic control channel % 3--Ts-Series of timestamps related to te Ch405 and 490 channels % 4--Event-Two colum...
de3124dcfd9da428e5dfc88c0f0792bd4c7337e2d85fdfd3fea913486edce275
MATLAB
4,030
70
function [sdf] = sdfStats(cfg, SpikeTrials, force) fname = fullfile(cfg.datasavedir, [cfg.prefix, 'sdfStats.mat']); if exist(fname, 'file') && force == false load(fname, 'sdf'); return end for ipart = 1 : size(SpikeTrials, 2) if ipart > size(SpikeTrials,2) continue end ...
4218bea89fc9299b4d815bf53a2157e4826fb6f54f92a375db9cf795ffe73de3
MATLAB
4,034
100
classdef ConnectomeRandomizationMethods % Collection of randomization strategies for connectome matrices methods (Static) function [randomizedMat,randDomDefMat] = randomGeneration(conMat, domDefMat, ~) arguments conMat (:,:) logical domDefMat (:,:) logical; ...
519552bee50bdd622aa1777ae07d53804ae28d84cc2ccb322633bf708f4d39c2
MATLAB
4,035
111
% % BDP BrainSuite Diffusion Pipeline % % Copyright (C) 2019 The Regents of the University of California and % the University of Southern California % % Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi, % David W. Shattuck, and Richard M. Leahy % % This program is free sof...
3a3a46604439fe3989052673f7b77675704aa06a5da3d13b393d6e1fa5fb3d34
MATLAB
4,036
97
function [cfg] = writeSpykingCircusFileList(cfg, force) % WRITESPYKINGCIRCUS writes a concatinated data file for SpykingCircus and % sampleinfo is returned for later (cutting results back up) % % use as % writeSpykingCircus(cfg, MuseStruct, force, varargin) % % third argument "force" is to force recalculation of sam...
3e96c1ced9d6eaff9ff83200e0cebc12e03dd48ef59af0e76c393fb084fd4ac0
MATLAB
4,039
108
function [sens, noise_cov] = vrc_phase_correction(sens, ref_mag, PPIparams, N_coils, gadNoiseDir, scaleNoiseCov, vrc_mask_thr, noise_cov_power) %************************************************************************** % % vrc_phase_correction % % input sens: image space sensitivities [RO, PE1, PE2, N_order,...
a75537fa871aa7c45f46f958de0985b485c5f09ee50f823542c9a0c76354231a
MATLAB
4,051
98
clc; clear; load('jrr_tyr_ccc_peri.mat'); ccc_peri_together = mean(peri_all_stack4(:,8:13)'); ccc_peri_apart = mean(peri_all_stack5(:,8:13)'); ccc_peri_diff = ccc_peri_together-ccc_peri_apart; load('/Users/jglab/Desktop/lfp_coh_raw/jrr_tyr_cc_SaveData/jrr_tyr_cc_peri.mat'); cc_peri_together = mean(peri_all_stack4(:,...
f0b5e8ae567a882545ae61af99046da8dab497a947b9e915d4a92217363fb4fb
MATLAB
4,057
119
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2019 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % mo...