| Contents | Index |
Because the imroi class is abstract, creating an instance of the imroi class is not allowed.
imroi supports the following methods. Type methods imroi to see a complete list.
id = addNewPositionCallback(h,fcn) adds the function handle fcn to the list of new-position callback functions of the ROI object h. Whenever the ROI object changes its position each function in the list is called with the syntax:
fcn(pos)
where pos is of the form returned by the object's getPosition method.
The return value, id, is used only with removeNewPositionCallback.
BW = createMask(h) returns a mask, or binary image, that is the same size as the input image with 1s inside the ROI object h and 0s everywhere else. The input image must be contained within the same axes as the ROI.
BW = createMask(h,h_im) returns a mask the same size as the image h_im with 1s inside the ROI object h and 0s outside. This syntax is required when the axes that contain the ROI hold more than one image.
delete(h) deletes the ROI object h
color = getColor(h) gets the color used to draw the ROI object h. The three-element vector color specifies an RGB triplet.
pos = getPosition(h) returns current position of the ROI object h.
fcn = getPositionConstraintFcn(h) returns a function handle fcn to the current position constraint function of the ROI object h.
removeNewPositionCallback(h,id) removes the corresponding function from the new-position callback list of the ROI object h. id is the identifier returned by the addNewPositionCallback method.
resume(h) resumes execution of the MATLAB command line. When called after a call to wait, resume causes wait to return an accepted position. The resume method is useful when you need to exit wait from a callback function.
setColor(h,new_color) sets the color used to draw the ROI object h. new_color can be a three-element vector specifying an RGB triplet, or a text string specifying the long or short name of a predefined color, such as 'white' or 'w'. See ColorSpec for a list of predefined colors.
setConstrainedPosition(h,candidate_position) sets the ROI object h to a new position. The candidate position is subject to the position constraint function. candidate_position is of the form expected by the setPosition method.
setPositionConstraintFcn(h,fcn) sets the position constraint function of the ROI object h to be the specified function handle, fcn. Whenever the object is moved because of a mouse drag, the constraint function is called using the syntax:
constrained_position = fcn(new_position)
where new_position is of the form returned by the getPosition method. You can use the makeConstrainToRectFcn to create this function.
accepted_pos = wait(h) blocks execution of the MATLAB command line until you finish positioning the ROI object h. You indicate completion by double-clicking on the ROI object. The returned position, accepted_pos, is of the form returned by the object's getPosition method.

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |