sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
051a5ae86851bc66dd2e9a0fda0a30d9fbda5217f3efdc518526e41f5fa1e016
MATLAB
3,114
121
classdef AffineGridGenerator < dagnn_bc.Layer %DAGNN.AFFINEGRIDGENERATIOR Generate an affine grid for bilinear resampling % This layer maps 1 x 1 x 6 x N affine transforms to 2 x Ho x Wo x N % sampling grids compatible with dagnn.BlilinearSampler. % (c) 2016 Ankush Gupta properties Ho = 0; Wo = 0; en...
c38fb8a0695bca0d456bc2ed63f3d3684c879cbebaf7b0a60893abbae8ba1e54
MATLAB
3,114
76
function sero_pulseq_gui_recon % Create the main figure fig = uifigure('Position', [100, 100, 400, 300], 'Name', 'Recon of TWIX data'); % Persistent variable to store last used folder persistent lastUsedFolder; if isempty(lastUsedFolder) lastUsedFolder = pwd; % Default to the current working directory end % Data ...
982bf77158d4dff86c256c6770a158992c672de7888044a00b9bda525aa99dff
MATLAB
3,115
95
%% This demo loads and pre-processes 3D time series of calcium imaging % This part is specific for the properties of the time series and must be modified according to one's needs. %% The second part (starting with "%% Select ROIs") uses the 3D time series to load a non-graphical user interface % This part is based on...
3cd16ce743d9d9651de1d8f5c231b99fa6c0e609740605042fa87fe59b5b5c2d
MATLAB
3,116
79
function [bestParam,bestParamScore,bestParamIdx] = get_bestParam(CVscore,candParamsIdx,paramGrid,metric) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % get_bestParam returns best parameter in parameter space according to % given their CV scores. % % Arguements: % CVscore: Matrix in whic...
2e3d7a18231bc4d1fe73dadd3815419df0c7310f490968aeef2371afab3d9a48
MATLAB
3,118
111
%% [pSWI,dSWI,swi_phase] = swi(magn,phase,filterSize,thres,m) % % Input % -------------- % magn : image that combines with phase contrast, can be 3D/4D % phase : phase map (in rad) % filterSize : window length of Hamming filter % thres : threshold used to create positive/negative phase contr...
aa865b86cdc54c19dd8f65fd0600aa1da5f7cdbfb46915b0319e26f1c6a806ba
MATLAB
3,118
85
function y = base64decode(x) %BASE64DECODE Perform base64 decoding on a string. % % BASE64DECODE(STR) decodes the given base64 string STR. % % Any character not part of the 65-character base64 subset set is silently % ignored. % % This function is used to decode strings from the Base64 encoding specified % in...
599e63b755a9e0dbc52d2fd0611cc648ee40a43f7c90a468570814e0df4ca46b
MATLAB
3,119
43
matlabbatch{1}.spm.tools.physio.save_dir = {'physio_out'}; matlabbatch{1}.spm.tools.physio.write_bids.bids_step = 3; matlabbatch{1}.spm.tools.physio.write_bids.bids_dir = {''}; matlabbatch{1}.spm.tools.physio.write_bids.bids_prefix = 'sub-control01_task-YOURTASK_run-1'; matlabbatch{1}.spm.tools.physio.log_files.vendor ...
c971e2bf4e6766ad773477da46166b1eb81baf4863ae515c5fada1b88a82f0bd
MATLAB
3,119
88
function fear_coactComp_5Cells(basename,varargin) % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; % basename='~/data/Fear/triple/booyah180430/booyah180430' load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMeta...
8b69dedd726506770856f4122763d2841faeb38e32e6096be9bcce8e3701c33d
MATLAB
3,120
79
% eegplugin_bva_io() - EEGLAB plugin for importing Brainvision % .vhdr and .ahdr data files. % % Usage: % >> eegplugin_bva_io(fig, trystrs, catchstrs); % % Inputs: % fig - [integer] EEGLAB figure % trystrs - [struct] "try" strings for menu callbacks. % catchstrs - [struct] "...
bc82dfc0ee27dbe5cd94a0d60d9179eb8492ad35d17247812cd746cfe6aabfa2
MATLAB
3,121
66
function cutBaseline_stft(params, resp, triggers) % gets preprocessed data: resp{sess} = [samples x ch] % & struct triggers. % sampleSessLabel: [3238x3 double] - triplets = [sample, sess, clz] % timeSessLabel: [3238x3 double] - time in [s] % eventDuration: [3238x1 double] - in [s] % ...
281ba467213e755728ed37669a1318bb18cbc8695a75feccf2c4bc2ef7145099
MATLAB
3,122
74
function osp_onRightBasis( ~, ~ ,gui) %% osp_onRightX % Callback function on process click on left x voxel direction button. % % % USAGE: % osp_onRightX( ~, ~ ,gui); % % INPUT: gui = gui class containing all handles and the MRSCont % % OUTPUT: Changes in gui parameters and MRSCont are writt...
92b7bd3bf3eeeb98a7ee3f42c9a5dfc3a9fba0ecab4a3a93fa4ae906efa9a490
MATLAB
3,122
74
%% %%%%%%%% Do setup nsdsetup; %% %%%%%%%% Use nsd_mapdata to get betas into MNI space % Ran on Aug 18 2019 (1-224) [includes restingbetas and going forward] % Update on Sep 3 2019 (225-239). % DEC 29 2019: update and run for nsdimagery√ % DEC 29 2019: update and run for nsdsynthetic % define nsubj = 8; betadirs = ...
f46c32a3543565b547afbeb2de808399be52e3dd38d8ab8f80137dedbf15f82f
MATLAB
3,123
97
close all clear all glusnf = 1; load('Y:\users\zilan662\Glusnfr_spine_metadata\glusnfr_spine_bci\061324_glusnfrspinebci5\Baseline\baselineMask_1.mat') frames_tmp_ = sbxgrabframe('Y:\users\zilan662\Glusnfr_spine\glusnfrspinebci05\061324_glusnfrspinebci05\061324_glusnfrspinebci05_000_000\061324_glusnfrspinebci05_000_00...
1b109da167249ec23e9d5b3e71cd41f25b43c4889e1c6605beedc8abf67c68c0
MATLAB
3,124
84
classdef ConfoundRegression < baseScaler %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ConfoundRegression removes variance explained by the confounds from % given data. Simply, a linear regression method is fitted on the each % feature in a given data using confounds are pred...
f429f15f2be8829c091db0a03cc5cc53d082c52202e5188dcca659b9e3a75eef
MATLAB
3,124
73
%% Makes a nice supplementary materials figure of the parameter recovery results printFigFlag = 0; % set to 1 to print figure in 2 png and svg formats % Load the results of the parameter recovery: parameters obtained by % fitting synthetic data created with fitted parameters, with 1SD of noise % added to the happiness...
24c2fdf9c836925a5340d69d4c4a68bf352deb2a6d234cedab95cc45444c1e62
MATLAB
3,125
63
clear all, close all % tidy up n = 2350; x = 7*rand(n,1); xs = linspace(-0.4,8,200)'; opt = []; xs(13:15) = xs(12); % mess with the test set x(14) = x(15); x(17) = x(16); % mess with the training set sn = 0...
3669bbbf9bca97c9262f9f75da01db86a8729f7847e39787b65fc39da566ef42
MATLAB
3,125
109
function [fh yMin, yMax] = tapas_uniqc_plot_image_diagnostics(Y,iDynSli,fh, yMin, yMax) %plots abs and phase of specific dyn/slice of complex data, for different %sets of coils, adjusts plot limits automatically % % [fh yMin, yMax] = tapas_uniqc_plot_image_diagnostics(Y,iDynSli,fh, yMin, yMax) % % IN % Y ...
5a8237487f428eaeada92ea2487e7bfc9c7ca48c3861df48255e1128aa04c391
MATLAB
3,126
66
%% sepia_configuration_BFR % % Description: a script contains all the background field removal method names and related function names % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 11 March 2020 % Date modified: % % DO NOT change the variable name % DO NOT change the order of the entities, add a ne...
b68fbf0eac63e01b47a532c49663496d5fb1083025636bc9c052d23bb25b9a9c
MATLAB
3,126
93
function scatterHistDiff(x, y, xeb, yeb, colors) % takes paired data x and y, optional arguments for errorbars around % individual datapoints (see ploterr) and plots a scatterplot as well as a % rotated histogram of the differences between the two. % requires http://nl.mathworks.com/matlabcentral/fileexchange/22216-pl...
f8e578c237b35453f60f3888251f0b6065896080658369d5dbf25027a61b19e5
MATLAB
3,126
102
function B = doubly_stochastic(A, maxiter, mode, checkperiod) % Project a matrix to the doubly stochastic matrices (Sinkhorn's algorithm) % % function B = doubly_stochastic(A) % function B = doubly_stochastic(A, maxiter) % function B = doubly_stochastic(A, [], mode) % function B = doubly_stochastic(A, maxiter, mode) % ...
96f2a8a8397adc90ece2f81fb0a3506d331f6bdd191605789c2822981932b138
MATLAB
3,127
105
function GenerateBIDSStructure(nSubs, nSes, dataTypes) %% GenerateBIDSStructure(nSubs, nSes, dataTypes) % This function generates a coarse empty BIDS structure that can be used to % pre-sort imaging and MRS data into a structure than can be reasonably % well BIDS-ified with tools like BIDScoin. % % USAGE: % ...
e1cf87f50c2be6c95ff227be4f79b69ddb941681fdb6e087ab16b4c7829a3edf
MATLAB
3,127
119
function imageRDMs(RDMs,varargin) % imageRDMs(RDMs,varargin); % % Visualizes one or many RDMs, and uses the *.RDM fields for each structure % can deal with a number of different input formats: % % % Joern Diedrichsen 2015 %__________________________________________________________________________ % Copyright (C) 2010 ...
690c7441ca3d98c2955da05f007daa95fd78935fedd6debb122451d1881f4ccc
MATLAB
3,128
116
function ons_secs = tapas_physio_preprocess_phys_timeseries(ons_secs, sqpar, doNormalize) % Preprocess raw cardiac/respiratory time series (e.g. amplitude % normalization, padding for acquisition duration) % % ons_secs = tapas_physio_preprocess_phys_timeseries(ons_secs) % % IN % ons_secs raw time series (c(ardia...
4af4e8c851234d1f5a35c3257397b6e823d3f0155745fd8827d83f4041f9326c
MATLAB
3,129
78
function varargout = printSVG(varargin) % prints current figure to SVG file at (pretty much) same size as on % screen. If % % INPUTS: 4 (all optional) % - 1st argument: name, default = the one from figure % - 2nd argument: file format, default = 'png' % - 3rd argument: resolution, default = 300 DPI (irrelevant for ep...
7819b40277ce76ad1ddf10dd4ec63bab194c204391ee38216209a3cb3885489d
MATLAB
3,129
97
function [fit,cfg] = fit_MixtureModelBias(x,data,bias,cfg) % [fit,cfg] = fit_MixtureModelBias(x,data,bias,cfg) % % fit mixture model by minimising MSE if nargin < 4 cfg = struct; end if ~isfield(cfg,'fitmean') cfg.fitmean = false; end if ~isfield(cfg,'offset') if isfi...
106000e73bbbefd493422c6c395cb449e37a32a7496a7c6f89b944bf4a691210
MATLAB
3,130
78
function varargout = printfig(varargin) % prints current figure to tiff file at (pretty much) same size as on % screen. If % % INPUTS: 4 (all optional) % - 1st argument: name, default = the one from figure % - 2nd argument: file format, default = 'png' % - 3rd argument: resolution, default = 300 DPI (irrelevant for e...
749bdf60248ab8ed27a475a6283e6c57c82677248bf2935fe1bbf2d2363a1473
MATLAB
3,130
78
function [ts_ind,dataCell,codeEval] = TS_WhichProblemTS(opID,whatData,doPlot) % TS_WhichProblemTS Lists the indices of the time series with bad values for a given opID % %---INPUTS: % opID: the ID of the operation to investigate % whatData: hctsa data source (default: 'raw'; cf. TS_LoadData) % doPlot: plot some example...
3a59447e42c416c2638330cc9661e2d38c710f7e4c5ef871c5a07cfe5673dccf
MATLAB
3,131
69
% BIDS_EXPORTER - BIDS export wizard, from raw EEG to BIDS % % Usage: % >> bids_exporter; % create new study interactively % % Authors: Dung Truong and Arnaud Delorme, SCCN, INC, UCSD, July 22, 2024 % Copyright (C) Arnaud Delorme, 2024 % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentati...
fa010292cb2fb02c7ceb031e58c3952d7a42625301e58fe3e25e94c9330729c0
MATLAB
3,131
88
%% h = sepia_handle_panel_qsm_STIiLSQR(hParent,h,position) % % Input % -------------- % hParent : parent handle of this panel % h : global structure contains all handles % position : position of this panel % % Output % -------------- % h : global structure contains all new and other h...
1965af421bce82f0bddaa7db6a4f764a611188e67a78e8b343aed9f6c415dd53
MATLAB
3,134
77
% (C) Copyright 2020 CPP visual motion localizer developpers %This function creates a direction matrix A with %events [0 180 270 90]. %Then it creates another direction matrix B such that the directions are %paired (0,180) and (270,90) %A and B are combined for their corresponding pairs %The target matrix is also cre...
918d45597b06f73b2ba8a57d65251d7bcb3f82c08f35fc9679adaeae48c6fce4
MATLAB
3,134
127
% addpath('C:\CODE\GitHub\KiloSort\preDetect') function WUinit=optimizePeaks(ops,uproj,Nchan) nt0 = ops.nt0; nProj = size(uproj,2); nSpikesPerBatch = 4000; inds = 1:nSpikesPerBatch * floor(size(uproj,1)/nSpikesPerBatch); inds = reshape(inds, nSpikesPerBatch, []); if ~exist...
a404db32cd5c4d3ecff57beb69badbe22753a863a972ac339c2f3e5782268bce
MATLAB
3,134
89
% GETTEXT - This function prints a dialog box on screen and waits for % the user to enter a string. There is a cancel button which % returns a value of []. % Usage: % >> out = gettext(label1,label2,...,label7); % % Author: Colin Humphries, CNL / Salk Institute, La Jolla, 1997 % Copyright (C...
65ca195149ff540c0ea0632b7c92f28afe3dcf95ada9d9d42ec6b2eea1ec8b90
MATLAB
3,135
102
function [Q, iQ, q] = gn_scale_U(EUU, EZZ, A0, nA0, N, D, q0) % FORMAT [Q, iQ] = gn_scale_U(EUU, EZZ, A0, nA0, N, D, q0) % ww - W'LW % > Must have been orthogonalised before. % zz - Z*Z' % > Must have been orthogonalised before. % Sz - cov[Z] % > Must have been orthogonalised before. % n0 - Number...
033e06e44ad7694b3214e82a5d9c849422047bb48732981563198e2c0146c381
MATLAB
3,136
79
function [K,dK] = covProd(cov, hyp, x, z) % covProd - compose a covariance function as the product of other covariance % functions. This function doesn't actually compute very much on its own, it % merely does some bookkeeping, and calls other covariance functions to do the % actual work. % % Note that cov = {c...
dd79992c6a7a4b63c4bf28f9c74fba9b6eb30d02d889aa925ebb254a71fbec01
MATLAB
3,136
58
% LBFGSB Call the nonlinear bound-constrained solver that uses % limited-memory BFGS quasi-Newton updates. % % The basic function call is % % LBFGSB(x0,lb,ub,objfunc,gradfunc) % % The first input argument x0 is either a matrix or a cell array of % matrices. It declares the starting point for the s...
8b10ce3c945a201bba35516bf22e4045f585739e2923a881137321f12da2a9af
MATLAB
3,137
79
function BF_ProgressBar(progressProp,PB_length,theChar,suffixText) % Create/update a text progress bar. % %---INPUTS: % progressProp: EITHER Text string to initialize ('new') or terminate ('close') % OR Proportion progress (numerical) % PB_length: Length of progress bar (in characters) % theC...
acf28f975c49fe1155e15e7be796cb4e7d54513a9724f9695526fbfbe5a3faa6
MATLAB
3,138
91
function settings = sd_get_image_specs(layers, settings) % SD_GET_IMAGE_SPECS Obtains information from images % % DESCRIPTION % This function obtains information from images, including header % specifics, transformation matrix, and slice dimensions and positions. % % SYNTAX % [settings, p] = SD_GET_IMAGE_SPECS(lay...
f7cfda2ee493f046b1386f87d37683e9f56425bf7f01e028921d7ced8aec413b
MATLAB
3,139
94
function [ni,canXform] = niftiApplyCannonicalXform(ni, canXform, phaseDir) % Reorient NIFTI data and metadata fields into RAS space % % [ni,canXform] = ... % niftiApplyCannonicalXform(ni, ... % [canXform=mrAnatComputeCannonicalXformFromDicomXform], phaseDir=[]) % % Inputs: % ni: Nifti-1 data s...
682e5523109875bb65dd72a96ad3a82cc546f370b715a799549f58be96b59540
MATLAB
3,140
78
function plotPrePostStimFR(spikeData, allStimTimes, Params, figFolder, figName, Info) %PLOTPREPOSTSTIMFR Summary of this function goes here % Detailed explanation goes here numStimEvent = length(allStimTimes); numChannels = length(spikeData.stimInfo); % Start the post-stim window after the blanked artifa...
6a098dd6ca6a870596c226a07abc21a53deae14a93ee2eb7035547427619e246
MATLAB
3,140
90
function [refShift, refFWHM] = fit_OspreyReferencing(dataToFit) %% [refShift, refFWHM] = fit_OspreyReferencing(dataToFit) % Calculates the reference shift and full-width half-maximum (FWHM) of a % spectrum according to the LCModel algorithm. The algorithm is described in: % S.W. Provencher, "Estimation of met...
4fa03790ddc69a1a540dae75245a7d8d79a4cb1e7bc241b94f35c976aa92d666
MATLAB
3,141
94
function callBoxDeleteCallback(rectangle,evt) % Only do anything if the face was selected, not the markers if ~strcmp(evt.SelectedPart, 'face') return end hObject = get(rectangle,'Parent'); handles = guidata(hObject); clicked_tag = str2double(get(rectangle, 'Tag')); switch evt.SelectionType case 'right' % d...
58fc3a629bc13a4b3e9ff43b2bad1ad7be1f9e63bee5a863dc6c432a8de1705d
MATLAB
3,141
77
function out = DN_OutlierTest(y, p, justMe) % DN_OutlierTest How distributional statistics depend on distributional outliers. % % Removes the p% of highest and lowest values in the time series (i.e., 2*p% % removed from the time series in total) and returns the ratio of either the % mean or the standard deviation of...
6dbc5de732607469d04000e46717bd1c6b206e6e01edcb808c3a93d38c3e2935
MATLAB
3,141
78
% STD_ADDVARLEVEL - add design variable level % % Usage: % >> [STUDY] = std_makedesign(STUDY); % >> [STUDY] = std_makedesign(STUDY, designind); % % Inputs: % STUDY - EEGLAB STUDY set % designind - [integer > 0] index (number) of the new STUDY design {default: all} % % Author: Arnaud Delorme, Instit...
babad73f847642373e2ea48f5da6cd9d0781f0fb8b5f2d9cfbf6dd3dbccd8cba
MATLAB
3,141
97
function density_image(varargin) % function density_image([fname],[radius],[threshold],[plot types]) % % tor wager, 4/19/03 % % This function plots line graphs, a montage, and a surface rendering % of a density map image, thresholded at a level you choose % % fname: must be an analyze image file containing dens...
452927af15f32f839acead071deda7bf354e4ab5da32f137fcdeb4a7bb1cff4a
MATLAB
3,142
102
function FigureS14(datadir, codedir) %FigureS14 Wait time curves without threshold have qualitatively similar % context effects, but longer average wait times. % datadir = directory of dataset % codedir = director of code %% Set up paths s = pathsep; pathStr = [s, path, s]; onPath = contains(pathStr,... coded...
f132de88949c0f568704cbfd5205b017ea53d01d58a5acb55ed96eff8f84b74f
MATLAB
3,142
74
% this function detects potential malware in the current folder and subfolders % % Author: A. Delorme, October 2013 % Copyright (C) Author: A. Delorme, October 2013 % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and details. % % Redistribution and use in source and binary forms, wit...
d81bbcce2dc318e1454c5586f969b6095add54f88a86ac29806c35ba2a363cf1
MATLAB
3,143
63
%clear; clc; morph_path = '/oak/stanford/groups/kalanit/biac2/kgs/projects/babybrains/mri/code/morphology_allparameters/'; addpath(morph_path) % Set participants subj = {'bb02_mri0_mask', 'bb02_mri3_mask', 'bb02_mri6_mask', 'bb04_mri0_mask', ... 'bb04_mri6_mask', 'bb05_mri0_mask', 'bb05_mri3_mask', 'bb05_mri6_mask...
e325083f5343cc860dd682bbb081c8b49cfc51560642548f0734692c9f56ea78
MATLAB
3,143
74
%% Cortical Input (CI) % % Copyright 2025 Laura Schmid % Permission is hereby granted, free of charge, to any person obtaining a % copy of this software and associated documentation files (the % “Software”), to deal in the Software without restriction, including % without limitation the rights to use, copy, modify, ...
a46543000939225f55711ae59540d5a506df7f28b89633eae4cd0d53684e6e50
MATLAB
3,145
102
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % normalizeValues.m % % Normalizes the input values to range between the minValue and maxValue % provided. Returns the values in type 'double' % %-------------------------------------------------------------------------- % % function values...
4c8d7d059c24ad3b6c58e5ffa67d216f4f3640cc62280193637aaa61deceb432
MATLAB
3,146
74
%{ vis.Movie (lookup) # movies used for generating clips and stills movie_name : char(8) # short movie title --- path : varchar(255) # movie_class : enum('mousecam','object3d','madmax') # original_file : varchar(255) ...
112ee73a2a9c8fcb205285aa5d5519ac5de309554edcaa57df50caa92ec1cc57
MATLAB
3,148
104
function [b, tau, er, exp_t_1_coeff, stats, bestfit, bint] =... regress_latency_vs_rew(A, nback, plotarg,... z_arg, hit_arg, blk_arg, varargin) %regress latency to cpoke against rewards, a la Wang/Uchida 2013. %also fits exponential. cmc 12/2/20 %inputs: A struct. If you give it the S struct, will convert it to...
a8e906da0a6dc2fd99533eac093cb8767139605b744ea192d58ab67103ad8fcf
MATLAB
3,148
113
%% ms SEI text: reaction times (RT_all) & right-wrong answers (RWM) % (c) Jiri, Nov23 %% settings (v30) % subjList = msSEI_getSubjList('SEI_withRS'); % pathBeg = 'F:\dox\ms_switch_EI\data\v30_stft_baseRS_bip\switchin_EI_IE_bip'; %% settings (v31) subjList = msSEI_getSubjList('SEI_all'); pathBeg = 'F:\dox\ms_switch_EI...
d116d2878dc241cd96de624f9ae3a4056c0d4ffa62403b593ef94216859682b4
MATLAB
3,148
110
function plotResBlock(res100) %it's always attention RIGHT (the left have been flipped) fx = 2:2:45; e11=1; e12=5; e21=7; e22=11; fTheta1 = 3; fTheta2 = 7; fAlpha1=8; fAlpha2=12; fBetaLow1=14; fBetaLow2=24; fBetaHigh1=25; fBetaHigh2=35; thetaFW = squeeze(nanmean(res100.fwdB(:,fx>=fThe...
f8dd32088ac95bda42478bc1f356756e8ca1597604bd70e0e7ba139f7d3acf92
MATLAB
3,148
102
%January 2025 SW: Script that reads out a portion of the eye and reads the average %brightness over time from a tiffstack (frames), RED LASER USED, fiber %implant in the brain, 1, 2.5, 5, 7.5, 10 mW %darkness %red stack : 1-4134 %% clc;clear all;close all; %% CHANGE ACCORDINGLY % %DARK tiffFilePath1 = 'C:\Users\...
31ee82816e2f49cbd4fe74123c5f50e4a1419ebdd1d30f6b3bd491de026812b0
MATLAB
3,149
84
% POP_COPYSET - Copy the current EEG dataset into another dataset. % % Usage: % >> ALLEEG = pop_copyset(ALLEEG, index1); % pop-up % >> [ ALLEEG EEG CURRENTSET ] = pop_copyset(ALLEEG, index1, index2 ); % % Inputs: % ALLEEG - array of dataset structure % index1 - input dataset number % index2 - inde...
59e3d75b17e6e9e569312b57138cf90ac62db9770913288ba108dd310d5ae47d
MATLAB
3,149
89
% pop_icflag - Flag components as atifacts % % Usage: % EEG = pop_icflag(EEG, thresh) % % Input % EEG - EEGLAB dataset % thresh - [7x2 float] array with threshold values with limits to include % for selection as artifacts. The 6 categories are (in order) Brain, Muscle, % Eye, Heart, Line ...
a36bdef3b131236a4db07dd2e72d339f1ada753c2c446af46463c9b225d98cb5
MATLAB
3,149
110
classdef nntest < matlab.unittest.TestCase properties (ClassSetupParameter) device = {'cpu', 'gpu'} dataType = {'single', 'double'} end properties currentDevice currentDataType randn rand zeros ones toDevice toDataType range = 128 end methods (TestClassSetup) ...
8a55bc3ad1b239dffd1a022f426ef2f29feec4e3675bec1e34d6afeeb1acb0ad
MATLAB
3,151
57
% For the process of DSC-MRI % Youjie Wang, 2025-07-26. wangyoujie2002@163.com % params toolbox_dir = '/this/is/for/nipype/dsc_mri_toolbox'; % path to the DSC-MRI toolbox DSC_info = niftiinfo('/this/is/for/nipype/pwi_path'); load('/this/is/for/nipype/aif_conc.mat', 'aif_conc'); % aif_conc should be a vector of AIF ...
214940e13f5605210f35892bd93280e4fef6add88a7544f9f7550cd31fabb29a
MATLAB
3,152
105
function [Xsol] = Test_nonlinear_eigenvalue_problem(L, k, alpha) % Minimize total energy minimization nonlinear eigenvalue problem. % % function [Xsol] = Test_nonlinear_eigenvalue_problem(L, k, alpha) % % L is a discrete Laplacian operator, % alpha is a given constant, and % k corresponds to the smallest eigenspace sou...
b64157d84d1d0630cf8b7ade0ec4ce186363b93d72174ae32f1913ff80a27be4
MATLAB
3,152
73
function pheno_resid = resid(pheno_file, ids_file, covar_file) % Args: % pheno_file: a file with phenotypes to residualize (lh.pial.0.fsaverage3.csv) % - no header % - columns contain phenotypes (no other columns) % ids_file: a file with imaging ids (vertex_subjectlist) % ...
fc7c8e26de1b736af843f299b3157e5b168e0b254906064e3405b034ff531ca4
MATLAB
3,154
115
% windows() - Symmetric window functions % % Usage: % >> h = windows(t, m); % >> h = windows(t, m, a); % % Inputs: % t - char array 'rectangular', 'bartlett', 'hann', 'hamming', % 'blackman', 'blackmanharris', 'kaiser', or 'tukey' % m - scalar window length % % Optional inputs: % a - scalar or vector wi...
56059356ce09907fd99a82fef45c1d7921d4335bc24df0ffab2bc663f8522041
MATLAB
3,155
81
function getTriggers_emoReco_timesLabels(params) % extracts trigger times and class labels % saves to session cache files % (c) Jiri, Nov16 n_selected = 0; % number of selected trials n_total = 0; % number of all trials for sess = 1:size(params.storage.sessionCacheFiles,2) t_trigger = []; clz_...
d3344b14d098bd569f3e0f526f61d3383ef2af1e82bf2b9a3e9795444133df92
MATLAB
3,155
85
echo off; % EEGLAB_OPTIONS - handle EEGLAB options. This script (not function) % set the various options in the EEG_OPTIONS file. % % Usage: % eeglab_options; % % Author: Arnaud Delorme, SCCN, INC, UCSD, 2006- % Copyright (C) Arnaud Delorme, SCCN, INC, UCSD, 2006- % % This file is part of EEGLAB,...
2f382d4c6ce421bc79d1463da05c6d09f27600a1efea02c89803568d5da64668
MATLAB
3,156
113
function [myelin, C1, C2, C3, tau] = Setup_Agents( ... myelin, borders, sizing) % SETUP_AGENTS % % Initialises agent populations (C1, C2, C3) and constructs the myelin % structure, including oligodendrocyte grouping and state variables. % % INPUTS: % myelin - myelin structure from Setup_Simulation % borders -...
6b29f1a201de5ed42a3bfcd4a297ac678ade3ea0b9428013c3ab2fc61c4f06e8
MATLAB
3,156
81
function net = cnn_mnist_init(varargin) % CNN_MNIST_LENET Initialize a CNN similar for MNIST opts.batchNormalization = true ; opts.networkType = 'simplenn' ; opts = vl_argparse(opts, varargin) ; rng('default'); rng(0) ; f=1/100 ; net.layers = {} ; net.layers{end+1} = struct('type', 'conv', ... ...
7c957179ecca8138e8e62b1136ffe81291bd421561f0f8363a9bbbeac6b91764
MATLAB
3,156
96
function res = permutation_null_spin_correlated_genes(img_data) % PERMUTATION_NULL_SPIN_CORRELATED_GENES(IMG_DATA) performs permutation testing to examine % whether imaging profiles associate with gene expression profiles, based % on the null-brain model (where random genes were selected from % brain-expressed genes)....
a2e701b2e7430ebfc556e5f4bb479d6cba6487cc2a98091956359273b8e4c794
MATLAB
3,156
125
function r = save_mgh(vol, fname, M, mr_parms) % % save_mgh(vol,fname, M, <mr_parms>); % % M is the 4x4 vox2ras transform such that % y(i1,i2,i3), xyz = M*[i1 i2 i3 1] where the % indicies are 0-based % % mr_parms = [tr flipangle te ti] % % See also: load_mgh, vox2ras_0to1 % % % % save_mgh.m % % Ori...
b33839f3ad35a364082bb4779b34692b8e121285e80d8a52949acd722edea523
MATLAB
3,157
94
function PlotLinkage(linkage,varargin) %PlotLinkage - Plot network clustering obtained e.g. by FCA analysis. % % USAGE % % PlotLinkage(linkage,<options>) % % INPUT % % linkage network similarity matrix obtained using <a href="matlab:help FunctionalClustering">FunctionalClustering</a> % <options> ...
02fe06a45cb8bfdc02e69c730fe7d0510b37d8c3a8e24ba17b88109480c633d2
MATLAB
3,158
98
clc; clear; atlas = cifti_read('C:\Users\lihon\Desktop\abcd_study\atlas\Schaefer\Schaefer2018_400Parcels_17Networks_order.dlabel.nii'); atlas_parcel = atlas.cdata; atlas_label = unique(atlas_parcel(atlas_parcel>0)); num_parcel = length(atlas_label); % load regional brain development (RBD) index patterns K = 3; cen_...
ed2509b124ef1032498a127cf97b70bf660a051e017b9ecb8cb89070ff50e772
MATLAB
3,158
134
function dbcluster_glass_plot(newcl,mycol,varargin) % dbcluster_glass_plot(newcl,colors,[select by field],[cell vector of conditions to select]) % tor wager % newcl = clusters structure, output of database2clusters.m % % Creates 3 views of glass brain with points in each cluster plotted % in different symbols % % Needs...
0f114fbab583e0213d555b393c2250f0a8c8d9b73d7b76a0f2c89e40c048943c
MATLAB
3,159
98
function organiseTsvMtMst % it is a mini function to % to change the trial type % the originial tsv files have the trial types named "motion" % we change it to motion_right or motion left depending on the aperture % position deleteSuffix = 1; % add bids repo bidsPath = '/Users/shahzad/GitHubCodes/CPP_BIDS'; ...
84ad6a4b423c7b6474faa18156ffc361762ed46dbdf2de0471d88a5d6b36d17a
MATLAB
3,159
86
%% [chi] = Wrapper_QSM_iLSQR(localField,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 the data...
fc68da6f86723c7c204ed7625479f62962b4ab7aa5dad96493f3e827bd9791cc
MATLAB
3,160
102
function res = fit_models(D_list, cfg, with_interactions) % FIT_MODELS Run regressions at global, rsn_pairs, nodewise nLevels = numel(D_list); res = struct(); for li = 1:nLevels D = D_list{li}; levelName = util.get_level_name(D, 'fit_models'); % Fit model T = aggregate_and_fit(D, cfg, with...
5d49127087c9ed45ef161c87ceb2c4ccffeddc16bd10c4ea6b229cb5a04e2695
MATLAB
3,161
91
function ri=rindex(dist,partition) %function ri=rindex(dist,partition) % %PURPOSE % %To compute a clustering validity index called R-index to assist in %selecting a proper number of clusters. Input argument %'partition' defines different clustering results, partitions, of %the same data. Clustering result that has a (l...
b07cddebff2565ddda82193448373ee4da6df95c29100f4246dab0e2236e3204
MATLAB
3,161
75
function [cpulse, verbose] = tapas_physio_get_oxy_pulses_filtered(c, t, ... dt120, verbose) % Determines peaks of pulse oximeter data after Gaussian and high pass % filtering, thresholding and assuming maximum heart rate (minimum peak % distance) % % [cpulse, verbose] = tapas_physio_get_oxy_pulses_filtere...
15964d050204dad66efcce1553a8f941a434276278250dafc7935a05b2d8881a
MATLAB
3,162
103
function xtfce=surfing_clustertfce(node2area,nbrs,x,dt,showprogress) % Treshold-free cluster enhancement (TFCE) for volumes and surfaces. % Yields a score (e.g. t-value) to each node, that is higher if the node % is either part of a small but strong cluster, or a weak but large cluster % % XTFCE=SURFING_CLUSTERTFCE(...
ee4ebb0467a41474e6c3ecbd9763b6678440f3b8ae5d348ac2e882b53ec3d16f
MATLAB
3,165
78
function ProcessData_Figure4(datadir, codedir, savedir) %ProcessData_Figure4 - Process raw data saved under datadir such that it can be plotted by PlotFigure4. % INPUTS: % datadir - Local directory where 'Golden_Nature/RawData_Figure4.mat' from Zenodo was saved % codedir - Local directory where code (e.g., publishe...
34783ba8d1f837fe7866ca3a1ea835f627232d49f49e7de579d141f93d2574b2
MATLAB
3,166
87
% Script demo_reslice % ONE_LINE_DESCRIPTION % % demo_reslice % % % See also % Author: Saskia Bollmann & Lars Kasper % Created: 2019-11-27 % Copyright (C) 2019 Institute for Biomedical Engineering % University of Zurich and ETH Zurich % % This file is part of the TAPAS UniQC Toolbox, which is...
833a1cf48c4b6c5eae81107f844d9cddbb84619e18ff66a2bc7f0a4b3c934eb0
MATLAB
3,166
85
function [] = load_files () %%load_files Input experimental files and analysis parameters to WormTracker3000. % Users can: % Select an XSLX file containing an index/parameter tab and an XY coordinate tabs % Select an XSLX file containing XY coordinates and input parameters % using a GUI % <Fut...
d371c08055dd2305cd30a8874a68bc131bddbf54d16e7a513856cc5223b4704a
MATLAB
3,166
93
function [outputImage, varargout] = apply_spm_method_per_4d_split(this, methodHandle, varargin) % Applies SPM-related method of MrImageSpm4D to a higher-dimensional MrImage ... % splitting data into 4D chunks executing SPM method for each split separately % before recombining the image % % Y = MrImage() % [newY, ou...
16631aac923750dc5638f20d7dbf781be3ad7073ab08c8eb17ea11829f5fc643
MATLAB
3,169
105
function Xsol = nonlinear_eigenspace(L, k, alpha) % Example of nonlinear eigenvalue problem: total energy minimization. % % function Xsol = nonlinear_eigenspace(L, k, alpha) % % L is a discrete Laplacian operator, % alpha is a given constant, and % k corresponds to the dimension of the least eigenspace sought. % % Thi...
e0a2a518845afd55ee62aa238f3257b597eaf96f2081d039eaf4a02d5050f131
MATLAB
3,169
82
%% get_set_bfr_lbv(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid % ...
5359ea9eeb4dc8c85c3465cf6ef7ad8c769f839f027734b268e2b37018cb76be
MATLAB
3,170
104
% EEG_EMPTYSET - Initialize an EEG dataset structure with default values. % % Usage: % >> EEG = EEG_EMPTYSET; % % Outputs: % EEG - empty dataset structure with default values. % % Author: Arnaud Delorme, CNL / Salk Institute, 2001 % % See also: EEGLAB % Copyright (C) 2001 Arnaud Delorme, Salk Institute, arno@sa...
ad979e43928f61c54024bad028e0b6b0db1766e783a79a29ee9bbba3321f42ae
MATLAB
3,171
87
function fear_cueTrigTripleAct_optMeanShift(basename,varargin) load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) param.binSize=0.02; param.halfWindow=5; param.varName='cueTrigCoactChamber'; param.saveFile=[basicMetaData.AnalysesName '-cueTri...
51a0c3409759dc3a9a7175a039b4fef129d7e560ef27117bbeb5501bbbfaf108
MATLAB
3,172
122
function bandPassMovieChunk(h5Path,bpFilter,varargin) %% mocoMovies % SYNTAX % [mov_corrected,mov_shifted,summary]=mocoMovies(movie,movie4shifts) % % HELP: % Perform motion correction from the green movie, which contains the best blood vessel contrast % and applies shifts on the red movie. Requires Normcorre on the...
60725bae1ca330757e61d28589e512878eeb361ac50c742a70982467a56f8ad0
MATLAB
3,173
85
function [sbc, fpe, logdp, np] = ARFIT_arord(R, m, mcor, ne, pmin, pmax) %ARORD Evaluates criteria for selecting the order of an AR model. % % [SBC,FPE]=ARORD(R,m,mcor,ne,pmin,pmax) returns approximate values % of the order selection criteria SBC and FPE for models of order % pmin:pmax. The input matrix R is the upp...
ba5724192ad5f5da0f4c4871882d7b6f0251cfa402855b5a9ac62e1105ddb2ab
MATLAB
3,173
80
function handleCurrentFigure(fileName, userOptions) % handleCurrentFigure(fileName, userOptions) % % handleCurrentFigure is a function which will, based on the preferences set in % userOptions, save the current figure as a .pdf, a .ps or a .fig; either % leaving it open or closing it. % % fileName --- The name...
17fbf927e76feb1b274308da5c54e2bde6cc8845728d4a6f45a70a99a21e00f5
MATLAB
3,174
75
function [sc, sf, si, nsel, fsel] = surfing_subsurface(c, f, i, r, n2f) % Generates a sub-surface with nodes from a surface that are within a % certain radius (Euclidian distance) from a center node. % % [SV, SF, SI, NSEL, FSEL] = SURFING_SUBSURFACE(C, F, I, R[, N2V]) % INPUTS: % C: 3xN coordinates for N no...
a0f4f8cb3cb089a3d35a250db4bc822c407e410dac5ac98785278bc1df9d5c20
MATLAB
3,174
88
% Main script for laminar projection of SANDI maps onto cortical surfaces % using FreeSurfer mri_vol2surf with 5% cortical depth increments % % Reference: % Lee H, ..., Huang S, Communications Biology, 2026 % % Requirements: % - FreeSurfer installed and configured % - FreeSurfer recon-all completed % - Valid FreeSurfe...
26261ed7a7c60ffd9ab34bb016ff81167d57c36f6891173fe86785d71adff039
MATLAB
3,175
106
function FuncHomoConn(NCore) % path = '/home/NCPL09/Desktop/MRIDATA/ReseachPlan/Autism/analysis_fun/FunImgARWCSF' % outdir = '/home/NCPL09/Desktop/MRIDATA/ReseachPlan/Autism/analysis_fun/tongji/FHC' path=uigetdir; outdir=uigetdir; sublist = dir (path) [TMSPath, fileN, extn] = fileparts(which('TMStarget.m')) ; [mhea...
76847e068958251b580971e7889b6ccf722811163b6c362c5a47d5775d789093
MATLAB
3,175
60
% -Performs re-reference to average potential that is defined as the % average potential across all the channels INCLUDING the initial % reference channel which is usually unipolar-in that case, the average % is calculated as sum(EEG.data,1)/...
963df3d521f60def9e63f09e2be26a4d0cb3d216fe994bbd2f7551b6841e4194
MATLAB
3,175
69
function [HeatMapMatrix, ThresholdMatrix, DeviationsCount] = PlotDeviationMatrix(Subject,ReferenceCohort,FullTitle) % --- Deviations in azimuth specific RMSErrors between subject and control % --- group, normalized by the standard deviation of the control group's std % --- across subjects RMSE_deviation_lp = (Subject....
0afe11e2f0d601f63f38543980184d748c3fcda6825b155c459e9b502b7460c9
MATLAB
3,178
74
function ssMerged = mergeStructures( ssDest, ssSource ) % mergeStructures selectively create and update fields in ssDest with those in ssSource, recursively % Merge tree-like structures in much the same way as files are % copied to destination folders, overwriting values where they exist. % % ...
b01118cc55975fada6946ce9a922b62939e207a522f2db7f8addb3dcd3521e4e
MATLAB
3,179
77
function [IDX,C,SUMD,K]=kmeans_opt(X,varargin) %%% [IDX,C,SUMD,K]=kmeans_opt(X,varargin) returns the output of the k-means %%% algorithm with the optimal number of clusters, as determined by the ELBOW %%% method. this function treats NaNs as missing data, and ignores any rows of X that %%% contain NaNs. %%% %%% [IDX]=k...
0da00680a1c02d3cec3e9688a00076dfeea462a5ae4b7e1dfbc5e8a1f179ec23
MATLAB
3,180
83
%% SummarizeSessionData % load Unit data and summarized into session data ClassifyUnits; clearvars -except Unit %% Load Other Data BNBResult = load('D:\Data\Lobster\BNB_Result_fullshuffle.mat'); DistanceResultPath = 'D:\Data\Lobster\FineDistanceResult_syncFixed_May'; %% Make into a table Sessions = table(... u...
0ef77996bdf527ca4d0dc0e49300330db773e4ba5b4b2db5049f78cc1cd61da2
MATLAB
3,180
133
%2D inputs N = 2; alpha = 1; %leak term % Parameters T = 100; % Number of time steps num_targets = 8; % Number of peripheral targets radius = 5; % Radius of the movement (distance from center to targets) center = [0; 0]; % Center location curve_strength = 0.2; % Strength of the curvature (perpendicular of...
6b5022276d148dd8d8760b9cf14c92b993d6b17d77cef463546ddb32a20350d0
MATLAB
3,180
98
%% Figure 1 main YOURDATAPATH = ''; %% Panels A-C use mouse 1 mouse = 'cfa17'; session = '200825'; [R, M, config] = loadData(mouse, session, 'R', 'DLC3', YOURDATAPATH); % Lock data for trajectories config.preT = -100; config.postT = 100; config.tBase = 10; eventNames = {'liftTimeDLC', 'grabTimeC'}; goodTrials = ~isna...
8c8766fa143e32d02f091c2830fe5ac0728e4f178a733291f1b066848282e2ba
MATLAB
3,183
67
function [Es, Ed, delta_s] = pipelineCompareStaticDynamicEnergy(time_series, control_node, window_size) % Pipeline of Compare static and dynamic control energy % use staticMiniEnergy.m and dynamicMiniEnergy to calculate the control % energy. % This pipeline include: % 1. random select the start point and ...
3f9509f0b6dfa6105c8f7a96140c1ea5c7dea374d1f6029596924f7d843cdefe
MATLAB
3,184
90
function combinedObject = combine(this, combineHandle, tolerance) % Combines properties or outputs of methods applied to objectArray data % into a new object % % Y = MrCompare() % combinedObject = combine(this, combineHandle) % % This is a method of class MrCompare. % % IN % combineHandle property of the object...
69f114cabd106617dd6821f66845f9bd0b57da88273cba7c44f14c5c186025ab
MATLAB
3,184
73
function p = HT_IndependenceTests(y, theTest) % HT_IndependenceTests p-value of a hypothesis test of serial independence. % % These tests ask whether the temporal ordering of the time series carries % structure: the null hypothesis is that successive values are independent (no % serial dependence). Unlike the tests...