function K=isot(k,sig,opt,theta)
%
% isot :: Function to generate a spatial isotropic kernel
%
%% Input variables
% k :: Kernel gain
%
% sig :: Standard deviation of the kernel
%
% opt (1: normal isotropic kernel; 2: isotropic kernel whose center is
% displaced by one unit in the direction [theta])
%
% theta :: Direction (in radians) in which the kernel center is displaced
% if opt = 2
%
%% Output variable
% K :: Kernel matrix
%
%% Reference
% Grossberg, S. and Pilly, P. K. (2008). Temporal dyanamics of decision-making during motion perception in the visual cortex. Vision Research, 48(12), 1345-1373.
%
%% Author
% Praveen K. Pilly (advaitp@gmail.com)
%
%% License policy
% Written by Praveen K. Pilly, Department of Cognitive and Neural Systems, Boston University
% Copyright 2009, Trustees of Boston University
%
% Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted
% without fee, provided that the above copyright notice and this permission notice appear in all copies, derivative works and
% associated documentation, and that neither the name of Boston University nor that of the author(s) be used in advertising or
% publicity pertaining to the distribution or sale of the software without specific, prior written permission. Neither Boston
% University nor its agents make any representations about the suitability of this software for any purpose. It is provided "as
% is" without warranty of any kind, either express or implied. Neither Boston University nor the author indemnify any
% infringement of copyright, patent, trademark, or trade secret resulting from the use, modification, distribution or sale of
% this software.
%
%% Last modified
% June 25, 2009
%%
if opt==2
x1=cos(theta+pi+pi/2);
y1=sin(theta+pi+pi/2);
if abs(x1)<10^(-15)
x1=0;
end
if abs(y1)<10^(-15)
y1=0;
end
x=sign(x1);
y=sign(y1);
else
x=0;
y=0;
end
N=2*ceil(3*sig)+1;
N1=(N-1)/2 + 1;
for i=1:N
for j=1:N
K(i,j)=exp(-0.5*((i-N1-x)^2+(j-N1-y)^2)/(sig^2));
end
end
K(:,:)=k*K(:,:)./sum(sum(K(:,:)));
return