Code covered by the BSD License  

Highlights from
imdisp

4.75

4.8 | 14 ratings Rate this file 95 Downloads (last 30 days) File Size: 7.02 KB File ID: #22387
image thumbnail

imdisp

by

 

10 Dec 2008 (Updated )

Display multiple images as a montage of subplots

| 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.

This function is now included in the sc package:
http://www.mathworks.com/matlabcentral/fileexchange/16233
The version here will not be maintained.

Acknowledgements

This file inspired Add An Roi Toolbar To Your Figure, Imdisp (Enhanced Version), Simulate Motion In Cartesian Mri, and Sc Powerful Image Rendering.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (22)
02 Oct 2013 dikra KHEDHAOUIRIA  
17 Jul 2013 Yi Sui  
17 Jul 2013 Yi Sui  
09 Jun 2013 Erik BĂ©langer

Hi,

This tool is great, placing gaps between images is nice, exactly what I was looking for.

However, I noticed that gaps are doubled for every images that do not touch to outer borders of the montage. Single gaps are used for images lying around the montage.

For quick data screening it is fine but for building final montage figures it is a little annoying to have irregular spacing between images. Can it be fixed?

21 Jan 2013 Jurgen

I made a small adjustment in imdisp today:
line 139 "lims = default_limits(A)" changed to lims = default_limits([I{:}])

This will ensure the colormap will cover the whole range of values in the images of cell array I.

17 Jan 2013 Jurgen

Basic solution for caption:
uicontrol('Style','Text','String','MyInfo')

Since I use size=1 alot, for me this gives a small title (default:in the lower left corner).

Get index with:
int2str(getfield(get(gcf,'UserData'),'index'))

24 Nov 2011 Venkat R

Hi
This tool is better than Matlab's montage. as it can display images unequal in size. Is it also possible to display such images in a standard size, instead of displaying in their truesizes? Because the small image displayed with a tall image looks unappealing for comparison.

thanking you

05 Oct 2011 FT  
27 Jan 2011 Irvin

Excellent for reviewing fmri timeseries. It's been said, but yeh, frame number annotation would be great.

25 Jan 2011 Daniel Lopes

Great piece of code! It is quite useful for processing medical images as one can see the several outputs of image filtering all at once or by scrolling them down in one figure. Not quite friendly to customize by adding extra graphical elements such as text, titles or lines.

30 Sep 2010 Dan Knudsen  
25 Jun 2010 Amitabh Verma

Thanks Oliver, your work around works as well. But loading multi-frames a gig each tend to really slow things down. It would be nice to have (previous, current, next) pages loaded at a time. Maybe when you have some free time on you. Thanks again !

23 Jun 2010 Oliver Woodford

Amitabh: I don't have time to do that, unfortunately. However, if you load the images yourself then it's easy to do. Put the two (or more) sets of images into a 2xN cell array, display them in a 1x2 grid, then page through a row at a time (up/down). This will give you the effect you want.

23 Jun 2010 Amitabh Verma

I would like to make a feature request. I use imdisp to visually compare two images for which it works great. However, I am also dealing with multi-frame (time-lapse) tiff images. If there is an option to forward using the arrow keys like it does for single multi-frame images which forwards to the next frame for both/multiple loaded multi-frame images it would be greatly useful and appreciated. (Only needed where the size of multi-frame is same for the loaded images) Thanks !

24 May 2010 Amitabh Verma

Thanks Oliver for the update. With the multi-frame support it works great now !

21 May 2010 Amitabh Verma

Hi,
I have a multipage tiff which I would like to use using imdisp but cannot seem to load all the pages using filename. Only the first image displays. Any help would be most appreciated. Thanks, works like a charm for everything else.

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?)

16 Apr 2009 Shi vera

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

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.

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 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 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.

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.

02 Mar 2010

A few bug fixes. Also made scrolling through image sets more responsive.

17 Mar 2010

Improved image placement when using multiple monitors. The image should now always appear entirely on the screen.

13 May 2010

Fixed bug affecting indexed images specified by filename (thanks to Christos Strubulis for helping to find it). Added support for more file formats for images specified by filename.

24 May 2010

Added support for multi-frame image files

09 Jun 2010

Fix to bug introduced in previous update, which caused an error when supplying multiple images in a cell array.

08 Jul 2014

Updated description as this file is included in the sc package.

Contact us