How to define, edit and delete ROI in a (scatter) plot?
4 views (last 30 days)
Show older comments
I have a plot of data of some measurement. I want to define several ROIs in the plot, in order to make fitting, or determine the baseline or whatever reason, and I need these ROIs in a variable (or variables). Is it possible to make it grafically? All the methods I tried (imline, brush, datacursor) are for different task and does not allow editing, deleting the ROIs both from the picture and from the variable, I was not able to follow the changes I have made when tried i.e. change the limits of the ROI.
I think there should be something but I could not find it. It is so essential when someone wants to evaluate the data.
Thanks for any suggestions.
Csaba
0 Comments
Answers (2)
Debarati Banerjee
on 12 Apr 2016
For the function 'imline', you can use the method 'delete' to delete the the ROI object from figure. You may edit the position of the ROI using the method 'setPosition'.
Please refer to the section 'Methods' of the following link for more details: http://in.mathworks.com/help/images/ref/imline.html
Hope this helps!
Cheers, Debarati
Debarati Banerjee
on 13 Apr 2016
You may use the 'DeleteFcn' property to call a function when an 'imfill' object is being deleted.
>> set(h,'DeleteFcn',{@fcn}) % where h is an imfill object
In the 'fcn' function you can pass aapropriate display commands which will display messages in Command Window and help you in understanding which object is deleted/ position is changed.
3 Comments
Debarati Banerjee
on 14 Apr 2016
Hello Csaba,
Please find the scripts 'mainfcn.m' and 'test.m'. In the mainfcn script I have created a ROI (h) and have added the DeleteFcn callback with the function test. Once the ROI is deleted, the test function is executed. In the test script, I am displaying a message in Command Window. Additionally I am setting the value of h to 0 for understanding purpose.
Its just an idea and I hope this helps!
Cheers Debarati
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!