Hi,
I have a question regarding ROIs. I have an image with a ROI which is movable by the user. Upon clicking a "save ROI" button I wish to save the ROI to do some analysis with it. In principle I want to display the saved ROI in the image but make it fixed in position and size so that it cannot be altered by the user anymore. Here's how I thought how I would go about doing that:
-> make a copy of the current movable and scalable ROI
-> change attributes of that copy; fix size and position
-> add copy to the plot
def saveROI(self):
copyROI = self._ROI #make copy of user-draggable ROI
# copyROI.setProperty("movable", False) #doesn't seem to work
copyROI.setZValue(10) # make sure ROI is drawn above image
copyROI.translatable = False #fix position
copyROI.removeHandle(0) #disable scaling
self._Plot.addItem(copyROI)
However, this will overwrite the user-draggable ROI (self._ ROI) and only display the copy. I think the ROI object must have some index so basically it is overwritten by the copy?
To overcome this I could get all the relevant data from the user-ROI and build fixed ROI from that but it seems kinda ugly (lots of if statments to handle the different ROI shapes etc.). It would be much nicer to create a copy and just alter some attributes on the fly. Is this possible?
On a side note, could someone explain to me how one uses the .setProperty method correctly?
Thanks a lot, Chris