def save_to_stack(self): from scikits.image import io img = self.arr.copy() io.push(img) msg = dedent(''' The image has been pushed to the io stack. Use io.pop() to retrieve the most recently pushed image.''') msglabel = QLabel(msg) dialog = QtGui.QDialog() ok = QtGui.QPushButton('OK', dialog) ok.clicked.connect(dialog.accept) ok.setDefault(True) dialog.layout = QtGui.QGridLayout(dialog) dialog.layout.addWidget(msglabel, 0, 0, 1, 3) dialog.layout.addWidget(ok, 1, 1) dialog.exec_()
def test_stack_basic(): x = np.arange(12).reshape(3, 4) io.push(x) assert_array_equal(io.pop(), x)
def test_stack_non_array(): io.push([[1, 2, 3]])