4.66667

4.7 | 4 ratings Rate this file 228 downloads (last 30 days) File Size: 6.15 KB File ID: #22387

imdisp

by Oliver Woodford

 

10 Dec 2008 (Updated 01 May 2009)

Code covered by BSD License  

Display multiple images as a montage of subplots

Download Now | Watch this File

File Information
Description

This function combines the functionality of IMAGE, IMAGESC, IMSHOW and MONTAGE.

In particular, it improves upon the MONTAGE function in the Image Processing Toolbox in these ways:
   - Image Processing Toolbox not required
   - Images are placed in subplots, so can be zoomed separately.
   - Small images are properly enlarged on screen.
   - Gaps can be placed between images.
   - Images can be viewed on a grid smaller than the number of images.
   - Surplus images can be viewed by scrolling through pages.
   - A directory of images can be viewed easily, by calling IMDISP with no arguments (a visual DIR).

To see two useful modes of operation try the following:

load mri
figure;
imdisp(D, bone(256));
figure;
imdisp(D, bone(256), 'Size', 1);

Use arrow keys to scroll through the image set with the single image.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
20 Dec 2008 Francis Burton

This function does exactly what I hoped and expected the original Image Processing Toolbox function to do, only much better and with some extra useful behavior - namely the ability to scroll through image sets. Mathworks could do worse than hire the author to write new, improved IPT functions.

20 Mar 2009 Image Analyst

One note of warning. If you call this function from within your m-file code for your GUI, it will blow away everything on your GUI - it will not automatically pop up a new window. To avoid this, I simply put the lines
figure;
imdisp(montageCellArray, 'Border', [.01 .01]);
into my code. This will bring up a new blank figure (which will get replaced by the montage of images rather than my GUI.)
Looking forward to the captions....

20 Mar 2009 Image Analyst

One note of warning. If you call this function from within your m-file code for your GUI, it will blow away everything on your GUI - it will not automatically pop up a new window. To avoid this, I simply put the lines
figure;
imdisp(montageCellArray, 'Border', [.01 .01]);
into my code. This will bring up a new blank figure (which will get replaced by the montage of images rather than my GUI.)

Secondly, I'd like to see the option of having the base file name as a caption on each image.

Third, it should do a better job of sizing the window. Mine pops up with the bottom edge under the Windows task bar, and tons of space on the right and left edge of the screen. Ideally there would be an option to size it to some fraction of the screen, such as 90% of the size in both x and y direction, or even fully maximized (no border).

20 Mar 2009 Oliver Woodford

Displaying more than one image will clear the figure. Displaying a single figure will put it in the current axes.

The idea of having the filenames as captions is excellent, but there are a couple of issues that I can see which would significantly increase the complexity of the code, not least how and where to render the text so it is clearly visible, so I'm afraid I won't be doing it. I recommend someone giving it a try though.

Figure size is chosen to maximize image size of large images, or give integer magnification for small images (thus avoiding nearest-neighbour resizing artefacts). Layout is chosen to allow the largest image size possible. Note that this will not necessarily minimize the number of blank spaces. Both figure size and layout are based on the size of the first image. If you have an example of it doing a bad job please email me the images and test script.

16 Apr 2009 Shi vera

oh,i think this is a good idea to write some functions that what we really need!

27 Jul 2009 Yaroslav Bulatov

One gotcha is that one image in the grid can be rendered differently depending on other images in the array (related to scaling of intensity values perhaps?)

Please login to add a comment or rating.
Updates
11 Dec 2008

Added ability to scroll by row. Bug fixes.

25 Feb 2009

Bug fix

19 Mar 2009

Improved functionality for single images, to be more like IMSHOW. Name changed from MONTAGE to IMDISP to reflect this.

31 Mar 2009

Important bug fixes

01 May 2009

Faster when displaying an array of images. Can accept limits as an input (without the parameter name first), like imagesc and imshow.

Tag Activity for this File
Tag Applied By Date/Time
gui Oliver Woodford 10 Dec 2008 16:31:27
image processing Oliver Woodford 10 Dec 2008 16:31:27
figure Oliver Woodford 10 Dec 2008 16:31:27
montage Oliver Woodford 10 Dec 2008 16:31:27
display Oliver Woodford 10 Dec 2008 16:31:27
image Oliver Woodford 10 Dec 2008 16:31:27
multiple subplots Oliver Woodford 10 Dec 2008 16:31:27
multiple images Oliver Woodford 10 Dec 2008 16:31:27
subplot Oliver Woodford 10 Dec 2008 16:31:27
imagesc Oliver Woodford 19 Mar 2009 13:39:24
imshow Oliver Woodford 19 Mar 2009 13:39:24
grid Oliver Woodford 23 Mar 2009 09:21:33
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com