def createWidget(self, parent): red = QColor(255, 0, 0) green = QColor(0, 255, 0) blue = QColor(0, 0, 255) model = BoxListModel() model.insertRow(model.rowCount(), BoxLabel("Box 1", red)) model.insertRow(model.rowCount(), BoxLabel("Box 1", green)) model.insertRow(model.rowCount(), BoxLabel("Box 1", blue)) a = BoxListView(parent) a.setModel(model) return a
# =========================================================================== # Example of how to do the thing # we generate a dot at random position every 200 milliseconds # when the dot happen to be in the centre of the movable squere in the # image then we show a one on the top left corner # =========================================================================== from ilastik.widgets.boxListView import BoxListView from PyQt5.QtWidgets import QWidget app = QApplication([]) boxListModel = BoxListModel() h, w = (500, 500) LV = BoxListView() LV.setModel(boxListModel) LV._table.setShowGrid(True) g = Graph() cron = QTimer() cron.start(500 * 100) op = OpArrayPiper2(graph=g) # Generate random noise shape = (1, w, h, 1, 1) # array = np.random.randint(0,255,500*500).reshape(shape).astype(np.uint8) import scipy array = scipy.misc.lena().astype(np.uint8) array = vigra.sampling.resize(array.astype(np.float32), (h, w)).reshape(shape).astype(np.uint8)