plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | cbaldassano/Parcellating-connectivity-master | LogLikelihood.m | .m | Parcellating-connectivity-master/matlab/ddCRP/LogLikelihood.m | 661 | utf_8 | 26ee1bd3171ae1def2d42f1edb44ce34 | % Computes sum of log-likelihood terms for given sufficient statistics (in Nx3
% matrix, with columns [count, mean, sum of squared dev]) and vectorized
% hyperparameters
function logp = LogLikelihood(stats, hyp)
stats = stats(stats(:,1)>1,:);
% stats = [N | mu | sumsq]
% hyp = [mu0 kappa0 nu0 sigsq0 nu0*sigsq0 co... |
github | cbaldassano/Parcellating-connectivity-master | ddCRP.m | .m | Parcellating-connectivity-master/matlab/ddCRP/ddCRP.m | 10,798 | utf_8 | 5451bd293b592001c4dae22d5c7b95ee | % Main function: Fits our model, given a connectivity matrix D and spatial
% adjacency specified by adj_list. An initialization of the voxel links
% init_c and a ground truth parcellation gt_z (for comparison) can optionally
% be provided. MCMC will be run for num_passes over the dataset, with
% hyperparameter... |
github | cbaldassano/Parcellating-connectivity-master | PlotMDS.m | .m | Parcellating-connectivity-master/matlab/viz/PlotMDS.m | 4,909 | utf_8 | b4e214c7c8d2240663d85457012c344f | function PlotMDS()
subj = load('/data/supervoxel/output/group468/ddCRP3000_dist_mds_subjprocrustes');
group = load('/data/supervoxel/output/group468/ddCRP3000_dist_mds');
paths = [...
55 54 60 61; ...
141 140 145 146; ...
8 17 16 0; ...
93 101 100 0];
RSC = [13 98];
figure... |
github | cbaldassano/Parcellating-connectivity-master | NormalizeConn.m | .m | Parcellating-connectivity-master/matlab/util/NormalizeConn.m | 349 | utf_8 | 8cdb0da4b315616452938021a4aa7c44 | % Normalize connectivity matrix "D" to have zero mean and unit variance
function D = NormalizeConn(D)
D = cast(D, 'double');
off_diags = true(size(D));
for i = 1:size(D,1)
off_diags(i,i) = false;
end
off_diags = off_diags(:);
D = D - mean(D(off_diags));
D = D./std(D(off_diags));
... |
github | cbaldassano/Parcellating-connectivity-master | CheckSymApprox.m | .m | Parcellating-connectivity-master/matlab/util/CheckSymApprox.m | 317 | utf_8 | 0f916fb9c6b57de1399b1cf9c2d5421c | % (Approximately) return whether an array is symmetric
function sym = CheckSymApprox(D)
% Random indices to check for symmetry
sym_sub = [randi(size(D,1), 1000,1) randi(size(D,1), 1000,1)];
sym = all(D(sub2ind(size(D), sym_sub(:,1), sym_sub(:,2)))==...
D(sub2ind(size(D), sym_sub(:,2), sym_sub(:,1))));
end |
github | cbaldassano/Parcellating-connectivity-master | ChooseFromLP.m | .m | Parcellating-connectivity-master/matlab/util/ChooseFromLP.m | 362 | utf_8 | 9d80ca00e5a46eb9c0ed76a024ced6dc | % Computes sum of log-likelihood terms for given sufficient statistics (in Nx3
% matrix, with columns [count, mean, sum of squared dev]) and vectorized
% hyperparameters
function i = ChooseFromLP(lp)
max_lp = max(lp);
normLogp = lp - (max_lp + log(sum(exp(lp-max_lp))));
p = exp(normLogp);
p(~isfinite(p)) = 0;
cumP... |
github | cbaldassano/Parcellating-connectivity-master | RandomizeConstantSizes.m | .m | Parcellating-connectivity-master/matlab/util/RandomizeConstantSizes.m | 1,081 | utf_8 | c87dfa530ca5e2305cb46e6aed300e7f | function z = RandomizeConstantSizes(z, adj_list, restarts)
s_target = ParcelSizes(z);
s = s_target;
z_orig = z;
for r = 1:restarts
if (r==restarts || mod(r,5)==0)
disp(['Restart ' num2str(r) ', NMI=' num2str(CalcNMI(z_orig,z))]);
end
for i = 1:max(z)
[z s] = AddNeighbor(z, adj_list, s, i);
... |
github | cbaldassano/Parcellating-connectivity-master | ClusterSpanningTrees.m | .m | Parcellating-connectivity-master/matlab/util/ClusterSpanningTrees.m | 1,334 | utf_8 | 4e4e37f141a42956a3dac7f84ce9636e | % In order to use the Ward clustering z as an initialization to our model, we
% need to generate voxel links "c" that are consistent with the Ward
% clustering. There are many way to do this, but a simple one is to
% construct a minimum spanning tree within each cluster, and set each
% element's "c" link to poi... |
github | cbaldassano/Parcellating-connectivity-master | smoothhist2D.m | .m | Parcellating-connectivity-master/matlab/util/smoothhist2D.m | 3,945 | utf_8 | 207fb5c7cf80ab18f9e7bf2f0cd3b22a | function smoothhist2D(X,lambda,nbins,outliercutoff,plottype)
% SMOOTHHIST2D Plot a smoothed histogram of bivariate data.
% SMOOTHHIST2D(X,LAMBDA,NBINS) plots a smoothed histogram of the bivariate
% data in the N-by-2 matrix X. Rows of X correspond to observations. The
% first column of X corresponds to the hori... |
github | cbaldassano/Parcellating-connectivity-master | alphavol.m | .m | Parcellating-connectivity-master/matlab/util/alphavol.m | 6,328 | utf_8 | 5be094263a839385cbc31c9f98d7091e | function [V,S,bound] = alphavol(X,R,fig)
%ALPHAVOL Alpha shape of 2D or 3D point set.
% V = ALPHAVOL(X,R) gives the area or volume V of the basic alpha shape
% for a 2D or 3D point set. X is a coordinate matrix of size Nx2 or Nx3.
%
% R is the probe radius with default value R = Inf. In the default case
% the b... |
github | cbaldassano/Parcellating-connectivity-master | GradientMap.m | .m | Parcellating-connectivity-master/matlab/util/GradientMap.m | 990 | utf_8 | 61fcddb6d8438029d138a29cc687cef8 | function grad_map = GradientMap(Y, adj_list)
if (size(Y,1) > 1)
Qy = repmat(dot(Y,Y,2),1,size(Y,1));
Y = Qy+Qy'-2*(Y*Y');
Y(1:(size(Y,1)+1):size(Y,1)^2) = 0; % Remove numerical errors on diagonal
Y = squareform(Y);
end
n = length(adj_list);
grad_map = zeros(n,1);
valid_dims = true(n,1);
for i = 1:n
... |
github | cbaldassano/Parcellating-connectivity-master | stlwrite.m | .m | Parcellating-connectivity-master/matlab/util/stlwrite.m | 9,631 | utf_8 | 2a41b91fc57147c0eb24127e874d0efe | 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 and verti... |
github | cbaldassano/Parcellating-connectivity-master | ClusterDifference.m | .m | Parcellating-connectivity-master/matlab/util/ClusterDifference.m | 542 | utf_8 | 482f4b922a05aacf9367721d7a961ffb | function diff_map = ClusterDifference(z1, z2)
z1_pairs = PairMat(z1);
z2_pairs = PairMat(z2);
diff_map = sum(xor(z1_pairs, z2_pairs));
end
function z_pairs = PairMat(z)
z_pairs = false(length(z));
[sorted_z, sorted_i] = sort(z);
bins = mat2cell(sorted_i, 1, diff(find(diff([0 sorted_z (max(z)+1)]))));
for c = 1:le... |
github | cbaldassano/Parcellating-connectivity-master | CalcNMI.m | .m | Parcellating-connectivity-master/matlab/util/CalcNMI.m | 682 | utf_8 | 85863de2a747ec146a47f6473e6a283a | % Compute normalized mutual information between two parcellations gt_z and z
function NMI = CalcNMI(gt_z, z)
N = length(gt_z);
MI = 0;
gt_z = gt_z(:)';
z = z(:)';
gt_p = zeros(max(gt_z),1);
H_gt = 0;
for i = unique(gt_z)
gt_p(i) = sum(gt_z == i) / N;
H_gt = H_gt - gt_p(i) * log(gt_p(i));
end
p = zeros(max(z)... |
github | cbaldassano/Parcellating-connectivity-master | LearnSynth.m | .m | Parcellating-connectivity-master/matlab/synth/LearnSynth.m | 2,305 | utf_8 | 2ab90ec6d059e9c3f58299e5f0420b94 | % Computes a parcellation of synthetic data at different noise
% levels, using Ward Clustering and our method based on the ddCRP. Each
% parcellation is evaluated based on its Normalized Mututal Information
% with the ground truth. The input "type"={'square','stripes','face'}
% determines the underlying ground ... |
github | cbaldassano/Parcellating-connectivity-master | GenerateSynthVaryNoise.m | .m | Parcellating-connectivity-master/matlab/synth/GenerateSynthVaryNoise.m | 3,094 | utf_8 | 3805794b5cb3a7b4484d9f9b3ae6c3ab | function GenerateSynthVaryNoise( )
rng(1);
sqrtN = 18;
synth_sig = linspace(0,9,10);
blurring = 0.2;
coords = zeros(sqrtN^2,2);
adj_list = cell(sqrtN^2,1);
for r = 1:sqrtN
for c = 1:sqrtN
currVox = c + (r-1)*sqrtN;
coords(currVox,:) = [r c];
adj_list{currVox} = [];
if (r > 1)
... |
github | cbaldassano/Parcellating-connectivity-master | GenerateSynthData.m | .m | Parcellating-connectivity-master/matlab/synth/GenerateSynthData.m | 3,712 | utf_8 | f987312b044eb6115501fe3c9175d3c9 | % Generate synthetic dataset of "type"={'square','stripes','face'} at a given
% noise level "sig". Returns a dataset containing a connectivity
% matrix D, and adjacency list adj_list, ground truth parcellation z, and
% element coordinates coords
function [D adj_list z coords] = GenerateSynthData(type, sig)
sqrtN... |
github | cbaldassano/Parcellating-connectivity-master | load_nii_ext.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/load_nii_ext.m | 5,544 | utf_8 | 09a2960b9d48f4b0363d5065f1780cbd | % Load NIFTI header extension after its header is loaded using load_nii_hdr.
%
% Usage: ext = load_nii_ext(filename)
%
% filename - NIFTI file name.
%
% Returned values:
%
% ext - Structure of NIFTI header extension, which includes num_ext,
% and all the extended header sections in the header extens... |
github | cbaldassano/Parcellating-connectivity-master | rri_orient.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/rri_orient.m | 2,081 | utf_8 | dc7dc5e38cf317da9f9628117e2b24bb | % Convert image of different orientations to standard Analyze orientation
%
% Usage: nii = rri_orient(nii);
% Jimmy Shen (jimmy@rotman-baycrest.on.ca), 26-APR-04
%___________________________________________________________________
function [nii, orient, pattern] = rri_orient(nii, varargin)
if nargin >... |
github | cbaldassano/Parcellating-connectivity-master | save_untouch0_nii_hdr.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/save_untouch0_nii_hdr.m | 8,813 | utf_8 | a0a201073cb18f09b62842e94094c451 | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function save_nii_hdr(hdr, fid)
if ~isequal(hdr.hk.sizeof_hdr,348),
error('hdr.hk.sizeof_hdr must be 348.');
end
write_header(hdr, fid);
return; % save_nii_hdr
%------------------------------------------------... |
github | cbaldassano/Parcellating-connectivity-master | rri_zoom_menu.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/rri_zoom_menu.m | 770 | utf_8 | f0bae2b3d88fd719c47fd467e867e19f | % Imbed a zoom menu to any figure.
%
% Usage: rri_zoom_menu(fig);
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
%--------------------------------------------------------------------
function menu_hdl = rri_zoom_menu(fig)
if isnumeric(fig)
menu_hdl = uimenu('Parent',fig, ...
'Label','... |
github | cbaldassano/Parcellating-connectivity-master | rri_select_file.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/rri_select_file.m | 17,235 | utf_8 | 0e0b14435a670dd8805aa514f7dbb6bb | function [selected_file, selected_path] = rri_select_file(varargin)
%
% USAGE: [selected_file, selected_path] = ...
% rri_select_file(dir_name, fig_title)
%
% Allow user to select a file from a list of Matlab competible
% file format
%
% Example:
%
% [selected_file, selected_path] = ...
% ... |
github | cbaldassano/Parcellating-connectivity-master | clip_nii.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/clip_nii.m | 3,421 | utf_8 | 19da887808bddae362df38b0e9f35076 | % CLIP_NII: Clip the NIfTI volume from any of the 6 sides
%
% Usage: nii = clip_nii(nii, [option])
%
% Inputs:
%
% nii - NIfTI volume.
%
% option - struct instructing how many voxel to be cut from which side.
%
% option.cut_from_L = ( number of voxel )
% option.cut_from_R = ( number of voxel )
% option... |
github | cbaldassano/Parcellating-connectivity-master | affine.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/affine.m | 16,664 | utf_8 | 419b609560eb98534c0e32cc4506cc7f | % Using 2D or 3D affine matrix to rotate, translate, scale, reflect and
% shear a 2D image or 3D volume. 2D image is represented by a 2D matrix,
% 3D volume is represented by a 3D matrix, and data type can be real
% integer or floating-point.
%
% You may notice that MATLAB has a function called 'imtransform.... |
github | cbaldassano/Parcellating-connectivity-master | load_untouch_nii_img.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/load_untouch_nii_img.m | 15,224 | utf_8 | 46fb6696904467f1848e2882cd7a72f6 | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function [img,hdr] = load_untouch_nii_img(hdr,filetype,fileprefix,machine,img_idx,dim5_idx,dim6_idx,dim7_idx,old_RGB,slice_idx)
if ~exist('hdr','var') | ~exist('filetype','var') | ~exist('fileprefix','var') | ~exist('machine','var')
e... |
github | cbaldassano/Parcellating-connectivity-master | load_untouch_nii.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/load_untouch_nii.m | 6,373 | utf_8 | 303eb6438d7d37e2144d554504fbdf54 | % Load NIFTI or ANALYZE dataset, but not applying any appropriate affine
% geometric transform or voxel intensity scaling.
%
% Although according to NIFTI website, all those header information are
% supposed to be applied to the loaded NIFTI image, there are some
% situations that people do want to leave the ... |
github | cbaldassano/Parcellating-connectivity-master | collapse_nii_scan.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/collapse_nii_scan.m | 7,038 | utf_8 | 2d30d10b884719503df2974ff39b7093 | % Collapse multiple single-scan NIFTI files into a multiple-scan NIFTI file
%
% Usage: collapse_nii_scan(scan_file_pattern, [collapsed_fileprefix], [scan_file_folder])
%
% Here, scan_file_pattern should look like: 'myscan_0*.img'
% If collapsed_fileprefix is omit, 'multi_scan' will be used
% If scan_file_fol... |
github | cbaldassano/Parcellating-connectivity-master | rri_orient_ui.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/rri_orient_ui.m | 5,635 | utf_8 | 3361ce417798ffe2c6b53cf194b2a146 | % Return orientation of the current image:
% orient is orientation 1x3 matrix, in that:
% Three elements represent: [x y z]
% Element value: 1 - Left to Right; 2 - Posterior to Anterior;
% 3 - Inferior to Superior; 4 - Right to Left;
% 5 - Anterior to Posterior; 6 - Superior to Inferior;
% e.g.:
% Standard... |
github | cbaldassano/Parcellating-connectivity-master | load_untouch0_nii_hdr.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/load_untouch0_nii_hdr.m | 8,293 | utf_8 | d823050e9ba931a2ba7f9d9a3893d2d1 | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function hdr = load_nii_hdr(fileprefix, machine)
fn = sprintf('%s.hdr',fileprefix);
fid = fopen(fn,'r',machine);
if fid < 0,
msg = sprintf('Cannot open file %s.',fn);
error(msg);
else
fseek(fid,0,'bof')... |
github | cbaldassano/Parcellating-connectivity-master | load_nii.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/load_nii.m | 7,006 | utf_8 | 71beffc9e2b0c7e14c2f8dc8adbadbf1 | % Load NIFTI or ANALYZE dataset. Support both *.nii and *.hdr/*.img
% file extension. If file extension is not provided, *.hdr/*.img will
% be used as default.
%
% A subset of NIFTI transform is included. For non-orthogonal rotation,
% shearing etc., please use 'reslice_nii.m' to reslice the NIFTI file.
% I... |
github | cbaldassano/Parcellating-connectivity-master | unxform_nii.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/unxform_nii.m | 1,221 | utf_8 | ff8be64760837046b931857d59ca304e | % Undo the flipping and rotations performed by xform_nii; spit back only
% the raw img data block. Initial cut will only deal with 3D volumes
% strongly assume we have called xform_nii to write down the steps used
% in xform_nii.
%
% Usage: a = load_nii('original_name');
% manipulate a.img to make... |
github | cbaldassano/Parcellating-connectivity-master | load_untouch_nii_hdr.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/load_untouch_nii_hdr.m | 8,739 | utf_8 | eb068c88e2b7bb518ea557d0734bc65d | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function hdr = load_nii_hdr(fileprefix, machine, filetype)
if filetype == 2
fn = sprintf('%s.nii',fileprefix);
if ~exist(fn)
msg = sprintf('Cannot find file "%s.nii".', fileprefix);
error(msg);
end
... |
github | cbaldassano/Parcellating-connectivity-master | save_nii_ext.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/save_nii_ext.m | 1,015 | utf_8 | db919f3a7a4b2f64dae641b1e97fa4a0 | % Save NIFTI header extension.
%
% Usage: save_nii_ext(ext, fid)
%
% ext - struct with NIFTI header extension fields.
%
% NIFTI data format can be found on: http://nifti.nimh.nih.gov
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
function save_nii_ext(ext, fid)
if ~exist('ext','var') | ~exist('fi... |
github | cbaldassano/Parcellating-connectivity-master | view_nii_menu.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/view_nii_menu.m | 14,895 | utf_8 | d81fb80884a14ae659630258fbc330bc | % Imbed Zoom, Interp, and Info menu to view_nii window.
%
% Usage: view_nii_menu(fig);
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
%--------------------------------------------------------------------
function menu_hdl = view_nii_menu(fig, varargin)
if isnumeric(fig)
menu_hdl = init(fig);
... |
github | cbaldassano/Parcellating-connectivity-master | load_nii_hdr.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/load_nii_hdr.m | 10,311 | utf_8 | ef81f82b43da4fbd79a9de1787b5ae22 | % 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;... |
github | cbaldassano/Parcellating-connectivity-master | save_untouch_slice.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/save_untouch_slice.m | 20,263 | utf_8 | 833f175c0298d11697418454a03993db | % Save back to the original image with a portion of slices that was
% loaded by "load_untouch_nii". You can process those slices matrix
% in any way, as long as their dimension is not altered.
%
% Usage: save_untouch_slice(slice, filename, ...
% slice_idx, [img_idx], [dim5_idx], [dim6_idx], [dim7_idx])
%
% ... |
github | cbaldassano/Parcellating-connectivity-master | load_nii_img.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/load_nii_img.m | 12,720 | utf_8 | 5670adb84a76f241bd221003bee8187d | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function [img,hdr] = load_nii_img(hdr,filetype,fileprefix,machine,img_idx,dim5_idx,dim6_idx,dim7_idx,old_RGB)
if ~exist('hdr','var') | ~exist('filetype','var') | ~exist('fileprefix','var') | ~exist('machine','var')
error('Usage: [img,... |
github | cbaldassano/Parcellating-connectivity-master | bresenham_line3d.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/bresenham_line3d.m | 4,682 | utf_8 | f2e52d1f3ac9779b22baf3bb4d2ac201 | % Generate X Y Z coordinates of a 3D Bresenham's line between
% two given points.
%
% A very useful application of this algorithm can be found in the
% implementation of Fischer's Bresenham interpolation method in my
% another program that can rotate three dimensional image volume
% with an affine matrix:
... |
github | cbaldassano/Parcellating-connectivity-master | make_nii.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/make_nii.m | 7,105 | utf_8 | 6b1565392965b164217621e71d213ddd | % Make NIfTI structure specified by an N-D matrix. Usually, N is 3 for
% 3D matrix [x y z], or 4 for 4D matrix with time series [x y z t].
% Optional parameters can also be included, such as: voxel_size,
% origin, datatype, and description.
%
% Once the NIfTI structure is made, it can be saved into NIfT... |
github | cbaldassano/Parcellating-connectivity-master | verify_nii_ext.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/verify_nii_ext.m | 1,721 | utf_8 | 0339aeb8d7286e4f08165c9eeeb4c2cd | % Verify NIFTI header extension to make sure that each extension section
% must be an integer multiple of 16 byte long that includes the first 8
% bytes of esize and ecode. If the length of extension section is not the
% above mentioned case, edata should be padded with all 0.
%
% Usage: [ext, esize_total] = ... |
github | cbaldassano/Parcellating-connectivity-master | get_nii_frame.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/get_nii_frame.m | 4,497 | utf_8 | cc9b1b92f34e5ae67dc34c35a5174c75 | % Return time frame of a NIFTI dataset. Support both *.nii and
% *.hdr/*.img file extension. If file extension is not provided,
% *.hdr/*.img will be used as default.
%
% It is a lightweighted "load_nii_hdr", and is equivalent to
% hdr.dime.dim(5)
%
% Usage: [ total_scan ] = get_nii_frame(filename)
%
... |
github | cbaldassano/Parcellating-connectivity-master | flip_lr.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/flip_lr.m | 3,568 | utf_8 | d95b62698d44a65a3c2f02fbabc632ac | % When you load any ANALYZE or NIfTI file with 'load_nii.m', and view
% it with 'view_nii.m', you may find that the image is L-R flipped.
% This is because of the confusion of radiological and neurological
% convention in the medical image before NIfTI format is adopted. You
% can find more details from:
%
%... |
github | cbaldassano/Parcellating-connectivity-master | save_nii.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/save_nii.m | 9,690 | utf_8 | ed292054cab74afaf953455bfbc200aa | % Save NIFTI dataset. Support both *.nii and *.hdr/*.img file extension.
% If file extension is not provided, *.hdr/*.img will be used as default.
%
% Usage: save_nii(nii, filename, [old_RGB])
%
% nii.hdr - struct with NIFTI header fields (from load_nii.m or make_nii.m)
%
% nii.img - 3D (or 4D) matrix o... |
github | cbaldassano/Parcellating-connectivity-master | rri_file_menu.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/rri_file_menu.m | 4,153 | utf_8 | c9faa3905c642854eeed98ab8b02998e | % Imbed a file menu to any figure. If file menu exist, it will append
% to the existing file menu. This file menu includes: Copy to clipboard,
% print, save, close etc.
%
% Usage: rri_file_menu(fig);
%
% rri_file_menu(fig,0) means no 'Close' menu.
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
... |
github | cbaldassano/Parcellating-connectivity-master | reslice_nii.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/reslice_nii.m | 10,146 | utf_8 | f1e2f0b5ea9c733e82f1f809671276c3 | % 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 N... |
github | cbaldassano/Parcellating-connectivity-master | save_untouch_nii.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/save_untouch_nii.m | 6,726 | utf_8 | cb98e2799abc112dca5b10078bde09bf | % Save NIFTI or ANALYZE dataset that is loaded by "load_untouch_nii.m".
% The output image format and file extension will be the same as the
% input one (NIFTI.nii, NIFTI.img or ANALYZE.img). Therefore, any file
% extension that you specified will be ignored.
%
% Usage: save_untouch_nii(nii, filename)
%
%... |
github | cbaldassano/Parcellating-connectivity-master | view_nii.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/view_nii.m | 146,334 | utf_8 | 54b1c1dc1a0acbb6fc1640bdcf848fee | % VIEW_NII: Create or update a 3-View (Front, Top, Side) of the
% brain data that is specified by nii structure
%
% Usage: status = view_nii([h], nii, [option]) or
% status = view_nii(h, [option])
%
% Where, h is the figure on which the 3-View will be plotted;
% nii is the brain data in NIFTI format;
% o... |
github | cbaldassano/Parcellating-connectivity-master | mat_into_hdr.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/mat_into_hdr.m | 2,691 | utf_8 | 847d96698f45f7c5e7decbb3a0c3187f | %MAT_INTO_HDR The old versions of SPM (any version before SPM5) store
% an affine matrix of the SPM Reoriented image into a matlab file
% (.mat extension). The file name of this SPM matlab file is the
% same as the SPM Reoriented image file (.img/.hdr extension).
%
% This program will convert the ANALYZE 7.5 SPM... |
github | cbaldassano/Parcellating-connectivity-master | xform_nii.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/xform_nii.m | 18,628 | utf_8 | e39c421e7f117cbc81c56e9d023774a3 | % internal function
% 'xform_nii.m' is an internal function called by "load_nii.m", so
% you do not need run this program by yourself. It does simplified
% NIfTI sform/qform affine transform, and supports some of the
% affine transforms, including translation, reflection, and
% orthogonal rotation (N*90 ... |
github | cbaldassano/Parcellating-connectivity-master | make_ana.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/make_ana.m | 5,665 | utf_8 | 37d574b277823f941138c9548127d720 | % Make ANALYZE 7.5 data structure specified by a 3D or 4D matrix.
% Optional parameters can also be included, such as: voxel_size,
% origin, datatype, and description.
%
% Once the ANALYZE structure is made, it can be saved into ANALYZE 7.5
% format data file using "save_untouch_nii" command (for more de... |
github | cbaldassano/Parcellating-connectivity-master | extra_nii_hdr.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/extra_nii_hdr.m | 8,085 | utf_8 | 4f76a8a66736025a0acf3efa15a2d2aa | % Decode extra NIFTI header information into hdr.extra
%
% Usage: hdr = extra_nii_hdr(hdr)
%
% hdr can be obtained from load_nii_hdr
%
% NIFTI data format can be found on: http://nifti.nimh.nih.gov
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
function hdr = extra_nii_hdr(hdr)
switch hdr.dime.da... |
github | cbaldassano/Parcellating-connectivity-master | rri_xhair.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/rri_xhair.m | 2,300 | utf_8 | 95954b8cd43e01fba5c4b2f335be1780 | % rri_xhair: create a pair of full_cross_hair at point [x y] in
% axes h_ax, and return xhair struct
%
% Usage: xhair = rri_xhair([x y], xhair, h_ax);
%
% If omit xhair, rri_xhair will create a pair of xhair; otherwise,
% rri_xhair will update the xhair. If omit h_ax, current axes will
% b... |
github | cbaldassano/Parcellating-connectivity-master | save_untouch_nii_hdr.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/save_untouch_nii_hdr.m | 8,721 | utf_8 | 0d396eaeebb6114f24d56ab74a8299cf | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function save_nii_hdr(hdr, fid)
if ~isequal(hdr.hk.sizeof_hdr,348),
error('hdr.hk.sizeof_hdr must be 348.');
end
write_header(hdr, fid);
return; % save_nii_hdr
%------------------------------------------------... |
github | cbaldassano/Parcellating-connectivity-master | expand_nii_scan.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/expand_nii_scan.m | 1,381 | utf_8 | 0715d668d046bcc608ea78cd0c2089bd | % Expand a multiple-scan NIFTI file into multiple single-scan NIFTI files
%
% Usage: expand_nii_scan(multi_scan_filename, [img_idx], [path_to_save])
%
% NIFTI data format can be found on: http://nifti.nimh.nih.gov
%
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
%
function expand_nii_scan(filename, img_idx, n... |
github | cbaldassano/Parcellating-connectivity-master | load_untouch_header_only.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/load_untouch_header_only.m | 7,255 | utf_8 | f1210f851ab6610e7656121194cb5c8b | % Load NIfTI / Analyze header without applying any appropriate affine
% geometric transform or voxel intensity scaling. It is equivalent to
% hdr field when using load_untouch_nii to load dataset. Support both
% *.nii and *.hdr file extension. If file extension is not provided,
% *.hdr will be used as default.... |
github | cbaldassano/Parcellating-connectivity-master | bipolar.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/bipolar.m | 2,239 | utf_8 | c860ec93d96b6ab636c985280d79958d | %BIPOLAR returns an M-by-3 matrix containing a blue-red colormap, in
% in which red stands for positive, blue stands for negative,
% and white stands for 0.
%
% Usage: cmap = bipolar(M, lo, hi, contrast); or cmap = bipolar;
%
% cmap: output M-by-3 matrix for BIPOLAR colormap.
% M: number of shades in th... |
github | cbaldassano/Parcellating-connectivity-master | save_nii_hdr.m | .m | Parcellating-connectivity-master/matlab/NIFTI_20130306/save_nii_hdr.m | 9,497 | utf_8 | 66a99df0cb0f3c1f44c6e36dcd13cddf | % internal function
% - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
function save_nii_hdr(hdr, fid)
if ~exist('hdr','var') | ~exist('fid','var')
error('Usage: save_nii_hdr(hdr, fid)');
end
if ~isequal(hdr.hk.sizeof_hdr,348),
error('hdr.hk.sizeof_hdr must be 348.');
end
... |
github | cbaldassano/Parcellating-connectivity-master | CompareConnTypes.m | .m | Parcellating-connectivity-master/matlab/HCP/CompareConnTypes.m | 1,738 | utf_8 | 6864a149739b349da4fc9ab088a49a9f | function [X, Y, P, Xpdf, Ypdf, indep, unsmoothP] = CompareConnTypes(conn_vectors)
diff_lim = 5;
n = size(conn_vectors,1);
bin = zeros(n,2,'uint8');
nbins = [100 diff_lim*10];
edges1 = linspace(-0.1,0.5, nbins(1)+1);
X = edges1(1:end-1) + .5*diff(edges1);
edges2 = linspace(0.001, diff_lim, nbins(2)+1);
Y = edges2(1:end... |
github | cbaldassano/Parcellating-connectivity-master | CoordsToNII.m | .m | Parcellating-connectivity-master/matlab/HCP/CoordsToNII.m | 1,024 | utf_8 | d6b79478e98c3a3e24847e5fab471d66 | function CoordsToNII(coords, vals, max_dist, ref_file, out_file)
if (length(vals) == 1)
vals = vals*ones(size(coords,1),1);
end
ref = load_nii(ref_file);
ref_dim = ref.hdr.dime.dim(2:4);
Smat = [ref.hdr.hist.srow_x; ref.hdr.hist.srow_y; ref.hdr.hist.srow_z];
if (Smat(1,1) < 0)
Smat(1,1) = abs(Smat(1,1));
... |
github | cbaldassano/Parcellating-connectivity-master | SubjSvmWeights.m | .m | Parcellating-connectivity-master/matlab/HCP/SubjSvmWeights.m | 752 | utf_8 | 83e410acf910d061aa6eda0f44905d61 | function [w_col overlay] = SubjSvmWeights(models, parcel_inds)
subj_w = -1*cell2mat(cellfun(@(x) x.SVs'*x.sv_coef, models, 'UniformOutput', false)');
mean_w = mean(subj_w,2);
[~,p] = ttest(subj_w',0,0.05,'right');
sig = p<0.05;
minw = 0;%-0.4;
maxw = 0.4;
numc = 100;
cmap = PTcolormap(numc,[minw maxw]);
col_ind = r... |
github | cbaldassano/Parcellating-connectivity-master | eigs_new.m | .m | Parcellating-connectivity-master/matlab/normcut/eigs_new.m | 60,305 | utf_8 | 9b1b7812a58737132cbce5d867e826b2 | function varargout = eigs(varargin)
%EIGS Find a few eigenvalues and eigenvectors of a matrix using ARPACK
% D = EIGS(A) returns a vector of A's 6 largest magnitude eigenvalues.
% A must be square and should be large and sparse.
%
% [V,D] = EIGS(A) returns a diagonal matrix D of A's 6 largest magnitude
% eige... |
github | cbaldassano/Parcellating-connectivity-master | quadedgep.m | .m | Parcellating-connectivity-master/matlab/normcut/quadedgep.m | 3,430 | utf_8 | 538987b84e5c0c088bd729dc3000bc3d | % function [x,y,gx,gy,par,threshold,mag,mage,g,FIe,FIo,mago] = quadedgep(I,par,threshold);
% Input:
% I = image
% par = vector for 4 parameters
% [number of filter orientations, number of scales, filter size, elongation]
% To use default values, put 0.
% threshold = threshold on edge strength
... |
github | ikarib/DSGE-2015-Apr-master | objfcnmhdsge.m | .m | DSGE-2015-Apr-master/estimation/objfcnmhdsge.m | 8,372 | utf_8 | 02d58f029e83214d2f73d9759ac7d583 | % OVERVIEW
%
%
% This is a dsge likelihood function that can handle 2-part estimation where
% there is a model switch. It also checks that parameters are within certain
% bounds--which is the main difference from dsgelh_2part.m.
%
% HOWEVER, this program is by and large the same as dsgelh_2part.m, save the
% bound-ch... |
github | ikarib/DSGE-2015-Apr-master | adj2part.m | .m | DSGE-2015-Apr-master/estimation/adj2part.m | 403 | utf_8 | 8ce7006804f6dddc4391295b8d8bafb9 | % OVERVIEW
%
% Returns "adj", which is used to adjust the number of variables and sizing for
% 2part models. We need to do this because 555, 556, 557 add another equation
% and state to model a non-iid evolution of the monetary shock. On the other
% hand, 955 already has that
function [ adj ] = adj2part(mspec)
class2... |
github | ikarib/DSGE-2015-Apr-master | dsgelh.m | .m | DSGE-2015-Apr-master/estimation/dsgelh.m | 6,368 | utf_8 | 0f5bbdb66e0e9561d9962a49efac8077 | % OVERVIEW
%
% This is a dsge likelihood function that can handle 2-part estimation where
% there is a model switch.
%
% HOWEVER, this program is by and large the same as objfcnmhdsge_2part.m, save
% the bound-checking. Therefore, the code has been substantially consolidated
% and much of the code supporting the operat... |
github | ikarib/DSGE-2015-Apr-master | get_start_ant.m | .m | DSGE-2015-Apr-master/estimation/get_start_ant.m | 989 | utf_8 | 4cad7ac6742ecdd783ebdf0eddff1134 | % OVERVIEW
%
% Returns the starting indices for the anticipated policy shock states and
% shocks. Very model-class specific
function [start_ant_state, start_ant_shock, revol_ind] = get_start_ant(mspec, nant)
class2part;
% Set the starting indices for states and shocks corresponding to anticipated
% policy sho... |
github | ikarib/DSGE-2015-Apr-master | dsgelh_getNoZB.m | .m | DSGE-2015-Apr-master/estimation/dsgelh_getNoZB.m | 2,143 | utf_8 | 6216e7542ab564e481319c08a41b844c | % OVERVIEW
%
% This function pulls out the state equation matrices for the models WITHOUT
% anticipated policy shocks (model 510, 904, etc), from the state equation
% matrics for the models WITH anticipated policy shocks (e.g. 555, 557, 955).
% This is because the models WITH anticipated shocks contain the models WITHO... |
github | ikarib/DSGE-2015-Apr-master | dsgelh_partition.m | .m | DSGE-2015-Apr-master/estimation/dsgelh_partition.m | 1,009 | utf_8 | a87587ea8e20b7b002f7babbb9d52e92 | % OVERVIEW
%
% This function will partition the sample for estimation purposes,
% accommodating 2-part estimation if relevant.
%
% Returns a structure array where size = number of distinct periods (presample,
% normal, ZB, etc.). The mt struture will hold the relevant matrices for each
% period.
function [mt, pd] = ds... |
github | ikarib/DSGE-2015-Apr-master | is2part.m | .m | DSGE-2015-Apr-master/estimation/is2part.m | 158 | utf_8 | 6a249cf54bffde66608809a0501778bc | % OVERVIEW
%
% Function checks if a model is a two part model
function [ yesno ] = is2part(mspec)
class2part;
yesno = (any(mspec == class2part_all));
end
|
github | ikarib/DSGE-2015-Apr-master | figspecs.m | .m | DSGE-2015-Apr-master/plotting/figspecs.m | 7,167 | utf_8 | a2716b3b091cbe87783ea44f18fef779 | % figspecs.m will output specifications for each type of product and figure
function [Xaxis,Yaxis,Title,line,lgnd,plotSeparate] = ...
figspecs(V_a,V_1,mspec,peachcount,plotType,...
varnames,varnames_YL,varnames_YL_4Q,Vseq,Vseq_alt,nobs,Idate,Startdate,Enddate,...
sirf,sirf_shockdec,sirf_counter,sirf_sho... |
github | ikarib/DSGE-2015-Apr-master | dsgesolv.m | .m | DSGE-2015-Apr-master/dsgesolv/dsgesolv.m | 5,576 | utf_8 | 288ad7510d38277bd36505931c1def66 | % OVERVIEW
% dsgesolv.m finds a solution to the DSGE model with an input parameter vector.
% To help construct the G0, G1, C, PSI, and PIE matrices, which are used to
% express the model in canonical form, the following programs are called
% (1) getpara<>.m: assigns a parameter name to ... |
github | ikarib/DSGE-2015-Apr-master | forecastFcn_est_ant.m | .m | DSGE-2015-Apr-master/forecast/forecastFcn_est_ant.m | 17,749 | utf_8 | dc69f3087913fa8c24e6d34dd0ff26b6 | % OVERVIEW
% forecastFcn_est_ant.m: a function called on by forecast_mode_est_ant.m. This
% function takes draws allocated each worker to calculate
% forecasts, counterfactuals, shock decompositions, and
% smoothed
% shock est... |
github | ikarib/DSGE-2015-Apr-master | augmentStates.m | .m | DSGE-2015-Apr-master/forecast/augmentStates.m | 1,902 | utf_8 | 81cc41e6a3bf9ca0f0705a66d2e7020b | % OVERVIEW
%
% This function expands the number of states to accomodate extra states for the
% anticipated policy shocks. It does so by taking the zend and Pend for the
% state space without anticipated policy shocks, then shoves in nant (or
% nant+1, see below) zeros in the middle of zend and Pend in the location of
%... |
github | ikarib/DSGE-2015-Apr-master | setOutfiles.m | .m | DSGE-2015-Apr-master/forecast/setOutfiles.m | 5,648 | utf_8 | 6c5d4a0f55f3854cc4c4d960af34490b | % OVERVIEW
% setOutfiles.m creates variable outfile, where each field name is a type of
% data that we want to write (ie forecast or shockdec).
% Each field of outfile is the name of the output file.
%
% IMPORTANT VARIABLES
% outfile: a structure where each field name is a type of
% ... |
github | ikarib/DSGE-2015-Apr-master | ExpFFR_OIS.m | .m | DSGE-2015-Apr-master/data/ExpFFR_OIS.m | 4,368 | utf_8 | a4c55d1165b193e3cc6ee9ce5490fcfc |
%% Loads in expected FFR derived from OIS quotes
function [ExpFFR,peachdata_FFR] = ExpFFR_OIS(nant,antlags,psize,zerobound,peachflag)
% 2008-Q4 expectations (from Jan-2009 BCFF survey, conducted mid-/end- of Dec-2008)
ExpFFR(1,:) = [0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 2.1 2.2 2.4];
% % 2009-Q1 expectations (f... |
github | ikarib/DSGE-2015-Apr-master | loaddata.m | .m | DSGE-2015-Apr-master/initialization/loaddata.m | 4,710 | utf_8 | 89010a19a6ec3a138a9168ee21ad67b5 | %% loaddata
%
% Description: reads time series data from ASCII
% Output:
% 1) YYall ---> matrix of observables
% 2) XXall --->
% 3) ti -->
% 4) nobs --> number of periods in data imported
% 4) dlpopall --> log differences of the population obtained from Haver Analaytics
% 5... |
github | ikarib/DSGE-2015-Apr-master | mspec_add.m | .m | DSGE-2015-Apr-master/initialization/mspec_add.m | 5,286 | utf_8 | 25c146a6cab91c28aa898ff227cfed97 |
function [nvar,varnames,graph_title,cum_for,popadj,varnames_YL,varnames_irfs,varnames_YL_4Q,varnames_YL_irfs,...
names_shocks,names_shocks_title,nl_shocks_title,shocksnames,cum_irf,vardec_varnames,shockcats,list,shockdec_color] = mspec_add(mspec,dataset,zerobound,nant,fourq_flag)
eval(['states',num2str(mspec)]);
... |
github | ikarib/DSGE-2015-Apr-master | getState.m | .m | DSGE-2015-Apr-master/initialization/getState.m | 419 | utf_8 | e507dfeee3a7ef500952ff790e6f475f | % OVERVIEW
% getState.m gets the numerical index for a state. This function replaces
% getE_pi.m, getpigap_t.m, getr_sh.m, getrt.m, getR_t.m
%
% INPUTS
% name: the state name as a string
%
% OUTPUTS
% stateNum: state's numerical index
%
% EXAMPLE:
% r_sh = getState(mspec,nant,'r_sh')
% returns r_sh = 10
function stat... |
github | ikarib/DSGE-2015-Apr-master | transp990.m | .m | DSGE-2015-Apr-master/initialization/transp990.m | 3,792 | utf_8 | 3da321b460c2f157f083fb3b6a17074e | %% Transformations:
%% format: [type, a, b, c]
%% Type 1:
%% x is [a,b] -> [-1,1] -> [-inf,inf] by (1/c)*c*z/sqrt(1-c*z^2)
%% Type 2:
%% x is [0,inf] -> [-inf,inf] by b + (1/c)*ln(para[i]-a);
function trspec = transp990(mspec)
trspec = zeros(100,4);
nantpad = 20;
trspec(1,:) = [1 1E-5 .999 1]; %% alp;
trspe... |
github | ikarib/DSGE-2015-Apr-master | getpara00_990.m | .m | DSGE-2015-Apr-master/initialization/getpara00_990.m | 8,973 | utf_8 | 5a1f1db12610e29cc311727d2be24efd | function [alp,zeta_p,iota_p,del,ups,Bigphi,s2,h,ppsi,nu_l,zeta_w,iota_w,law,laf,bet,Rstarn,psi1,psi2,psi3,pistar,sigmac,rho,epsp,epsw...
gam,Lmean,Lstar,gstar,rho_g,rho_b,rho_mu,rho_z,rho_laf,rho_law,rho_rm,rho_sigw,rho_mue,rho_gamm,rho_pist,rho_lr,rho_zp,rho_tfp,rho_gdpdef,rho_pce,...
sig_g,sig_b,sig_mu,sig_z,... |
github | ikarib/DSGE-2015-Apr-master | priors990.m | .m | DSGE-2015-Apr-master/initialization/priors990.m | 3,905 | utf_8 | cfb3ecb951c7f583de2746aebb9dae73 | % Define Prior parameters
% pshape is 1: BETA(mean,stdd)
% 2: GAMMA(mean,stdd)
% 3: NORMAL(mean,stdd)
% 4: INVGAMMA(s^2,nu)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% loose lambda_f prior %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function prior = pri990
prior = zero... |
github | ikarib/DSGE-2015-Apr-master | augmentSmoother.m | .m | DSGE-2015-Apr-master/kalman/augmentSmoother.m | 3,685 | utf_8 | 51ca184b9b489a57d6e02cf9d6653eb0 | % OVERVIEW
% augmentSmoother.m augments output matrices to accomodate
% additional states for anticipated shocks.
%
% The state transition equation is: S_t = TTT*S_t-1+RRR*eps_t
% The measurement equation is: Y_t = ZZ*S_t+DD
%
% INPUTS
% r_tlx, r_tl1:
% nant: number of anticipated shocks
% antlags... |
github | ikarib/DSGE-2015-Apr-master | augmentFilter.m | .m | DSGE-2015-Apr-master/kalman/augmentFilter.m | 5,098 | utf_8 | adabbde2cf6d62bb982fae8e1255f6b2 | % OVERVIEW
% augmentFilter.m augments the output matrices in order to
% accomodate additional states for anticipated shocks:
%
% The state transition equation is: S_t = TTT*S_t-1+RRR*eps_t
% The measurement equation is: Y_t = ZZ*S_t+DD
%
% INPUTS
% r_tl1: For new, augmented state vector, this is the ... |
github | yang123vc/LTE-Cell-Scanner-master | gather_format_signal_file_for_future.m | .m | LTE-Cell-Scanner-master/regression_test_signal_file/gather_format_signal_file_for_future.m | 7,268 | utf_8 | adfd3fd14914375018cdb622ac2beaca | function gather_format_signal_file_for_future
clear all; close all;
rtlsdr_remove_header_and_save_as('~/git/rtl-sdr-LTE/scan-capture/frequency-1850-1880MHz/f1860_s1.92_g0_1s_strong.bin', 'f1860_s1.92_g0_1s_strong_rtlsdr.bin');
rtlsdr_remove_header_and_save_as('~/git/rtl-sdr-LTE/scan-capture/frequency-1850-1880MHz/f186... |
github | dkramnik/Eagle-Public-master | leaf_heater_regulate_temp_simple.m | .m | Eagle-Public-master/meng-plant-raman/MATLAB/controller-rev1/basic_demo/leaf_heater_regulate_temp_simple.m | 2,513 | utf_8 | 5ebdde17c0309c6aa6a6ff05ea119b79 | % Clean up
close all
clear
clc
delete( instrfind );
dotimer
% This is a hack to give the timer callback function access to variables
function dotimer
% Open serial instruments
instruments.TEMP_SENSOR = leaf_heater_open_serial( [ ] );
instruments.SMU = visa( 'ni', 'GPIB0::23::INSTR' );
fopen( instruments.SMU );
fpr... |
github | dkramnik/Eagle-Public-master | leaf_heater_monitor_temp.m | .m | Eagle-Public-master/meng-plant-raman/MATLAB/controller-rev1/basic_demo/leaf_heater_monitor_temp.m | 1,169 | utf_8 | 4317abed03df521b2c3da356bbbdafef | close all
clear
clc
% Clean up
delete( instrfind );
%% Open serial instrument
TEMP_SENSOR = leaf_heater_open_serial( [ ] );
%% Start collecting and plotting data
figure();
temp_array = [];
time_array = [];
t = timer;
t.BusyMode = 'error'; % Throw error if timer fires during callback function execution
t.Executi... |
github | dkramnik/Eagle-Public-master | leaf_heater_regulate_temp_simple.m | .m | Eagle-Public-master/meng-plant-raman/MATLAB/controller-rev2/basic_demo/leaf_heater_regulate_temp_simple.m | 2,513 | utf_8 | 5ebdde17c0309c6aa6a6ff05ea119b79 | % Clean up
close all
clear
clc
delete( instrfind );
dotimer
% This is a hack to give the timer callback function access to variables
function dotimer
% Open serial instruments
instruments.TEMP_SENSOR = leaf_heater_open_serial( [ ] );
instruments.SMU = visa( 'ni', 'GPIB0::23::INSTR' );
fopen( instruments.SMU );
fpr... |
github | dkramnik/Eagle-Public-master | leaf_heater_monitor_temp.m | .m | Eagle-Public-master/meng-plant-raman/MATLAB/controller-rev2/basic_demo/leaf_heater_monitor_temp.m | 1,169 | utf_8 | 4317abed03df521b2c3da356bbbdafef | close all
clear
clc
% Clean up
delete( instrfind );
%% Open serial instrument
TEMP_SENSOR = leaf_heater_open_serial( [ ] );
%% Start collecting and plotting data
figure();
temp_array = [];
time_array = [];
t = timer;
t.BusyMode = 'error'; % Throw error if timer fires during callback function execution
t.Executi... |
github | vast-wang/Clustering-master | CalculateObj.m | .m | Clustering-master/Code_MVCC/CalculateObj.m | 773 | utf_8 | 1338c33a9cf9a43915f5f0b0b79a3a1a | %% Calculate objective function
function [obj_NMF, obj_Lap, obj_VVc, obj_Pi] = CalculateObj(data, W, V, L,Vcon, options, pai, view_num)
tempNMF = zeros(1,view_num);
tempLap = zeros(1,view_num);
tempVVc = zeros(1,view_num);
tempPi = zeros(1,view_num);
for i = 1:view_num
KW = data{i}*W{i};
KWV = KW*V{i}... |
github | vast-wang/Clustering-master | litekmeans.m | .m | Clustering-master/Code_MVCC/litekmeans.m | 15,553 | utf_8 | 06167b010478bdc709da450bba421565 | function [label, center, bCon, sumD, D] = litekmeans(X, k, varargin)
%LITEKMEANS K-means clustering, accelerated by matlab matrix operations.
%
% label = LITEKMEANS(X, K) partitions the points in the N-by-P data matrix
% X into K clusters. This partition minimizes the sum, over all
% clusters, of the within... |
github | ltyscu/superResolution_sparseRepresentation-master | l2ls_learn_basis_dual.m | .m | superResolution_sparseRepresentation-master/solver_sparseCoding/l2ls_learn_basis_dual.m | 2,371 | utf_8 | c186ba98bb109153d97867df8489ca4b | function B = l2ls_learn_basis_dual(X, S, l2norm, Binit)
% Learning basis using Lagrange dual (with basis normalization)
%
% This code solves the following problem:
%
% minimize_B 0.5*||X - B*S||^2
% subject to ||B(:,j)||_2 <= l2norm, forall j=1...size(S,1)
%
% The detail of the algorithm is describe... |
github | ltyscu/superResolution_sparseRepresentation-master | l1ls_featuresign.m | .m | superResolution_sparseRepresentation-master/solver_sparseCoding/l1ls_featuresign.m | 7,403 | utf_8 | 45a3b69aedbcba3d4d2655651475961d | function Xout = l1ls_featuresign (A, Y, gamma, Xinit)
% The feature-sign search algorithm
% L1-regularized least squares problem solver
%
% This code solves the following problem:
%
% minimize_s 0.5*||y - A*x||^2 + gamma*||x||_1
%
% The detail of the algorithm is described in the following paper:
% 'Effic... |
github | ltyscu/superResolution_sparseRepresentation-master | sparse_coding.m | .m | superResolution_sparseRepresentation-master/solver_sparseCoding/sparse_coding.m | 7,494 | utf_8 | 78d19babbcc5196c187226e728042870 | function [B S stat] = sparse_coding(X_total, num_bases, beta, sparsity_func, epsilon, num_iters, batch_size, fname_save, pars, Binit, resample_size)
% Fast sparse coding algorithms
%
% minimize_B,S 0.5*||X - B*S||^2 + beta*sum(abs(S(:)))
% subject to ||B(:,j)||_2 <= l2norm, forall j=1...size(S,1)
%
% T... |
github | ltyscu/superResolution_sparseRepresentation-master | itrBackProjection.m | .m | superResolution_sparseRepresentation-master/src/itrBackProjection.m | 2,250 | utf_8 | ce689f22bf17bb7b583fbbc596e5714b | %%
% Implements iterated back-projection in the super-resolution algorithm in the paper
% [1] "Image Super-Resolution as Sparse Representation of Raw Image Patches" by
% Jianchao Yang ; ECE Dept., Univ. of Illinois at Urbana-Champaign, Urbana, IL ;
%itrBackProjection2() is the algorithm described in the above 08' pap... |
github | ltyscu/superResolution_sparseRepresentation-master | dict_sample.m | .m | superResolution_sparseRepresentation-master/src/dict_sample.m | 3,793 | utf_8 | 4e35e083e246262fff531cb0b2a35a8b | %dictionary training
function [Y,sizeh,sizel]=dict_sample(imgDir,noPatches, codebookSize,scale,patch_sizel,overlap)
%written by Shiv Surya
%use this sparsecoding library for training dictionary
%http://web.eecs.umich.edu/~honglak/softwares/nips06-sparsecoding.htm
%populate statistics of training image
imgList=dir(... |
github | ltyscu/superResolution_sparseRepresentation-master | SR.m | .m | superResolution_sparseRepresentation-master/src/SR.m | 6,054 | utf_8 | 6955cf9657fec730883f81bac7134c3f | %%
% Implements the super-resolution algorithm in the paper
% [1] "Image Super-Resolution as Sparse Representation of Raw Image Patches" by
% Jianchao Yang ; ECE Dept., Univ. of Illinois at Urbana-Champaign, Urbana, IL ;
% Wright, J. ; Huang, T. ; Yi Ma
% Code by Shiv Surya,
% Graduate student,
% Electrical engineer... |
github | frostinassiky/NMR-Metabolite-Profiling-master | TournamentSelection.m | .m | NMR-Metabolite-Profiling-master/Metabolite Qulification/TournamentSelection.m | 596 | utf_8 | 5209437d63bc3cadea2c2b12f1a48058 | %
% Copyright (c) 2015, Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the "license.txt" for license terms.
%
% Project Code: YPEA101
% Project Title: Implementation of Real-Coded Genetic Algorithm in MATLAB
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yar... |
github | frostinassiky/NMR-Metabolite-Profiling-master | Crossover.m | .m | NMR-Metabolite-Profiling-master/Metabolite Qulification/Crossover.m | 682 | utf_8 | 4fdcf0da38e58382b1251f78fc6c220a | %
% Copyright (c) 2015, Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the "license.txt" for license terms.
%
% Project Code: YPEA101
% Project Title: Implementation of Real-Coded Genetic Algorithm in MATLAB
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yar... |
github | frostinassiky/NMR-Metabolite-Profiling-master | RouletteWheelSelection.m | .m | NMR-Metabolite-Profiling-master/Metabolite Qulification/RouletteWheelSelection.m | 511 | utf_8 | e2a848e659774c85d1c0de90ec1cb0ad | %
% Copyright (c) 2015, Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the "license.txt" for license terms.
%
% Project Code: YPEA101
% Project Title: Implementation of Real-Coded Genetic Algorithm in MATLAB
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yar... |
github | frostinassiky/NMR-Metabolite-Profiling-master | Mutate.m | .m | NMR-Metabolite-Profiling-master/Metabolite Qulification/Mutate.m | 670 | utf_8 | 856e5ac5dec0d2dcbc28b7fc037e6354 | %
% Copyright (c) 2015, Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the "license.txt" for license terms.
%
% Project Code: YPEA101
% Project Title: Implementation of Real-Coded Genetic Algorithm in MATLAB
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.