Save/load gui state with imroi objects

I am current developing a gui from guide that uses imroi objects on an image that is an axes. Could someone give an example of saving and loading a previous state from guide using imroi objects so when you load, the objects are still adjustable?
Example: You have an image in an axis and an impoly object(s) that is adjustable. The goal is to be able to load the image and the impoly object(s) so you can adjust them.
Background: I am working with a neural image in which I want to create roi regions of cells. I have roughly 200 impoly objects in which I may have to adjust around the cell after an automatic cell segmentation algorithm creates the objects. I want to save the objects so if it takes a long time to fix the locations, I can load the state that I was previously working from.

 Akzeptierte Antwort

Image Analyst
Image Analyst am 23 Jul. 2012

0 Stimmen

Just use save() to save your variables to a .mat file, and use load() to recall them the next time you want to use them, like the next time you launch your app. I do it all the time - it works great.

3 Kommentare

Andrew
Andrew am 23 Jul. 2012
I did what you said but I am unsure how to reactivate the imroi objects. I have a variable called handles.shapes which are the imroi objects. I load them but they do not appear nor are they recognized. Any more suggestions?
Image Analyst
Image Analyst am 24 Jul. 2012
If you want to interact with them again, then you'll have to call the functions again. For example you'll need to save the "position" variable that imrect returns to your mat file. Then when you want to interact with imrect again, you'll have to read the variable out of the mat file and call imrect with that variable to set it up for further user interaction.
Andrew
Andrew am 25 Jul. 2012
Worked out nicely. Thank you for resolving my problem Image Analyst!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by