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 | Brain-Modulation-Lab/bml-master | permutationTest.m | .m | bml-master/stat/permutationTest.m | 7,376 | utf_8 | 835d2df86b9402893d58e70d59cca7b7 | % [p, observeddifference, effectsize] = permutationTest(sample1, sample2, permutations [, varargin])
%
% Permutation test (aka randomisation test), testing for a difference
% in means between two samples.
%
% In:
% sample1 - vector of measurements from one (experimental) sample
% sample2 - vect... |
github | Brain-Modulation-Lab/bml-master | bml_annot_consolidate.m | .m | bml-master/annot/bml_annot_consolidate.m | 5,342 | utf_8 | ad62572c50564017216b36c6c8bb9e89 | function cons = bml_annot_consolidate(cfg, annot)
% BML_ANNOT_CONSOLIDATE returns a consolidated annotation table
%
% Use as
% cons = bml_annot_consolidate(cfg, annot);
% cons = bml_annot_consolidate(annot);
%
% The first argument cfg is a configuration structure, which can contain
% the following field:
% cfg.cri... |
github | Brain-Modulation-Lab/bml-master | bml_coding2annot.m | .m | bml-master/annot/bml_coding2annot.m | 28,895 | utf_8 | 752f7b7b1cda1913994d1d7a52186e1f | function annot = bml_coding2annot(cfg)
% BML_CODING2ANNOT creates annotation table from CodingMatrix
%
% Use as
% annot = bml_codingmatrix2annot(cfg)
%
% cfg.CodingMatPath - path to mat file with coding info
% cfg.EventsPerTrial - double, defaults depends on CodingAppVersion
% cfg.roi - roi table ... |
github | paultimothymooney/Data-Projects-master | fret_correct.m | .m | Data-Projects-master/Random/MATLAB/Useful scripts from Hoffman Lab/fret_correct.m | 8,355 | utf_8 | b531c86da0d93dc0ee87aad35423d58e | function fret_correct(aexp,dexp,fexp,abtfn,dbtfn,varargin)
% outputs = fret_correct(af,df,fr,abtfn,dbtfn,params)
% outputs = fret_correct(af,df,fr,abtfn,dbtfn,baf,bdf,bfr,params)
% PURPOSE: A program to remove the intensity in a set of FRET images due to
% bleed-throughs or cross-talks. Can do linear or non-linea... |
github | paultimothymooney/Data-Projects-master | fret_bledth.m | .m | Data-Projects-master/Random/MATLAB/Useful scripts from Hoffman Lab/fret_bledth.m | 15,227 | utf_8 | 3d1b0ad59971ac2997ba11373997cc29 | function [abt,dbt] = fret_bledth(doa,dod,dof,varargin)
% files = fret_bledth(doaf,dodf,dofr,param)
% files = fret_bledth(doaf,dodf,dofr,baf,bdf,brd,param)
% files = fret_bledth(doaf,dodf,dofr,baf,bdf,brd,aoaf,aodf,aofr,param)
% PURPOSE: Calculate the bleed-throughs and cross-talk associated with FRET
% imaging. ... |
github | 26hzhang/OptimizedImageEnhance-master | Sift.m | .m | OptimizedImageEnhance-master/matlab/Sift.m | 25,130 | utf_8 | 8801fad8ac6769b01edbd9b10d2cea9c | function [frames,descriptors,gss,dogss]=Sift(I,varargin)
% SIFT Extract SIFT features
% [FRAMES,DESCR]=SIFT(I) extracts the SIFT frames FRAMES and their
% descriptors DESCR from the image I.
%
% The image I must be gray-scale, of storage class DOUBLE and
% ranging in [0,1].
%
% FRAMES is a 4xK matrix ... |
github | 26hzhang/OptimizedImageEnhance-master | bilateralFilter.m | .m | OptimizedImageEnhance-master/matlab/bilateralFilter.m | 6,703 | utf_8 | a76d6aab0840ad8b7e6e749526f36660 | %
% output = bilateralFilter( data, edge, ...
% edgeMin, edgeMax, ...
% sigmaSpatial, sigmaRange, ...
% samplingSpatial, samplingRange )
%
% Bilateral and Cross-Bilateral Filter using the Bilateral Grid.
%
% Bilaterally filters the image 'data' ... |
github | damien911224/theWorldInSafety-master | extractOpticalFlow_gpu.m | .m | theWorldInSafety-master/actionRecognition/lib/dense_flow_cpu/matlab/extractOpticalFlow_gpu.m | 1,645 | utf_8 | e184fc7aad7743036e394d6b08ba37f9 |
function [] = extractOpticalFlow_gpu(index, device_id, type)
% path1 = '/nfs/lmwang/lmwang/Data/UCF101/ucf101_org/';
% if type ==0
% path2 = '/media/sdb/lmwang/data/UCF101/ucf101_flow_img_farn_gpu_step_2/';
% elseif type ==1
% path2 = '/media/sdb/lmwang/data/UCF101/ucf101_flow_img_tvl1_gpu_step_2/';
% else
% ... |
github | damien911224/theWorldInSafety-master | extracOpticalFlow.m | .m | theWorldInSafety-master/actionRecognition/lib/dense_flow_cpu/matlab/extracOpticalFlow.m | 1,034 | utf_8 | 87c098785c996cfa862cd7e84742994e |
function [] = extracOpticalFlow(index)
path1 = '/home/lmwang/data/UCF/ucf101_org/';
path2 = '/home/lmwang/data/UCF/ucf101_warp_flow_img/';
folderlist = dir(path1);
foldername = {folderlist(:).name};
foldername = setdiff(foldername,{'.','..'});
for i = index
if ~exist([path2,foldername{i}],'dir')
mkdir([p... |
github | damien911224/theWorldInSafety-master | extractOpticalFlow.m | .m | theWorldInSafety-master/actionRecognition/lib/dense_flow_cpu/matlab/extractOpticalFlow.m | 1,042 | utf_8 | e73edca68bee408e232e58e19e2aae1b |
function [] = extractOpticalFlow(index)
path1 = '/nfs/lmwang/lmwang/Data/UCF101/ucf101_org/';
path2 = '/media/sdb/lmwang/data/UCF101/ucf101_flow_img_TV/';
folderlist = dir(path1);
foldername = {folderlist(:).name};
foldername = setdiff(foldername,{'.','..'});
for i = index
if ~exist([path2,foldername{i}],'dir')
... |
github | damien911224/theWorldInSafety-master | classification_demo.m | .m | theWorldInSafety-master/actionRecognition/lib/caffe-action/matlab/demo/classification_demo.m | 5,412 | utf_8 | 8f46deabe6cde287c4759f3bc8b7f819 | function [scores, maxlabel] = classification_demo(im, use_gpu)
% [scores, maxlabel] = classification_demo(im, use_gpu)
%
% Image classification demo using BVLC CaffeNet.
%
% IMPORTANT: before you run this demo, you should download BVLC CaffeNet
% from Model Zoo (http://caffe.berkeleyvision.org/model_zoo.html)
%
% *****... |
github | damien911224/theWorldInSafety-master | extractOpticalFlow_gpu.m | .m | theWorldInSafety-master/actionRecognition/lib/dense_flow/matlab/extractOpticalFlow_gpu.m | 1,645 | utf_8 | e184fc7aad7743036e394d6b08ba37f9 |
function [] = extractOpticalFlow_gpu(index, device_id, type)
% path1 = '/nfs/lmwang/lmwang/Data/UCF101/ucf101_org/';
% if type ==0
% path2 = '/media/sdb/lmwang/data/UCF101/ucf101_flow_img_farn_gpu_step_2/';
% elseif type ==1
% path2 = '/media/sdb/lmwang/data/UCF101/ucf101_flow_img_tvl1_gpu_step_2/';
% else
% ... |
github | damien911224/theWorldInSafety-master | extracOpticalFlow.m | .m | theWorldInSafety-master/actionRecognition/lib/dense_flow/matlab/extracOpticalFlow.m | 1,034 | utf_8 | 87c098785c996cfa862cd7e84742994e |
function [] = extracOpticalFlow(index)
path1 = '/home/lmwang/data/UCF/ucf101_org/';
path2 = '/home/lmwang/data/UCF/ucf101_warp_flow_img/';
folderlist = dir(path1);
foldername = {folderlist(:).name};
foldername = setdiff(foldername,{'.','..'});
for i = index
if ~exist([path2,foldername{i}],'dir')
mkdir([p... |
github | damien911224/theWorldInSafety-master | extractOpticalFlow.m | .m | theWorldInSafety-master/actionRecognition/lib/dense_flow/matlab/extractOpticalFlow.m | 1,042 | utf_8 | e73edca68bee408e232e58e19e2aae1b |
function [] = extractOpticalFlow(index)
path1 = '/nfs/lmwang/lmwang/Data/UCF101/ucf101_org/';
path2 = '/media/sdb/lmwang/data/UCF101/ucf101_flow_img_TV/';
folderlist = dir(path1);
foldername = {folderlist(:).name};
foldername = setdiff(foldername,{'.','..'});
for i = index
if ~exist([path2,foldername{i}],'dir')
... |
github | dabamos/openadms-server-master | api.m | .m | openadms-server-master/examples/clients/octave/api.m | 1,685 | utf_8 | 96ec2c25505068abb0665ba993068e3d | ################################################################################
# OpenADMS Server API Access Example
################################################################################
# Run inside the command window:
# >> source("api.m");
# >> source("profile.m");
# >> data = get_json(host, user, p... |
github | nsdesai/dynamic_clamp-master | DC.m | .m | dynamic_clamp-master/matlab_alternative/DC.m | 3,479 | utf_8 | ff97efa3d0178044850c872645730cf4 | % Matlab script to communicate with the Teensy 3.6 when it is in dynamic
% clamp mode.
%
% Calling DC without arguments opens the GUI and initializes all the
% numbers at 0.0.
%
% The GUI calls the subfunctions by passing arguments.
%
% Last modified 06/11/17.
function [] = DC(varargin)
if (nargin==0) ... |
github | mribri999/MRSignalsSeqs-master | lin.m | .m | MRSignalsSeqs-master/Lecture-Examples/lin.m | 291 | utf_8 | 0b4623bc8e1b70a0bca534fc35e56d28 | % This function linearizes a matrix (m) of any dimension (eg M=m(:)).
% If an index vector (ind) is given then the the ind entries of m(:) are
% returned.
%
% SYNTAX: m=lin(m);
% m=lin(m,ind);
%
% DBE 12/22/03
function m=lin(m,ind);
m=m(:);
if nargin==2
m=m(ind);
end
return |
github | mribri999/MRSignalsSeqs-master | rot3d.m | .m | MRSignalsSeqs-master/Lecture-Examples/rot3d.m | 280 | utf_8 | ddd58619ab5636f2789e146fd9e9a07e | % This function simply activates the camer toolbar and allows 3D rotation
%
% Uses: cameratoolbar('SetMode','orbit','SetCoordSys','none');
%
% DBE 12/29/02
function rot3d
cameratoolbar('Show');
cameratoolbar('SetMode','orbit');
cameratoolbar('SetCoordSys','none');
return |
github | mribri999/MRSignalsSeqs-master | csens2d.m | .m | MRSignalsSeqs-master/Matlab/csens2d.m | 942 | utf_8 | bb28eb1175ba75749a0a6c9d861be532 | %
% function [ncs,cs] = csens2d(klow)
%
% Function calculates 2D coil sensitivities from an array klow,
% that is a calibration region (ie mostly zero except near the
% center.
%
% INPUT:
% klow = Nx x Ny x Nc matrix
%
% OUTPUT:
% ncs = coil sensitivities, normalized by RMS
% cs = coil sensitivities, raw
% cmrms =... |
github | mribri999/MRSignalsSeqs-master | plotgradinfo.m | .m | MRSignalsSeqs-master/Matlab/plotgradinfo.m | 3,718 | utf_8 | 52ec061fe9e274ac50b1fd0f861894e2 | %
% function [k,g,s,m1,m2,t,v]=plotgradinfo(g,T,k0)
%
% Function makes a nice plot given a 2D gradient waveform.
%
% INPUT:
% g gradient (G/cm) = gx + i*gy, or Nx2, Nx3 or Nx4.
% T sample period (s)
% k0 initial condition for k-space.
%
% OUTPUT:
% k k-space trajectory (cm^(-1))
% g gradient (G/cm)
% s slew rate ... |
github | mribri999/MRSignalsSeqs-master | epg_gradecho.m | .m | MRSignalsSeqs-master/Matlab/epg_gradecho.m | 3,862 | utf_8 | 60eaf73a6815f16315b3249214cc1cda | % function [s,phasediag,FZ] = epg_gradecho(flipangle,T1,T2,TR,TE,rfdphase,rfdphaseinc,gspoil,dfreq,N)
%
% EPG simulation of any gradient-echo sequence:
% (a) balanced SSFP
% (b) gradient spoiling
% (c) reversed gradient spoiling
% (d) RF spoiling
% (e) Perfect spoiling
%
% INPUT:
% flipangle = flip angle i... |
github | mribri999/MRSignalsSeqs-master | epg_gradspoil.m | .m | MRSignalsSeqs-master/Matlab/epg_gradspoil.m | 1,596 | utf_8 | e3198d6aadc9e77ccb34e81b1a38966b | % function [s,phasediag,P] = epg_gradspoil(flipangle,N,T1,T2,TR)
%
% EPG Simulation of Gradient-spoiled sequence.
%
% flipangle = flip angle (radians)
% N = number of TRs
% T1,T2,TR = relaxation times and TR
%
% All states are kept, for demo purposes, though this
% is not really necessary.
function [s,phasediag,P] ... |
github | mribri999/MRSignalsSeqs-master | yrot.m | .m | MRSignalsSeqs-master/Matlab/yrot.m | 532 | utf_8 | 3c88674a611fed2de10652231470c9dd | % function [M] = yrot(angle)
%
% Function returns the rotation matrix M such that
% y = Mx rotates a 1x3 cartesian vector about the y axis
% by angle degrees, using a left-handed rotation.
%
% ======================== CVS Log Messages ========================
% $Log: yrot.m,v $
% Revision 1.2 2002/03/28 00:50:12 bah... |
github | mribri999/MRSignalsSeqs-master | gridmat.m | .m | MRSignalsSeqs-master/Matlab/gridmat.m | 3,644 | utf_8 | afcd86ff08365e331425ce6448d70c75 | %
% Function [dat] = gridmat(ksp,kdat,dcf,gridsize)
%
% function performs gridding in Matlab. This is designed to
% be a teaching function, and is not necessarily fast(!), but
% reasonable for 2D gridding.
%
% INPUT:
% ksp = k-space locations, kx+i*ky, normalized to |k|<=0.5, 1/pixel.
% dat = complex d... |
github | mribri999/MRSignalsSeqs-master | zrot.m | .m | MRSignalsSeqs-master/Matlab/zrot.m | 530 | utf_8 | 14f6f75ae9fdf7b82c76961f50fef6e7 | % function [M] = zrot(angle)
%
% Function returns the rotation matrix M such that
% y = Mx rotates a 1x3 cartesian vector about the z axis
% by angle degrees, using a left-handed rotaton.
%
% ======================== CVS Log Messages ========================
% $Log: zrot.m,v $
% Revision 1.2 2002/03/28 00:50:12 bah
... |
github | mribri999/MRSignalsSeqs-master | Rad229_fig_style.m | .m | MRSignalsSeqs-master/Matlab/Rad229_fig_style.m | 3,234 | utf_8 | aae76bd3f690c606f3af2c0411448294 | % This function makes some stylistic figure adjustments.
%
% SYNTAX: PAM_fig_style(handle,aspect,style,invert)
%
% EXAMPLE: PAM_fig_style(gcf,'rect',[],0);
%
% DBE@STANFORD.EDU (March 2021) for Rad229
function Rad229_fig_style(handle,aspect,style,invert)
%% Define the defaults...
if nargin<1, handle=gcf; end
if na... |
github | mribri999/MRSignalsSeqs-master | mc2mr.m | .m | MRSignalsSeqs-master/Matlab/mc2mr.m | 644 | utf_8 | be31adafa98db265334c4f2d3167b16d | %
% function Mr = mc2mr(Mc)
%
% Transform magnetization of the
% complex form [mx+i*my; mx-i*my; mz].
% to the rectilinear form [mx;my;mz]. to
% INPUT:
% 3xN array of rectilinear magnetization [mx;my;mz]
%
% OUTPUT:
% 3xN array of complex magnetization [mx+i*my; mx-i*my; mz]
%
function Mr = mc2mr(Mc)
% -- Check i... |
github | mribri999/MRSignalsSeqs-master | dispangle.m | .m | MRSignalsSeqs-master/Matlab/dispangle.m | 195 | utf_8 | 40c4589aceb98b70dbc698989c7958d7 | %
% function dispangle(arr)
%
% Function displays the angle of the complex data
% on a scale of black=-pi to white=pi.
%
function dispangle(arr)
angarr = angle(arr)+pi;
dispim(angarr,0,2*pi);
|
github | mribri999/MRSignalsSeqs-master | Rad229_Slice_Select_Demo.m | .m | MRSignalsSeqs-master/Matlab/Rad229_Slice_Select_Demo.m | 6,903 | utf_8 | 13d0c7ac57bccd934e9d43c4d9b1911a |
%% Rad229_Slice_Select_Demo – Demonstrate designing both the RF pulse and gradient for slice selection.
%
% SYNTAX - [acq, sys, Gx, Gy, Gz, RF] = Rad229_Slice_Select_Demo(acq, RF);
%
% INPUTS - acq.dz = 10.0e-3; % Slice thickness [m]
%
% RF.alpha = 90; % RF flip angle [degrees]
% ... |
github | mribri999/MRSignalsSeqs-master | ksquare.m | .m | MRSignalsSeqs-master/Matlab/ksquare.m | 1,379 | utf_8 | efb55f2285247497b43ce655a8c5a1d2 | % function kdata = ksquare(center,swidth,kloc,tsamp,df)
%
% Function generates k-space data for a square
% with given center location (cm) and swidth length (cm)
% at the given k-space locations, with the given sampling period
% and off-resonance (Hz)
%
% INPUT:
% center,swidth = describes square, in cm
% center ca... |
github | mribri999/MRSignalsSeqs-master | mr2mc.m | .m | MRSignalsSeqs-master/Matlab/mr2mc.m | 732 | utf_8 | 7dec1eae20e3c60b49c89281c763e1aa | %
% function Mc = mr2mc(Mr)
%
% Transform magnetization of the form [mx;my;mz] to
% complex form [mx+i*my; mx-i*my; mz].
%
% INPUT:
% 3xN array of rectilinear magnetization [mx;my;mz]
% (if 1xN or 2xN, will zero-pad)
%
% OUTPUT:
% 3xN array of complex magnetization [mx+i*my; mx-i*my; mz]
%
function Mc = mr2mc(Mr)
... |
github | mribri999/MRSignalsSeqs-master | bssfp.m | .m | MRSignalsSeqs-master/Matlab/bssfp.m | 507 | utf_8 | 96744d0b445a59428b227ad9fc71605f | % function s = bssfp(a,TR,TE,T1,T2,df)
%
% Calculate the bSSFP signal as a function of parameters
%
% a = flip angle in degrees
% Times in ms, df in Hz
function s = bssfp(flip,TR,TE,T1,T2,df)
E1 = exp(-TR/T1);
E2 = exp(-TR/T2);
flip = flip*pi/180;
phi = 2*pi*df*TR/1000; % Precession over TR (rad)
sf = sin(flip);
cf... |
github | mribri999/MRSignalsSeqs-master | nift.m | .m | MRSignalsSeqs-master/Matlab/nift.m | 247 | utf_8 | b42635fa9b515225c2f86820ee575a50 | % function im = nift(dat)
%
% Function does a centered, normalized inverse 2DFT of the data:
%
% im = ifftshift(ifft2(ifftshift(dat))) * sqrt(length(dat(:)));
function im = nft(dat)
im = ifftshift(ifft2(ifftshift(dat))) * sqrt(length(dat(:)));
|
github | mribri999/MRSignalsSeqs-master | whirl.m | .m | MRSignalsSeqs-master/Matlab/whirl.m | 4,577 | utf_8 | 259921edea3503ca1aeec88927628fc4 | %
% function [g] = whirl(N,res,fov)
%
% Function designs a WHIRL trajectory, as presented by J. Pipe.
% WHIRL should be slightly faster than spiral and TWIRL, as the
% maximum gradient amplitude is reached more quickly.
%
% INPUT:
% N = # interleaves.
% res = resolution in cm (NOT mm).
% fov = field-of-view in c... |
github | mribri999/MRSignalsSeqs-master | xrot.m | .m | MRSignalsSeqs-master/Matlab/xrot.m | 531 | utf_8 | fc2b5f31aff687cb23ec7bf18b369dbb | % function [M] = xrot(angle)
%
% Function returns the rotation matrix M such that
% y = Mx rotates a 1x3 cartesian vector about the x axis
% by angle degrees, using a left-handed rotation.
%
% ======================== CVS Log Messages ========================
% $Log: xrot.m,v $
% Revision 1.2 2002/03/28 00:50:12 bah... |
github | mribri999/MRSignalsSeqs-master | grid_phantom.m | .m | MRSignalsSeqs-master/Matlab/grid_phantom.m | 1,342 | utf_8 | c49a29850f1fa9463b4ce8f67569a6a6 | % This function creates a simple grid-pattern phantom.
%
% SYNTAX - grid_im = grid_phantom(imsize)
%
% INPUT - imsize - integer that defines square matrix size
%
% OUTPUT - grid_im - Image of a circular phantom with a grid pattern
%
% Original code creation by Michael Loecher. DBE@STANFORD.EDU (April 2020 for ... |
github | mribri999/MRSignalsSeqs-master | get_stim.m | .m | MRSignalsSeqs-master/Matlab/get_stim.m | 1,229 | utf_8 | d421c1a26df13cf49d1e908f84edaba7 | % GET_STIM Summary of this function goes here
%
% Reference: "Peripheral Nerve Stimulation-Optimal GradientWaveform Design"
% Rolf F. Schulte1 and Ralph Noeske
% https://onlinelibrary.wiley.com/doi/epdf/10.1002/mrm.25440
%
% Detailed explanation goes here...
%
% MLoecher@STANFORD.EDU (March 2020... |
github | mribri999/MRSignalsSeqs-master | epg_spins2FZ.m | .m | MRSignalsSeqs-master/Matlab/epg_spins2FZ.m | 1,065 | utf_8 | 1e07562d41c0a6e336e15c251927765f | %function [FpFmZ] = epg_spins2FZ(M,trim)
%
% Function converts a 3xQ array of vectors to EPG states F+,F- and Z,
% with Q representing the dimension across a voxel. Note that it
% is not realistic to have more than floor(Q/2)+1 states, since M
% is real-valued and the F states can be complex.
%
% INPUT:
% M = [Mx My ... |
github | mribri999/MRSignalsSeqs-master | nft.m | .m | MRSignalsSeqs-master/Matlab/nft.m | 230 | utf_8 | 5fe423f4805f1a08b5eaf72ee8b204d1 | % function im = nft(dat)
%
% Function does a centered, normalized 2DFT of the data:
%
% im = fftshift(fft2(fftshift(dat)))/sqrt(length(dat(:)));
function im = nft(dat)
im = fftshift(fft2(fftshift(dat))) / sqrt(length(dat(:)));
|
github | mribri999/MRSignalsSeqs-master | epg_grad.m | .m | MRSignalsSeqs-master/Matlab/epg_grad.m | 874 | utf_8 | 39dd6f49ede899ea6a221825e7914cf9 | %
%function [FpFmZ] = epg_grad(FpFmZ,noadd)
% Propagate EPG states through a "unit" gradient.
%
% INPUT:
% FpFmZ = 3xN vector of F+, F- and Z states.
% noadd = 1 to NOT add any higher-order states - assume
% that they just go to zero. Be careful - this
% speeds up simulations, but may compromise accuracy!
%
% O... |
github | mribri999/MRSignalsSeqs-master | relax.m | .m | MRSignalsSeqs-master/Matlab/relax.m | 498 | utf_8 | 03fa5fcf79e37d4cd0722187418b6749 | %
% function [A,B] = relax(T,T1,T2,combine)
%
% Function returns A matrix and B vector for
% relaxation over time T, with relaxation times T1 and T2,
% such that m' = A*m+B where m and m' are the magnetization before
% and after the relaxation.
%
% If combine==1 and one output, then output is [A B] (3x4)
%
%
function [... |
github | mribri999/MRSignalsSeqs-master | Rad229_MRI_sys_config.m | .m | MRSignalsSeqs-master/Matlab/Rad229_MRI_sys_config.m | 1,873 | utf_8 | 7b0d7a24f8a88c08915cfcc5172a5a0d | %% This function defines some default parameters and constants for an MRI system.
% The MRI hardware is designed to be whimpy. This is helpful to better see the gradient
% waveforms and to make the gradient waveform timing a little easier, thereby avoiding
% some timing errors (maybe).
%
% DBE@STANFORD.EDU (March 20... |
github | mribri999/MRSignalsSeqs-master | epg_stim.m | .m | MRSignalsSeqs-master/Matlab/epg_stim.m | 574 | utf_8 | 41fc7a7ad9cfaa2413f950131fccd64c | %function [S,P] = epg_stim(flips)
%
% Function uses EPG simulation to quickly calculate
% the signal from a stimulated echo sequence defined
% as
% flip - gradient - flip - gradient ... flip - gradient
%
% Relaxation is neglected, and flip angles (vector) are in degrees
%
% Example Try: fplot('abs(epg_stim([x x x])... |
github | mribri999/MRSignalsSeqs-master | plotc.m | .m | MRSignalsSeqs-master/Matlab/plotc.m | 474 | utf_8 | ab1bc5ee7fc1584f5431e2b9f109ec3b | % plotc(x,y)
%
% plots the complex vector y as a function of x.
% plots real (blue --) ,imag (red :) and magnitude (yellow -).
% returns the row as a vector.
function plotc(x,y);
if (nargin <2)
y = x;
x = 1:max(size(y));
% color... plot(x,real(y),'b--',x,imag(y),'r:',x,abs(y),'y-');
plot(x,real(y),'b--',x,ima... |
github | mribri999/MRSignalsSeqs-master | epg_show_grelax.m | .m | MRSignalsSeqs-master/Matlab/epg_show_grelax.m | 1,639 | utf_8 | 6ba59e021fa637fec91e98bce725d7ca | %function [FpFmZ] = epg_show_grelax(FpFmZ,noadd,T1,T2,T,Nanim,showtwists,shiftfs)
%
% Propagate EPG states through a "unit" gradient, with relaxation
% and animate.
% NOTE: This is a bit contrived, as the magnetization is not
% really all in F0 (say) as it dephases.
%
% INPUT:
% FpFmZ = 3xN vector of F+, F- and Z st... |
github | mribri999/MRSignalsSeqs-master | absplit.m | .m | MRSignalsSeqs-master/Matlab/absplit.m | 480 | utf_8 | a41abadf15aa5b974cd5558744fbe139 |
% function [Ai,Bi] = absplit(n,A,B)
%
% Function 'splits' a propagation A,B into sub-matrices so that
% n 'propagations' of M'=Ai*M+Bi is the same as M'=A*M+B.
%
% This is useful for animating an operation, where you want
% to split it into many frames. See abanim.m
%
function [Ai,Bi] = absplit(n,A,B)
if (nargin < ... |
github | mribri999/MRSignalsSeqs-master | Rad229_Phase_Encode_Demo.m | .m | MRSignalsSeqs-master/Matlab/Rad229_Phase_Encode_Demo.m | 5,438 | utf_8 | e3b51110b8110bc45a5626b8874afec5 | %% Rad229_Phase_Encode_Demo – Demonstrate phase encode gradient design for imaging.
%
% Recall, dy = FOVy / Ny . In general, the user can usually pick FOVy and Ny on the scanner.
% dky = 1 / FOVy = gamma_bar * dG * t_PE . The k-space step size defines the FOV.
%
% Note: See code for variable definitions and u... |
github | mribri999/MRSignalsSeqs-master | bvalue.m | .m | MRSignalsSeqs-master/Matlab/bvalue.m | 467 | utf_8 | f0f548fec405864d56b70c8b0ac13788 | %
% Function b = bvalue(gradwave,T)
%
% Function calculates the b value of a gradient waveform.
% If there is a 180 pulse, then flip the gradient sign on one
% side or another!
%
% Input:
% gradwave = waveform, in mT/m
% T = sampling period in seconds
%
% Output:
% b = b value in s/mm^2
%
function b = bvalue(gradwa... |
github | mribri999/MRSignalsSeqs-master | epg_show_grad.m | .m | MRSignalsSeqs-master/Matlab/epg_show_grad.m | 1,108 | utf_8 | 9c25c01ccb827fd97c1a569a7de1f490 | %function [FpFmZ] = epg_show_grad(FpFmZ,noadd,Nanim,showtwists)
%
% Propagate EPG states through a "unit" gradient, and animate as it
% goes. NOTE: This is a bit contrived, as the magnetization is not
% really all in F0 (say) as it dephases.
%
% INPUT:
% FpFmZ = 3xN vector of F+, F- and Z states.
% noadd = 1 to NO... |
github | mribri999/MRSignalsSeqs-master | Rad229_Conventional_FlowEncode.m | .m | MRSignalsSeqs-master/Matlab/Rad229_Conventional_FlowEncode.m | 2,718 | utf_8 | ef61334ada6f73e181cb69c3838efbc3 | %% Rad229_Conventional_FlowEncode – Demonstrate designing a flow-compensated gradient waveform.
%
% Based, in part, on this paper:
%
% Encoding strategies for three-direction phasecontrast MR imaging of flow.
% Pelc NJ, Bernstein MA, Shimakawa A, Glover GH. J Magn Reson Imaging 1991;1(4):405-413.
%
% S... |
github | mribri999/MRSignalsSeqs-master | epg_show.m | .m | MRSignalsSeqs-master/Matlab/epg_show.m | 4,171 | utf_8 | 4dd86bc75767ad354554469883b69b0d | %function epg_show(FZ,frac,scale,Nspins,showtwists,shiftfs,simpleaxes)
%
% Show all (n+1) EPG states in 3x(n+1) plot
%
% FZ = 3xn column vector of F+,F- and Z.
% frac = fraction of twist, if animating.
% scale = axis scale [-scale scale] defaults to 1.
% Nspins = number of spins, defaults to 24
% showtwists = 0 (... |
github | mribri999/MRSignalsSeqs-master | epg_show_relax.m | .m | MRSignalsSeqs-master/Matlab/epg_show_relax.m | 1,078 | utf_8 | e4bb021805481aace14a6a3cb18a3a4a | %function [FpFmZ] = epg_show_relax(FpFmZ,T1,T2,T,Nanim,showtwists)
%
% Propagate EPG states through relaxation given by T1,T2,T
% plotting frames.
%
% INPUT:
% FpFmZ = 3xN vector of F+, F- and Z states.
% T1,T2 = Relaxation times (same as T)
% T = Time interval (same as T1,T2)
% ... |
github | mribri999/MRSignalsSeqs-master | time2freq.m | .m | MRSignalsSeqs-master/Matlab/time2freq.m | 365 | utf_8 | 07e6fbd7bb7f88c4e51f1989bcefc7b2 | % function f = time2freq(t)
%
% Function converts a time array to the corresponding frequency
% points such that the (shifted) FFT of an array at times t leads
% to frequency points f.
%
% Example: time2freq([-5:4]) = [-.5:0.1:0.4]
%
function f = time2freq(t)
dt = t(2)-t(1);
df = 1/ (length(t))/dt;
np = length(t);... |
github | mribri999/MRSignalsSeqs-master | calc_spherical_harmonics.m | .m | MRSignalsSeqs-master/Matlab/calc_spherical_harmonics.m | 1,699 | utf_8 | 31db11c485a21aaafb0f6275a035a408 | % This function computes the the spherical harmonic coefficients that are
% specific to a scanner and used to compute the non-linear gradient induced
% displacement distortion.
%
% SYNTAX - B = calc_spherical_harmonics(Alpha, Beta, X, Y, Z, R0)
%
% INPUTS - Alpha - Coefficient for the cosine terms
% Bet... |
github | mribri999/MRSignalsSeqs-master | abanim.m | .m | MRSignalsSeqs-master/Matlab/abanim.m | 409 | utf_8 | 1052c1b376c2c5e9e11075063db7dde7 | %
% function M = abanim(M,n,A,B)
%
% Animate a propagation of the form M'=A*M+B, where
% A and B are assumed to be rotations and relaxation that occur
% continuously across the animation interval.
%
function M = abanim(M,n,A,B)
if (nargin < 4) B=[0;0;0]; end;
[Ai,Bi] = absplit(n,A,B); % Split operation into n frames
... |
github | mribri999/MRSignalsSeqs-master | senseweights.m | .m | MRSignalsSeqs-master/Matlab/senseweights.m | 1,123 | utf_8 | ed1edffe9e99b42f82638f7f074d6ef7 | %
% function [W,gfact,imnoise] = senseweights(sens,Psi)
%
% Function calculates the SENSE weights at a pixel given
% input sensitivities and covariance matrix. A reduction
% factor R can be assumed from the shape of the sens matrix.
% The number of coils Nc is determined by the size of sens. If Psi
% is omitted it is... |
github | mribri999/MRSignalsSeqs-master | epg_animgrad.m | .m | MRSignalsSeqs-master/Matlab/epg_animgrad.m | 464 | utf_8 | 49f9c207af0dadbe2a458095ffc05f97 |
function FZ = epg_animgrad(FZ,N,scale)
%function FZ = epg_animgrad(FZ,N,scale)
%
% Animate an EPG state to the next F state.
%
% N = #spins
% scale = axis scale multiplier
%
if (nargin < 2) N = 24; end;
if (nargin < 3) scale = 1; end;
Nf = 20;
for p=1:Nf
epg_showstate(FZ,p/Nf,scale,N);
drawnow;
pause(0.05);
... |
github | mribri999/MRSignalsSeqs-master | mag.m | .m | MRSignalsSeqs-master/Matlab/mag.m | 436 | utf_8 | 2fb6a38305d2b59296e48d46098f7491 | % This function finds the magnitude of a vector of any length or of a
% matrix along a given dimension (1 or 2)
%
% SYNTAX: mag=mag(vector,dim);
% mag=mag(vector); % If a vector
%
% DBE 01/25/00
function mag=mag(vector,dim)
% len=length(vector);
if nargin==1
dim=find(min(size(vector))==size(vector));
e... |
github | mribri999/MRSignalsSeqs-master | epg_cpmg.m | .m | MRSignalsSeqs-master/Matlab/epg_cpmg.m | 2,518 | utf_8 | 2b2df3aaccdfcc424ec6f2a6ee47f8ef | % function [s,phasediag,P] = epg_cpmg(flipangle,etl,T1,T2,esp)
%
% EPG Simulation of CPMG sequence. First flip angle
% is 90 about y axis, and others by default are about
% x-axis (make flipangle complex to change that).
%
% flipangle = refocusing flip angle or list (radians)
% etl = echo train length, if single flipa... |
github | mribri999/MRSignalsSeqs-master | epg_rf.m | .m | MRSignalsSeqs-master/Matlab/epg_rf.m | 1,121 | utf_8 | 9a45c7686a8396fcff76dbd9aa18a2be | %
%function [FpFmZ,RR] = epg_rf(FpFmZ,alpha,phi)
% Propagate EPG states through an RF rotation of
% alpha, with phase phi (both radians).
%
% INPUT:
% FpFmZ = 3xN vector of F+, F- and Z states.
%
% OUTPUT:
% FpFmZ = Updated FpFmZ state.
% RR = RF rotation matrix (3x3).
%
% SEE ALSO:
% epg_gra... |
github | mribri999/MRSignalsSeqs-master | design_symmetric_gradients.m | .m | MRSignalsSeqs-master/Matlab/design_symmetric_gradients.m | 8,333 | utf_8 | edaf1e6b9780a887e95b4b9b17ea4656 | function [TE,G,b] = design_symmetric_gradients(bvalue_target,T_ECHO,T_90,G_Max,MMT)
% Returns the TE for symmetric DWI waveforms with a specified b-value and
% sequence timing parameters. The waveforms used are: MONOPOLAR, BIPOLAR
% and MODIFIED BIPOLAR (Stoeck CT, von Deuster C, Genet M, Atkinson D, Kozerke
% ... |
github | mribri999/MRSignalsSeqs-master | vds.m | .m | MRSignalsSeqs-master/Matlab/vds.m | 10,710 | utf_8 | 53e86b9243ff4d9736f898b64a4fff7b | %
% function [k,g,s,time,r,theta] = vds(smax,gmax,T,N,Fcoeff,rmax,z)
%
%
% VARIABLE DENSITY SPIRAL GENERATION:
% ----------------------------------
%
% Function generates variable density spiral which traces
% out the trajectory
%
% k(t) = r(t) exp(i*q(t)), [1]
%
% Where q is the same as theta...
% r and q ar... |
github | mribri999/MRSignalsSeqs-master | dispim.m | .m | MRSignalsSeqs-master/Matlab/dispim.m | 765 | utf_8 | 8084246dbda9eb28bb4312282cfbaeb8 | % dispim(im,[low,high])
% displays magnitude version of image im (complex array)
%
% im = 2D image array (real or complex, magnitude displayed)
% low = black level, high = white level.
% Omit low,high for autoscaling.
%
% ===========================================================
function [low,high] = dispim(im,low,... |
github | mribri999/MRSignalsSeqs-master | epg_show_rf.m | .m | MRSignalsSeqs-master/Matlab/epg_show_rf.m | 1,713 | utf_8 | aab5f333732230eeda7211ef9fc956d8 | %function [FpFmZ,RR] = epg_show_rf(FpFmZ,alpha,phi,Nanim,showtwists)
%
% Propagate EPG states through an RF rotation of
% alpha, with phase phi (both radians), plotting frames.
%
% INPUT:
% FpFmZ = 3xN vector of F+, F- and Z states.
% alpha, phi = flip angle and phase.
% Nanim = Number of frames
% ... |
github | mribri999/MRSignalsSeqs-master | zpadcrop.m | .m | MRSignalsSeqs-master/Matlab/zpadcrop.m | 904 | utf_8 | c5421c7fd1276b9c7436c3f476b371dd | % function newim = zpadcrop(im,newsize)
%
% Function zero pads or crops an image to the new
% size in x and y, keeping the image centered.
%
function newim = zpadcrop(im,newsize)
sz = [size(im)];
if (length(sz)==2) sz = [sz 1]; end; % Make 3D at least.
newim = zeros(newsize);
if (length(newsize) < length(sz))
... |
github | mribri999/MRSignalsSeqs-master | adiabatic.m | .m | MRSignalsSeqs-master/Matlab/adiabatic.m | 1,666 | utf_8 | 8b021ffd7cb6660a379759a6669d7422 | %
% function [b1,freq,phase] = adiabatic(peakb1,bw,beta,T,Ts,blochsim)
%
% Function designs a Silver-Hoult adiabatic pulse with
% peakb1 = max B1 in Gauss.
% bw = bandwidth in Hz
% beta = S-H beta (in Hz)
% T = duration in seconds
% Ts = sample period in seconds
% blochsim = 1 to simulate pulse.
%
% Run with no argume... |
github | mribri999/MRSignalsSeqs-master | gaussian2d.m | .m | MRSignalsSeqs-master/Matlab/gaussian2d.m | 480 | utf_8 | c77cd444e9874db3a899cd743b7f3d3c | % function im = gaussian2d(size,mean,sigma)
%
% Function generates a gaussian image with the above parameters.
% Mean and sigma can be vectors if different in x and y, or it
% is the same.
function im = gaussian2d(sz,mn,sig);
if (length(sz) < 2) sz = [sz sz]; end;
im = zeros(sz(2),sz(1));
if (length(mn)<2) mn = [mn... |
github | mribri999/MRSignalsSeqs-master | cropim.m | .m | MRSignalsSeqs-master/Matlab/cropim.m | 467 | utf_8 | a41647bfa4391a46758c0d2aba2f9324 | % Function [cim] = cropim(im,sx,sy)
%
% Crops image to sx x sy.
% If sy is omitted, sy=sx.
% If sx is omitted, sx=size(1)/2.
% If sx or sy is < 1, then fractional
%
function [cim] = cropim(im,sx,sy)
sz = size(im);
if (nargin < 2) sx = floor(sz(1)/2); end;
if (nargin < 3) sy = sx; end;
if (sx<1) sx=sz(1)*sx; end; ... |
github | mribri999/MRSignalsSeqs-master | epg_showstate.m | .m | MRSignalsSeqs-master/Matlab/epg_showstate.m | 4,770 | utf_8 | 4458c0eef9b87faf31ff67541300168a | function epg_showstate(FZ,frac,scale,Nspins,voxelvar,simpleaxes)
%function epg_showstate(FZ,frac,scale,Nspins,voxelvar,simpleaxes)
%
% Show an EPG representation in a single 3D plot.
% (Zero-out other states if just wanting to show 1 basis function.
%
% FZ = 3x1 column vector of F+,F- and Z.
% frac = fraction of twist,... |
github | mribri999/MRSignalsSeqs-master | epg_relax.m | .m | MRSignalsSeqs-master/Matlab/epg_relax.m | 848 | utf_8 | 865ca72ddc8b060332d46233d3e4b573 | %function [FpFmZ,EE] = epg_relax(FpFmZ,T1,T2,T)
%
% Propagate EPG states through a period of relaxation over
% an interval T.
%
% INPUT:
% FpFmZ = 3xN vector of F+, F- and Z states.
% T1,T2 = Relaxation times (same as T)
% T = Time interval (same as T1,T2)
%
% OUTPUT:
% FpFmZ = updated F+, F- and Z states.
% EE ... |
github | mribri999/MRSignalsSeqs-master | Rad229_MRI_Phantom.m | .m | MRSignalsSeqs-master/Matlab/Rad229_MRI_Phantom.m | 1,927 | utf_8 | e1453e3b131e8433928e0bb9fab86e50 | %% Rad229_MRI_Phantom – Create an object with MRI related properties.
%
% SYNTAX - [ P , M ] = Rad229_MRI_Phantom(acq)
%
% INPUTS - acq is a structure that needs to contain acq.Nx (number of
% pixels defining the *square* phantom matrix size.
%
% OUTPUTS - P - Is the phantom object matrix [acq.Nx x acq.Nx]
... |
github | mribri999/MRSignalsSeqs-master | homodyneshow.m | .m | MRSignalsSeqs-master/Matlab/homodyneshow.m | 1,512 | utf_8 | 205063c142e65166d21bf63a960bb495 | % Function imhd = homodyneshow(im,w)
%
% Function does a homodyne reconstruction on
% data for a complex image im, with merge filter
% width w (even) and displays stages.
%
function imhd = homodyneshow(im,w)
if (nargin < 2) w=16; end;
% Get image size
[m,n] = size(im);
% Low-pass filter
%
lpf = zeros(m,1);
lpf( floo... |
github | mribri999/MRSignalsSeqs-master | magphase.m | .m | MRSignalsSeqs-master/Matlab/magphase.m | 382 | utf_8 | 4b1fc6a38d193b9710db763156ee0158 | %
% function magphase(x,arr)
%
% Function plots in two subplots the magnitude and
% phase of a complex-valued signal.
%
function magphase(x,arr)
if (nargin < 2)
arr = x;
x = 1:length(arr);
end;
mg = abs(arr);
ph = angle(arr);
subplot(2,1,1);
plot(x,mg);
ylabel('Magnitude');
subplot(2,1,2);
plot(x,ph/pi);
ylabel... |
github | mribri999/MRSignalsSeqs-master | vecdcf.m | .m | MRSignalsSeqs-master/Matlab/vecdcf.m | 1,811 | utf_8 | 35f82890de93bea5905a12f0b6065577 | % function [dcf,k] = vecdcf(g,k [,N,res,FOV])
%
% Calculate the Density Correction Factors for
% a given spiral trajectory using the vector approach
% used by Craig Meyer (MRM, 1992)
%
% INPUT:
% g = gradient (Gx + i*Gy)
% k = k-space (kx + i*ky)
%
%
% OUTPUT:
% dcf = list of density compensation factors
%
%
% NOTE... |
github | mribri999/MRSignalsSeqs-master | epg_grelax.m | .m | MRSignalsSeqs-master/Matlab/epg_grelax.m | 2,622 | utf_8 | dc7d9df2a831bffc54fc2da5f6058dab | %function [FpFmZ,EE,BV] = epg_grelax(FpFmZ,T1,T2,T,kg,D,Gon,noadd)
%
% Propagate EPG states through a period of relaxation, and
% diffusion over an interval T, with or without a gradient.
% Leave last 3 blank to exclude diffusion effects.
%
% INPUT:
% FpFmZ = 3xN vector of F+, F- and Z states.
% T1,T2 = Relaxation t... |
github | mribri999/MRSignalsSeqs-master | lplot.m | .m | MRSignalsSeqs-master/Matlab/lplot.m | 406 | utf_8 | 507fa16138e49993eeb9d94975ed5ccd | % Function lplot(xlab,ylab,tit,ax,grid);
%
% Label a figure, turn on grid, and set properties
%
function lplot(xlab,ylab,tit,ax)
if (nargin >0) && (length(xlab)>0)
xlabel(xlab); end;
if (nargin >1) && (length(ylab)>0)
ylabel(ylab); end;
if (nargin >2) && (length(tit)>0)
title(tit); end;
if (nargin >3) && (le... |
github | mribri999/MRSignalsSeqs-master | ft.m | .m | MRSignalsSeqs-master/Matlab/ft.m | 172 | utf_8 | 3de787c860ab4b960b481aa3ead77652 | % function im = ft(dat)
%
% Function does a centered 2DFT of the data:
%
% im = fftshift(fft2(fftshift(dat)));
function im = ft(dat)
im = fftshift(fft2(fftshift(dat)));
|
github | mribri999/MRSignalsSeqs-master | Rad229_Conventional_FlowComp.m | .m | MRSignalsSeqs-master/Matlab/Rad229_Conventional_FlowComp.m | 3,236 | utf_8 | f5785538f1bc291dd9a9505ecef0be9d | %% Rad229_Conventional_FlowComp – Demonstrate designing a flow-compensated gradient waveform.
%
% Based, in part, on this paper:
%
% Encoding strategies for three-direction phasecontrast MR imaging of flow.
% Pelc NJ, Bernstein MA, Shimakawa A, Glover GH. J Magn Reson Imaging 1991;1(4):405-413.
%
% SYN... |
github | mribri999/MRSignalsSeqs-master | epg_mgrad.m | .m | MRSignalsSeqs-master/Matlab/epg_mgrad.m | 939 | utf_8 | e79c2b413cb65a6eb82cbd8f75a426d8 | %
%function [FpFmZ] = epg_mgrad(FpFmZ,noadd)
% Propagate EPG states through a *NEGATIVE* "unit" gradient.
% (States move the opposite direction to epg_grad!)
%
% INPUT:
% FpFmZ = 3xN vector of F+, F- and Z states.
% noadd = 1 to NOT add any higher-order states - assume
% that they just go to zero. Be careful - th... |
github | mribri999/MRSignalsSeqs-master | epg_FZ2spins.m | .m | MRSignalsSeqs-master/Matlab/epg_FZ2spins.m | 1,952 | utf_8 | 70c6102373f20b409e7ebbe080b33238 | %function [M] = epg_FZ2spins(FpFmZ, N, frac)
%
% Function returns a 3xN array of magnetization vectors [Mx My Mz].'
% that is represented by the EPG state FpFmZ. Note that the
% magnetization assumes that a "voxel" is divided into N states,
% as is necessary to make the conversion. N must be at least
% as large as ... |
github | mribri999/MRSignalsSeqs-master | epg_zrot.m | .m | MRSignalsSeqs-master/Matlab/epg_zrot.m | 483 | utf_8 | 83073de8b2328d733399d898a026f8f4 | %function [FpFmZ] = epg_zrot(FpFmZ,rotangle)
%
% Rotate spin state about Mz axis by rotangle radians.
%
% INPUT:
% FpFmZ = 3xN vector of F+, F- and Z states.
% rotangle = angle by which to rotate (radians)
%
% OUTPUT:
% Updated FpFmZ state.
%
% SEE ALSO:
% epg_grad, epg_grelax
%
% B.Hargre... |
github | mribri999/MRSignalsSeqs-master | mingrad.m | .m | MRSignalsSeqs-master/Matlab/mingrad.m | 1,339 | utf_8 | 3f15db389b0c2af9df7ca0ed8ad106ee | %
% function [g,t] = mingrad(area,Gmax,Smax,dt)
%
% Function calculates the fastest gradient waveform
% to achieve the given area in k-space, and returns
% it, along with a time array.
%
% INPUT:
% area = desired k-space area in cm^(-1)
% Gmax = maximum gradient (mT/m) [50];
% Smax = maximum slew (mT/m/ms) [200];
%... |
github | mribri999/MRSignalsSeqs-master | ghist.m | .m | MRSignalsSeqs-master/Matlab/ghist.m | 1,314 | utf_8 | 3305eccce75e3e6a42f1b0230f828e03 | %
% Function ghist(data,gmean,gsig,nbins,gtitle,gleg1,gleg2)
%
% Function makes is histogram of a signal, and superimposes
% a gaussian fit.
%
% INPUT:
% data = signal to make histogram for.
% gmean = estimate for gaussian fit, mean [default=mean(data)]
% gsig = estimate for gaussian fit, sigma [default=std(data)]
%... |
github | mribri999/MRSignalsSeqs-master | gaussian.m | .m | MRSignalsSeqs-master/Matlab/gaussian.m | 262 | utf_8 | 822d6349afc30f0f984cb8aa020e2619 | % Function y = gaussian(x,mn,sig)
%
% Function generates the gaussian distribution output y
% based on x and the mean (mn) and sigma (sig). x can be a
% number or array.
%
function y = gaussian(x,mn,sig)
y = exp(-(x-mn).^2 / (2*sig^2)) / (sqrt(2*pi)*sig);
|
github | mribri999/MRSignalsSeqs-master | calcgradinfo.m | .m | MRSignalsSeqs-master/Matlab/calcgradinfo.m | 1,595 | utf_8 | e888e10d970046f47949765dcd3ecee4 | %
% function [k,g,s,m1,m2,t,v]=calcgradinfo(g,T,k0,R,L,eta)
%
% Function calculates gradient information
%
% INPUT:
% g gradient (G/cm) = gx + i*gy
% T sample period (s)
% k0 initial condition for k-space.
% R coil resistance (ohms, default =.35)
% L coil inductance (H, default = .0014)
% eta coil efficiency (G/c... |
github | mribri999/MRSignalsSeqs-master | Rad229_Fourier_Encoding.m | .m | MRSignalsSeqs-master/Matlab/Rad229_Fourier_Encoding.m | 4,185 | utf_8 | 47fce21ee336430db323a1896cd391cf | %% Rad229_Fourier_Encoding demonstrates some Fourier sampling functions
%
% SYNTAX - [acq, F] = Rad229_Fourier_Encoding(acq);
%
% INPUTS - acq.FOVx = 210e-3; % Field-of-view along y-direction [m]
% acq.Nx = 21; % Number of pixels to discretize FOVy [#]
%
% acq.FOVy = 150e-3; % Field-of... |
github | mribri999/MRSignalsSeqs-master | epg_animrf.m | .m | MRSignalsSeqs-master/Matlab/epg_animrf.m | 554 | utf_8 | 6cfb79f3aa674888de66015188f2e9a1 |
function FZ = epg_animrf(FZ,flip,phase,N,scale,showorder)
%
% Animate an EPG state through an RF pulse
%
if (nargin < 4) N = 24; end;
if (nargin < 5) scale = 1; end;
if (nargin < 6) showorder=-1; end;
Nf = 20;
for p=0:Nf
if (showorder==-1)
epg_showstate(FZ,0,scale,N);
else
epg_showorder(FZ(:,showorder... |
github | mribri999/MRSignalsSeqs-master | throt.m | .m | MRSignalsSeqs-master/Matlab/throt.m | 814 | utf_8 | 834e1e36edf884f08695802d4e400f4b | % function [M] = throt(alpha,phi)
%
% Function returns the rotation matrix M such that
% y = Mx rotates a 1x3 cartesian vector about the axis
% defined by y=x*tan(phi), by alpha degrees.
% The rotation is left-handed.
%
% phi is in degrees too.
%
% See also: tprot
%
% ======================== CVS Log Messages ========... |
github | mribri999/MRSignalsSeqs-master | lfphase.m | .m | MRSignalsSeqs-master/Matlab/lfphase.m | 500 | utf_8 | c789ff17af4c8d63fb446a7b994b3231 | %
% Function ph = lfphase(m,n,w)
%
% Function generates a low-resolution phase function, by
% FFT of random coefficients.
%
% 2*w+1 = width of non-zero Fourier coefficients.
function ph = lfphase(m,n,w)
if (nargin < 2) n=m; end;
if (nargin < 3) w=4; end;
arr = zeros(m,n);
arr(floor(m/2-w):floor(m/2+w) ,floor(n/2-w):... |
github | mribri999/MRSignalsSeqs-master | corrnoise.m | .m | MRSignalsSeqs-master/Matlab/corrnoise.m | 1,031 | utf_8 | d0ce1f985ee5934dccd09c7d2843ae45 | % Function [nc,Rout] = corrnoise(mn,R,n)
%
% Function generates correlated noise, where
% R can be complex.
%
% INPUT:
% mn = mean of noise (default to 0)
% R = noise covariance matrix
% n = number of samples
%
% OUTPUT:
% nc = mxn array of noise samples, where m is dimension of R
% Rout = covariance of samples (c... |
github | mribri999/MRSignalsSeqs-master | calc_harmonics.m | .m | MRSignalsSeqs-master/Matlab/calc_harmonics.m | 1,077 | utf_8 | 73ca3d9e0c073bab404e7a6bb16a8799 | %**************************************************************************%
function B = calc_harmonics(Alpha, Beta, X, Y, Z, R0)
%MRIS_GRADIENT_NONLIN__SIEMENS_B calculate displacement field from Siemens's coefficients
nmax = size(Alpha,1)-1;
% convert to spherical coordinates
R = sqrt(X.^2+Y.^2+Z.^2);
R_e... |
github | mribri999/MRSignalsSeqs-master | nlegend.m | .m | MRSignalsSeqs-master/Matlab/nlegend.m | 489 | utf_8 | ff232770257e189028cd6d741fc4f7fc | % Function nlegend(a,fmt);
%
% Make a legend from the numbers in an array a.
% Default is to use %d, but if fmt is defined, use it instead.
%
% Example if a=[1.2 3.4] and fmt='b=%g' then this will
% effectively do legend('b=1.2','b=3.4')
%
% Note that you have to make sure length(a) does not exceed the
% number of plot... |
github | mribri999/MRSignalsSeqs-master | epg_rfspoil.m | .m | MRSignalsSeqs-master/Matlab/epg_rfspoil.m | 1,959 | utf_8 | 79e6603fe80cc62bf57047fa33f68c55 | % function [s,phasediag,P] = epg_rfspoil(flipangle,phinc,N,T1,T2,TR)
%
% EPG Simulation of RF-spoiled sequence.
%
% flipangle = flip angle (radians)
% phinc = phase increment (radians);
% N = number of TRs
% T1,T2,TR = relaxation times and TR
%
% All states are kept, for demo purposes, though this
% is not really ne... |
github | mribri999/MRSignalsSeqs-master | abprop.m | .m | MRSignalsSeqs-master/Matlab/abprop.m | 1,670 | utf_8 | 6ebd17e34985c6d45e06bb9ba5f19a41 | %
% function [A,B,mss] = abprop(A1,B1,A2,B2,A3,B3,...)
%
% Function 'propagates' matrices A and B to give overall A,B
% such that m' = A*m+B. The Ai,Bi are applied in order, ie A1,B1
% are the first applied to m, then A2,B2 and so on.
%
% If mss is provided, the steady-state is calculated - in which case
% the A1,B1 l... |
github | mribri999/MRSignalsSeqs-master | Rad229_plot_style.m | .m | MRSignalsSeqs-master/Matlab/Rad229_plot_style.m | 1,679 | utf_8 | ba46ff910ca044a190b2bffe39dfc3e1 | % This function defines a color palette for plots and can also be used to
% fetch the default colors for other uses (e.g. colormap_style.m).
%
% color = Rad229_plot_style(p)
%
% DBE@STANFORD.EDU (March 2021) for Rad229
function color = Rad229_plot_style(p)
% Color Pallette - In a preferred order...
if nargin==0 || nu... |
github | mribri999/MRSignalsSeqs-master | smart_subplot.m | .m | MRSignalsSeqs-master/Matlab/smart_subplot.m | 2,247 | utf_8 | 20f330ec355fb3bf46ad98d6aba64f08 | % This function simply places the subplot axes with
% better positioning than the default call to SUBPLOT.
% The axis handle is returned as 'h'.
%
% SYNTAX : h=smart_subplot(m,n,p[,gap,lm,bm])
%
% INPUTS : m - Number of rows
% n - Number of columns
% p - Plot number (raster order)
% ... |
github | mribri999/MRSignalsSeqs-master | Rad229_MRI_Resolution_Phantom.m | .m | MRSignalsSeqs-master/Matlab/Rad229_MRI_Resolution_Phantom.m | 1,484 | utf_8 | e91f07df8677c8b2b20b80be55b4e0fe | %% Rad229_MRI_Resolution_Phantom – Create a resolution phantom with some noise.
%
% SYNTAX - [ P , M ] = Rad229_MRI_Resolution_Phantom( acq , obj )
%
% INPUTS - acq is a structure that needs to contain acq.Nx (number of
% pixels defining the *square* phantom matrix size.
%
% - obj is a structure t... |
github | mribri999/MRSignalsSeqs-master | psf2d.m | .m | MRSignalsSeqs-master/Matlab/psf2d.m | 1,681 | utf_8 | fa922acc74050bf5dcaa222ab5a86e1a | % function im = psf2d(ksp,oversamp,timemode)
%
% Function calculates and plots the point-spread function for
% a given 1D or 2D k-space.
%
% INPUT:
% ksp = k-space sample points (can be weighted if desired)
% oversamp = oversampling of PSF (to smooth). Default 16
% timemode = 1 for ksp to be k x time
%
% OUTPUT:
... |
github | mribri999/MRSignalsSeqs-master | ift.m | .m | MRSignalsSeqs-master/Matlab/ift.m | 187 | utf_8 | 82904e346076c3b915c46439a30bef8f | % function im = ft(dat)
%
% Function does a centered inverse 2DFT of the data:
%
% im = ifftshift(ifft2(ifftshift(dat)));
function im = ift(dat)
im = ifftshift(ifft2(ifftshift(dat)));
|
github | mribri999/MRSignalsSeqs-master | sinc.m | .m | MRSignalsSeqs-master/Matlab/sinc.m | 288 | utf_8 | 08e1ceaf2751003b3496a701b614bf09 | % function y = sinc(x)
%
% Function returns y = sin(pi*x)/pi*x if x is non-zero, and 1 otherwise.
% Works on arrays.
function y = sinc(x)
sz = size(x);
x = x(:);
y = x; % Allocate
f1 = find(x==0);
f2 = find(x~=0);
y(f1)=1;
y(f2) = sin(pi*x(f2))./(pi*x(f2));
y = reshape(y,sz);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.