Hi,
IsoCurveItem is know to be slow (look at the source code). You have two
possibilities :
- write another implementation more efficient (and suggest it on github)
- use another library for the computation of the isolines. Skimage is a
good candidate since the method is written in cython.
I personnaly chose the second solution for my app (do not have the time to
write annother method), and it work perfectly. I have observed a nice
speed-up (x10 to x100) compared to the implementation of pyqtgraph.
Regards,
Vincent
Le vendredi 17 mars 2017 10:44:33 UTC+1, [email protected] a écrit :
>
>
> Hi,
>
> I have an ImageView which resides in a PlotItem (for the grid) and want to
> draw a number of IsoCurveItems on the ImageItem like in the IsoCurveItem
> example file. The image is about 1000 x 1000 px. Adding the IsoCurveItems
> seems to be very slow. I put a
> QApplication.processEvents()
> in the loop and can literally watch the curves appear one after another.
> Is there a way to speed things up for larger number of curves?
>
> Thanks...
>
> Here is some test code:
> from pyqtgraph.Qt import QtGui, QtCore, QtWidgets
> import numpy as np
> import pyqtgraph as pg
>
> app = QtGui.QApplication([])
>
> m = n = 1000
> x, y = np.meshgrid(range(m), range(n))
> data = (x - m / 2) ** 2 + (y - n / 2) ** 2
>
> win = pg.GraphicsWindow()
> vb = win.addViewBox()
> img = pg.ImageItem(data)
> vb.addItem(img)
>
> for level in np.linspace(data.min(), data.max(), 11)[1:-1]:
> c = pg.IsocurveItem(data=data, level=level, pen=(0, 0, 0))
> c.setParentItem(img)
> QtWidgets.QApplication.processEvents()
>
> if __name__ == '__main__':
> app.exec_()
>
>
>
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/846ec40b-83e0-4c13-8878-2a2e953d202a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.