View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

4.7 | 3 ratings Rate this file 14 Downloads (last 30 days) File Size: 11.3 KB File ID: #9183 Version: 1.0
image thumbnail



Laszlo Balkay (view profile)


29 Nov 2005 (Updated )

Interactive roi definition tool

| Watch this File

File Information

ROITOOL enables to define different type of rois on images (intensity, RGB) by mouse. The supported types are 'polygon', 'circle' and 'rectangle'. ROIPOLY returns the handler of the line object relating
 to the roi. The created roi can be dragged and moved to any position of the image with the help of DRAGGABE function (developed by Francois Bouffard, see the help of draggable).

ROITOOL generates a context menu to the roi making possible the selection of the following commands:(MATLAB displays the context menu whenever you right-click over the object)

- change the roi color
- change the size of the line width
- switch on/off the 'statistical bar', which displays the main stat. results of the roi (mean, std, min, max, roi area)
- switch on/off the 'histogram figure', which shows the intensity histogram of the pixels belonging to the roi
- switch on/off the 'detailed rectangle' figure, which plots the zoomed image segment defined by the rectangle roi
- resize the roi (in case of circle or rectangle roi)
- delete the roi

ROITOOL('circledemo'), ROITOOL('rectangledemo') or ROITOOL('polygondemo')

start the roi definition using the MATLAB 'MRI' data set.
Installing, running: unzip the downloaded file and include them to your matlab path


Draggable inspired this file.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
24 Oct 2015 arnold

arnold (view profile)

yes, so many great old tools are broken in the newer versions. Too bad Mathworks didn't care for backward compatibility.

addRoiToolbar is broken too.

Comment only
18 Jun 2015 Brian

Brian (view profile)

Does not work in Matlab 2015 anymore. Brings an error

Undefined function 'real' for input arguments of type ''.

Comment only
16 Dec 2013 jorge bojorquez

It is very good!!! Thanks a lot.

22 Jun 2012 Muhammad Ghani

I am trying to figure this code. I am having the error
Error using ==> roitool at 76
ROITOOL expects a current figure containing an image.

Please help me in this regard

Comment only
22 Aug 2011 Soha

Soha (view profile)

22 Aug 2011 Soha

Soha (view profile)

I've tried this around a week ago and it's great. I would like to retrieve the histogram data, anyway I could do this? (pixels values in the area chosen)

Comment only
14 Feb 2009 Laszlo Balkay

Laszlo Balkay (view profile)

Comment to Winnie: You can get the ROI handler issuing (for example) ">> roi_handler = roitool('circledemo');" and the ROI coordinates can be import by "x = get(roi_handler,'Xdata');
y = get(roi_handler,'Ydata');"

Comment only
26 Jan 2009 winnie

winnie (view profile)

I tried this tool today, but I could not retrieve the output. All it gave me was a single number... Any ideas? I need an output telling me the ROI co-ordinates!

Comment only
04 Dec 2007 Gal Haspel

did not work at first. error when calling "var". I had to change lines 286 and 370 to
roistd = std(double(userdata.currentimage(pixel_range)));

after that, it's useful and nice. thanks a lot!

12 Jul 2006 Laszlo Balkay

Comments to

The POLY2MASK sub-function is part of the image processing toolbox, which is required for ROITOOL. (see the detailed description above)

Comment only
12 Jul 2006 S C

the POLY2MASK sub-function is undefined, why?
help please!

Comment only
19 Mar 2006 A B

what sure i put in for arg1,2 and 3? help, please

Comment only

Contact us