```function showCOSFIREstructure(operator)

params = operator.params;

maxrho = max(operator.tuples(3,:));
maxsigma = params.COSFIRE.sigma0 + params.COSFIRE.alpha*maxrho;
dim = (2 * radius) + 1;

sig = zeros(dim);
for j = 1:size(operator.tuples,2)
rho = operator.tuples(3,j);
sigma = params.COSFIRE.sigma0 + params.COSFIRE.alpha*rho;
[x y] = pol2cart(operator.tuples(4,j),rho);
sig = max(sig,g);
end

figure;showim(sig);
axis off;
hold on;

for j = size(operator.tuples,2):-1:1
rho = operator.tuples(3,j);
[x y] = pol2cart(operator.tuples(4,j),rho);

if strcmp(params.inputfilter.name,'Gabor')
theta = operator.tuples(2,j);
lambda = operator.tuples(1,j);
set(el,'FaceAlpha',0,'EdgeAlpha',1,'EdgeColor',[1 1 1],'linewidth',2);
elseif strcmp(params.inputfilter.name,'DoG')
sigma = operator.tuples(2,j);
end
end

axis square;
axis off;
hold off;

function h=ellipse(ra,rb,ang,x0,y0,C,Nb)
% Ellipse adds ellipses to the current plot
%
% ELLIPSE(ra,rb,ang,x0,y0) adds an ellipse with semimajor axis of ra,
% a semimajor axis of radius rb, a semimajor axis of ang, centered at
% the point x0,y0.
%
% The length of ra, rb, and ang should be the same.
% If ra is a vector of length L and x0,y0 scalars, L ellipses
% are added at point x0,y0.
% If ra is a scalar and x0,y0 vectors of length M, M ellipse are with the same
% If ra, x0, y0 are vectors of the same length L=M, M ellipses are added.
% If ra is a vector of length L and x0, y0 are  vectors of length
% M~=L, L*M ellipses are added, at each point x0,y0, L ellipses of radius ra.
%
% ELLIPSE(ra,rb,ang,x0,y0,C)
% adds ellipses of color C. C may be a string ('r','b',...) or the RGB value.
% If no color is specified, it makes automatic use of the colors specified by
% the axes ColorOrder property. For several circles C may be a vector.
%
% ELLIPSE(ra,rb,ang,x0,y0,C,Nb), Nb specifies the number of points
% used to draw the ellipse. The default value is 300. Nb may be used
% for each ellipse individually.
%
% h=ELLIPSE(...) returns the handles to the ellipses.
%
% as a sample of how ellipse works, the following produces a red ellipse
% tipped up at a 45 deg axis from the x axis
% ellipse(1,2,pi/8,1,1,'r')
%
% note that if ra=rb, ELLIPSE plots a circle
%

% written by D.G. Long, Brigham Young University, based on the
% CIRCLES.m original
% written by Peter Blattner, Institute of Microtechnology, University of
% Neuchatel, Switzerland, blattner@imt.unine.ch

% Check the number of input arguments
if nargin<1,
ra=[];
end;
if nargin<2,
rb=[];
end;
if nargin<3,
ang=[];
end;

if nargin<5,
x0=[];
y0=[];
end;

if nargin<6,
C=[];
end

if nargin<7,
Nb=[];
end

% set up the default values

if isempty(ra),ra=1;end;
if isempty(rb),rb=1;end;
if isempty(ang),ang=0;end;
if isempty(x0),x0=0;end;
if isempty(y0),y0=0;end;
if isempty(Nb),Nb=300;end;
if isempty(C),C=get(gca,'colororder');end;

% work on the variable sizes

x0=x0(:);
y0=y0(:);
ra=ra(:);
rb=rb(:);
ang=ang(:);
Nb=Nb(:);

if isstr(C),C=C(:);end;

if length(ra)~=length(rb),
error('length(ra)~=length(rb)');
end;
if length(x0)~=length(y0),
error('length(x0)~=length(y0)');
end;

% how many inscribed elllipses are plotted

if length(ra)~=length(x0)
maxk=length(ra)*length(x0);
else
maxk=length(ra);
end;

% drawing loop
for k=1:maxk

if length(x0)==1
xpos=x0;
ypos=y0;
if length(ang)==1
an=ang;
else
an=ang(k);
end;
elseif length(ra)==1
xpos=x0(k);
ypos=y0(k);
an=ang;
elseif length(x0)==length(ra)
xpos=x0(k);
ypos=y0(k);
an=ang(k);
else