Skip to content
Snippets Groups Projects
Commit 5685ff3e authored by veitsupateit's avatar veitsupateit
Browse files

Change some files

parent ecfb9d9e
No related branches found
No related tags found
No related merge requests found
function euclideanDistance = eDist(x1, y1, x2, y2)
% Computes the euclidean distance
euclideanDistance = sqrt((x2 - x1)^2+(y2 - y1)^2);
end
\ No newline at end of file
......@@ -28,6 +28,7 @@ try
result = sprintf('{"subjectNo" : "%d", "trials" : [', subjectNo);
% Loop over trials
% Uncomment for use with design matrix
for trial = 1:5%size(designMatrix, 1)
% Assign vals
......
......@@ -34,7 +34,10 @@ for i = 1:length(F1)
end
end
% Shuffle
design = design(randperm(length(design)),:);
% Create index
design(:,1) = 1:length(design);
designMatrix = design;
......
function subjectNo = getCurrentSubjectNo()
% Function reads files in directory, extracts the number of the last
% experiment and increments it
currentDir = mfilename('fullpath');
idx = strfind(currentDir, '/');
folder = currentDir(1:idx(end));
......
function picNameList = getImgList()
% Function reads pictures in directory and returns a list of filenames
currentDir = mfilename('fullpath');
idx = strfind(currentDir, '/');
folder = currentDir(1:idx(end));
......
function filteredImage = laplacianFilter(img)
% Simple laplacian filter, change the middle value for different results.
middle = 5;
filter = [0 -1 0 ; -1 middle -1 ; 0 -1 0];
filteredImage = conv2(img, filter, 'same');
......
function [filtered_image] = lowpassFilter(img)
N = 20;
n=1;
d=50;
[x ~]=meshgrid(-floor(N/2):floor(N/2)-1,-floor(N/2):floor(N/2)-1);
% Define B
B = sqrt(2) - 1;
% Define distance to centre
D = sqrt(x.^2 + y.^2);
f = 1 ./ (1 + B * ((d ./ D).^(2 * n)));
filtered_image = conv2(img,f,'same');
end
function setGlobalbackground(val)
global backgroundcolor
backgroundcolor = val;
\ No newline at end of file
N = 20;
n=1;
d=50;
[x y]=meshgrid(-floor(N/2):floor(N/2)-1,-floor(N/2):floor(N/2)-1);
B = sqrt(2) - 1; %// Define B
D = sqrt(x.^2 + y.^2); %// Define distance to centre
hhp = 1 ./ (1 + B * ((d ./ D).^(2 * n)));
imagesc(1-hhp)
\ No newline at end of file
function jsonTrial = trialToJson(runNo, fix_durations, mouse_x, mouse_y, fix_x, fix_y)
% Creates the json file given the data provided as arguments. The json file
% is of the following structure
% [{
% 'subjectNo' : '',
% 'trials' :
......
function [] = writeREsult(jsonString)
current_dir = mfilename('fullpath');
idx=strfind(current_dir,'/');
folder = current_dir(1:idx(end));
folder = strcat(folder,'results/');
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment