sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
25ceb24c4d60c42521df50b2af6f26cd0c46e6f0310da7c91796bc20adc2eacc | MATLAB | 9,817 | 321 | % The basic application of the 'reslice_nii.m' program is to perform
% any 3D affine transform defined by a NIfTI format image.
%
% In addition, the 'reslice_nii.m' program can also be applied to
% generate an isotropic image from either a NIfTI format image or
% an ANALYZE format image.
%
% The resliced NIfTI fi... |
52f807600a1d27814eb3402478bdf410fa807d7ebac4d152da2f7f93fb3859d8 | MATLAB | 9,835 | 292 | function [ dbCA, cones, dir, Q, P, dualized ] = eliminate( prob, destructive, can_dual )
if nargin < 3, can_dual = nargout >= 6; end
if nargin < 2, destructive = false; end
% For the problem
%
% minimize c' * x + d
% s.t. y : A * x + b == 0
% x \in K
%
% The Lagrangian is
%
% L(x,y,z) = c' * ... |
44f5f4c8b39e1be8de8b690e59bc0521a1d6c701a468b332ede382f6579d1e6a | MATLAB | 9,836 | 208 | function spikes = ss_kmeans(spikes, options)
% SS_KMEANS K-means clustering.
% SPIKES = SS_KMEANS(SPIKES) takes and returns a spike-sorting object SPIKES.
% It k-means clusters the (M x N) matrix SPIKES.WAVEFORMS and stores the
% resulting group assignments in SPIKES.OVERCLUSTER.ASSIGNS, the cluster
% ... |
07a3f99c3c498ff8633334f12e0c553505ab3777e9cb80f584e1fe4ab192e3df | MATLAB | 9,837 | 320 | function [exploration,sws,rem] = BrainStates(s,t,f,q,emg,varargin)
%BrainStates - Determine brain state using LFP, EMG and movement.
%
% USAGE
%
% [exploration,sws,rem] = BrainStates(s,t,f,q,emg,<options>)
%
% s spectrogram
% t time bins for spectrogram
% f frequency... |
587d7658ce10cb74fd84c61d2b9440f388f0836a435784c8ff89d6a4f4e2c128 | MATLAB | 9,842 | 302 | function stats = MapStats(map,varargin)
%MapStats - Compute statistics for a map Z = f(X,Y), or a curve Z = f(X).
%
% Compute statistics on a continuous map, where one time-varying variable Z
% is represented as a function of one or two time-varying variables X and Y.
% The variable Z can either be a point process ... |
05bb1d0b9081af8f8dc56ec86bafca51dd0bb015b0dae79cf2dc94abea81c105 | MATLAB | 9,849 | 257 | % -------------------------------------------------------------------------
% Script: RATIO_dosl_Simulation_Validation
% Authors: Zijian Gao, Qianxue Shan, Weitian Chen
% Email: zijian.gao@link.cuhk.edu.hk
% Date: 2025-12-19
% Version: 1.0
%
% Copyright (c) 2025 Zijian Gao, Qianxu... |
52704815e184ef7ede788447fb5338f3a024c28e9467ed53a05727830c476a15 | MATLAB | 9,859 | 235 | % ====================================
%% Help
% ====================================
%
% CBIG_test_MSHBM_esfmri_glm
%
% This script builds the prewhitened GLM design matrices for each subject
% and run in the es_pp dataset and calls FreeSurfer mri_glmfit to estimate
% stimulation-evoked gamma maps. Prewhitening uses p... |
beb06e6452907cd96f2b3baf8f8cd38777f37c75074cdf996d4827c8fe6257aa | MATLAB | 9,859 | 227 | function cvx_optval = logsumexp_sdp( x, dim, tol )
%LOGSUMEXP_SDP SDP-based approximation of log(sum(exp(x))).
% LOGSUMEXP_SDP(X) computes an approximation of the function
% LOG(SUM(EXP(X))) using semidefinite programming techniques.
% The approximation is chosen so that, to within the numerical
% tol... |
ff8d701794d555ef5262616df08e02dd78c28537b9f7ad7369ee1ffb7b7b54a7 | MATLAB | 9,865 | 200 | function hp_sub = drawpanel(handle,initData,initEncoder,stepperHandle)
%
% Function:
%
veloLim = num2str(initData(1));
acceLim = num2str(initData(2));
currLim = num2str(initData(3));
serNum = num2str(initData(4));
step = num2str(initData(5));
position = num2str(initData(6),'%0.4f');
sliderPosition = round(... |
755d13f541b9429d9b1684a305de42f762ca2c52c5bda10e9e895cdc12647107 | MATLAB | 9,867 | 289 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% We study the Cross Inhibition (T1) model with generic asocial behaviour
%
% We consider the best-of-n case
%
% We vary eta and we plot the difference between the asymptotic fraction of
% best option and second best option for a given eta with respect to the
% c... |
c9cab52c3e38594dc8ac961f260cd007e138d5fe878c4a39691fb43c6aab7995 | MATLAB | 9,875 | 270 | function ea_ants_nonlinear(fixedimage, movingimage, outputimage, weights, outputbase, options)
% Wrapper for ANTs nonlinear registration
if ischar(fixedimage)
fixedimage = {fixedimage};
elseif ~iscell(fixedimage)
ea_error('Please supply variable fixedimage as either char or cellstring');
end
if ischar(movingi... |
361c6aff84be13b528e408aa442e83078ea4566a331181b037f664b949ea5202 | MATLAB | 9,892 | 293 | function [b, xlim, ylim, xpixel_width, ypixel_width, xdata, ydata] = G_Outline_Pixels( h, dat, varargin)
% Plot contour lines
%
% Syntax
% Outline_Pixels( h, dat)
% Outline_Pixels( h, dat, 'key', value, ...)
%
% Input
% h, handle to an IMAGESC object
% dat, binarized matrix
%
% Optional key... |
3fe2b2a46a88bece7f71a421a44f24c2a2fb6dbd12139556ed696483cd7a0b0d | MATLAB | 9,898 | 310 | function ea_screenshot(outn, method, figure_handle)
if ~exist('method','var')
method='exportfig';
end
% if figure_handle is not passed as input, default to gcf
if ~exist('figure_handle', 'var')
figure_handle = gcf;
end
switch method
case {'exportfig','ld','hd','transparent'}
warning('off');
... |
0ac0d50879be2b83610b6d9a01871c6abf69e795aac22e1ed1b93397e2f74500 | MATLAB | 9,902 | 274 | function install_sedumi( varargin )
%SeDuMi installation script
%
% Heavy rewrite by Michael C. Grant for SeDuMi 1.34
% Now detects if binaries are already
%
% This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko
% Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1)
%
% Copyright (C) ... |
b76ad7721af0db385b30350e8aceaca755bcadbb4ff58548e324e6fe44157ae8 | MATLAB | 9,914 | 234 | % pop_loadcnt() - load a neuroscan CNT file (pop out window if no arguments).
%
% Usage:
% >> EEG = pop_loadcnt; % pop-up window mode
% >> EEG = pop_loadcnt( filename, 'key', 'val', ...);
%
% Graphic interface:
% "Data fomat" - [checkbox] 16-bits or 32-bits. We couldn't find in the
% data file w... |
75412a7ee8f2ca5957bf00ee593b93f5bb144ba72f320a4346345ff1b96e8ad1 | MATLAB | 9,922 | 200 | function varargout = spectrogram(x,varargin)
%SPECTROGRAM Spectrogram using a Short-Time Fourier Transform (STFT).
% S = SPECTROGRAM(X) returns the short-time Fourier transform of the
% signal specified by vector X in the matrix S. By default, X is divided
% into eight segments with 50% overlap, and each segment ... |
878375bae0132d8fd6536a62e2df02299a536b685183d1c337cc5117ee0e77ab | MATLAB | 9,934 | 246 | %% QUICKPID - quick partial information decomposition calculation
% Calculates the partial information terms (synergy, redundancy, and unique
% information) between three variables (a Y variable and two X variables).
% Depending on the situation, the information results could be interpretted
% as converging (X variable... |
e7750caa9c0183113b658d67a5f8444c956c3a18fa8dd2772845b3ea22586b62 | MATLAB | 9,939 | 250 | function [ccg,ic] = chXcorr(hc_L,hc_R,fs,varargin)
%CHXCORR Calculate cross-correlograms with a wide range of options.
%
% CCG = IOSR.AUDITORY.CHXCORR(HC_L,HC_R,FS) cross-correlates the input
% 2-D matrices HC_L and HC_R over 10ms frame with a maximum lag of 1ms.
% It is assumed that the number of frequency chan... |
286bf06470dddc0c0944310856cab0e0cbc3fe64abd0fa41677e594b54691c0d | MATLAB | 9,950 | 252 | %% LaBGAScore_pet_a_set_up_paths_always_run_first.m
%
%
% *USAGE*
%
% Always run this first before you run other LaBGAScore pet second level batch scripts.
%
%
% *OPTIONS*
%
% * modelname default 'trc-DPA714' (line ~73) - rename to your tracer's
% identifier (must match the naming used by the
% ... |
691393fe6ae2f45d993e79b30fc23fc0b396b139a898faba4c4b9d5f35898dba | MATLAB | 9,955 | 253 | function varargout = nii_moco(nii, out, ref)
% Perform motion correction to the input NIfTI data.
%
% Syntax:
% p = NII_MOCO(filename_in); % return correction parameter only
% NII_MOCO(filename_in, filename_out); % save corrected image file
% [p, nii_out] = NII_MOCO(nii_in); % also return correct NIfTI without savin... |
bf1efccbbe2e412b10324ac54dec821da5a82c708c5bd010c14324c898c8907f | MATLAB | 9,957 | 231 | % writeeeg - Generating CNT/EDF/BDF/GDF-files using BIOSIG toolbox. Note
% that the CNT file format is not fully functional. See also the
% writecnt.m Matlab function (there is no fully working
% Neuroscan writing function to our knowledge).
%
% writeeeg( filename, data, srate, 'key', ... |
9bbe21157cb2c0e2b51c8b50ea4eaf775dfe93507884bc819d451b59d513e71e | MATLAB | 9,964 | 283 | function Ptree = palm_tree(B,M)
% Generates a tree that takes the dependence structure
% between observations into account. From this tree, the
% permutations can be generated later.
%
% Usage:
% Ptree = palm_tree(B,M)
%
% - B : Multi-level block definitions.
% - M : Design matrix.
% - Ptree : Permutation... |
7fb69b1ecffba970bc37b1fd2298055fe89a761e82f1f2dece651656ee517a53 | MATLAB | 9,973 | 256 | function [percentMissing_gaussian, percentMissing_symmetric, ksTest_pValue, ...
ampliBin_gaussian, spikeCountsPerAmpliBin_gaussian, gaussianFit_cutoff] = percSpikesMissing(theseAmplitudes, theseSpikeTimes, timeChunks, param)
% JF, Estimate the amount of spikes missing (below the detection threshold)
% by fitting a ... |
ef4353d7865e0ef5cb0b96bd330e989669f1828cceeabf08e0c3f22262cf24ed | MATLAB | 9,974 | 277 | % -------------------------------------------------------------------------
% Script: RATIO_dosl_Sensitivity_Analysis.m
% Authors: Zijian Gao, Qianxue Shan, Weitian Chen
% Email: zijian.gao@link.cuhk.edu.hk
% Date: 2025-12-19
% Version: 1.0
%
% Copyright (c) 2025 Zijian Gao; Qianx... |
3462bb4ce857723d4f90b0ff152ab31ee7dd60bebf08914f128396fcf39d10ea | MATLAB | 9,984 | 187 | function options = glmnetSet(opts)
%--------------------------------------------------------------------------
% glmnetSet creates or alters an options structure for glmnet.m.
%--------------------------------------------------------------------------
% options = glmnetSet; (with no input arguments)
% creates a st... |
04ea72fe9bd5ba3beba49df3a531118ea6f0d3fb80cb3da9867468aeefe4cc85 | MATLAB | 9,989 | 256 | classdef (Abstract) DiscreteWaveform < GeneralWaveform
%DISCRETEWAVEFORM This class would be abstract class to have
% Detailed explanation goes here
properties (Abstract, SetAccess = 'private')
Triggers
end
properties (SetAccess = 'private')
FirstOfTrain
LastOfT... |
76d59ec82a8171c035cdb33f977b4e9686d83b8a0e94e92ccbb1a8dc4dcf603d | MATLAB | 9,989 | 219 | function tests = testSurrFindrho
%TESTSURRFINDRHO Contract tests for Surr_findrho and Surr_PseudoPeriodic.
%
% Surr_findrho searches for the noise radius rho that maximises the number
% of short runs the pseudo-periodic surrogate shares with the original
% (Small, Yu & Harrison 2001). Its contract is minimal and ... |
56809f575703ef1c9c95d235c6a516fd3074222c0219ec9a16e3875adfa87d87 | MATLAB | 9,994 | 308 | %% LaBGAScore_prep_juspace_input.m
%
%
% *USAGE*
%
% This script creates the necessary input files (i.e. firstlevel con images)
% for spatial correlation analysis with PET receptor maps with the JuSpace toolbox
% from LaBGAS standard first and second level file organization
%
% Launch JuSpace from your Matlab termina... |
e58ba5dcebc96ba17c7017ed66d7f6c62a23b6ef407ba4f53bcd215c3a528c6b | MATLAB | 10,004 | 208 | function CBIG_ArealMSHBM_check_example_results(out_dir, unittest_flag)
% CBIG_ArealMSHBM_check_example_results(out_dir)
%
% This script is used to compare the example results generated by user with the reference results.
% The script will go through each example and check if the final results exist or not. If the fina... |
89b34031d59da35a81c18fbbc1cb7c384e879aa6620bcd842828c1ee52dd7b5f | MATLAB | 10,014 | 354 | function b = padarrayXT(varargin)
%PADARRAYXT Modified version of built-in function 'padarray'.
% Mirroring ('symmetric' option) does not duplicate the border pixel.
% B = PADARRAYXT(A,PADSIZE) pads array A with PADSIZE(k) number of zeros
% along the k-th dimension of A. PADSIZE should be a vector of
% nonnega... |
9083e4b21b83156ac1084076ec2cf7f30b7896f80729c9f69ea7ffa5f0db4cb9 | MATLAB | 10,017 | 273 | function ellipse_t = fit_ellipse( x,y,plot_opt )
%
% fit_ellipse - finds the best fit to an ellipse for the given set of points.
%
% Format: ellipse_t = fit_ellipse( x,y,axis_handle )
%
% Input: x,y - a set of points in 2 column vectors. AT LEAST 5 points are needed !
% axis_handle - optio... |
771604c08bfa19ac7f4efb240ada3047e7f67e0e5bdae3b4f224938917eaf1e9 | MATLAB | 10,031 | 280 | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function [hdr, filetype, fileprefix, machine] = load_nii_hdr(fileprefix)
if ~exist('fileprefix','var'),
error('Usage: [hdr, filetype, fileprefix, machine] = load_nii_hdr(filename)');
end
machine = 'ieee-le';
new_ext = 0;
if fin... |
98ae7139a237501545a4d90ea4db5f1bc387c0a370ae25285637ea655d521e6e | MATLAB | 10,031 | 191 | function spikes = ss_aggregate(spikes, reintegrate_outliers)
% SS_AGGREGATE ISI-restricted heirarchical cluster aggregation.
% SPIKES = SS_AGGREGATE(SPIKES) takes and returns a spike-sorting object
% SPIKES after aggregating clusters (requires a previous overclustering
% and an interface energy matrix calc... |
c9a99aeffcd489b932a8d2159f8a1b81a7ffe1adfc21c642ac42b410ffba8147 | MATLAB | 10,037 | 345 | function [res, errStr, res2]= maskstruct_query(varargin)
%function [res, errStr, res2]= maskstruct_query(maskStruct, commandStr[, op1[, op2[... [, opN]]]])
%
% General method query a infomations and data from a maskStruct
%
% maskStruct: should contain a valid maskStruct Ver2
% command: {}
% op[1..end] the p... |
ae2d830188260d9b7a259587a812c51e582e666abf3d28faa82d1efcfa05d3ba | MATLAB | 10,043 | 292 | function [type, dimord] = ft_datatype(data, desired)
% FT_DATATYPE determines the type of data represented in a FieldTrip data
% structure and returns a string with raw, freq, timelock source, comp,
% spike, source, volume, dip, montage, event.
%
% Use as
% [type, dimord] = ft_datatype(data)
% [status] = ft_... |
7d498d3e9ccbae832d81c8a9ab4a52457d32ee21d7c270146783330868ec2a7d | MATLAB | 10,050 | 354 | function b = padarrayXT(varargin)
%PADARRAYXT Modified version of built-in function 'padarray'.
% Mirroring ('symmetric' option) does not duplicate the border pixel.
% B = PADARRAYXT(A,PADSIZE) pads array A with PADSIZE(k) number of zeros
% along the k-th dimension of A. PADSIZE should be a vector of
% nonnega... |
6969a42e0865e2a545d3e8bcf21ed17e56d1e044e8cb143401319b7b98156c80 | MATLAB | 10,051 | 291 | function results = readyaml(filePath)
% readyaml() reads out YAML files and writes the data to a struct
%
% Syntax: readyaml('myyamlfile.yaml')
%
% Inputs:
% filepath - string or char that gives the path to the yaml file
%
% Outputs:
% results - resulting struct from the yaml file
%
% Author: Maa... |
02179a8dbbb9ec742590ce12fb539fc7f5eb588a1f4978814421e5b356c94697 | MATLAB | 10,054 | 271 | function [ FR,PC,DRP ] = rel_phase_disc( S1, S2, varargin )
% [ FR,PC,DRP ] = rel_phase_disc( S1, S2, S1_events, S2_events )
% inputs - S1, Signal 1 must be the lower frequency signal.
% - S2, Signal 2 must be the higher frequency signal.
% optional inputs
% - S1_events, Cyclical event occuring w... |
41d5c9a31cf1937d3ec81e47fbd3574e9e91490a28d79e7c54572e65459292f7 | MATLAB | 10,060 | 305 | %MRSTRUCT_QUERY query mrStruct.
% ret = mrstruct_query(mrStruct,queryStr, arg1)
%
% queryStr = {min,max,dimensions,sizeAy,size_x,size_y,size_t,
% size_z,echos,spectral,dataType,1...9,vox} (required).
% 'dimensions': number of dimensions in mrStruct.
% 'sizeAy': size of dataAy in mrStruct.
% 'si... |
bb0b6467dd4f3cee5b66b1c840e072b8de0ad7fe4a2bd3af85c98e5ddab76409 | MATLAB | 10,068 | 298 | function [maskl,mask2l,maskl_new]=chkCellRing2b(im1,subim1sz,thrf,lmax,maskin)
% Usage ... msk=chkCellRing2b(im1,subim1sz,thrf,lmax)
%
% Segment cell based on radius from the center location
% im1 is the base image to segment, subim1sz is the neighborhood to focus
% thrf is the intensity-thr-fraction and look-region in... |
97cdcb45df55ea19b3e59ce42fe5e502a4aba744e79434efdfc1f469dc9bac9a | MATLAB | 10,084 | 210 | % Writes all features of the ImageJ (IJ) binary roi file format (*.roi) as specified by ij.io.RoiDecoder.
% matlabpathcoors - an ordered list of coordinate pairs that describe a single ROI boundary. Coordinates assumed to be (y,x) order (where y is vertical image axis and x horizontal image axis) and follow the Ma... |
4c46e5bc1be5dabb1f9fa39a5a7a26dcbfbff659411e9b4c2806054714cd5a66 | MATLAB | 10,091 | 248 | function SANDIinput = make_direction_average(SANDIinput)
% Calculate the direction-average of the data
%
% Author:
% Dr. Marco Palombo
% Cardiff University Brain Research Imaging Centre (CUBRIC)
% Cardiff University, UK
% 8th December 2021
% Email: palombom@cardiff.ac.uk
data_filename = SANDIinput.data_filename;
mask... |
2abe814fe1d0818ee67b53b337d40b1014bdd7f8230c444a7849bccc4557f970 | MATLAB | 10,092 | 275 | function filtered = bz_Filter(samples,varargin)
%Filter - Filter samples.
%
% USAGE
%
% filtered = bz_Filter(samples,<options>)
%
%INPUT
% samples samples given as a [t x channels] timeseries vector
% or as buzcode structure with fields samples.data,
% samples.timestam... |
c9636f4eb925ed0b8fd9933d30e95a260c49a95ae89512fc0d36f337614c8e4d | MATLAB | 10,092 | 255 |
% sessionSummary.m
% This scritp runs preliminary descriptive analysis to get a summary overview
% of the session.
% HISTORY:
% - Based on Manu Valero-BuzsakiLab 2019
% - Some reorganization, pre-processing steps transferred to expPipeline: 5/20, AntonioFR
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
mkdir('Summar... |
d3587360f78c054a0878d4bb5047f1e3395731fa1f4b56603bb999383fccd5f6 | MATLAB | 10,098 | 212 |
function [rawWaveformsFull, rawWaveformsPeakChan, signalToNoiseRatio] = extractRawWaveformsFast(param, spikeTimes_samples, ...
spikeClusters, reExtract, savePath, verbose)
% JF, Get raw waveforms for all templates
% ------
% Inputs
% ------
% param with:
% rawFile: string containing the location of the raw .bin or... |
ffc89bef876aeb77c2f43d3a45d68652784f29c4f2111d4c737e5195b360b2ec | MATLAB | 10,106 | 277 | function varargout = ea_sweetspotcontrol(varargin)
% EA_SWEETSPOTCONTROL MATLAB code for ea_sweetspotcontrol.fig
% EA_SWEETSPOTCONTROL, by itself, creates a new EA_SWEETSPOTCONTROL or raises the existing
% singleton*.
%
% H = EA_SWEETSPOTCONTROL returns the handle to a new EA_SWEETSPOTCONTROL or the hand... |
3d8cc343e9286cbcf8dd40cfadc943a191ff1596e2cd5b065b23cafe5d747b3e | MATLAB | 10,110 | 286 | %% Visualization of BOLD response as a sum of responses
clear; clc;
% Load model parameters
loadparam;
% Compute timestep and grid spacing
dx = topology.L / topology.Nx;
dt = topology.T / topology.Nt;
% Compute geometric response and geometric BOLD response
ts = run_periodic(topology,homparam,hetparam_hom,stim);
ts_... |
0251a84e0a1e2de77533868fe7752aa3dffd2be2b6d90e0f073a44446884ca79 | MATLAB | 10,116 | 215 | %%% extact MUA - THINGS
% v.2-Gemini
% 2024 P. Papale fecit
clear all
addpath(genpath('\_code\code_utils_v2\'));
% constants
monkey = 'monkeyN';
datadir_gen = '\';
temp_folder = '\_temps\';
dates = {'20220111','20220112','20220113','20220114'};
instances = 1:8;
stimbit = 1;
trial_length = .3;
pre_trial... |
baacf8961328ed2e3f3e3f1edcc81acb54dbe8e2968145fb661cf5faca47a2f0 | MATLAB | 10,125 | 275 | function ClusterStates_MakeFigure(SleepState,basePath,noprompts)
%Check needed here if Sleep state has the right stuff
v2struct(SleepState.detectorinfo.detectionparms.SleepScoreMetrics)
v2struct(SleepState.detectorinfo.StatePlotMaterials)
v2struct(SleepState.detectorinfo.detectionparms.SleepScoreMetrics.histsandthre... |
7e802a9a98d04199cbd095ad36ba328f2ea48c9bea8370d023a535bb9e2a0e98 | MATLAB | 10,137 | 205 | function CBIG_MMLDA_get_subinfo_wrapper(out_dir)
% Get subject information
% Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
if nargin < 1 || isempty(out_dir)
out_dir = [getenv('CBIG_REPDATA_DIR') '/stable_projects/disorder_subtypes' ...
'/Sun2019_A... |
6e217a0f2e01be0bc4474aa54d6efd54dbc1d0223c92ba9b168cfe14d930b7c6 | MATLAB | 10,144 | 209 | classdef MotionCorrection < handle
% MotionCorrection object for the NoRMCorre algorithm
properties
file =''; % filename
dims; % dimensionality of the FOV
nd; % number of dimensions (2d or 3d)
T; % number of timest... |
4b2a5a0b0c3171753d3c721772201238fbc383810867c3e0e3e330068c4b9458 | MATLAB | 10,145 | 348 | roimask_imagename = 'Buhle_Silvers_2014_Emotion_Regulation_Meta_thresh.img';
roimask = which(roimask_imagename); % not 1/0
%% Add this to access the roimask
if isempty(which(roimask))
gunzip(which([roimask_imagename, '.gz']))
end
roimask_shortname = 'EmoMetaMask'; % this is a short, unique name identifying this ... |
46842b53c2e4a44fd13ddf5d4182ecba5f17e957f7a2aa1fc27a77487c9e9920 | MATLAB | 10,147 | 182 | function [hdr, fid, cleanupObj] = read_nifti2_hdr(filename)
% READ_NIFTI2_HDR
%
% Use as
% [hdr, fid, cleanupObj] = read_nifti2_hdr(filename)
% where
% filename = string
%
% cleanupObj MUST be kept around until you are done reading from fid,
% as it will close fid when it is ... |
de844b697f3c5d69116da116bc00e2986d21c3bebfb28a2b3699ccf812154829 | MATLAB | 10,147 | 293 | function [a,b,c] = SyncHist(synchronized,indices,varargin)
%SyncHist - Compute a histogram on event-synchronized samples (e.g. a PSTH).
%
% Compute a histogram on event-synchronized point-process (e.g. spikes) or
% continuous (e.g. voltages) samples, obtained using the function <a href="matlab:help Sync">Sync</a>.
% I... |
40bac4703102fa14e9dea3d437bde918df3dbe6c922c34c096980fb1e9dca8a0 | MATLAB | 10,151 | 249 | function [T,TtrfROI,TtrfAnml,uPTfreq,tableIndices,params] = ...
compileAnimalDataTable(varargin)
% compileAnimalDataTable compiles data table of all ROI for all animals
% respective to stimulus parameters and TRF
%
% INPUT:
% varargin:
% loadParams --> load existing ... |
c103b7637f74b895f943e13ae689661b693e454905626f35d9d69841db66b9a6 | MATLAB | 10,158 | 306 | % This version was derived from the original version by Pestilli and Caiafa.
% Copyright (2015), Franco Pestilli (Indiana Univ.) - Cesar F. Caiafa (CONICET)
% email: pestillifranco@gmail.com and ccaiafa@gmail.com
% https://github.com/francopestilli/life available under
% https://github.com/francopestilli/life/blob/mast... |
fb006618dacb183b09d58ad4f18a97b00d23c7122a7206950e906f533d47f772 | MATLAB | 10,169 | 212 | % -------------------------------------------------------------------------
% Script: T1D_Estimation.m
% Authors: Zijian Gao,Qianxue Shan,Weitian Chen
% Email: zijian.gao@link.cuhk.edu.hk
% Date: 2025-12-20
% Version: 1.0
%
% Copyright (c) 2025 Zijian Gao, Qianxue Shan, Weitian Ch... |
85fad24ccba0ccc42582ced7b827a885d52a2d78b1556ab8e16459f4f0656092 | MATLAB | 10,173 | 183 | function [hdr, fid, cleanupObj] = read_nifti2_hdr(filename)
% READ_NIFTI2_HDR
%
% Use as
% [hdr, fid, cleanupObj] = read_nifti2_hdr(filename)
% where
% filename = string
%
% cleanupObj MUST be kept around until you are done reading from fid,
% as it will close fid when it is ... |
843bd9c7e6045a229a5330ff04f3c48e7fabd70f90a6f9418b6b7b2b1e102ca0 | MATLAB | 10,175 | 240 | function tests = testAmi
%TESTAMI Contract and known-answer tests for ami / ami_histogram / ami_kde.
%
% Mutual information has real analytic properties to test against, which is
% more than most estimators in this library offer:
%
% I(X;Y) >= 0 always, with equality iff independent
% ... |
b9642d27d71f76e390b2b7a825144f721a4b286d2c8c53ee3c4181c0d07c3ea2 | MATLAB | 10,200 | 288 | % NOTE: the use of this script is being deprecated, as the option to run
% second-level regression on conditions is now built into
% prep_3a_run_second_level_regression_and_save.m; please use that script
% instead of this one
% @lukasvo76, May 2022
%
% THIS SCRIPT RUNS BETWEEN-PERSON (2nd-level) Regression analyses
% f... |
ae77f81b02bad21a5a509440baa979034ac9fbb0157e1c4f8fd639c9ecf9931d | MATLAB | 10,210 | 273 | % loadeeg() - load a binary data file in Neuroscan .eeg file format.
%
% Usage:
% >> signal = loadeeg(filename);
% >> [signal, accept, typeeeg, rt, response, chan_names, pnts, ...
% ntrials, srate, xmin, xmax] = loadeeg( filename, chanlist, ...
% triallist, typerange, accepttype, rtrange, responsetype);
%
%... |
26585fe94b3d612ffb7dd2ddde1283df8e61e23b28497470632cb270ca43dc90 | MATLAB | 10,225 | 270 | function varargout = ssg_featureselect(varargin)
% SSG_FEATURESELECT M-file for ssg_featureselect.fig
% SSG_FEATURESELECT(axes_handle) creates a new SSG_FEATURESELECT. Not
% a user GUI; intended for internal use by SS GUI applications.
% Begin initialization code - DO NOT EDIT
gui_Singleton = 0;
gui_State =... |
f70d3aa4bd226fa751fe9b4c4ebfcff29011e329878994f14343a448dd797e1e | MATLAB | 10,226 | 249 | %% Code to plot results from FieldTrip TFR cluster-based permutation analysis
%
% An alternative visualization for the results of FieldTrip cluster-based
% permutation analysis on time-frequency data. The code avoids opacity alpha
% masking by using custom color scales, smoothed by a gaussian filter.
% Informati... |
c7a4b707bae81a99713ff8c4b45715fc608518b33fe36b3a201e4c383ae2043e | MATLAB | 10,275 | 275 | function pc = perceptualCentroid2(x,fs,varargin)
%PERCEPTUALCENTROID2 Alternative perceptual spectral centroid
%
% PC = IOSR.AUDITORY.PERCEPTUALCENTROID2(X,FS) calculates the spectral
% centroid of signal X, sampled at FS, with respect to mel-frequency.
%
% The algorithm first calculates the long-term average... |
00354d7c6dd17e566c5975b04fcedb591e3c3e00b0bb4478994df9f7c4e0b332 | MATLAB | 10,285 | 282 | function varargout = ea_roicontrol(varargin)
% EA_ROICONTROL MATLAB code for ea_roicontrol.fig
% EA_ROICONTROL, by itself, creates a new EA_ROICONTROL or raises the existing
% singleton*.
%
% H = EA_ROICONTROL returns the handle to a new EA_ROICONTROL or the handle to
% the existing singleton*.
%
% ... |
2d5d46d59a151e07a2c38eb4bb4b5ca38feec14a7b5e060e422230d499b16a1f | MATLAB | 10,286 | 253 | function stlwrite(filename, varargin)
%STLWRITE Write STL file from patch or surface data.
%
% STLWRITE(FILE, FV) writes a stereolithography (STL) file to FILE for a
% triangulated patch defined by FV (a structure with fields 'vertices'
% and 'faces').
%
% STLWRITE(FILE, FACES, VERTICES) takes faces an... |
a26850884855323e42073c068e31e734fc9823ae75878b44f2eac68a3be8fbe3 | MATLAB | 10,286 | 221 | function param = qualityParamValues(ephysMetaDir, rawFile, ephysKilosortPath, gain_to_uV, kilosortVersion)
% JF, Load a parameter structure defining extraction and
% classification parameters
% ------
% Inputs
% ------
% ephysMetaDir: dir() structure of the path to your .meta or .oebin meta
% file
% rawFile: ... |
f804a6139d14d38a842b77365a9df104acadb38c41eadcad593b681226808bf3 | MATLAB | 10,286 | 276 | classdef gramm < matlab.mixin.Copyable
%GRAMM Implementation of the features from R's ggplot2 (GRAMmar of graphics plots) in Matlab
% Pierre Morel 2015
properties (Access=public)
legend_axe_handle %Store the handle of the legend axis
title_axe_handle %Store the handle of the title axis
... |
1d87e5436a4779b83ff4735ca2492122ed7dfe042c42cd51e3238386ff84efa9 | MATLAB | 10,291 | 281 | % Copyright (c) 2018, Bruno Luong
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% * Redistributions of source code must retain the above copyright notice, this
% list of conditions and the f... |
1fc169108942cfe143eda7088fea61bddb936c7b16eb305deea94e5c433442b3 | MATLAB | 10,292 | 349 | % Perform a subset of NIFTI sform/qform transform. Transforms like
% (Translation, Flipping, and a few Rotation (N*90 degree) are
% supported. Other transforms (any degree rotation, shears, etc.)
% are not supported, because in those transforms, each voxel has
% to be repositioned, interpolated, and whole im... |
11811a60def9969476af082bc607c4620a35eb6ae7b7f29e85f286256d6e2d64 | MATLAB | 10,294 | 309 | %% LaBGAScore_pet_prep_2_load_image_data_and_save.m
%
%
% *USAGE*
%
% This prep script
%
% # loads first-level PET images into CANlab's fmri_data_st objects
% # performs quality control, including plots if requested in a2 script
% # z-scores images and then repeats 1) and 2)
% # saves the relevant resulting objects/v... |
c3b7c81a964e193fec9a90e240a1146607dd4c41abb196cc5175daff02339ffd | MATLAB | 10,300 | 226 | % writelocs() - write a file containing channel location, type and gain information
%
% Usage:
% >> writelocs( chanstruct, filename );
% >> writelocs( chanstruct, filename, 'key', 'val' );
%
% Inputs:
% chanstruct - EEG.chanlocs data structure returned by readlocs() containing
% channe... |
93b216625e51558b7466b606098f6d085b679d7537b16e468760a74681ab932a | MATLAB | 10,311 | 292 | function [ConditionalISI] = bz_ConditionalISI(spikes,conditionalvariable,varargin)
%[ConditionalISI] = ConditionalISI(spikes,conditionalvariable,<options>)
%
% INPUTS
% spikes cell array (from spikes.times)
% conditionalvariable struct with .data and .timestamps
%
%Future: multiple conditional variab... |
3a49c33ce68976d413962b0ada73d30e409e6fb90a45d5432384d786548d8447 | MATLAB | 10,320 | 229 | % pop_rejchan() - reject artifacts channels in an EEG dataset using joint
% probability of the recorded electrode.
%
% Usage:
% >> pop_rejchan( INEEG ) % pop-up interative window mode
% >> [EEG, indelec, measure, com] = ...
% = pop_rejchan( INEEG, 'key', 'val');
%
% Inputs:
% INEEG - input... |
dc3e8ab47e1ac464f58274fccaaeca015b27c73aa00ccf69ed6335c22dce5437 | MATLAB | 10,335 | 285 | function handles = loadDataforPlots(handles, plotID)
datafilepath = handles.datafilepath;
if nargin<2
datafilename = handles.datafilename{1};
else
datafilename = handles.datafilename{plotID};
end
fprintf('Load data from: ' ); fprintf('%s\n', fullfile(datafilepath, datafilename));
variableinfo = who('-file',... |
be6687545b9d45a4152c1dac402aed024fd87db5dc24f7ea09cb27d805ae2284 | MATLAB | 10,341 | 247 | function varargout = channel_property_viewer(varargin)
% CHANNEL_PROPERTY_VIEWER MATLAB code for channel_property_viewer.fig
% CHANNEL_PROPERTY_VIEWER, by itself, creates a new CHANNEL_PROPERTY_VIEWER or raises the existing
% singleton*.
%
% H = CHANNEL_PROPERTY_VIEWER returns the handle to a new CHANNEL... |
5f1eb83f58e9acfa3e195b6c34380057b4d5b93e52dc2e9ec99dbeea73833624 | MATLAB | 10,343 | 295 | % Name: Robert Kim
% Date: 11-25-2023
% Email: robert.f.kim@gmail.com
% cross_temporal_across_models.m
% Description: Cross-temporal discriminability analysis on the one-layer
% two-modality (instr2) RNNs. For each (network, condition) pair, runs the
% network on random trials, splits trials into odd/even halves (dataA... |
64c26c8d0e3c8684ee5b60e3e73262207fcd0c050b987622624552335db068bf | MATLAB | 10,346 | 249 |
function [tracking] = getSessionTracking(varargin)
%
% Gets position trackign for each sub-session and concatenate all of them so they are
% aligned with LFP and spikes. Default is recording with Basler, and requiere avi videos
% and at least one tracking LED. There is an alternative in case OptiTrack was used.
% N... |
05eee18e50821be4793e2ec42ff745f23474b8c4a81594bd8781b115bae9a719 | MATLAB | 10,348 | 220 | function [maximum_absolute_difference_between_mean_and_ith_deleted_result percentage_relative_to_max_between_mean_and_ith_result_deleted] = get_convergence_values(cv, results_for_each_resample_run_averaged_over_CV_splits)
% This code calculates the different between the mean results averaged over all resample runs, ... |
853e0dbac0590d532bc4b014d35c85f649f5f83974df9526d3708185ab3c1780 | MATLAB | 10,352 | 209 | classdef MotionCorrection < handle
% MotionCorrection object for the NoRMCorre algorithm
properties
file =''; % filename
dims; % dimensionality of the FOV
nd; % number of dimensions (2d or 3d)
T; % number of... |
3356b78a1ed1f88daceec37704b9a29d86576efe07c08c10a4739932dffa5c90 | MATLAB | 10,355 | 193 | function cifti_write(cifti, filename, varargin)
%function cifti_write(cifti, filename, option pairs...)
% Write a cifti file.
%
% Specifying "..., 'keepmetadata', true" leaves the file-level metadata as-is:
% if false or not specified, the 'Provenance' metadata value is moved to
% 'Paren... |
b1b8e56d72ff0eb1804a3c78c7fc90d01cb4557a872299d2fbdc6bedd02817c2 | MATLAB | 10,370 | 243 | % pop_multifit() - fit multiple component dipoles using DIPFIT
%
% Usage:
% >> EEG = pop_multifit(EEG); % pop-up graphical interface
% >> EEG = pop_multifit(EEG, comps, 'key', 'val', ...);
%
% Inputs:
% EEG - input EEGLAB dataset.
% comps - indices component to fit. Empty is all components.
%... |
b2d1485308e7f358346d313949a86febbeabe3c02165c404e6667d85cc2ce4bf | MATLAB | 10,397 | 247 | function [xyczt_img metadata] = import_PrairieTif(varargin)
% SYNTAX: [xyczt_img metadata] = import_PrairieTif(varargin)
% import_PrairieTif('C:\Images\SingleScan001-1')
%
% METHOD: Imports an image taken from a prairie CLSM into MATLAB memory
% with an axis convention of xyczt. By default, removes any singleto... |
681cf51571431f7bb7ebb4dead212539bca6b86a031c801ea3dfda0dbe65d853 | MATLAB | 10,398 | 371 | function [baseline, decline] = CBIG_hypoTest_3t(stats)
% [baseline, decline] = CBIG_hypoTest_3t(stats)
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
beta = stats.Bhat;
betaCov = stats.CovBhat;
baseline = zeros(9, 3);
decline = zeros(9, 3);
%% --------------... |
3ac4338f68f690836aca6cd0f7833140594692a9a9f1275a5f154b75e1e27358 | MATLAB | 10,425 | 249 | % pop_xfirws() - Design and export xfir compatible windowed sinc FIR filter
%
% Usage:
% >> pop_xfirws; % pop-up window mode
% >> [b, a] = pop_xfirws; % pop-up window mode
% >> pop_xfirws('key1', value1, 'key2', value2, 'keyn', valuen);
% >> [b, a] = pop_xfirws('key1', value1, 'key2', value2, 'keyn', valuen);
%... |
54bca2bcef73a688fa5709c4612d16d8445eecfb25f54aa06c684449331f03ec | MATLAB | 10,427 | 284 | function results = LaBGAScore_run_reports(scriptnames, htmlsavedir, varargin)
% Publish a chain of analysis scripts and FAIL LOUDLY when one of them errors.
%
% *USAGE*
%
% results = LaBGAScore_run_reports(scriptnames, htmlsavedir)
% results = LaBGAScore_run_reports(scriptnames, htmlsavedir, 'artefacts', A)
% results =... |
60fce6ba0558a955aefcb5402903ff0bc9074d1bc8ecc21014efc7f957535bca | MATLAB | 10,429 | 276 | function stats = ReconstructPosition(positions,spikes,phases,varargin)
%ReconstructPosition - Bayesian reconstruction of positions from spike trains.
%
% Instantaneous positions are reconstructed using a Bayesian algorithm.
% Instantaneous population firing rates can be estimated either over fixed time
% windows, or o... |
bc822bf10449016228016c777011b502cce06f291a91b09794371a3625ad9017 | MATLAB | 10,457 | 370 | function [baseline, decline] = CBIG_hypoTest_3t(stats)
% [baseline, decline] = CBIG_hypoTest_3t(stats)
beta = stats.Bhat;
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
betaCov = stats.CovBhat;
baseline = zeros(9, 3);
decline = zeros(9, 3);
%% ---------------... |
2bef1a0a2a4f12b062f435c226843128160d25a9a742fceb7490fc048e2db136 | MATLAB | 10,463 | 328 | function mono_res = bz_MonoSynConvClick (spikeIDs,spiketimes,varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% INPUTS
%%%
%%% spikeIDs = Nx3 matrix. N = # spikes.
%%% col1 = shank ID, col2 = cluID on shanke, col3 = unit ID
%%%
%%% spikestimes = Nx1 matrix aligned with spikeIDs where each row is a
%%% time stamp ... |
026dc0afec9c944fd1ccb7a652977de6c2d32445b8f30652c5e27d30e4fc5dee | MATLAB | 10,465 | 309 | % [fighan, axh, handles] = plugin_canlab_condition_contrast_plot(data_to_plot, DAT, analysis_name, dv_name)
%
% This plugin function plots a series of conditions in one panel, and a
% series of contrasts across those conditions in another. This is useful
% for showing patterns of means across conditions and contrasts i... |
702c5cff764352d24c50db4eac9effbb3642c69e93706e4268ca903ff9e9494d | MATLAB | 10,466 | 251 | function [] = uw_overlay_bwthresh(anat_img, overlay_img, output_img, overlayThresh, overlayPercent, overlayAlpha, overlayInterp, overlayCoreg)
% FUNCTION uw_overlay_bwthresh
% Version 1.0
%
% A function for merging overlay data with an anatomical image. bwthresh
% will do a binary threshold of the overlay dat... |
ab0e253f273ffaad5739219aa00e45905028c367102b8972dd8c014edad50baf | MATLAB | 10,467 | 246 | function varargout = nii_xform(src, target, rst, intrp, missVal)
% Transform a NIfTI into different resolution, or into a template space.
%
% NII_XFORM('source.nii', 'template.nii', 'result.nii')
% NII_XFORM(nii, 'template.nii', 'result.nii')
% NII_XFORM('source.nii', [1 1 1], 'result.nii')
% nii = NII_XFORM... |
65652153cbfa4e48302315ab04fc3c6f262fa6a29e200ebeb1a9830bd905cf09 | MATLAB | 10,469 | 286 | function showTractStats(datastruct)
ftr = datastruct.ftr;
if isempty(ftr);
return;
end;
fh = findobj('tag','mesoGT_statfigure');
ssds = get(fh,'userdata');
sfigure(fh);
if isempty(findobj(gcf,'Tag','mesoGT_s... |
64410bc210399dac0ea7d7f511ceab140ec6c11ae32023bbdf7cb9219b4f7f5c | MATLAB | 10,470 | 253 | % std_erp() - Constructs and returns channel or ICA activation ERPs for a dataset.
% Saves the ERPs into a Matlab file, [dataset_name].icaerp, for
% data channels or [dataset_name].icaerp for ICA components,
% in the same directory as the dataset file. If such a file
% ... |
6dc6f3f8e6b90cdd2d9d1173d9810a2ce8765039d611bda3a78941731c079e41 | MATLAB | 10,470 | 311 | function z = mtimes( x, y, oper )
% Disciplined convex programming information for MTIMES:
% True matrix multiplications Z = X * Y---that is, where neither X
% nor Y is a scalar---require both multiplications and additions.
% For example, element (i,j) of Z is given by
% X(i,1) * Y(1,j) + X(i... |
c38d77fb33a09bc961d2378b10cabede163bf2525f6125691da6f8c2495c8bab | MATLAB | 10,477 | 179 | % pop_erpparams() - Set plotting and statistics parameters for cluster ERP
% plotting
% Usage:
% >> STUDY = pop_erpparams(STUDY, 'key', 'val');
%
% Inputs:
% STUDY - EEGLAB STUDY set
%
% Input:
% 'topotime' - [real] Plot ERP scalp maps at one specific latency (ms).
% ... |
e5cbf4252ca9c58ed1366e0f2746d151550eb43776871b1d19922bed8dfb4f73 | MATLAB | 10,478 | 224 | %% chan map
%% example 2.0 4-shank in an horzontal stripe
% list of channel indices (and give
% an index to dead channels too). chanMap(1) is the row in the raw binary
% file for the first channel. chanMap(385) = flipper in my case
chanMap = 1:384;
% the first thing Kilosort does is reorder the data with d... |
558f1e81e51eece978941190bf4bb4b558348d6d474718a6d58360350c5b1156 | MATLAB | 10,480 | 270 | % pop_biosig() - import data files into EEGLAB using BIOSIG toolbox
%
% Usage:
% >> OUTEEG = pop_biosig; % pop up window
% >> OUTEEG = pop_biosig( filename, channels, type);
%
% Inputs:
% filename - [string] file name
%
% Optional inputs:
% 'channels' - [integer array] list of channel indices
% 'blockrange'... |
03cf90ad28361c19766866c8ffda4b264a25416fb654af8b0d6921a82a1fc20d | MATLAB | 10,533 | 309 | function varargout = ea_edit_regressor(varargin)
% EA_EDIT_REGRESSOR MATLAB code for ea_edit_regressor.fig
% EA_EDIT_REGRESSOR, by itself, creates a new EA_EDIT_REGRESSOR or raises the existing
% singleton*.
%
% H = EA_EDIT_REGRESSOR returns the handle to a new EA_EDIT_REGRESSOR or the handle to
% t... |
d2da45d05c6ec935823186c7e84ccc448780647a3149763dbe609e6a937c75d4 | MATLAB | 10,547 | 276 | function [fet clu spktimes wav]= ConvertKlusta2Matlab(shank,basepath,...
basename,wvformExtract,saveFiles,numCores,keepMUA)
% USAGE
%
% [fet clu spktimes wav]= ConvertKlusta2Matlab(shank,basepath,basename,wvformExtract,saveFiles,numCores)
%
% INPUTS
%
% shank - the shank number (as a number, not text) equal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.