# displayImages

## PURPOSE

displayImages - Display a set of images of the same size (bx,by)

## SYNOPSIS

function im = displayImages(images,ncol,bx,by)

## DESCRIPTION

     displayImages - Display a set of images of the same size (bx,by)

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 function im = displayImages(images,ncol,bx,by)
    0002 % displayImages - Display a set of images of the same size (bx,by)
    0003 %
    0004
    0005 n = length(images);
    0006 nrow = ceil(n/ncol);
    0007 widthMargin = 5;
    0008 width = by*ncol + (ncol-1)*widthMargin;
    0009 heightMargin = 5;
    0010 height = bx*nrow + (nrow-1)*heightMargin;
    0011 im = 255-zeros(height,width,3);
    0012 for i=1:n
    0013     if isempty(images{i})
    0014         continue
    0015     end
    0016     row = ceil(i/ncol);
    0017     col = i-(row-1)*ncol;
    0018     startx = (row-1)*(bx+heightMargin);
    0019     starty = (col-1)*(by+widthMargin);
    0020     towrite = double(imresize(images{i},[bx,by]));
    0021     towrite = uint8(255 * (towrite-min(towrite(:)))/(max(towrite(:))-min(towrite(:))));
    0022     if size(towrite,3) == 3
    0023         im((startx+1):(startx+bx),(starty+1):(starty+by),:) = towrite(:,:,:);
    0024     else
    0025         im((startx+1):(startx+bx),(starty+1):(starty+by),:) = repmat(towrite,[1 1 3]);
    0026     end
    0027 end
    0028 im = uint8(im);