This function adds an ROI toolbar to your figure.
The ROIs are created using matlab buid-in class imroi.
addRoiToolbar: Add an ROI toolbar to the current figure.
addRoiToolbar(h): Add an ROI toolbar to the figure with a handle h.
Example 2 (Multiple images):
Now draw some ROIs,and right click on one of them, you will see more functions in a context menu, such as:
* change color
* x-y plot
Thanks to the "draggable" made by Francois Bouffard, you can drag around the textbox of ROI info.
imdisp is a nice tool to display multiple images in one figure, written by Oliver Woodford
see also: imroi, imrect, imellipse, imfreehand, imline.
%Edited by Muinul Islam
hcm= unique(cell2mat(hcm)); Replace this line by
too bad it doesn't seem to work under 2014b or 2015a anymore.
Hi, another idea: You offer XY Plot for a line but it would also make sense to offer an xy-plot for a selected rectangle... plot the cumulative sum (column-wise, i.e.). This is a feature I use most often with ImageJ, would be great to have in Matlab because there is currently no quick way to do it.
got some more suggestions of features you might wanna add:
- the capability to simply copy a ROI, that'd be very useful!
- it would be great if one could save all ROIs and load them again on a different image
- create a cell or struct with all the ROIs (size, position, mean values etc.). This would be great for evaluating the ROIs with some code
Stunning work! really helps a lot, thank you!
Just check the help of imroi
You can get the position using
pos = getPosition(h)
where h is the handle of an imroi object.
Thank You! I realized the solution was that i had to double click the image i was interested in before selecting the roi tool. Another question is does this function allow me to get the x and y data points of the roi. I would like to be able to have the same roi show up on another image in the same position. Thanks!
addRoiToolbar takes figure handles,
So you can use
where h is the handle of the figure you want to add the toolbar on.
let me know if it works.
Hello, I am trying to use this in a GUI with multiple axes. However the function only works on the most recently opened gui figure but i would like it to work on all the figures. How do i do this?
% --- Executes just before image_processing_July9 is made visible.
function image_processing_July9_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to image_processing_July9 (see VARARGIN)
% Choose default command line output for image_processing_July9
handles.output = hObject;
set(handles.edit_gamma,'String', sprintf('%4.0f%', get(handles.gamma_slider,'Value')));
set(handles.edit_transparency,'String', sprintf('%4.0f%', get(handles.transparency_slider,'Value')));
% Update handles structure
% UIWAIT makes image_processing_July9 wait for user response (see UIRESUME)
arnold, thank you for your feedback.
I updated it to support the live update of histogram.
Thanks, nice function!
Is there a way you could add a live update for a plot or histogram?
Add a slider to adjust the number of bins in histogram
Live update for histogram and x-y plot.
Create scripts with code, output, and formatted text in a single executable document.