FHROI: Interactively specify 2D freehand ROI
Overlays an imfreehand ROI on an image.
Gives the ability to tweak the ROI by adding and
subtracting regions as needed, while updating
the ROI boundaries as an overlay on the image.
Returns a logical matrix of the same size as the
bwMask = fhroi([axHandle])
axHandle: handle to axes on which to operate (optional)
bwMask: ROI mask as logical matrix
I = rand(20) + eye(20);
imshow(I, , 'Colormap', hot, 'initialMagnification', 1000);
bwMask = fhroi;
See also IMFREEHAND, CREATEMASK
Andrew Davis (2020). FHROI: Interactive freehand ROI (https://www.mathworks.com/matlabcentral/fileexchange/34890-fhroi-interactive-freehand-roi), MATLAB Central File Exchange. Retrieved .
I thought I would post this question I received via email in case others have a similar question:
Q: I was wondering if there is a modification that can be made to report the roi (bwMask) not as a binary, but with the original signal intensities of the image?
A: The nice thing about returning the ROI as a logical is that it can be used to index the original matrix directly. So if your original image was I, you can call
>> Iselected = I(bwMask);
to get a vector of signal intensities corresponding to the ROI. Or to get an image with the non-ROI pixels zeroed out, you could call
>> Imasked = I.*bwMask;
For more, see Steve's blog: http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/
re-submission of the file since it didn't update last time
- Added 'delete ROI' user option