% sets outside of image to specified value but PRESERVES SIZE       Steve Mann
%
% Y = bordersamesize(X,10);    % border 10 pixels all around
%
% Y = bordersamesize(X,3,4);   % 3 rows of zeros, 4 cols of zeros;
%                              % looks nice on a 3by4 image (eg. TV screen size)
%
% Y = bordersamesize(X,0,0,10,20,myNaN);% pads 10 rows at bottom and 20 to right
%
% myNaN defaults to -Inf
%
% Applications: making black lines to show borders of images in mosaics

function Y = dummy(X,thicknessrow,thicknesscol,thicknessrow2,thicknesscol2,myNaN)

if nargin < 6
  disp('bordersamesize: myNaN defaulting to -Inf; probably for chval to black')
  myNaN = -Inf;
end%if

if nargin == 2
  thicknesscol = thicknessrow;
end%if
if nargin == 1
  disp('bordersamesize: width of border not specified; defaulting to 1 pixel wide')
  thicknesscol = 1;
  thicknessrow = 1;
end%if

if nargin==4
  error('bordersamesize: 4 input arguments not supported')
end%if

[M N] = size(X);

if nargin < 4 % pad all the way around
  thicknessrow2=thicknessrow;
  thicknesscol2=thicknesscol;
end%if
rowpad  = myNaN*ones(thicknessrow,N);
colpad  = myNaN*ones(M,thicknesscol);
rowpad2 = myNaN*ones(thicknessrow2,N);
colpad2 = myNaN*ones(M,thicknesscol2);
Y = X;
Y(:,1:thicknesscol)=colpad;
Y(:,N-(thicknesscol2-1):N)=colpad2;
Y(1:thicknessrow,:)=rowpad;
Y(M-(thicknessrow2-1):M,:)=rowpad2;

