sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
5dbc061adafca982e388a55056019df796bebe65c860144fa6cb5e0a85457f38 | MATLAB | 948 | 28 | function outputimage = LCN_3Dimage_dilate(inputimage,kernel)
% inputimage = 3D binary image
% kernel = vector with the number of voxels to dilate in each of the 3 dimensions
% outputimage = 3D binary image of the same size as inputimage
%
% Needs to be extended but for what we want, this is sufficient
%_______________... |
8c6f137d61f97f00d4e9648e16ec0a7de605776a573c8910613bac4522a79743 | MATLAB | 950 | 27 | function tree = set(tree,uid, parameter, value)
% XMLTREE/SET Method (set object properties)
% FORMAT tree = set(tree,uid,parameter,value)
%
% tree - XMLTree object
% uid - array (or cell) of uid's
% parameter - property name
% value - property value
%____________________________________________________... |
549f025a8fd103dfd680c4de97437d135c17e50cb7283fa9651b6159d5b405c2 | MATLAB | 951 | 31 | % PARSEKEY convert a string into a struct pointer
%
% PARSEKEY(str) splits a string semantically on dots (while respecting
% quotes), then converts each segment of the resulting pointer into a
% valid field name with a predictable structure.
%
% See also PARSEVALUE, SPLITBY
function key = parsekey(str)
% spl... |
17922ac8c025078f76d1b90565967b74aca74ace0360eda281dc198b5d0c14b8 | MATLAB | 954 | 34 | function x = setdual( x, y )
x.dual_ = y;
x.value_ = do_setdual( x.value_, y );
function x = do_setdual( x, y )
switch class( x ),
case 'struct',
nx = numel( x );
if nx > 1,
error( 'Dual variables may not be attached to struct arrays.' );
end
f = fieldnames(x);
y... |
50086e09fd50bf56b710a7c989f0860d4fc66de2a9f00d73b29c853145ec7271 | MATLAB | 954 | 34 | %% Example 2 to visualize topic model results
%
% This example shows how to visualize documents in a 2D map.
% The documents are located such that neighboring documents have similar
% topic distributions. Documents are shown by their corresponding titles
%%
% Load a document-topic count matrix saved for the nip... |
51a1a89cbdba775eead50821ab7cbf598b347b791f47740ff658d4ad99c3236a | MATLAB | 954 | 31 | classdef( Hidden, Sealed ) SelectionData < event.EventData
%uix.SelectionData Event data for selection event
%
% e = uix.SelectionData(o,n) creates event data including the old
% value o and the new value n.
% Copyright 2009-2015 The MathWorks, Inc.
% $Revision: 1165 $ $Date: 2015-12-0... |
d59f403ee742fa5b210e1023573aa5a90939f35bb12a83e29c2d9de665fcae2c | MATLAB | 955 | 33 | function CEM_concat_plot(fulltrial,types,exptype,numcol)
if exptype == 1
load fifteencolormap_pur
cm = fifteencolormap;
clear fifteencolormap
elseif exptype == 2
load eighteencolormap
cm = eighteencolormap;
clear eighteencolormap
end
... |
1d99659dc4fc85bd86044b7faf01bc8ccedb9b22c0da6c3236479a7e0a8b9ea8 | MATLAB | 956 | 34 | function avgCorr = CBIG_hunMatch(beta_best, beta)
% avgCorr = CBIG_hunMatch(beta_best, beta)
%%% Reorder subtypes to obtain the maximal correlation coefficients
% Construct the COST matrix
% pos1 pos2 ...
% topic1
% topic2
% ...
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/m... |
39b1087031d8ca783c670b2274d7ba86bb9c0746797d3696ff7dd07468738a7c | MATLAB | 956 | 32 | function joint_var_matrix = structural_covariance(data)
%
% HELLO!
%
% joint_var_matrix = structural_covariance(data)
%
% Construction of intra-individual brain structural covariance networks
% Based on Yun et al., 2020, Brain
%
% INPUT:
% data = z-scored matrix of morphological featu... |
45268318c4129303357433a499a7145b9a7ad57deb1406b51e89a16975859b8b | MATLAB | 957 | 33 | function [varargout]=edmunds_karp_max_flow(A,u,v,varargin)
% EDMUNDS_KARP_MAX_FLOW Edmunds-Karp max flow algorithm
%
% The Edmunds-Karp algorithm implements the augmenting path idea
% to compute a maximum flow or minimum cut in a network.
%
% See the max_flow function for calling information and return parameters.
% ... |
f59a9121f917ddb36729cf294e70be22430be8e6057aa13e6e5f2d10dc3c9586 | MATLAB | 957 | 36 | function ea_conv_antswarps(transform_file_name, reference, float)
% switches ants transform extenstion between .h5 and .nii.gz
[~,~,ext] = fileparts(transform_file_name);
switch ext
case '.gz'
ext = '.nii.gz';
out_ext = '.h5';
case '.h5'
out_ext = '.nii.gz';
otherwise
error... |
88f9cb37a34f0321d7c2589b236d2e323722c2b81196f93979cf14e22ef52152 | MATLAB | 958 | 28 | function N_tracts = ea_get_N_pathways(ActivationProfileDict)
% get total number of pathways (tracts) exported from Fiber Filtering
% ActivationProfileDict - json file generated when exporting the tracts
jsonText = fileread(ActivationProfileDict);
ProfileDict = jsondecode(jsonText);
N_tracts = 0;... |
b2c3732da8478cc4c51e19e1aaa6a12b43932848ae84985ad1b034162d65d79c | MATLAB | 958 | 43 | function lfband(fit,varargin)
% adds confidence bands around the plot of a locfit() fit.
%
% for 2-d fits, produces separate surface plots of upper and
% lower confidence limits.
%
% Bands are based on 95% pointwise coverage, using a single
% (i.e. global) estimate of sigma^2.
xfit = lfmarg(fit);
% placing... |
78d27275f9f2ba43878bc337a416f0c41315dd3cff7d13e73f24bf62bdc3f971 | MATLAB | 959 | 27 | function CBIG_MMLDA_vector2nifti(vector, mask, out_name)
% CBIG_MMLDA_vector2nifti(vector, mask, out_name)
%
% Convert vector to a nifti volume by filling the voxels in the mask of value 1 with values in the vector.
%
% Input:
% - vector : 1 x M vector. M is number of voxels.
% - mask : nifti volume. Number... |
1e811784f8162875c626dcc6f6158b5c85733781da0db58c3723687bc2dfb16b | MATLAB | 960 | 54 | function [odf odfmean] = FunkRadonTrans(pos,posout,L,alpha)
N = size(pos,3);
SH = cpmSH(pos,L);
SH = vertcat(SH{:});
SHout = cpmSH(posout,L);
SHout = vertcat(SHout{:});
for k = 1:2:L
regu{k} = ones(2*k-1,1)*(k-1)*k;
Leg = legendre(k-1,0,'norm');
funkradon{k} =ones(2*k-1,1)*Leg(1)*3^(k-1)/factorial(k-1); ... |
34e3c6848c5260a05b1a2d36dcb755e19086adfd0e3d35a2b09e0bfcc2d08120 | MATLAB | 960 | 33 | function [nObjects Object]=ReturnSepparateFaceObjects(F)
F_new=zeros(size(F)); nF=size(F,1);
N=zeros(1,numel(F));
Object=cell(1,100);
nObjects=0;
while(nF>0)
nN=1; N(nN)=F(1,1);
nF_new=0;
while(nN>0)
row=find((F(1:nF,1)==N(1))|(F(1:nF,2)==N(1))|(F(1:nF,3)==N(1)),1,'first');
if(~... |
71dd9922a20f249fbdb2ebd4e067a48b192c177274288b36ad7eb9d0c0ef201d | MATLAB | 960 | 34 | function [meta] = readMetaForCBins(binName,aporlfp)
if nargin<2
aporlfp='ap';
end
% Create the matching metafile name
file = dir(fullfile(binName,['*' aporlfp '.meta']));
if isempty(file)
file = dir(fullfile(binName,['*.meta']));
end
% Parse ini file into cell entries C{1}{i} = C{2}{i}
fid = fopen(fullfile(f... |
f5c2713565572fb70acd3f1a97ccec165c73e2409f1221a9f7357165f93f88ac | MATLAB | 960 | 32 | function CBIG_Yeo2011_generate_example_results(output_dir)
% CBIG_Yeo2011_generate_example_results(output_dir)
%
% This function is a matlab wrapper to run the csh script to generate the
% example results for Yeo2011.
% See README file for more details about the example:
% $CBIG_CODE_DIR/stable_projects/brain_parcel... |
0cc4cf83dc54995cecfb2f63b887025bce0b5f0d974399ce3018789ae6c67a3f | MATLAB | 961 | 38 | function [v,s] = CircularVariance(angles,dim)
%CircularVariance - Estimate circular variance and standard deviation.
%
% USAGE
%
% [v,s] = CircularVariance(angles,dim)
%
% angles angles in radians
% dim optional dimension along which the mean should be computed
%
% OUTPUT
%
% v ... |
1555ae3273e880cc061919408a0898d0eda6c1ef53b6913d7cb13d3ec505158b | MATLAB | 961 | 44 | function databases = DBList(pattern)
%DBList - List existing databases.
%
% USAGE
%
% databases = DBList(pattern)
%
% pattern optional name search pattern (see below)
%
% EXAMPLES
%
% % List all databases
% databases = DBList;
%
% % List all databases starting with 'LFP'
% databases = DBList... |
e7c9fb4bfdb7a01641c1d211d4b580554a8460f603dd5883dc9c39ecd48efbd8 | MATLAB | 961 | 30 | function varargout=ea_explorer_stats_nmap(varargin)
% Function to estimate a certain mass univariate test (see below) as used
% in explorer apps.
% - Expects valsin as V x N matrix where
% V is the number of
% voxels/streamlines/etc and
% ... |
41937080007389403c1aa0d204db93cc99455688c7f967048ebfe4141a973ad0 | MATLAB | 962 | 42 | function load_scope(files,refresh_rate,sample_frequency)
close all
shot_size=round(sample_frequency/refresh_rate);
ring=zeros(shot_size*20,1)';
fig = figure('Position',[500,500,800,600],...
'NumberTitle','off',...
'Name','Scope',...
'doublebuffer','on',...
'HandleVisibility','o... |
0d42fa0fab46a55152eb076585d4f901007da528dc4500a3da25c7c58ecff083 | MATLAB | 963 | 42 | function newpt=rotatevec3d(pt,v1,u1,p0)
%
% newpt=rotatevec3d(pt,v1,u1,p0)
%
% rotate 3D points from one Cartesian coordinate system to another
%
% author: Qianqian Fang, <q.fang at neu.edu>
%
% input:
% pt: 3D points defined in a standard Cartesian system where a unitary
% z-vector is (0,0,1), 3 columns for x... |
1b92fbdfef51142ed08a84a6a0a670ebd5950bc46363459470afcd26b11a738c | MATLAB | 963 | 39 | function [node,elem,face]=readmedit(filename)
%
% [node,elem,face]=readmedit(filename)
%
% read Medit mesh format
%
% author: Qianqian Fang, <q.fang at neu.edu>
%
% input:
% fname: name of the medit data file
%
% output:
% node: node coordinates of the mesh
% elem: list of elements of the mesh
% face: ... |
376c70be98b0e369d7af267262caa9a8747271ad575635da951f7a3f4d83d987 | MATLAB | 963 | 29 | function ea_perform_ft_proxy(options)
% function ea_ft_mesotracking_reisert
% function ea_ft_deterministictracking_kroon
% function ea_ft_globaltracking_reisert
% function ea_ft_gqi_yeh
eval([options.lc.struc.ft.method,'(options)']); % triggers the fibertracking function and passes the options struct to it.
% BIDS: S... |
3fd1d87ad65855f011028b9067e637e777e912f60c1f4fa8a0f02bdd75b00342 | MATLAB | 963 | 31 | function icc_val = subfun_compute_icc3_1(X)
% X: a (n_subjects x 2) matrix, columns are sessions
if size(X,2) ~= 2
error('Input must have exactly two columns (2 sessions).');
end
n = size(X, 1); % number of subjects
% Means
mean_rows = mean(X, 2); % per subject
mean_cols = mean... |
bfc9cd335ab3f9b946fe3bfbfcc679933cbb8a7ad5743db1d9e1636acf933ee9 | MATLAB | 963 | 24 | function handles = showframestamptbl(framestamp, stampinfo, handles)
if ~isempty(framestamp)
% if min(size(stampinfo)) == 1
% t0 = [1; find(diff(framestamp)~=0)+1];
% t1 = [find(diff(framestamp)~=0);length(framestamp)];
% g = framestamp(t0);
% glist = sort(unique(g),1);
% t =... |
dd6545c9604e83c3fb7f4f0d7f6b45833c8aa9c379de8c444fb52bf794653c51 | MATLAB | 963 | 21 | %CheckMyM - Make sure mym is installed and functional.
%
% Connectivity to MySQL database server depends on mym. Make sure
% this is installed and functional.
%
% USAGE
%
% CheckMyM
% Copyright (C) 2007-2010 by Michaël Zugaro
%
% This program is free software; you can redistribute it and/or modify
% it under the t... |
9bf95c75d8b2bc2af8d998396e87890a3cabc5d2bb99ffb28409751b49583bb9 | MATLAB | 965 | 32 | function results = gifti_runtests(pth)
if ~nargin, pth = fileparts(mfilename('fullpath')); end
d = dir(pth);
d([d.isdir]) = [];
d(arrayfun(@(x) isempty(regexp(x.name,'^test_.*\.m$','once')),d)) = [];
results = struct('Passed',{},'Failed',{},'Incomplete',{},'Duration',{});
for i=1:numel(d)
results(i).Failed = fal... |
d7a49103b40c45c787c299dd7beb6100475c1f18aa581099bd046a6b8de2f954 | MATLAB | 965 | 36 | % function result= reshape_index(index, resolution)
%
% change a 1-dim Index in a length(resolution)-dim index.
% index is the 1-dim index resolution describes the size
% of the matrix und result is an Vektor of the indices of
% the matrix
%
% Example:
% M= reshape(1:2000, [5,... |
43db630d5dec6e9d50b7ee8038847b97d3bd68805e8ce279e5620c1c35dd3dfb | MATLAB | 967 | 27 | %Contiguous - Determine a patch of contiguous points.
%
% Given a matrix of zeros and ones, where ones form 'patches' of contiguous
% items, find all items that belong to the same patch as item (i,j).
%
% USAGE
%
% y = Contiguous(x,i,j)
%
% x input matrix
% i,j starting coordinates (... |
8299358b74ef2b774dedbfe738f2dc980f519c8c1fe508436ae124b87e43bfb7 | MATLAB | 967 | 39 | function entry = findindict(c,dcode)
% Look up an entry in the dictionary
%__________________________________________________________________________
% Copyright (C) 2005-2012 Wellcome Trust Centre for Neuroimaging
%
% $Id: findindict.m 4986 2012-10-05 17:35:09Z guillaume $
entry = [];
d = getdict;
d = d.(dcode);
if... |
91e12b619916d88dd5d0da39a520cee618d170ddd3edd433d7d57b823c236aa9 | MATLAB | 967 | 43 | function database = DBUse(database)
%DBUse - Set (or determine) current database.
%
% Set (or determine) current database to store/retrieve processed data.
%
% USAGE
%
% DBUse(database)
% database = DBUse()
%
% database database name
%
% SEE
%
% See also DBConnect.
%
% Copyright (C) 2007-2012 ... |
ca05f6b3700c506ef7db69ce3ecb3e0928e11b0b1d619c4f72f7b994c0e50523 | MATLAB | 967 | 37 | clear;
clc;
close all;
addpath(genpath('../functions/'));
SUBINFO_FILE = '../../subInfo/rid_sex_mDoB_yDoB_mExam_yExam_ageExam_dx_icv_bl.csv';
GMICV_FILE = '../../vbm_810bl/gmVolAndICV/rid_gmVol_icv_bl.csv';
K = 3;
%------- Which quantity? - Q
% 1 for MMSE, 2 for MEM, 3 for EF
Q = 3;
% Requirement for x-axis: auto,... |
cca51ed0d36d06a1a8ba76e6d35c7883a89257d4e9bfdeebe82e3d6de8aeff5a | MATLAB | 967 | 24 | function y = entr( x )
%ENTR Scalar entropy.
% ENTR(X) returns an array of the same size as X with the unnormalized
% entropy function applied to each element:
% { -X.*LOG(X) if X > 0,
% ENTR(X) = { 0 if X == 0,
% { -Inf otherwise.
% If X is a vector representi... |
d32cc06f85f55bc0da9495d9d565d791bbb41c4d312d7e538e65900761d5b8b1 | MATLAB | 968 | 37 | function newedge=orderloopedge(edge)
%
% [newedge]=orderloopedge(edge)
%
% order the node list of a simple loop based on connection sequence
%
% author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
% date: 2008/05
%
% input:
% edge: a loop consisted by a sequence of edges, each row
% is an edg... |
0464b6216adcdc6aaa8f873538c7dcb2099509643f08bc995cbbca839f6de559 | MATLAB | 969 | 37 | clear;
clc;
close all;
addpath(genpath('../functions/'));
SUBINFO_FILE = '../../subInfo/rid_sex_mDoB_yDoB_mExam_yExam_ageExam_dx_icv_bl.csv';
GMICV_FILE = '../../vbm_810bl/gmVolAndICV/rid_gmVol_icv_bl.csv';
K = 3;
%------- Which quantity? - Q
% 2 for MEM, 3 for EF
Q = 2;
% Requirement for x-axis: auto, auto-center... |
9dcc3ef00d19270d73da3bd6d017b93a9e8ab8d16061376373c81c6fb8d2d935 | MATLAB | 969 | 34 | function positions = LoadPositions(filename,rate)
%LoadPositions - Read positions from file.
%
% USAGE
%
% positions = LoadPositions(filename,rate)
%
% filename position file name
% rate optional sampling rate (if timestamps are not
% provided in the file)
% ... |
a3f7b85f5589648cf078a39d216250faaaafae26489e6c36d495f2f797c7efa9 | MATLAB | 969 | 34 | function found = ea_checkSpecialChars(paths)
% Check for special characters (and space) in the path
found = 0;
if isempty(paths)
return
elseif ischar(paths)
paths = {paths};
end
if iscolumn(paths)
paths = paths';
end
if strcmp(paths{1}, 'No Patient Selected')
return
end
if isunix
special_charac... |
d0cc8b13577bbbe92ae1ae6c68cb8a288415f7563aade31e95afc359c3263436 | MATLAB | 969 | 32 | function data=change_row_to_column(data)
% Helper routine to transform 1d arrays into column vectors that are needed
% by other routines in Chronux
%
% Usage: data=change_row_to_column(data)
%
% Inputs:
% data -- required. If data is a matrix, it is assumed that it is of the
% form samples x channels/trials an... |
9c4bf941394875199b48c4407b4b03ad1e62373131a42d51a7bd14b6a7c90226 | MATLAB | 970 | 30 | % This code create an RGB directional color coded map (see README.md for more details).
%
%%%%%%%%%%%%%%%%%%%%% VARIABLES %%%%%%%%%%%%%%%%%%%%%%%%
%%% Inputs: %%%
%
% img_fa- Fractional anisotropy map from DTI data
% data_v1- Principal vectore map from DTI data
%%% Output: %%%
%
% rgb- RGB map of the FA da... |
bf8efadef2634d24323812c7cdbf5ede1600144e171e968648fb8c936dcd7017 | MATLAB | 970 | 43 | function node=orthdisk(c0,c1,r,ndiv,v1)
%
% node=orthdisk(c0,c1,r,ndiv)
%
% Defining a 3D disk that is orthogonal to the vector c1-c0
%
% author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
%
% input:
% c0: a 1x3 vector for the origin
% c1: a 1x3 vector to define a direction vector c1-c0
% r: the radius... |
f5b491eb933c84748b181c478ebf022a09ce522f8fc8cf43731cd670c6db4404 | MATLAB | 973 | 40 | function M = off_read(filename)
% Read OFF-formatted data from disk
% FORMAT M = off_read(filename)
%
% filename - OFF-formatted file name
% M - data structure
%__________________________________________________________________________
%
% OFF Format Specification:
% https://en.wikipedia.org/wiki/OFF_(file_form... |
04fa6cc7c8d049034026095f1daf6909bc6e705491db84af01bbbf78d318349c | MATLAB | 974 | 36 | %scf - Set current figure, without making it visible.
%
% This function is useful in batches where figures must remain invisible. It
% is equivalent to figure(h) but does not make h visible.
%
% USAGE
%
% scf(h)
%
% h figure handle
%
% SEE ALSO
%
% See also Hide, sca, StartBatch.
%
% Copyrigh... |
4201e1388415f034c643ffa7b8de31229d4695e35ef8875a9e1e0359d3fbbec9 | MATLAB | 974 | 43 | function ea_isolate_fa(options)
disp('Export FA...');
directory=[options.root,options.patientname,filesep];
Vdti=spm_vol([directory,options.prefs.dti]);
Xdti=spm_read_vols(Vdti);
bval=load([directory,options.prefs.bval]);
bvec=load([directory,options.prefs.bvec]);
if size(bvec,1)~=3
bvec=bvec';
end
if size(bval... |
7cefef93544114072405c5648fb6cfb89ebf503b3f741a4217940871ea64603a | MATLAB | 974 | 32 | function vals=ea_explorer_corrsignan(vals,ps,obj)
allvals=cat(1,vals{:});
allps=cat(1,ps{:});
nnanidx=~isnan(allvals);
numtests=sum(nnanidx);
switch lower(obj.thresholding.multcompstrategy)
case 'fdr'
pnnan=allps(nnanidx); % pvalues from non-nan value entries
[psort,idx]=sort(pnnan);
prank... |
a91bcd64bbbcd2bab2746ce521b261be50ac37c14bf867232ecc481af5117f3a | MATLAB | 974 | 19 | function newfn=SOFAcheckFilename(fn)
%SOFACHECKFILENAME
% newFN = SOFAcheckFilename(FN) checks the filename FN and:
% SOFA API - function SOFAcheckFilename
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences
% Licensed under the EUPL, Version 1.1 or ñ as soon they will be appr... |
ec15c68b2f8ead982c14364d090db18d257f749fe7027686412ef36ac5ef99bf | MATLAB | 974 | 32 | function output_args = ciftisavereset(cifti, filename, caret7command)
%Save a CIFTI file as a GIFTI external binary and then convert it to CIFTI
tic
save(cifti,[filename '.gii'],'ExternalFileBinary')
toc
%unix(['/media/1TB/matlabsharedcode/ciftiunclean.sh ' filename '.gii ' filename '_.gii']);
%unix(['mv ' filename ... |
9242e6f02eb6a7f15916be48075ce129e7f19a8592bc8b151d0dd7732ea82e46 | MATLAB | 975 | 33 | function z = trace_inv( Y )
% TRACE_INV Trace of the inverse of a PSD matrix.
% For square matrix X, TRACE_INV(X) is TRACE(INV(X)) if X is Hermitian
% or symmetric and positive definite; and +Inf otherwise.
%
% An error results if X is not a square matrix.
%
% Disciplined convex programming informat... |
6f9f097f31afe880f23e333c2741d4a63a1d2f627838c5d2779926d8533c3c08 | MATLAB | 976 | 24 | function new_score_names = CBIG_ASDf_renameBehavScores(score_names)
% new_score_names = CBIG_ASDf_renameBehavScores(score_names)
%
% Utils function to rename behavioral scores, mainly for plotting purpose.
% 1. Trim scale name e.g. 'RBSR_6SUBSCALE', 'SRS';
% 2. Trim 'RAW' (raw scores) or 'T' (T scores) characters
%
% ... |
8be245e5386e8b002803d42d6c1540c02beeed8e094af1e38c55e2d002165995 | MATLAB | 976 | 33 | function vr = close(vr)
%VR=CLOSE(VR)
% Closes video VR and releases any system resources necessary to access it
% (e.g. threads, file handles, etc.). Do NOT just clear a videoReader
% object without first closing its handle:
%
% % BAD code--typically will leak system resources
% vr = videoReader(...);... |
0f574a318efbb60a4eda800ecfc41e151c11c95850c347beb2410e33ae506262 | MATLAB | 977 | 27 | function tree = set(tree,uid, parameter, value)
% XMLTREE/SET Method (set object properties)
% FORMAT tree = set(tree,uid,parameter,value)
%
% tree - XMLTree object
% uid - array (or cell) of uid's
% parameter - property name
% value - property value
%____________________________________________... |
4f0695bf240f5b8a6c2e584e6ce7d667a2e0e9aed94920174cadd2e04b2a73a0 | MATLAB | 977 | 31 | clear;
clc;
close all;
addpath(genpath('../functions/'));
CBIG_plotSetup;
SUBINFO_FILE = '../../subInfo/rid_sex_mDoB_yDoB_mExam_yExam_ageExam_dx_icv_bl.csv';
GMICV_FILE = '../../vbm_810bl/gmVolAndICV/rid_gmVol_icv_bl.csv';
%!!!!!!
K = 3;
% AD
GRP = 'ad_188'; % possible values: ad_188 mci_394 a+_mci_147 converter_mc... |
ebd609a096cffac658bee9fc1943efcc6f085974c3c7f44be60edad7bffe39c2 | MATLAB | 977 | 30 | function d = getdict
% Dictionary of GIfTI/NIfTI stuff
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
% Guillaume Flandin
% $Id: getdict.m 7379 2018-07-25 09:11:24Z guillaume $
persistent dict;
if ~isempty(dict)
d = dict;
... |
1990fd8dd5e09836e744fe55ae5e98b93307c8cb1793ba0f4497c0dc935d8858 | MATLAB | 978 | 23 | function z = rdivide( x, y )
% Disciplined convex programming information for RDIVIDE:
% For DCP purposes, the RDIVIDE division operator X./Y is identical
% to X.*(1./Y). The right-hand term must be constant and non-zero;
% and if the left-hand term is nonlinear, the constat must be real.
%
% Dis... |
338318c5fde06b0d79ad63fb2cca5ebce38f0b5dc2c51024efcc9e62a07df54c | MATLAB | 978 | 39 | function [conn,connnum,count]=meshconn(elem,nn)
%
% [conn,connnum,count]=meshconn(elem,nn)
%
% create node neighbor list from a mesh
%
% author: Qianqian Fang, <q.fang at neu.edu>
% date: 2007/11/21
%
% input:
% elem: element table of a mesh
% nn : total node number of the mesh
%
% output:
% conn: output, ... |
8032e438fb63fefa3156c5888705f7fcbc724f259d1d4e5925187c8a718625a3 | MATLAB | 978 | 29 | function CBIG_MMLDA_generate_JetColormap
% This function will generate a txt file and a png image for Jet colormap.
%
% The JetColormap.txt file is used as input of freeview. For more info, please
% refer to freeview or CBIG_MMLDA_view_vol_slice_with_underlay.m for example use.
% The JetColorbar.png image is a colorba... |
c779f55c9bc4313264d666bfa08d07a23cd7519990e1a40581978626c9a8ddb5 | MATLAB | 978 | 22 | % This script will compile all the C files of the registration methods
cd(['functions', filesep, 'mexfunctions']);
if ismac
compflags = '';
elseif isunix
compflags = ' COMPFLAGS=''$COMPFLAGS -static-libstdc++''';
elseif ispc
compflags = ' COMPFLAGS="$COMPFLAGS /MT"';
end
mex('-compatibleArrayDi... |
6a14ce5cb1d122adc453effcc37d3284edca2b40623a8f9159ad78dcc62a603b | MATLAB | 979 | 31 | % [labels, start, stop] = Boris.load(filename)
% Returns a list of events encoded with BORIS.
% Output:
% labels: 'behavior1', 'behavior2', ...
% start: [start1, start2, ...];
% stop: [stop1, stop2, ...]
%
% epochs = Boris.load(filename)
% Output:
% {'behavior1', [start1, stop1, start2, stop2, ...], '... |
c53bd1c6bb706b86bda22db4671ac076c4d59b9a87804f03fff3488875a42541 | MATLAB | 979 | 19 | % CVX: Top-level commands to control CVX.
%
% cvx_begin - Starts a new CVX specification.
% cvx_clear - Clears all active CVX data.
% cvx_end - Completes a cvx specification.
% cvx_pause - Pauses the processing of CVX models.
% cvx_power_warning - Controls the CVX w... |
0532da13900ad27f3012dd350d073e9c6c901108499b8e02cfd4b85a0109cc35 | MATLAB | 980 | 12 | % Antenna array design
% <a href="http://stanford.edu/~boyd/papers/ant-pat.html">Antenna Array Pattern Synthesis via Convex Optimization</a>
% <a href="http://stanford.edu/~boyd/papers/magdes.html">FIR Filter Design via Spectral Factorization and Convex Optimization</a>
%
% ant_array_min_beamwidth.m - Minimize be... |
49db5df02851054635758c0b5201572f5e0b774de36ba74ce36b6c578237357d | MATLAB | 980 | 52 | function [y_m, R, P, b, y_int] = LinearRegression(x, y, ifPlot)
% fits x and y to a linear model, and returns the R and P values, along
% with y_m, model y values
%
% [y_m, R, P, b, y_int] = LinearRegression(x, y)
degree=2; % linear regression
if length(x)~=length(y)
error('LinearRegression needs x and y with sa... |
ae44f0ee550c31dd7b2cce9307810744012a3ff8f4d3a184f0cb64d5dfd52a3a | MATLAB | 980 | 31 | function [wmean,wcov]=weightmecov(data,weights)
%WEIGHTMECOV computes the reweighted mean and covariance matrix of multivariate data.
%
% Required input arguments:
% data : data matrix
% weights : weights of the observations
%
% This function is part of LIBRA: the Matlab Library for Robust Analysis,
%... |
c231cf5275a3defec8810268979a7ad1dadc779db2aefc8f1d670cdee1cc92d4 | MATLAB | 980 | 32 | function [balanced,cmap] = ea_autocontrast(img, percent)
% Balance the contrast for visualization of nifti image
%
% Follow the fashion in MRIcron, the brightest PERCENT% of the voxels are
% shown as the maximum intensity, and the darkest PERCENT% of the voxels
% are shown as the minimum intensity. A gray color map is ... |
8236a8ac7260c5957b8bc33a40d655eada455428598f883dec57a01488bb77d7 | MATLAB | 981 | 39 | function multiplot_multitrace(xx, yy, er, cc, ttlabel, figiniID)
N = size(yy,2);
if N<=20
h1 = figure(figiniID+1);
subc = round(sqrt(N));
subr = ceil(N/subc);
for i = 1:N
subplot(subr, subc, i),
generatesubplot(er, xx, yy,i)
end
else
c = ceil(N/20);
for k = 1:c
... |
9bb343061e52fca84e8fc4e0a4f3c5c77f54f052389773113c75516c1815ecf5 | MATLAB | 981 | 36 | %sca - Set current axes, without making the figure visible.
%
% This function is useful in batches where figures must remain invisible. It
% is equivalent to axes(h) but does not make the figure visible.
%
% USAGE
%
% sca(h)
%
% h axes handle
%
% SEE ALSO
%
% See also Hide, scf, StartBatch.
%
... |
52264c9cb907f227c4b63015386dcfbe145066dbe70bb56b3bdb098a82ca72b3 | MATLAB | 982 | 38 | function centroid=meshcentroid(v,f)
%
% centroid=meshcentroid(v,f)
%
% compute the centroids of a mesh defined by nodes and elements
% (surface or tetrahedra) in R^n space
%
% author: Qianqian Fang, <q.fang at neu.edu>
%
% input:
% v: surface node list, dimension (nn,3)
% f: surface face element list, dimens... |
b47d19b0ad4fa3c2e8f13b56190f395b7b96be9e66640d2c3cd4719e2faf8521 | MATLAB | 983 | 36 | function varargout=ea_checkmacaque(varargin)
varargout{1}=''; % make default human
varargout{2}=0;
try
if isfield(varargin{1},'macaquemodus') % options have been entered
options=varargin{1};
varargout{1}='';
if options.macaquemodus
varargout{1}=['toolbox',filesep,'macaque',file... |
b530aec99ce0914f8685699fb7efdc0caed6299cb73ba76d143f5e2c7c46c24c | MATLAB | 984 | 26 | % Local Estimation a spike firing rate (in spikes per unit time).
%
% The estimation procedure approximates the log of the spike firing
% rate by a quadratic polynomial, within a sliding window.
%
% The first argument to locfit() is a column vector of the spike times.
% 'family','rate' specifies that the output of the ... |
d2c6315915ccdfd3b953b28abf7d5509c4672e5e9edd73e11e7febdb82e5b5ab | MATLAB | 984 | 34 | function plotMetricMapCCF(dorsalMaps, allROIs, metricField, smoothSD, cmapInfo)
% Creates a binned and smooth map of cell metric values from the field
% metricField
% Figure
allenMapSMc(dorsalMaps, [-3.6, 0, -2, 3]) % Creates figure by itself
% Plot params
xLimits = [-4 0];
yLimits = [-2.35 3.3];
gridRes = 50;
% Mak... |
032a2c65d37f28403fef4f4a9082fe077f7e3dae11da1211f3c4793413f64a52 | MATLAB | 985 | 42 | function [signals, PC, V, data] = pca1(data)
% PCA1: Perform PCA using covariance.
%
% Usage:
% [signals, PC, V] = pca1(data)
%
% data (in) - MxN matrix of input data
% (M dimensions, N trials)
% signals - MxN matrix of projected data
% PC - each column is a principal component... |
322ed97dc1cf3fc4e7ab559e584c8572b180f5ab743d469f48ddfd9092ea532a | MATLAB | 985 | 39 | % written by Yiyuan Han, Essex BCI-NE Lab, 09/01/2020
% getISPCchannel: Measure the ISPC between two specific channels from a
% EEG data series
% Input:
% -phase: the input phase data series
% -channel1: the label of channel 1
% -channel2: the label of channel 2
% -electrodes: the electrode map between channel labels a... |
3e0608b1b81204e642c5c6540f4e47463e215b6b5d62dfe6b6c5902f57bf1895 | MATLAB | 985 | 33 | function Q = M2Q(M)
% Convert from rotation matrix to quaternion form
% See: http://skal.planet-d.net/demo/matrixfaq.htm
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: M2Q.m 1143 2008-02-07 19:33:33Z spm $
d = diag(M(1:3,... |
7feca06c1612970b7c7fb1570b09bb9f9f4cfb00a543432c6d25ec6a70159927 | MATLAB | 985 | 43 | %wrap - Set radian angles in range [0,2pi] or [-pi,pi].
%
% USAGE
%
% y = wrap(x,range)
%
% x angles in radians
% range optional: 1 for [-pi,pi] (default)
% 2 for [0,2pi]
%
% SEE ALSO
%
% See also isradians, clinspace.
%
% Copyright (C) 2010-2011 by Mic... |
d238aaed51fd909e6bfd6a058798b21cb60b4914f14baa0030e45c849d54b7c1 | MATLAB | 985 | 28 | %%*****************************************************************
%% HSDHKMcorr: corrector step for the HKM direction.
%%
%% SDPT3: version 3.1
%% Copyright (c) 1997 by
%% K.C. Toh, M.J. Todd, R.H. Tutuncu
%% Last Modified: 16 Sep 2004
%%*****************************************************************
function [par... |
0e20f32bdda001c840aed01183eec337701155a90f0c33e8267a5f08e195fc42 | MATLAB | 986 | 17 | function [xEdges, yEdges, xBounds, yBounds, cellSize] = computeGrid2D(xLimits, yLimits, gridRes)
% Computes 2D grid geometry given limits for X and Y and the number of bins
% desired for the shorter side of the grid
x_range = diff(xLimits); % total span in x
y_range = diff(yLimits); % tota... |
444c5f98b0dadd8293bd4188bf34639aa8eb0b078c41b5dcae42b771ec21f925 | MATLAB | 986 | 41 | function CBIG_MMLDA_generate_ColdHotColormap
% Written by Xiuming Zhang and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
% Create R G B for color table
no_bins = 255*4;
R = zeros(no_bins, 1);
R(1:255) = 0;
R(255+1:255*2) = 0;
R(255*2+1:255*3) = 1:255;
R(255*3+1:end) = 255;
G =... |
87ad0e9f4569128e86841dd39432bd52a1cd46fea332351df859da10a84f73fc | MATLAB | 987 | 25 | function ea_save_electrode(obj)
if isfile(obj.options.subj.recon.recon)
d = load(obj.options.subj.recon.recon);
else
d.reco.electrode = struct;
end
spacenames={'native','scrf','mni','acpc'};
for spacenm=1:length(spacenames)
try d.reco.electrode(obj.side).dbs.reco.(spacenames{spacenm}).coords_mm{obj.side}... |
cbfcdb320232699648adb496ca2c7374403d5715ba3da9770d665ec9a8b5f2e1 | MATLAB | 987 | 35 | function [allISIdist] = GSASmodel(GSASparms,logtbins,numcells,numAS)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
%
%Note: vectr form uses logCV... for fitting
%logtbins should be base e
if ~isstruct(GSASparms)
GSASparms = convertGSASparms(GSASparms,numcells,numAS);
end
%Here: ... |
d95a1ca9fcab3b864e1b60b77692b5904c3d7c6ed3cb239a9806d4c76dd78661 | MATLAB | 987 | 21 | function s = nnz( x )
% Disciplined convex/geometric programming information for NNZ:
% When used in CVX models, NNZ cannot deduce the numeric value of a
% CVX variable, so it returns the number of "structurally" nonzero
% elements; i.e., those that are not *identically* zero. This is
% similar t... |
4399817f9be1825852a8fdb08b171e7e3a308c0c84a482bfcfe6ce3dce14e329 | MATLAB | 988 | 38 | % GET_NESTED_FIELD get a value from inside a struct
%
% GET_NESTED_FIELD(obj, indx) follows the pointer `indx` into the
% struct or cell `obj`, and retrieves the value at the pointed
% location, if it exists. If any member of the pointer chain does not
% exist, it raises the error 'toml:NoSuchIndex'.
%
% See ... |
5e7a8d97ac0d6845f568993281229aa11a8a162c24e70ae066d2b37e90ff24df | MATLAB | 988 | 37 | % lookupchantemplate - look up channel template.
%
% Usage:
% [ found transform ] = lookupchantemplate( filename, template_struct);
%
% Inputs:
% filename - channel location file name
% template_struct - template strcuture as defined in dipfitdefs
%
% Outputs:
% found - [0|1] 1 if a transformation was... |
3fddd3c5b4d9a92b0aaf1f3099460251b8c4dd64ca7dc3892e3908d8fb7c50ee | MATLAB | 989 | 33 | function z = trace_sqrtm( Y )
% TRACE_SQRTM Trace of the square root of a PSD matrix.
% For square matrix X, TRACE_SQRTM(X) is TRACE(SQRTM(X)) if X is Hermitian
% or symmetric and positive definite; and +Inf otherwise.
%
% An error results if X is not a square matrix.
%
% Disciplined convex programmi... |
4546a24f5f494bc2e1086b39cbddf7c7d41d076cebe1dc0b06a66d1cef55676d | MATLAB | 989 | 40 | function [lab, pos] = read_besa_sfp(filename, uniqueonly)
% READ_BESA_SFP reads a besa style electrode location file.
%
% Use as:
% [lab, pos] = read_besa_sfp(filename, uniqueonly)
%
% Input arguments:
% filename = the file name
% uniqueonly = flag to determine behaviour, to return the positions of the
% ... |
4b8cb384fe96910f283d395bed7fe69ae2a50da844e1b340df5f0bab4d21ff12 | MATLAB | 989 | 49 | function y=rot3d_f(x,ang)
% Usage ... y=rot3d_f(x,ang)
%
% ang=[x y z] in degrees
% (when using myangle functions, use the negative of the result as
% rotation angles)
ang=ang*pi/180;
y=zeros(size(x));
if abs(ang(1))>10*eps, for mm=1:size(x,1),
a1=-tan(ang(1)/2);
a2=sin(ang(1));
a3=-tan(ang(1)/2);
... |
bdb80e189fd16aa00d29fec00bf49b4f157321802e86af674e3587eee12f2133 | MATLAB | 989 | 27 | function [im]=ea_getsurficeplots(niftiname,threshs)
% perform in tempdir given path handling issues in surfice
[pth,fn,ext]=fileparts(niftiname);
if ~exist(fullfile(pth,[fn,'_l_lat.png']),'file') || ~exist(fullfile(pth,[fn,'_l_med.png']),'file')
tempdir=ea_getleadtempdir;
uuid=ea_generate_uuid;
tniftiname=[... |
fcd20c221bdb2f47795e781be1222b1d595e5b69fdf2fc97d67f57d165ea5edd | MATLAB | 989 | 41 | function [n, ts] = plx_ts(filename, channel, unit)
% plx_ts(filename, channel, unit): read spike timestamps from a .plx file
%
% [n, ts] = plx_ts(filename, channel, unit)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% channel - 1-based channel number or channel name
% unit - unit nu... |
06fd926e6cc604ecb31d22ba1aa7b89369475d17227c873fb0969ff42c46ffd7 | MATLAB | 990 | 30 | function [dgG,drR,diffRG]=RGdiff(fluordata,fluordata_red)
avgfluor={};
stdfluor={};
for k=1:5 %for each of the five directions
fn=fieldnames(fluordata);
[ROInum,triallength]=size(fluordata.(fn{1}){1});
dirROIs=[];
for kk=1:ROInum% for each ROI
multitrialROI=[];%collect all the d... |
0dd1fe1d4bab45809dfbcd7f255fd81161a662fd9316e120238b03659a54d48a | MATLAB | 990 | 42 | function x = invert_woodbury(A, y, bad, alpha)
%RECON.INVERT_WOODBURY Tikhonov recon with spatially varying penalty.
% x = RECON.INVERT_WOODBURY(A, y, bad, alpha)
%
% Inputs
% A : channels × vertices Jacobian
% y : channels × 1 vector (e.g., task beta per channel)
% bad : vector of bad-chan... |
21b318ab97d8b9dc6e02fb48b7da14bba36129f9581e339e4ee330651f92ae25 | MATLAB | 990 | 33 | function ea_show_coregistration(options)
% __________________________________________________________________________________
% Copyright (C) 2014 Charite University Medicine Berlin, Movement Disorders Unit
% Andreas Horn
disp('Preparing images to show Coregistration...');
% Load & adjust coregistered and anchor imag... |
a5d412300855c464d9245b35c6cab1bcc77f67de4e38f6f48850b28bb1babc62 | MATLAB | 990 | 27 | function handles = Call_autofeature(handles)
clc
handles.pt = [];
handles.id = 0;
handles.spineROI = [];
handles.roi_seed = [];
handles.roi = [];
handles.tempRoi = [];
handles.Temptrace = [];
handles.trace = [];
handles.dend_shaft = [];
f_wait = waitbar(0.2,'Auto Feature Detection progressing');
sigma = handles.defaul... |
ed687c0cb7c15b578616ae7fb8035daf4202059eaad7f25176fe95e318f85b6f | MATLAB | 990 | 34 | function vw = close(vw)
%VW=CLOSE(VW)
% Closes video VW and releases any system resources necessary to access it
% (e.g. threads, file handles, etc.). Do NOT just clear a videoWriter
% object without first closing its handle:
%
% % BAD code--typically will leak system resources
% vw = videoWriter(...);
% .... |
e76633dce47edde17f1ecb650ddcd9d78eaa9569d66d39bf7bdce8dcc62ac1a6 | MATLAB | 991 | 54 | printhdr('Study Info')
infofilename = fullfile(basedir, 'study_info.json');
if ~exist(infofilename)
disp('Info file study_info.json is missing.');
return
else
textdat = fileread(infofilename);
end
if ~exist('jsondecode', 'builtin')
disp('Matlab version needs updating: jsondecode.m is ... |
f591b5baae74609109c47224efa3fd4c44e9625b3e2490802a069827b3227597 | MATLAB | 991 | 25 | %% map all the selectivity contrast maps from the floc experiment
% transforms from the native surface space to the fsaverage space for each
% subject using nsd_mapdata.m (which uses nearest neighbor for this
% transformation)
fsdir = [nsd_datalocation '/freesurfer/fsaverage'];
hemis = {'lh', 'rh'};
categories = {'fac... |
5aac58990ca7176fc92bc5da06a1f04dccc2ecce9fe41457511b3adf2f9ae16b | MATLAB | 992 | 49 | function [d dt pred] = bfs_in_mbgl(A,u)
% BFS_IN_MBGL Reimplement the BFS function with MatlabBGL visitors.
%
% [d dt pred] = bfs_in_mbgl(A,u)
%
% See BFS
%
% Example:
% load ../graphs/bfs_example.mat
% d = bfs_in_mbgl(A,1)
ip_d = ipdouble(-ones(num_vertices(A),1));
ip_dt = ipdouble(-ones(num_vert... |
6d726103a3519b87733948a9a04e8a5d456c7d037490da40d2c12f5713ef1ce7 | MATLAB | 992 | 44 | function addframe(vw,img)
%WORKED=ADDFRAME(VW)
% Writes a video frame. VW must be a videoWriter object and IMG a 2D
% numeric array with 1 or 3 channels that is autoconverted to a uint8
% image as follows:
%
% type assumed range
% ---- -------------
% uint8 0 to 255
% double 0 to 1
% logica... |
f85b834e326f41858c5c8492632de1c4f512f583cb32ead72239385547af78ab | MATLAB | 992 | 33 | % One free point localization
% Section 8.7.3, Boyd & Vandenberghe "Convex Optimization"
% Joelle Skaf - 10/24/05
%
% K fixed points x_1,...,x_K in R^2 are given and the goal is to place
% one additional point x such that the sum of the squares of the
% Euclidean distances to fixed points is minimized:
% mini... |
7a2824209276c27ef2a906d176cdc05424f8e0c7db38a2c7b5b584dc63857406 | MATLAB | 993 | 50 | function ea_exportmap(n,M,fis,regressor,output,mask,sk,corrtype)
n.img(:)=M;
n.fname=output;
n.dt(1) = 16;
ea_write_nii(n);
if ~exist('mask','var')
mask=nan;
end
if exist('sk','var')
switch sk
case 'k'
dok=1; dos=0;
case 's'
dos=1; dok=0;
case 'sk'
... |
93159eb11d41abd46fbb9af875bad936c40dca7b030d0337a3d3957eb4093c72 | MATLAB | 993 | 28 | function caller = callerfile(option)
%CALLERFILE Name of calling M-file.
% When called from within an M-file, CALLERFILE returns a string
% containing the name of the preceding M-file on the call stack. If the
% M-file was invoked directly from the command line (or if CALLERFILE is
% itself invoked dir... |
b0946ffce07568e84c2683d57ca49166eeff48868f32ea325812b830a2b5c1fb | MATLAB | 993 | 40 | function [stimts] = getstm(datafile)
% Read STM file
%
% Usage: [stimts] = getstm(datafile);
%
%
%
% Jim Donnett <donnett@axona.com>
% Axona Ltd
% 148 Green Lane, St. Albans, Herts, AL3 6EU, U.K.
% http://www.axona.com
%
% This script makes hard-coded assumptions about the .stm file format, namely that
% the timebase ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.