# montage2

## PURPOSE

Used to display collections of images and videos.

## SYNOPSIS

function varargout = montage2( IS, prm )

## DESCRIPTION

     Used to display collections of images and videos.

     Improved version of montage, with more control over display.
     NOTE: Can convert between MxNxT and MxNx3xT image stack via:
       I = repmat( I, [1,1,1,3] ); I = permute(I, [1,2,4,3] );

     USAGE
      varargout = montage2( IS, [prm] )

     INPUTS
      IS           - MxNxTxR or MxNxCxTxR, where C==1 or C==3, and R may be 1
                     or cell vector of MxNxT or MxNxCxT matrices
      prm
       .showLines  - [1] whether to show lines separating the various frames
       .extraInfo  - [0] if 1 then a colorbar is shown as well as impixelinfo
       .cLim       - [] cLim = [clow chigh] optional scaling of data
       .mm         - [] #images/col per montage
       .nn         - [] #images/row per montage
       .labels     - [] cell array of labels (strings) (T if R==1 else R)
       .perRow     - [0] only if R>1 and not cell, alternative displays method
       .hasChn     - [0] if true assumes IS is MxNxCxTxR else MxNxTxR
       .padAmt     - [0] only if perRow, amount to pad when in row mode
       .padEl      - [] pad element, defaults to min value in IS

     OUTPUTS
      h           - image handle
      m           - #images/col
      nn          - #images/row

     EXAMPLE - [3D] show a montage of images
      load( 'images.mat' ); clf; montage2( images );

     EXAMPLE - [3D] show a montage of images with labels
      load( 'images.mat' );
      for i=1:50; labels{i}=['I-' int2str2(i,2)]; end
      prm = struct('extraInfo',1,'perRow',0,'labels',{labels});
      clf; montage2( images(:,:,1:50), prm );

     EXAMPLE - [3D] show a montage of images with color boundaries
      load( 'images.mat' );
      I3 = repmat(permute(images,[1 2 4 3]),[1,1,3,1]); % add color chnls
      prm = struct('padAmt',4,'padEl',[50 180 50],'hasChn',1,'showLines',0);
      clf; montage2( I3(:,:,:,1:48), prm )

     EXAMPLE - [4D] show a montage of several groups of images
      for i=1:25; labels{i}=['V-' int2str2(i,2)]; end
      prm = struct('labels',{labels});
      load( 'images.mat' ); clf; montage2( videos(:,:,:,1:25), prm );

     EXAMPLE - [4D] show using 'row' format
      load( 'images.mat' );
      prm = struct('perRow',1, 'padAmt',6, 'padEl',255 );
      figure(1); clf; montage2( videos(:,:,:,1:10), prm );

     See also MONTAGE, PLAYMOVIE, FILMSTRIP

     Piotr's Image&Video Toolbox      Version 2.0
     Copyright 2008 Piotr Dollar.  [pdollar-at-caltech.edu]
     Please email me if you find bugs, or have suggestions or questions!
     Licensed under the Lesser GPL [see external/lgpl.txt]

## CROSS-REFERENCE INFORMATION

This function calls:

- getPrmDflt Helper to set default values (if not already set) of parameter struct.
- mat2cell2 Break matrix up into a cell array of same sized matrices.

This function is called by:

- pcaRandVec Generate random vectors in PCA subspace.
- pcaVisualize Visualization of quality of approximation of X given principal comp.
- rbfComputeBasis Get locations and sizes of radial basis functions for use in rbf network.
- FbApply2d Applies each of the filters in the filterbank FB to the image I.
- FbReconstruct2d Use to see how much image information is preserved in filter outputs.
- FbVisualize Used to visualize a series of 1D/2D/3D filters.
- filterSteerable Steerable 2D Gaussian derivative filter (for visualization).
- bbGt Bounding box (bb) annotations struct, evaluation and sampling routines.
- imMlGauss Calculates max likelihood params of Gaussian that gave rise to image G.
- maskGaussians Divides a volume into softly overlapping gaussian windows.
- maskSphere Creates an 'image' of a n-dimensional hypersphere.
- playMovie Shows/makes an/several movie(s) from an image sequence.