Code covered by the BSD License  

Highlights from

5.0 | 7 ratings Rate this file 35 Downloads (last 30 days) File Size: 23.2 KB File ID: #40753 Version: 2.3.3
image thumbnail




12 Mar 2013 (Updated )

This is a image slice viewer with built in scroll, contrast, zoom and ROI tools.

| Watch this File

File Information

Use this class to make a self-contained image viewing panel within a GUI (or any figure). Similar to imtool but with the added ability to scroll through slices of an image stack. Only designed to view grayscale (intensity) images. Hopefully this will save people time when either designing a GUI or even when they just need to quickly look through an image stack.

Required Products Image Processing Toolbox
MATLAB release MATLAB 8.4 (R2014b)
MATLAB Search Path
Other requirements Image processing toolbox
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
28 Aug 2015 Giorgio

Very nice tool!

Is it possible a faster window and leveling by mouse left click?

27 Aug 2015 Ibraheem Al-Dhamari

You are welcome Justin, it would be also nice to display two different 3D images in different colors (good to visualize fusion results).

Comment only
10 Jul 2015 Justin Solomon

Thanks @Meade and @Ibraheem Al-Dhamari for pointing out this bug. I tend to just convert all my images to doubles when I read them in so I hadn't seen this error before. I'll include this fix in the next version.

Comment only
09 Jul 2015 Meade

Meade (view profile)

Great code.

I get the following error when opening standard DICOM data using Matlab's baked in dicomread fnc:

---code below---
Error using .*
Integers can only be combined with integers of the same class, or scalar doubles.

Error in linspace (line 30)
y = d1 + (0:n1).*(d2 - d1)/n1;

Error in imtool3D (line 310)

---end code---

I changed line 310 to :

---code below---
---end code---

and it seemed to take care of it.
Thanks again!

08 Jul 2015 Ibraheem Al-Dhamari

very nice tool :D
I changed these lines after311 to make it suitable for different image types e.g. I have an 256x256x60 int16 image and I got some errors but this code solved them:

would be nice if there is "undo button". Maybe I implement this when I have more time.

31 Oct 2014 Justin Solomon

@Diana Carver, I just updated imtool3D to be compatible with R2014b. Hopefully should work for you now.

In case you're curious, the problem was that you can no longer make a double array of handles in R2014b. Thus cell2mat throws an error when trying to convert a cell array of handles to a double array of handles. This is because the new Matlab has drastically changed the graphics system. Graphics handles are now objects, and not doubles.

Comment only
27 Oct 2014 Diana Carver

Great tool! Only thing is, I just upgraded to 2014b and alas it no longer works. I get this error:

Error using cell2mat (line 52)
CELL2MAT does not support cell arrays containing cell arrays or objects.

Error in imtool3D (line 225)

Trying to debug it myself to figure out what went wrong.

27 Jul 2014 Justin Solomon

@ Edwin
I just submitted a major update to the tool. The user now has access to all the underlying handles of the objects contained in the tool. You may be able to accomplish what you want now. (Though I'm not entirely clear on what exactly you want to do).

%get a structured variable of all the handles
handles = getHandles(tool)
%et the 'AlphaData' property of the image

Comment only
12 Jun 2014 Justin Solomon

@ Edwin
Thanks for the positive feedback. Unfortunately there is not an AlphaData property for this tool right now. I'm planning to make a major revision to this tool to make it easier to access the underlying image objects. It will be much easier to do what you describe in the next version. Stay tuned! (no timeline yet, really busy with other stuff at the moment).

Comment only
11 Jun 2014 Edwin

Edwin (view profile)

Great tool! Is there an equivalent to an 'AlphaData' tag property for this tool? Trying to see if one could overlay a set of images and use this tool to scroll through it. Thanks!

19 Apr 2013 Maysam Shahedi

Maysam Shahedi (view profile)

Nice GUI!
You can use mouse wheel to switch slices. It makes the GUI easier to use.

19 Mar 2013 Anna Rodrigues  
18 Apr 2013 1.1

Added the method:
ROI = getROIinfo(tool)
This lets the user get information about the currently selected ROI

26 Jul 2014 1.2

New in version 2.0- Completely redesigned the tool. Window and leveling, pan, and zoom are now done with the mouse as is standard in most medical image viewers. Also the overall astestic design of the tool is improved with a new black theme. Added ab

28 Jul 2014 1.3

2.1- Added crop tool, help button, and button that resets the pan and zoom settings to show the entire image (useful when you're zoomed in and you just want to zoom out quickly.

05 Sep 2014 1.4

Updated Screenshot

23 Oct 2014 1.5

Updated to allow for multiple imtool3D objects in a single figure while being able to use the scroll wheel for each one.

31 Oct 2014 1.6

Updated for compatibility with MATLAB R2014b. Also fixed a bug where an error was shown when a single slice image is viewed with imtool3D.

04 May 2015 1.7

Added ability to overlay a semi-transparent mask on top of the image data. Also redesigned/simplified the ROI tools implementation.

04 May 2015 1.8

Now the code makes sure the figure is centered when creating an imtool3D object in a new figure.

22 May 2015 2.3.2

2.3.2- Squished a few bugs for older Matlab versions. Added method to set and get the transparency of the overlaid mask. Refined the panning and zooming.

22 May 2015 2.3.3

Fixed one more window and level bug.

22 May 2015 2.3.3

Fixed typo.

Contact us