-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSmoothRealTime.m
More file actions
executable file
·31 lines (26 loc) · 959 Bytes
/
SmoothRealTime.m
File metadata and controls
executable file
·31 lines (26 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function [outputLastPat] = SmoothRealTime(inputLastPat,roiDims,roiInds,FWHM)
% function [outputPatVec] = SmoothRealTime(inputPatVec,roiDims,roiInds,FWHM)
%
% Inputs:
% - inputLastPat : last pattern acquired [1 x voxels]
% - roiDims : roi dimensions [mask width x mask height x slices]
% - roiInds : roi indices [= find(mask)];
% - FWHM : full width half max of gaussian
%
% Outputs:
% - outputLastPat: smoothed version of last pattern acquired [1 x voxels]
%
%
% MdB, 8/2011
%smoothing parameters
smooth_kernelsize = [3 3 3]; %[units]
voxel_size = 3; %[mm]
smooth_sigma = (FWHM/voxel_size)/(2*sqrt(2*log(2)));
%smooth in 3D
inputLastPatVol = zeros(roiDims);
%convert 1D pattern vector to 3D pattern volume
inputLastPatVol(roiInds) = inputLastPat;
%smooth in 3D
inputLastPatVol = smooth3(inputLastPatVol,'gaussian',smooth_kernelsize,smooth_sigma);
%replace in pattern matrix
outputLastPat = inputLastPatVol(roiInds);