sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e3c0d2fd83a6139b713eb303854a59eb1848c77aceaa5115c3073a3fb88f9f7f
MATLAB
862
37
function entry = findindict(c,dcode) % Look up an entry in the dictionary % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: findindict.m 8776 2013-11-14 09:04:48Z roboos $ entry = []; d = getdict; d = d.(dcode); if ischar(c)...
b9bd2f1a91ce2d4c4aaa86f5360f3503d70b7b4927edd6509673f5096045556e
MATLAB
863
27
function [U_sigma, sigma] = match_eigs(U,V) %match_eigs matches two sets of orthonormal eigenvectors % % Command: [U_sigma, sigma] = match_eigs(U,V) % % U and V are N x N matrices with eigenvectors along the columns. % % Outputs: % U_sigma: N x N matrix of eigenvectors from U matched to V % ...
ac49fe8b7ff34c8364aafee7eb5121822ba0a397d42307f9224cda29e355efd2
MATLAB
865
28
function textureHist = BlobStructTextureHistLBP(blobIndIm, colourIm) % Get LBP's for all colour channels textureHistT = cell(1, size(colourIm,3)); numBlobs = max(blobIndIm(:)); % for i=1:size(colourIm,3) % currIm = GaussFilter(colourIm(:,:,i), 'smooth', .3); % % currIm = colourIm(:,:,i); % [LBP numBins] =...
c0264d4a6c57f67b11394c3f61f13813c09ef35ed2d2ef95bd7f57da5653b335
MATLAB
865
18
function [flip_needed, flip_possible] = determine_if_head_tail_flip(head_direction_dot_product, tail_direction_dot_product, parameters) %determines if a head/tail flip is needed time_threshold = parameters.TrackingMaxBackwardsTime * parameters.SampleRate; %number of frames to make a call flip_needed ...
f23c6e21d0bbc0da463409e863630c35a00083c098012a3ba62950d64f91008a
MATLAB
865
30
% Map Desikan atlas to Yeo-7 Atlas labels (exclude subcortical) % Yeo et al. 2011, JNP % % 22-08-2022 Jonathan Wirsich, Enrico Amico function [sameRSN, RSN_labels] = init_yeo(atlases, atl, lib_path) %Init yeo atlas if strcmp(atlases(atl).name, 'desikan') tmp = load([lib_path 'aparc_aseg_yeoRS7_68reg_e...
183ba52dc2f4188f08d2cc09015d14df89794692e6fa7b2560b5bff8ef8f2fe9
MATLAB
867
25
function [hBlobs blobsInit blobsRest] = RecreateBlobHierarchyIndIm(blobIndIm, blobBoxes, hierarchy) % function hBlobs = RecreateBlobHierarchyIndIm(blobIndIm, boxes, hierarchy) % % Recreate hierarchy from the initial segmentation image % % blobIndIm: Image with indices denoting segments % blobBoxes: ...
8a5dad6dc2bddbc05b2f48fdc080231606bffde74fb4f41dbd172fd786266465
MATLAB
867
28
% clear; addpath(genpath('.')) addpath(genpath(fullfile('..','ANE'))) %% dir_video=fullfile('E:','data_CNMFE'); list_Exp_ID={'blood_vessel_10Hz','PFC4_15Hz','bma22_epm','CaMKII_120_TMT Exposure_5fps'}; num_Exp = length(list_Exp_ID); eid = 4; Exp_ID = list_Exp_ID{eid}; DirSave = ['Results_',Exp_ID]; dir_add = fullfile(...
ab17e2f717c8105647bd87e304586c9a1a07789b9635b60e0b974f0f17abad26
MATLAB
867
44
function d = size(a,varargin) % overloaded size function for file_array objects. % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: size.m 8776 2013-11-14 09:04:48Z roboos $ sa = struct(a); nd = 0; for i=1:numel(sa), nd...
af825f4c3cdcc92e7003ac6dd8efe31e19e252e03308b07c9f010f44c5b0cc40
MATLAB
867
37
% linear regression of parameters and measurement clear; close all; clc; initime = clock; mkdir("figure"); mkdir("figure/agree"); mkdir("figure/disagree"); mkdir("figure/noOsc") addpath('funcs'); x1 = 0.125; y1 = 0.0125; x2 = 0.4; y2 = 0.029; N = 201; Iattn = 0.02; alltime = 4000; % y = k*x + b % get points (xn, yn...
039a1ce5635f3b355992c994e4f33c379d9447cd8672b440b8d3e8ded5ccf455
MATLAB
868
29
function [imagesCellTrain, filenameTrn] = loadImages(files, dirDB, allIndexes, indImagesTrain, numImagesTrain, plotta) %init vectorIndexTrain = allIndexes(indImagesTrain); filenameTrn = cell(length(vectorIndexTrain), 1); imagesCellTrain = cell(numImagesTrain, 1); %loop for i = 1 : length(vectorIndexTrain) fi...
1539c65072bd467d88dd224962a70df7405955fdacb254389080152c65f1e35a
MATLAB
868
20
<<<<<<< HEAD function indexes = computeReal(indexes, MATCHING_t) LogWrite('Compute indexes ...'); % calcolo DET [indexes.FMR, indexes.FNMR] = computeDET(indexes.gmsVector, indexes.imsVector, indexes.REJngra, indexes.REJnira, MATCHING_t); % calcolo EER [indexes.EER, indexes.EERlow, indexes.EERhigh] = computeEER(indexes...
287fba3a29866d4bfe99d30a6dcc0826c0b9430175179f51699b8f1dcdcac407
MATLAB
868
33
function openmeeg_license % OPENMEEG_LICENSE prints the license only once upon the first call to this % function. If the user does a "clear all", the license will again be shown. % This function should be included in every openmeeg function to ensure % that the license is displayed at least once. % Copyright (C) 2009...
3a930f8bff1b36583ceacb1a727bc5da960430e22ddf9df3cec377ad5d157a82
MATLAB
868
28
% This function is for "Vectorizing the Notion of Colon (:)", and was taken from (author: Loren Shure): % http://blogs.mathworks.com/loren/2008/10/13/vectorizing-the-notion-of-colon/ function x = coloncatrld(start, stop) % COLONCAT Concatenate colon expressions % X = COLONCAT(START,STOP) returns a vector conta...
81b3f756ce0e1a48d65bc856900dc0a166b2cddc9ed42dafdec1a56c56290c9d
MATLAB
868
32
function [retval] = fd3(fid) % [retval] = fd3(fid) % read a 3 byte integer out of a file % % fread3.m % % Original Author: Bruce Fischl % CVS Revision Info: % $Author: nicks $ % $Date: 2007/01/10 22:55:09 $ % $Revision: 8776 $ % % Copyright (C) 2002-2007, % The General Hospital Corporation (Boston, MA). % A...
53301923d9adcf9f9745c12e9885a88260ba7ec61ac41a4861d0e773c464a361
MATLAB
869
43
Adapts code from: https://github.com/trendscenter/gift function [bestx, yfit] = fit_L_tocurve_area(x,y) %[bestx, F] = fit_L_tocurve_area(x,y, plotit) % % if nargin < 3 % plotit = 1; % end x = x(:); y = y(:); %% % P = [xbp m1 m2 b] options = optimset('TolFun',1e-14, 'TolX', 1e-14, 'MaxFunEvals', 100000, 'MaxIter',...
5acb1ac2a742a7d91c1d2827be7917f7342445e9052afd4ce0bb94dccbd6c66a
MATLAB
869
20
function mltp_compute_bfo_90(obj, session) outputFolder = fullfile(session.getAnalysisDirectory(), obj.Config.best_fit_orientations.outputFolder); rotDeg = 90; numContexts = obj.Experiment.getNumContexts(); mirrorContexts = zeros(1,numContexts); % Set entry to 1 to mirror the context [per...
764831c1fab1f5d026420d6643f1ea52ae71bc2878837bbb4df0cba368093d05
MATLAB
869
27
% mglGetWindowPos.m % % usage: windowPos = mglGetWindowPos(socketInfo) % by: Justin Gardner % date: 07/29/17 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Returns the position of a windowed context opened with mglOpen(0) % returned position will ...
016822b883f4b6bb0454c4949a57ce38e08e0137bcc0e1fe3d49e12e2d2e5a3f
MATLAB
871
23
% VL_RODR Rodrigues' formula % R = VL_RODR(OM) where OM a 3-dimensional column vector computes the % Rodrigues' formula of OM, returning the rotation matrix R = % expm(vl_hat(OM)). % % [R,DR] = VL_RODR(OM) computes also the derivative of the Rodrigues % formula. In matrix notation this is the expression % % ...
23a289ac1228e31b04d169217855bca2f31c61a8bb4c570d95a840376e124fc7
MATLAB
872
27
function [ wearable_obj ] = getWearableObj( obj ) % Get Wearable object. % % Syntax: % [ wearable_obj ] = getWearableObj( obj ) % % Input parameters: % obj % % Output parameters: % wearable_obj % % Example: % [ wearable_obj ] = obj.getWearableObj() % % Available at: https://github.com/NC...
cf606fadaa0fad7b3e0ef093c1648a728cc60dcbf114c2e9201c8f01042f907b
MATLAB
872
21
function mlgp_compute_bfo_180(obj, session) outputFolder = fullfile(session.getAnalysisDirectory(), obj.Config.best_fit_orientations.outputFolder); rotDeg = 180; numContexts = obj.Experiment.getNumContexts(); mirrorContexts = zeros(1,numContexts); % Set entry to 1 to mirror the context [...
0e5d988294d23015b7c78e540bffed4642ab3888febbf64d5ab187ed14e1f131
MATLAB
873
36
function Kappa = curvature(muTest, consistency, regularization, plotflag) % cubic spline differentiation to find Kappa (largest curvature) if nargin < 3 plotflag = 1; end if plotflag == 1 figure(20), plot(consistency, regularization, 'marker', '*') end eta = log(regularization.^2); rho = log(consistency.^2);...
3296ef30e68770faa68b36afdb493ce5726f5519c92ccce4e7c390be52528794
MATLAB
873
37
function [fdata,delta] = reorder_match(f2c,cdata,ctrx,ftrx) [fnflies,nframes] = size(f2c); iscelldata = iscell(cdata); if iscelldata, cdata_cell = cdata; cnflies = numel(ctrx); cdata = nan([cnflies,nframes]); delta = nan(1,cnflies); for cfly = 1:cnflies, delta(cfly) = (ctrx(cfly).endframe-ctrx(cfly).fi...
757f1f0f2d86430692ea5ad0e532d8d6dacdc73dda8fd7f135398ac0e28db679
MATLAB
873
31
%% function save_nii_img_only(headerfilename,savefilename,images) % % Description: Wrapper script for saving with target image header % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 24 January 2017 % Date modified: 28 June 2020 (v0.8.0) % % cleaned up X.L. function save_nii_img_only(headerfi...
e5fdc5af13ec1f015884c2276782d422b5bd3ae195381a60c5c146f6984564d1
MATLAB
873
17
function object_task_correlations(pipe) % There are two forms of this task: % 1) hab session containing 4 trials, and NO test session % 2) hab session containing 4 trials, and test session containing 1 trial % 3) 5 separate session each containing 1 trial. if pipe.Experiment.getNumSessions() == 1 object_ta...
f3a8efff20092c756d2113a121f5bafff358c1a7f947d932a1355b86b379d71d
MATLAB
873
31
function [a,b, y_fit] = ml_util_medianmedian_linearfit(x,y) % This perform a median-median linear fit to the points x, y % and returns the intercept 'a' and slope 'b' such that % y_fit = a + b*x_data N = numel(x); if numel(y) ~= N error('Length of x and y must be the same.'); end ...
2326fca4ca22efc5e15120f98f8a11d62dfc3fda1b2f2325a25e8162c902b423
MATLAB
874
21
% % Prepare target matrix for the diagonality test when in "base" mode, % not self mode. This is identical to konect_prepare_matrix(), only % that for Laplacian decompositions this will return the underlying % adjacency matrix. % function [B] = prepare_matrix_target(decomposition, A, format) if strcmp(decompo...
16fd5d9b418dc6f99231bbe3adc9f3a35021601da656ed666b1e72b183ef0d43
MATLAB
875
43
function varargout = permission(varargin) % Format % For getting the value % dat = permission(obj) % % For setting the value % obj = permission(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: permission.m 8776 2013-...
3ef895401116d165873ddd2a589b6395b5c1388930b57198618e7754492f60b3
MATLAB
876
26
% figureS3(data_dir, read_from_excel) % INPUTS: % data_dir (str): Path to source data (default: 'source_data'). % % read_from_excel (bool): Flag to read from Excel (true) % or .mat files (false) (default: false). % % Mackay et al. 2024 (DOI:10.1038/s41467-024-52295-5) % License: M...
9223033504386f682c59484fb53ebf474f5667b45b73aa6e2cb1773c645c61f4
MATLAB
876
35
function [goodCycles, goodCS, z] = t2t_2csNOcs(csTimes, cycleMat_cs, z, whichSpike) %% Find Good Cycles/Trials % Condition 1: 1 cs in 200-1000ms z.csWindow_good = (z.sr_e * .201):(z.cycleLen_e/2); conds(:,1) = sum(cycleMat_cs(:,z.csWindow_good),2); conds(:,1) = conds(:,1) == 2; % Condition 2: NO cs in 0-200ms z.cs...
6f4a17213d5057f9a900746e70b29067a833982c376b863262bf50e522e29f6f
MATLAB
877
26
% figureS4(data_dir, read_from_excel) % INPUTS: % data_dir (str): Path to source data (default: 'source_data'). % % read_from_excel (bool): Flag to read from Excel (true) % or .mat files (false) (default: false). % % Mackay et al. 2024 (DOI:10.1038/s41467-024-52295-5) % License: M...
aa3faa5565f7de1883e453c7b4f36bf59d9288d7bbf9653e52328bafa4e1e4bf
MATLAB
877
22
function ExampleHeader = ml_sim_mclust_tfile_header(tfileBits) t = datestr(datetime('now','TimeZone','local','Format','d-MMM-y HH:mm:ss')); ExampleHeader = cell(1, 10); ExampleHeader{1} = '%%BEGINHEADER'; ExampleHeader{2} = '% Program: matlab'; %ExampleHeader{3} = '% MClust version: MClust 4.0.6; 2...
b797fbf23ef82a06afcc796ccd7a9aaf1814559d9348f4f45e7352d76f152067
MATLAB
877
30
% mglStencilCreateBegin % % $Id$ % usage: mglStencilCreateBegin(stencilNumber,invert) % by: justin gardner % date: 05/26/2006 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Begin drawing to stencil. Until mglStencilCreateEnd % is called, al...
062346fd7424933d7466c7fb3228bc7ffd3227ccd9c3de3f6c28f5e225e28d28
MATLAB
878
36
function vid = setupvideo(pos) imaqreset; vid(1) = videoinput('winvideo',1,'MJPG_1280x1080'); vid(2) = videoinput('winvideo',2,'MJPG_1280x1080'); % Set up the camera set(vid,'FramesPerTrigger',1); set(vid,'TriggerRepeat',Inf); triggerconfig(vid,'manual'); % Get a grayscale image set(vid,'ReturnedColorSpace','graysc...
1f503d496ae6904e302edcb4439432981ac784021bdf385f57408c06b7df5ded
MATLAB
878
22
function [data] = ml_experiment_description_load_metadata(experimentDescriptionFilename) [filePath, fileName, fileExtension] = fileparts( experimentDescriptionFilename ); if ~strcmp(fileExtension, '.json') error('Invalid extension for %s.', experimentDescriptionFilename); end data.edFolder =...
7c4184b953caed69e2e468d0ccfc11765aa969a1c5fc5e41b7b11dd040ec5f30
MATLAB
878
38
function make_hist_surv(handles) figure clf mc_method{1}='None'; mc_method{2}='FD'; mc_method{3}='power 2014 FD only'; mc_method{4}='power 2014 motion'; tit2=['MC: ' char(mc_method(find(handles.mc.motions)))]; subplot (5,1,1:4) f=handles.mc.n_surv_frames; % n_bins=min(sum(handles.mc.surv_ix),21); n_bins=21; up_to=ma...
8b4a9f9d2358798753a9ce2063b832ce738484e3e8949d9d09a864ab374ed984
MATLAB
878
32
function [tracks]= assignmentCoorection(tracks,meanTracks) MatchThresh = 10; cost = []; tracks = tracks; if ~isempty(meanTracks) % assign detections nTracks = length(tracks); nDetections = size(meanTracks,1); cost = zeros(nDetections,nTracks); for i = 1:nTracks QueryPoints = tracks(i).predic...
ad25f0ec30c1afbc054a06e9abf37faffba27f3f8a81771c15e8417dbf440682
MATLAB
878
21
function mlgp_compute_bfo_90_mod(obj, session) outputFolder = fullfile(session.getAnalysisDirectory(), obj.Config.best_fit_orientations.outputFolder); rotDeg = 90; numContexts = obj.Experiment.getNumContexts(); mirrorContexts = zeros(1,numContexts); % Set entry to 1 to mirror the context ...
c45c96716919a924fbbfb2d17453d91748ea6c5cf96549e1b50398099eec72c0
MATLAB
878
35
% mglVolume: Get/set system volume % % usage: vol = mglVolume(<volume>) % by: justin gardner % date: 08/08/2016 % copyright: (c) 2016 Justin Gardner (GPL see mgl/COPYING) % purpose: Gets / sets system volume. % % Volume can be a scalar (which sets volume to that level % i...
9e7eae0377e861ee49a6f128a01c15b223271f4f31921cdde0ccd7402b353937
MATLAB
879
35
function [x] = hilbert(xr) % Computes analytic signal % FORMAT [x] = hilbert(xr) % % Returns analytic signal x = xr + i*xi such that % xi is the Hilbert transform of real vector xr. %__________________________________________________________________________ % Copyright (C) 2009 Wellcome Trust Centre for Neuroimaging ...
e3c97d6092ad2c5708bb025d134599b82a0c6b2d45625c176ed5120a58c26fbf
MATLAB
879
36
function extras = write_extras(fname,extras) % Write extra bits of information %_______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: write_extras.m 8776 2013-11-14 09:04:48Z roboos $ [pth,nam,ext] = fileparts(fname); switch ext c...
049201a69e667775de9172a9c57f7bfffbaf823c17bf43fa18fdadf03ff576c9
MATLAB
880
21
% extract background features for contrast computation % (h ,w are size of no paddings) function feat_bkg = extr_feat_background(chns, h, w, p, bw) imh = chns.imh; imw = chns.imw; b = floor( bw * max(h, w) / 400 ); % get pixels in the probable background [xl, yl] = meshgrid(p : (p + b - 1), p : (p + h - 1)); % le...
6f5b29ea7d53d1ce821ae167c231e9a0d13ad915d98a24e847249c86e9686e11
MATLAB
880
30
function data = linearityScatterPlot_pieceWise(vec1, vec2, starts, stops, c, keep) [data.all_Rsq, data.all_slope, data.all_range, data.all_yfit] = linearityScatterPlot(vec1, vec2, keep, c); %% Calculate needed values for i = 1:length(starts) data.chunk(i) = starts(i):stops(i); data.vec1Chunk(i) = ve...
119c3793475e6b1551a35b6fc426e4bb1d8cb33b83b168f940729260ce633c53
MATLAB
881
19
function [t_ms, x_px, y_px, theta_deg] = ml_nlx_nvt_get_filtered_trial(iTrial, nvtFullFilename, CONFIG_NVT_FILE_TRIAL_SEPARATION_THRESHOLD_S) % Load the nvt file and split it into trials %nvtFullFilename = fullfile(pwd, 'VT1.nvt'); %CONFIG_NVT_FILE_TRIAL_SEPARATION_THRESHOLD_S = 100; nvtTrials = ml_nlx...
213c46a6d35a4d61195c034b8423fb092f7a48d8b087503c643087e917c1d9e3
MATLAB
882
43
function varargout = permission(varargin) % Format % For getting the value % dat = permission(obj) % % For setting the value % obj = permission(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: privatepermission.m 877...
a456ae0082b434dbf35e80756dbca79d674a158da8c94206f7ace07ac9cbf1ac
MATLAB
882
34
function [segmentIndexRanges] = ml_util_segment_array(a, maxDifference) %% Splits an array of values into segments whose values in each % segment dont differ by maxDifference. % % eg. t = [1 2 3 4 5 6 7 8 10 11 13 14 15 16 19 20] % % segmentI...
e753ae4599fc1e8cc44f08c6955c710d00b99e0a39c0d314385c99393f2ecd59
MATLAB
882
33
function logplot(x_orig, logscale) % Normal plot with layered logscale plot % logplot(x_orig, logscale) % x_orig Plotted data % logscale Optional 2-element vector representing plot range % for cropping logarithmic plot area % Copyright (C) 2004, 2005 DSS MATLAB package team (dss@cis.hut.fi)...
7ea6fe0591cffb94bfc73b80e378f52435d57067abe13170721a4f399371657e
MATLAB
883
36
function vl_demo_kdtree_self % VL_DEMO_KDTREE_SELF % Demonstrates using a kd-tree to find the pairwise nearest % neighbors in a set of points. % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % All rights reserved. % % This file is part of the VLFeat library and is made available under % the terms of th...
9eeafba0c04a3b462f0a0eebcbabe2fc810cbb62ab15a9a1d28d87e2f9f3c215
MATLAB
883
33
function [powerR, centerfreqR, powerIntR] = getPowerFreq(r, strt_prd, end_prd, band_from, band_to) %GETPOWERFREQ get both center frequency and the power of it % Detailed explanation goes here powerR = zeros(16,6); centerfreqR = zeros(16,6); powerIntR = zeros(16,6); maxFreq = 100; % max frequency kept for pop = 1:16...
bdf6daa6abbc2cb9fb97e4ebccdce4b60c7db4c1dfcfcc823f16cdaa737bdb06
MATLAB
883
28
function [ streaming_obj ] = getStreamingObj( obj ) % Get Streaming object. % % Syntax: % [ streaming_obj ] = getStreamingObj( obj ) % % Input parameters: % obj % % Output parameters: % streaming_obj % % Example: % [ streaming_obj ] = obj.getStreamingObj() % % Available at: https://githu...
f252098cd8653f8d7613d802f85ef4cebcb9f6bf12204b506fb5128c8923c874
MATLAB
883
26
function ret=SONWriteEventBlock(fh, chan, buffer, count) % SONWRITEEVENTBLOCK writes data to an ADC channel % % RET=SONWRITEEVENTBLOCK(FH, CHAN, BUFFER, COUNT) % INPUTS: FH the SON file handle % CHAN the target channel % BUFFER the data to be written containing int32 timestamps % COUNT the numb...
f1c5d72eca34dec8bf817add12f1460cc9a145ccee0807a4bc6e07c09b222329
MATLAB
884
25
function targetonfig = Surf2FigFnc(x_fig,target,tform_fig) %Surf2FigFnc 実際の脳表面の座標(mm)から画像上の座標(px)を求める関数。 % 詳細説明をここに記述 h = x_fig(1); % 拡大縮小 surfgrid = [target(:,1)-h,target(:,2),target(:,3)]; % x軸に関して回転 theta = deg2rad(x_fig(2)); u = deg2rad(x_fig(3)); %w = deg2rad(x_fig(4)); rotX = [1 0 0;0 cos(theta) s...
45ed26acd12c5fb9b5a379a7cfb37877a746d740a439e4e34af63a96c4d95e20
MATLAB
885
35
function [metrics_labels] = get_label_metrics(version,node_labels) % This funtion gets the labels of each metric given the choice of metrics % and the label of each node n_nodes=length(node_labels); if version==1 BC=strings(1,n_nodes); Ci=strings(1,n_nodes); EC=strings(1,n_nodes); D=strings(1,n_nodes);...
5735a0b5b72ac02f39e37aafdeb7b17329b65595aabb37b8e9d732df9027d301
MATLAB
885
31
% Function File: [X] = sinv (A) % % Compute the inverse of the square matrix A by singular value % decomposition. This is a more stable alternative to the native % inverse function when the matrix A is nearly singular (i.e. if % its determinant, or det(A) approaches zero). % % The singula...
6a65f6ad67fd95e5564a3c981b47acb39818d00e12193189383bed4c47817c8c
MATLAB
885
34
% pauseTask.m % % $Id$ % usage: pauseTask() % by: justin gardner % date: 10/26/06 % copyright: (c) 2006 Justin Gardner (GPL see mgl/COPYING) % purpose: fix trial timers when the stimulus has been paused % function task = pauseTask(task,pauseInterval) % check arguments if ~any(nargin == [2...
581a1574a1cd3a9ebce39913edb640e6f8d4c41cb4ec35e377a8f963f2bcc5b1
MATLAB
886
64
function img_data=read_img_rgb(img_file, data_type) assert(strcmp(data_type, 'uint8')); try [img_data, map] = imread(img_file); catch err_info disp(err_info); disp(img_file); error('image read error'); end if size(img_data, 4)>1 error('cannot read images with multi-frames'); % only load the first...
72a6c59912bf15e8aad84ad4697834392ed7fe4bf80f6754618ffe5acc8c8d16
MATLAB
886
43
function out=sparseconv(x,f) % SPARSECONV Speedy convolution of sparse vectors % % OUT = SPARSECONV(X, F) computes the convolution of the % (sparse) input vectors X and F. % % Gert Cuypers 4/10/2001 % Esat Sista KULeuven [rij,kol]=size(x); if kol>1 x=x.'; end [rij,kol]=size(x); if kol>1 error('x ...
a0ce7d0528bf937eeeea011d276abc95eec1caf91ed48df74b5a7f57d2f0787b
MATLAB
886
28
function bgtraces=generate_bgtraces_from_masks_exclude(video,masks) % Generate background traces for each neuron from ground truth masks. % Background intensity is the median of the intensity in the nearby % region of the neuron, but excluding the neuron itself. [Lx,Ly,T]=size(video); [Lxm,Lym,ncells]=size(masks); [x...
a7fe38b2e213e7cbbe878bfc074b66606e326a03f28547d0ba9847ecfe5240c6
MATLAB
888
27
% SONDATETIME gets or sets the creation data/time data in a SON file % The date/time are returned in standard MATLAB format % % Implemented through SONDateTime.dll % % DATEVECTOR = SONDATETIME(FH) % returns the creation date/time from the file % DATEVECTOR1 = SONDATETIME(FH, DATEVECTOR2) % sets the ti...
c38e30c8f897fad32c7234581fbe6d2f94341cb4b12fe5eec5a5fc89555e8101
MATLAB
889
17
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [M] = get_match_table_for_cells(TableA, TableB) % Get matching sessions between the two tables matchingRows = ml_util_find_row_matches([TableA.animalName, TableA.sessionName, TableA.cellName], [TableB.animalName, Ta...
0c4e1bdce856af6ff747c0ed55a6c9b1369f3ab85dc68415f186f48a97b3ebac
MATLAB
891
28
function [bestMap, bestCombination, metricValue] = best_flip_combinations_standarddeviation(maps) numTrials = size(maps,3); flipCombinations = flip_combinations(numTrials); numCombinations = size(flipCombinations,1); flipMetric = zeros(numCombinations,1); flippedMap = zeros(size(maps,1), size...
c35fc0a132f8bc1f60069aca258ba9e91e4ed9ebd998281ce256406b3f19bc87
MATLAB
891
27
% VL_IKMEANS Integer K-means % C = VL_IKMEANS(X,K) returns the centers of a K-means paritioning of % the data space X. X must be of class UINT8. C is of class UINT32. % % [C, I] = VL_IKMEANS(...) returns the cluster associations I of the % data as well. % % VL_IKMEANS() accepts the following options: % % M...
e68a2c4d819d2f38e1e8fc1f23270953c374ca2feb5ce4bd2aa8166a9b90ecf1
MATLAB
891
25
function cbar = colorbar_log(my_clim) %COLORBAR_LOG Apply log10 scaling to pseudocolor axis % and display colorbar COLORBAR_LOG(V), where V is the % two element vector [cmin cmax], sets manual, logarithmic % scaling of pseudocolor for the SURFACE and PATCH % objects. cmin and cmax should be specified on a LINEAR ...
f565c101b5a5ff444e3230f1f9c5b810988035f6a6bfae3fd13dd9ce64d5d9d1
MATLAB
891
26
function logEv = logevid_GLM(wts,hprs,mstruct) % logEv = logevid_GLM(wts,hprs,mstruct) % % Compute negative log-evidence under a GLM using the Laplace approximation % % INPUTS: % wts [m x 1] - regression weights % hprs [p x 1] - hyper-parameters % mstruct [1 x 1] - model structure with fields: % .neglogl...
58c1d8cc8ee73c1b0d173794230bb81922d784e92acaf22dfceeb09235e55cd6
MATLAB
892
31
function child = children(tree,uid) % XMLTREE/CHILDREN Return children's UIDs of node uid % FORMAT child = children(tree,uid) % % tree - a tree % uid - uid of the element % child - array of the UIDs of children of node uid %__________________________________________________________________________ % % Return UID'...
bc8185172a7a1e298cff4106b515dddf862a08f3e3a9cf95c541e32ca61a3860
MATLAB
892
29
function distances = pos2dists(positions) % distances = pos2dists(positions) % % Function to convert a series of points into a matrix of distances between % all the points. Input is the NxD list of N D-dimensional points. Output % is the NxN matrix of distances between any two points (position i,j in % the output is t...
c1dcbb83ea50b5647cf00116818abde2de96d03debc4a36876f90ed765b65ea2
MATLAB
892
44
function results = vl_test_lbp(varargin) % VL_TEST_TWISTER vl_test_init ; function test_unfiorm_lbps(s) % enumerate the 56 uniform lbps q = 0 ; for i=0:7 for j=1:7 I = zeros(3) ; p = mod(s.pixels - i + 8, 8) + 1 ; I(p <= j) = 1 ; f = vl_lbp(single(I), 3) ; q = q + 1 ; vl_assert_equal(find(f...
dfb3fe01d206c0b5f3a487f06cdc3cfddf799841e3381e2110d0c33e30965536
MATLAB
892
35
%FMUT unit testing %General setup % %AUTHOR: Eric Fields %VERSION DATE: 12 June 2020 clear all; close all; path(pathdef); %#ok<CLALL> %Add EEGLAB and MUT to path [ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab; %Remove FMUT directory within EEGLAB plugins folder rmpath(fileparts(which('FclustGND'))); %Add ...
5c4c851f3407ad58a6b02b7c95ea44ecaca8e86a67ce8134bb8613ba502ed0e0
MATLAB
894
19
SC = change_camera_ROI(SC,'BSI',SC.c0,SC.r0,OPT_S.n_FOV); %change camera ROI to capture N_FOV by N_FOV pixels SC = laser_set(SC.laser_settings.laser_power,SC); %set laser to standart power SC = change_exposure(SC,'BSI',SC.BSI_settings.very_high_exp); ...
638b0b51a00ad5df4dde8c2580eae41a72a2846f9a94f830f8f33f0bf13dcdf8
MATLAB
894
20
function [col,row] = GetNeedleTip(im) im = rgb2gray(im); I = imadjust(imtophat(im,strel('rectangle',[8,20])),[0.01,0.1]); BW = bwareaopen(I>100,500,4); CC = bwconncomp(BW); stats = regionprops(CC, 'BoundingBox'); aspectRatios = zeros(length(stats),1); for i = 1:length(stats) aspectRa...
cbad6e5b2b173e9a882cf0aeb42e93da24ce3dc9ae5d9ee769a486557180af70
MATLAB
894
20
function [HistSpl] = CardinalSpline(lag,c_pt,s) HistSpl = zeros(lag,length(c_pt)); %for each 1 ms timepoint, calculate the corresponding row of the glm input matrix for i=1:lag nearest_c_pt_index = max(find(c_pt<i)); nearest_c_pt_time = c_pt(nearest_c_pt_index); next_c_pt_time = c_pt(nearest_c_pt_index+1);...
044965a2cbcd855bf2975329b6f7cafad3d34b46ad1f36a7b08dbc7c2df61af5
MATLAB
895
29
Files = dir(['G:\My Drive\Hannah''s Server Data\1_Hannah_Payne\magmouse\data', '\**\*']); freeFiles = contains({Files.name}, {'free'}); freeFiles = Files(freeFiles); freeFiles = freeFiles(contains({freeFiles.name}, '.smr')); for i = 1:size(freeFiles, 1) disp(freeFiles(i).name) name = freeFiles(i).name; ...
378543a76dc34378ea2280420fa677ef1183881994da5f36ce2be53996537c48
MATLAB
895
28
function [params, beta] = beta_tanh(params, state, denf) % Local spectral shift function for denoise_tanh denoising function. % [s_new, params] = beta_tanh(params, state, s) % params Function specific modifiable parameters % state DSS algorithm state % denf Tanh denoising function % beta Deno...
3c110dc4c31b5195a09d41e9364fbbd7582a36a6c473516d6134681f4606aca9
MATLAB
895
41
%% diff between str connectivity with DTI fiber number (> 0 and =< 0) %% para path = pwd; load('unrelated_sub_matrix_DTI.mat') DTI_data = DTI_matrix; Type = {'DBM','VBM'}; cd .. load('node_name.mat') roi_num = 48; DTI_thr = 0; p_fdr = 0.05; results = struct; %% cal for itype = 1:length(Type) load(['unrelated...
4cab0ba9770dfd8df1960f21d5dde6a15191b4a63dd696da0bef9f8e39163ae5
MATLAB
895
23
% VL_IRODR Inverse Rodrigues' formula % OM = VL_IRODR(R) where R is a rotation matrix computes the the % inverse Rodrigues' formula of om, returning the rotation matrix R % = dehat(Logm(OM)). % % [OM,DOM] = VL_IRODR(R) computes also the derivative of the Rodrigues' % formula. In matrix notation this is the e...
d950d93635841d9a274a8338d437272bf2f7deeacb7accdd2f2e8d9c20f02ead
MATLAB
895
28
function [cci] = ml_cai_estimate_spikes_indices(trace_raw) % cci are the spike indices into trace_raw mstd = movstd(trace_raw, 7); x = linspace(0, max(mstd), 1000); mmstd = mstd; % lognfit can't use values of 0 mmstd(mmstd <= 0) = []; pt = prctile(x, 50); % 75 was last good value used ...
f45a4689d5f00b817439b0530369abf974a936840e01b19790144db4cc199358
MATLAB
895
21
function mlgp_compute_bfo_90(obj, session) outputFolder = fullfile(session.getAnalysisDirectory(), obj.Config.best_fit_orientations.outputFolder); rotDeg = 90; numContexts = obj.Experiment.getNumContexts(); mirrorContexts = zeros(1,numContexts); % Set entry to 1 to mirror the context %mirrorC...
1a70383997545e6c311a1983174008d1046614d2198bf00e00ecad32f94ad22d
MATLAB
896
27
function hBlobs = RecreateBlobHierarchy(blobs, hierarchy) % [blobs hierarchy] = RecreateBlobHierarchy(blobs, hierarchy) % % Recreates the hierarchical grouping using the starting blobs and the % resulting hierarchy. This allows one to save the grouping using % relatively small disk space while still being able t...
c04f777cd1ca6ebf3fb1a680c965301da5868bfab6ddfd53f6ff9d4e7188a78f
MATLAB
896
19
%----FUNCTION: % extract statistical color features (mean and standard deviation) from various of color spaces (RGB, HSV, LAB, Opponent color space) function [colorArr_c, colorArr_s] = sp_color_grid_cs(chns, grid_x, grid_y, patch_size, surrWidth) nPatch = numel(grid_x); colorArr_c = zeros(nPatch, 24); colorArr_s...
c6d9a4722f51b6afdfd180a0ad8b3e5737195b97df4be03b46b16ab2e3a95ec0
MATLAB
896
30
function [new_matrix] = remap_matrix(matrix,idx_map,noselfconnections) % This function remaps the matrix given the new indices in idx_map [n_nodes,~]=size(matrix); if n_nodes~=length(idx_map) error("The length of the mapping vector must be equal to the number of nodes of the original matrix.") end n_newnodes=len...
e2a0e0c6619e8643b732127b5256b01879b5c8078d7f7d86ad5bd65aa982bcec
MATLAB
896
31
function [gamma, beta] = getCenterFreq(signal) %GETCENTERFREQ get the center frequency of gamma oscillation, and beta %oscillation if exist % Detailed explanation goes here [pks,locs] = findpeaks(signal); if length(pks) < 3 gamma = 0; beta = 0; else mark1 = [pks(end-2), locs(end-2...
18fee99e95a006aa3238ef6aba78fc235eb4aca11d6fba5d5f9df4b9a70c44aa
MATLAB
897
22
function [Spikes, LFP, ThetaR, ThetaL, Nose_x, Nose_y, Nose_s, Orient,FPS] = Ehud_getSpikes(mouse,date,movie,firstTracked, lastTracked); % You'll need to chance the drive, but outside of that, the path should be % correct. % The 'mouse' and 'date' should be entered as strings. So, the function % should look l...
876a783f418dfa2b0e27b550eee32416b7f0fa6f613f18565033829fe674005d
MATLAB
897
32
function avi_to_tiff(input_path, output_path, ROI) %AVI_TO_TIFF 此处显示有关此函数的摘要 % 此处显示详细说明 vidObj = VideoReader(input_path); ROI = [350 450 1900 2050]; width = ROI(4) - ROI(2) + 1; height = ROI(3) - ROI(1) + 1; frameNumber = vidObj.NumFrames; stack = zeros(height, width, frameNumber, 'uint8'); ...
5ee2782bab6a9a9082f8857fd3220c0f68f8b8da903835a95ea0783cd8be45cc
MATLAB
898
44
function [all_cellocs,cell_stat,redcell_idx]= get_stat(Fall,redcell_idx) % objective: get 512x512xnumcells matrix with each of the soma-masks for % the cells stat=Fall.stat; iscell=Fall.iscell; cell_stat=stat(iscell(:,1)==1); % reduce stat to only iscells redcell_idx=redcell_idx(iscell(:,1)==1); %% numcells=...
91c09afc54aa52420f979de459569f3059e28528f04583a08dfb0893828afb60
MATLAB
898
25
function [isibin, isiwin, ylim, fs, cancelFlag] = uigetISIinfo() % % by Michela Chiappalone (14 Marzo 2006) % modified by Noriaki (9 giugno 2006) cancelFlag = 0; fs = []; isibin = []; isiwin = []; ylim = []; PopupPrompt = {'ISI bin [msec]', 'ISI window [msec]', 'Ylim [0,1]', 'Sampling frequen...
acc7c25786f01b2fe309db9c07dffd190f75144fa8f8404c73db0f92c860d994
MATLAB
898
31
function angles = ml_alg_center_out_angle_continuous_circle_bias(nSamples) % This computes the samples of center out angles when points are % picked uniformly at random from rectangular maps of size nX by nY centerX = 0; centerY = 0; angles = nan(1, nSamples); [x1,y1] = gen_samples_uniform_dis...
4206506efc208c57c7c870d1d0996e8364673779937b1112ae0f184833de6b79
MATLAB
899
31
% rmRefrPrdThreshCross.m % % Helper function called by detectSpikes() that removes threshold crossings % that occur within refractory period. % % INPUTS: % threshCrossInd - indicies of threshold crossings % refrPrd - refractory period length, in samples % % OUTPUTS: % corrThreshCrossInd - indicies of threshold ...
9eea41103db3125c5ecc65d6faa71d7a6a9a908c4743f719adac8bbcfef7bb97
MATLAB
901
39
function ret=SONChanDelete(varargin) % SONCHANDELETE deletes a channel from a SON file % RET=SONCHANDELETE(FH, CHAN {,QUERY}) % FH = file handle % CHAN = channel number 0 to SONMAXCHANS-1 % QUERY (if present) = 0 Do not query % <> 0 Query before deleting (default)...
ec29fc8892d595746a687d0ed1770b169a18ac04419173b52b2a68ad07692c9c
MATLAB
901
27
function value = read_power_2014_FD_only(motion_file,FD_threshold,key) if FD_threshold > 0.5 disp(['Input FD threshold (' num2str(FD_threshold) ') is greater than the maximum tested against (0.5)']) return end load(motion_file); motion_struct = motion_data{floor(100*FD_threshold)+1}; if strcmp(key,'format_st...
7956bcc545850329a6c3f9932bd0b38681aab55ca9824347b176efcd6e83c995
MATLAB
904
24
function state = dss_preprocess(X, state) % Preprocess data % Copyright (C) 2004, 2005 DSS MATLAB package team (dss@cis.hut.fi). % Distributed by Laboratory of Computer and Information Science, % Helsinki University of Technology. http://www.cis.hut.fi/projects/dss/. % $Id: dss_preprocess.m 8776 2013-11-14 09:04:48Z ...
90d5bdf6602f6f1c205de004c7a5d38e491a8bda0806d2c70a9317757769182e
MATLAB
904
31
function out = HPF(in, fSample, fCutoff) % out = HPF(in, fSample, fCutoff) % % Implements a one-pole high-pass filter on vector 'in'. % fSample = sample rate of data (in Hz or Samples/sec) % fCutoff = high-pass filter cutoff frequency (in Hz) % % Example: If neural data was sampled at 30 kSamples/sec % and you wish t...
13bc0d3b8dd792e3a3d3e246641304086d0b9432eb7dde67088ff3dc8dedb706
MATLAB
905
16
function Files = getFiles(base_folder,keystr,keystrnot); %keystr = {base_folder;'Movie';'to'}; % AND function of all items (need all to include) %if nargin<2, keystr = {'Movie';'to'}; end; % AND function of all items (need all to include) %if nargin<2, keystr = {'Movie';'to';'small'}; end; % (Ehud added Jan 1 2...
25e206f8a854a8d1d131556ec3472b1fffb6118b8bf58c1fe3f747bb6daeb066
MATLAB
905
36
% % Compute a spectral distribution. % % PARAMETERS % $network Network % $decomposition Decomposition type % % INPUT % dat/data.$network.mat % dat/meansi.$network.mat % % OUTPUT % dat/distr.$decomposition.$network % One line per bin. Three columns: count, begin end. % For time networks, all columns are double...
6a8a95523de745d6b8cce57e710c1edfd0701073b9a00f9279a8b4be3283c6c0
MATLAB
905
26
function [isartifact, maxdelta] = deltaV(eeg,threshold,framesinwindow) %DELTAV Takes a signal and tells you whether there are any amplitude %changes greater than the selected maxdelta, within a given time range. %Used as one method of detecting suspected artefact. % INPUTS % eeg: signal to check. % threshold: maximum p...
daabe28cc61c9f46a18336eff3d01c819c2afd6c19258122f7626131ea4f2e4b
MATLAB
905
38
function rP = calcEyeRadius(results, thetadeg) % Give theta in degreess pleass theta = thetadeg; p1 = results.pupil1(:,1); p2 = results.pupil2(:,1); c1 = results.cr1a(:,1); c2 = results.cr2b(:,1); %% Calculate distance between pupil and CR d1 = p1 - c1; d2 = p2 - c2; % Calculate pupil radius using approxiamate meth...
e4521c1e9825ec224066b99e5f43e8e155a4a94937a20bfafed91c63fa188479
MATLAB
905
24
%% Num cells data_path = '/Users/celia/Documents/two_context_data'; tetout = load(fullfile(data_path, 'tetrodes_20220316_100902_FINAL/analysis_results.mat')); calout = load(fullfile(data_path, 'calcium_20220516_170618/analysis_results.mat')); fig2tet = reformatTbl(tetout.analysisResults.NormalBFO90); fig2cal = reform...
8e113d5c5d0dee6daf0e04864515b44ba2bd13b3fdd292ce59ec9d2f2bd82240
MATLAB
906
30
function [data,FileName,PathName] = open_nii(file) % OPEN_NII opens files with .nii format using the NifTI Toolbox % (nifti.nimh.nih.gov/nifti-1/). Please download and include it in the % path. % % [DATA,FILENAME,PATHNAME] = OPEN_NII(FILE) outputs the data DATA of the FILE % with .nii format and provides the fil...
500a5c05b53c032c55b8316daf3b8839fea700aa4fe10c3d838b06d48e350f03
MATLAB
908
26
function ret=SONWriteEventBlock(fh, chan, buffer, count) % SONWRITEEVENTBLOCK writes data to an ADC channel % % RET=SONWRITEEVENTBLOCK(FH, CHAN, BUFFER, COUNT) % INPUTS: FH the SON file handle % CHAN the target channel % BUFFER the data to be written containing int32 timestamps % COUNT t...
d7ba62bf96491a58e281c4b1c04e4e91179afced0d4d6f8cf50163d10f85f10d
MATLAB
908
32
% % The label associated with a measure. The content of the returned % struct is used in various places as the canonical list of measures to % use. % % RESULT % labels Struct of labels by measure name % labels_short Short names % function [labels labels_short] = get_labels_measure() labels = struct(); % Indivi...
b0209855355100d22d003a38d8559cbc1fae6372d5ed7a15afd21c571055ea3c
MATLAB
909
31
function [S] = dss_2dmask(X, mask, params) % Perform masked DSS on 2d signals. % [S] = dss_2dmask(X, mask, params) % X Mixed 2d signals as 3d array, 1st dimension as signal index % mask 2d denoising mask % params Optional DSS algorithm parameters % S Result 2d source signal estimates % % C...
646b592d546c4d8fad38b373b3b9055bd0db6792e08d223817376144d3b0a58e
MATLAB
911
20
function mltp_compute_bfo_180(obj, session) % We don't need the shrunk data. outputFolder = fullfile(session.getAnalysisDirectory(), obj.Config.best_fit_orientations.outputFolder); rotDeg = 180; numContexts = obj.Experiment.getNumContexts(); mirrorContexts = zeros(1, numContexts); % Set entry to 1 ...