Documentation Center

  • Trial Software
  • Product Updates

imroi

Region-of-interest (ROI) base class

Description

Because the imroi class is abstract, creating an instance of the imroi class is not allowed.

Methods

imroi supports the following methods. Type methods imroi to see a complete list.

addNewPositionCallback — Add new-position callback to ROI object

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.

createMask — Create mask within image

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 — Delete ROI object

delete(h) deletes the ROI object h

getColor — Get color used to draw ROI object.

color = getColor(h) gets the color used to draw the ROI object h. The three-element vector color specifies an RGB triplet.

getPosition — Return current position of ROI object

pos = getPosition(h) returns current position of the ROI object h.

getPositionConstraintFcn — Return function handle to current position constraint function

fcn = getPositionConstraintFcn(h) returns a function handle fcn to the current position constraint function of the ROI object h.

removeNewPositionCallback — Remove new-position callback from ROI object

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 — Resume execution of MATLAB command line

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 — Set color used to draw ROI object.

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 — Set ROI object to new position

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 — Set position constraint function of ROI object

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.

wait — Block MATLAB command line until ROI creation is finished

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.

See Also

Was this topic helpful?