function result = dataGathered (myImage, Funcs, windowSizes, numTrials)
% Runs the specified trials per function per window size of the experiment,
% returning a struct as described in the problem statement.
% Arguments are
%	myImage - image data array to use 
%	Funcs - cell array of function handles to distortion functions
%	windowSizes - vector of window sizes
%	numTrials - number of trials to run per function and window size

trials = genTrials (Funcs, windowSizes, numTrials);
figure (1);
imagesc (myImage); 
colormap (gray);
pause (5);
result.windowSizes = windowSizes;
result.Funcs = Funcs;
result.numTrials = numTrials;
s = size(myImage);
for i = 1:size(trials,1)
	windowSize = [1 1] * windowSizes (trials (i,2));
	windowLowerLeft = round (rand (1,2) .* (s(1:2)-windowSize+1));
	distortedImage = myImage;
	% Extract subimage from myImage.
	subimage = myImage (windowLowerLeft(1)+(0:windowSize(1)-1), ...
		windowLowerLeft(2)+(0:windowSize(2)-1));
	distortedSubimage = _____ ;
	% Change subimage in distortedImage.
	distortedImage (windowLowerLeft(1)+(0:windowSize(1)-1), ...
		windowLowerLeft(2)+(0:windowSize(2)-1)) = distortedSubimage;
	[result.clickPosition(i,:), result.elapsedTime(i)] ...
		= timeUser(distortedImage, myImage);		
	result.windowSize (i) = trials (i,2);
	result.func (i) = trials (i,1);
	result.windowPos (i,:) = [windowLowerLeft];
end
