Discussion:
[guidata/guiqwt] Extract ROI to python variable
G M
2016-05-04 10:44:58 UTC
Permalink
Hi all,
I have embeded a 2d array viewer as a method (viewer) of my class so when I
need to plot 2d array data of an instsance of the class let's say "a" I can
call a.viewer(), I would like to be able to extract a ROI (sub matrix) to
save in a python variable inside my class e.g. a.ROI instead to save the
ROI as .npy and then reopen it with np.load. Is there any way to do it ?

Thanks for your help!

Best regards,
Giacomo


def viewer(self):
#Based on PythonQwt https://pypi.python.org/pypi/guiqwt
from guiqwt.plot import ImageDialog
from guiqwt.builder import make

def create_window():
win = ImageDialog(edit=True, toolbar=True, wintitle=self.name,
options=dict(show_contrast=True,show_xsection=True,
show_ysection=True, xlabel='stage res.= %s mm x' %(self.resolution), xunit=
'mm', ylabel="y",yunit='mm',zlabel='Distance',zunit='mm',
show_itemlist=True))
win.resize(800, 600)
return win



import guidata
_app = guidata.qapplication()
# --
win = create_window()
image2 = make.image(a.array, title="Data",xdata=[0,self.array.shape[
1]*self.resolution],ydata=[0,self.array.shape[0]*self.resolution],
interpolation="nearest")
plot = win.get_plot()
plot.add_item(image2, z=1)
win.exec_()
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...