Ejemplo n.º 1
0
    def reset_dn(self, dn, size, simul_z=None, simul_xy=None):

        if simul_z is None:
            simul_z = 1
        if simul_xy is None:
            simul_xy = dn.shape[1:][::-1]

        # simul_z = 2
        # simul_xy = (1024,)*2
        # simul_z = 2
        # simul_xy = (512,)*2

        self.bpm = Bpm3d_img(size=size,
                             dn=dn,
                             lam=.5,
                             simul_z=simul_z,
                             simul_xy=simul_xy)

        if not dn is None:
            self.dn_max = np.amax(dn)

        z = np.zeros_like(dn)
        z[0, 0, 0] = 1.

        units = [s / (n - 1.) for s, n in zip(size, dn.shape[::-1])]
        self.canvas.setModel(DataModel(NumpyData(z, stackUnits=units)))
Ejemplo n.º 2
0
def data_model(data):
    app = QtWidgets.QApplication(sys.argv)
    t = time.time()
    app.d = DataModel(NumpyData(data))
    print("time to datamodel: ", time.time() - t)
    QtCore.QTimer.singleShot(100, app.quit)
    app.exec_()
Ejemplo n.º 3
0
def test_tiffdata():
    d = TiffData(rel_path("../data/flybrain.tif"))

    m = DataModel(d)
    print(m)
    for pos in range(m.sizeT()):
        print(pos)
        print((np.mean(m[pos])))
Ejemplo n.º 4
0
def test_numpydata():
    d = NumpyData(np.ones((10, 100, 100, 100)))

    m = DataModel(d)

    print(m)
    for pos in range(m.sizeT()):
        print(pos)
        print(np.mean(m[pos]))
Ejemplo n.º 5
0
def test_spimdata():
    d = SpimData(rel_path("../data/spimdata"))

    m = DataModel(d)
    print(m)
    for pos in range(m.sizeT()):
        print(pos)
        print(np.mean(m[pos]))
    return m
Ejemplo n.º 6
0
def test_tiffdata():
    d = TiffData(rel_path("../data/flybrain.tif"))

    m = DataModel(d)
    print("thread is running: ", m.dataLoadThread.isRunning())
    print(m)
    for pos in range(m.sizeT()):
        print(pos)
        print((np.mean(m[pos])))
    time.sleep(.1)
Ejemplo n.º 7
0
def test_rawdata():
    d = RawData(rel_path("../data/raw_64_65_66.raw"),
                shape=(1, 66, 65, 64),
                dtype=np.uint16)

    print(d.size())
    m = DataModel(d)
    print(m)
    for pos in range(m.sizeT()):
        print(pos)
        print((np.mean(m[pos])))
Ejemplo n.º 8
0
def _with_glwidget(data):
    app = QtWidgets.QApplication(sys.argv)

    win = GLWidget()

    d = DataModel(NumpyData(data))
    t = time.time()
    win.setModel(d)
    print("time to set model in glwidget: ", time.time() - t)
    win.show()
    win.raise_()
    app.win = win
    QtCore.QTimer.singleShot(200, app.quit)
    app.exec_()
Ejemplo n.º 9
0
import numpy as np
from PyQt5 import QtCore
import logging
from spimagine import volshow, volfig, logger, qt_exec, NumpyData, DataModel


def single_data(data):
    w = volshow(data, raise_window=False)
    QtCore.QTimer.singleShot(1000, w.closeMe)
    qt_exec()


def test_volumes():
    d = np.random.uniform(0, 100, (100, ) * 3)

    for dtype in (np.float32, np.int8, np.uint16, np.int32):
        print("testing: %s" % dtype)
        single_data(d.astype(dtype))


if __name__ == '__main__':
    data = np.linspace(0, 255, 100**3).reshape((100, ) * 3).transpose(
        (1, 2, 0))

    m = DataModel(NumpyData(data.astype(np.uint8)))
    w = volshow(m)

    QtCore.QTimer.singleShot(1000, w.closeMe)
    qt_exec()