Code covered by the BSD License  

Highlights from


4.9 | 16 ratings Rate this file 94 Downloads (last 30 days) File Size: 455 KB File ID: #40440
image thumbnail




21 Feb 2013 (Updated )

4D/3D image visualization and evaluation GUI.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information

Imagine is back! Comfortable, powerful and intuitive visualization and evaluation of 3D or 4D data (e.g. x-y-z-t). Version 2.0 has an improved rendering engine for better contrast, supports complex data (magnitude/phase) and can show projections. It also supports the direct import of numerous (medical) file formats. Supports evaluation along lines, of regions of interest (ROI) and volumes of interest (VOI) using an easily extendible evaluation framework. ROI and VOI drawing is assisted by livewire (2D), region growing and isocontour function (both 3D). Comes with a documentation pdf-file.
Feature highlights:
- Smooth image zooming and adjustment of brightness and contrast using simple mouse operations.
- Import data directly from MATLAB workspace, mat-, DICOM-, NifTy-, GIPL- and standard image files.
- Displays intensity/magnitude, phase or minimum/maximum intensity projections.
- Powerful image evaluation features.
- Displays up to 16 3D-images simultaneously.
- Shows image intensity and coordinates at current cursor position.
- Link multiple 3D views or operate on individual views separately.
- 3D images can be rotated in 90 degree steps around all axes.
- Write your own evaluation function and easily incorporate into the framework.
- Save stacks of images to image files using the current contrast/brighness settings.

Required Products Image Processing Toolbox
MATLAB release MATLAB 8.2 (R2013b)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (33)
30 Nov 2014 Jose

Just to follow up, that solved my problem.

30 Nov 2014 Jose  
26 Nov 2014 Christian Wuerslin

Hola Jose,

I recently installed R2014b and had the same problem. For R2014b, the eventdata of the mouse wheel callback was changed to an object instead of a struct. The solution is to add this line

if isobject(iCnt), iCnt = iCnt.VerticalScrollCount; end

a few lines above the line which throws the error (just next to a very similar line, which checks for a struct). I will also upload a fixed version soon.

24 Nov 2014 Jose

Hi Christian,

I use imagine a lot and I think it's a great tool. However, I just upgraded to OSX Yosemite and I had to get Matlab R2014. The new imagine version works but the mouse scroll function to explore through slices seems to be broken. Here is the message I get when I try to use it:

Error while evaluating Figure WindowScrollWheelFcn

Undefined function 'plus' for input arguments of type 'matlab.ui.eventdata.ScrollWheelData'.

Error in imagine/fChangeImage (line 1847)
iNewImgInd = SData(iSeriesInd).iActiveImage + iCnt;

Any quick fix for this?

01 Nov 2014 Christian Wuerslin

Thanks for letting me know, Jacob. I work on windows, soI don't get that error. Will also be fixed in a nes release sool.

31 Oct 2014 Jacob Matthews

Had a followup error in which matlab couldn't find icon lw.png. It was in the icons folder but named with a capital 'L'... fixing it was the last error. Just a heads up!

31 Oct 2014 Christian Wuerslin

Hi Jacob,

I see the problem. The file is in the subfolder "Colormaps", but I only add that folder to the path a few lines later. I will upload a fixed version soon (along with some other bugfixes). Until then, you can either add the imagine subfolders to the path manually or move the block that is commented "Set some paths" up a few lines such that they are executed before the "load('mylines.mat');" command.
Sorry and thanks for letting me know.

29 Oct 2014 Jacob Matthews

Hi Christian,
Loved the original release. Use it for quick visualization all the time.
Just downloaded v2, but when I try to run the imagine function it errors on line 120 trying to load mylines.mat which doesn't exist. Am I missing something obvious? Or could this be a version issue?

18 Sep 2014 Ibraheem Al-Dhamari

I tried to load DICOM images but I get this error:
Undefined function or variable "SNewData".
Error in imagine/fLoadFiles (line 1465)
for i = 1:length(SNewData)
Error in imagine/fMenubarClick (line 475)
SNewData = fLoadFiles(csFilenames);
Error while evaluating image ButtonDownFcn
Is it not supported?

21 Jul 2014 Patrick  
18 Apr 2014 Charles  
10 Apr 2014 t zq


08 Apr 2014 Christian Baumgartner

I really enjoy working with your submission. Works perfectly, easy to understand and really nice UI. Well done!

02 Apr 2014 Trung

Sorry, I have figured it out. Holding right mouse button or using "Ctrl + left mouse" would allow the zoom function.

02 Apr 2014 Trung

This is a great app. However, I am unable to zoom. Is there anyone having the same problem or how can I zoom my imported images in the GUI of this app?

26 Feb 2014 Ta Hai

nice job! thank you

16 Dec 2013 francesco

very great tool, either more interactive! :)

04 Dec 2013 Tobias Haushahn  
23 Sep 2013 Michael  
23 May 2013 Martin  
05 May 2013 Paul Andrews  
12 Apr 2013 Arindam Bose  
06 Apr 2013 Christian Wuerslin

Hi Jiro,

OK, I think I'm starting to get the idea of the difference between app and function :). So the next version of the app will simply return the figure handle to comply with the specs.

Thanks for the publicity <3

05 Apr 2013 Jiro Doke

Yes, I think what you're doing makes sense if people are using your app from the command line. The App, on the other hand, is used through the Apps tab, so there won't be a use case of having an output argument anyway. Because of that, I think you can just remove that capability when packaging.

Great tool. BTW, I highlighted your entry on the File Exchange Pick of the Week:

05 Apr 2013 Christian Wuerslin

Hi Jiro,

wow, thanks for the thorough investigation. Would have taken me forever to figure that out. Well, I was trying to give people the possibility to add arbitrary plots (e.g. quiver, lines) to the axes and thus introduced the axes handle output. Since the axes are destroyed when the panel leyout is changed, I disabled this feature when the axes handles are returned. I guess I have to think of something different for the app. Thanks for your suggestions!



04 Apr 2013 Jiro Doke


I think I know what's going on. When you create an App, MATLAB checks to see if your function has an output argument or not. If it does, it will call "imagine" with an output argument. I see that in your code, you disable the ability to change the number of axes when "nargout" is 1.

Just as a note: as you can see from the documentation for Apps (the Tips section)

MATLAB assumes that the output from your function is a figure handle, and that's how it detects whether the figure has closed or not.

A fix would be to use a slightly different version of "imagine" for the App version, and not disable the multi-axes option. You can also output the handle of the figure, as opposed to the handle of the axes.

04 Apr 2013 Christian Wuerslin

Hi Jiro,

thanks for the feedback and making me aware of the bug. I can't test it at the moment and I am a bit puzzled why this error ocurres since the app uses the same m-file as the normal submission, which works fine (at least for me). I'll fix it as soon as I get to my 2012b workstation.

03 Apr 2013 Jiro Doke

Great tool, Christian!

I noticed that the App version has the "Panel Layout" button disabled, and I can't change the layout to show multiple frames.

I really like the interface and the look&feel of the App!

27 Feb 2013 Ronald  
25 Feb 2013 Christian Wuerslin

Hi Roland,

concerning the error: I must have accidentially changed the name of the subfolder "EvalFucntions" to "EvalFunctionsf". Rename this folder and it should work; I will also upload a fixed version asap.

The slice number is shown in the upper left corner of each image panel (since the panels might show different slices) togehter with the total number of slices.

To put the tooltip in the upper left corner is a good idea, I will incorporate that.

Thanks for your feedback!


25 Feb 2013 Ronald

Nice submission!
I encountered one error, Imagine cannot use the find the fEvalLineFWHM function (it is not on the path). Should be easy to fix.

Also some nice additions would be:
- show a tooltip for the buttons (or a text at the location where not the position and pixel value is shown).
- add the slice position instead of only showing x and y.

22 Feb 2013 Thomas

Best MRI image visualization tool!

22 Feb 2013 Thomas  
21 Feb 2013

Whoops, forgot the icons in the initial upload :S

26 Feb 2013

V 1.1 changelog:

- Fixed wrong subdirectory name.
- Subdirectory for evaluation functions is automatically added to path.
- Added Tooltips

20 Mar 2013

V 1.2 changelog:

- Documentation included
- Changed GUI architecture
- Added comments
- Some bugfixes
- Line profiles show captions
- Return axes handles

21 Mar 2013

V 1.2 changelog:

- Documentation included
- Changed GUI architecture
- Added comments
- Some bugfixes
- Line profiles show captions
- Return axes handles

21 Mar 2013

New icons.

27 Mar 2013

Fixed bugs in zooming and file opening operations.

03 Apr 2013

V 1.4 changelog:

- Added app
- Added save to file feature

09 Apr 2013

^^ Typo ^^
This is still V 1.3. App returns figure handle and allows layout change.

23 Oct 2014

V 1.4 Changelog:
- Added colormaps
- Added colorbar option
- Added evalbar option
- Better zooming operation

24 Oct 2014

V 2.0
- New display engine
- DICOM, NifFty, GIPL and mat-Import
- Complex data
- Projections
- New eval framework
- more bugs :)

04 Nov 2014

Fixed some bugs, updated documentation.

Contact us