File Exchange

image thumbnail

ROI Draw

version (18.3 KB) by Christopher Changchien
ROI Draw allows you to draw rectangular ROI's at any angle.


Updated 04 Dec 2008

View Version History

No License

Most ROI Drawing Tools limit you to either drawing a circular ROI or a rectangular ROI perpendicular to the X-Y axis. ROI Draw's primary purpose is to expand upon the drawing of rectangular ROI's by allowing you to draw them at any angle.

After selection of an ROI, ROI Draw crops and rotates your ROI into the X-Y plane using a bicubic interpolation algorithm (chosen in order to preserve textural properties) so that spatial statistics may be analyzed.

ROI Draw outputs a .MAT file which, in addition to storing your rotated ROI, stores the original image and a mask file (for calculating pixel statistics), and the coordinates of the corners of your ROI so that they can be used to colocalize an ROI on another image.

ROI Draw at this point only works for DICOM images as its primary purpose is for application in medical research.

Cite As

Christopher Changchien (2021). ROI Draw (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

xin li

Nice work!

Eric Diaz

Just as a response to the comment about using linear vs. cubic interpolation.

Technically it is not as good to use cubic interpolation when it comes to raw signal intensity images that will be later used for calculations (relaxation,etc...) because it can introduce values that do not exist.

The most true to form interpolation of medical imaging formats would actually be nearest neighbor because it does not introduce any new values at all. However, in the literature, it is accepted that a linear interpolation merely takes the average of neighboring pixels and thus has less potential for introducing completely spurious signal intensity values from trying to fit a bicubic model to the neighboring pixels.

If you take a look at the updates I changed it to bicubic interp.

Cris Luengo

I tried modifying it so it would work with other image file types, but ran into all sorts of problems because the code is so fragmented and duplicated. This is probably Guide's fault, and not the author's fault. But still, it's easier to write my own than trying to modify this one. I didn't understand how the interpolation rate is chosen.

Also, why do you say bilinear interpolation preserves texture properties? I think you would be much better of with cubic interpolation than with linear interpolation.

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!