# 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 2012 Piotr Dollar.  [pdollar-at-caltech.edu]
     Please email me if you find bugs, or have suggestions or questions!
     Licensed under the Simplified BSD License [see external/bsd.txt]