Example #1
0
    def __init__(self, mainWidget, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.main = mainWidget
        self.npoints = 200

        self.setAntialiasing(True)

        # First plot for the number of molecules
        self.plot1 = self.plotItem
        self.plot1.setLabels(bottom=('Tiempo', 's'),
                             left=('Number of single molecules'))
        self.plot1.showGrid(x=True, y=True)
        self.curve1 = self.plot1.plot(pen='y')
        self.plot1.vb.setLimits(yMin=-0.5)

        # Second plot for the number of overlaps
        self.plot2 = pg.ViewBox()
        self.ax2 = pg.AxisItem('right')
        self.plot1.layout.addItem(self.ax2, 2, 3)
        self.plot1.setLimits(yMin=-0.5)
        self.plot1.scene().addItem(self.plot2)
        self.ax2.linkToView(self.plot2)
        self.plot2.setXLink(self.plot1)
        self.ax2.setLabel('Number of overlaps')
        self.curve2 = pg.PlotCurveItem(pen='r')
        self.plot2.addItem(self.curve2)
        self.plot2.setLimits(yMin=-0.5)

        # Handle view resizing
        self.updateViews()
        self.plot1.vb.sigResized.connect(self.updateViews)

        self.fwhm = tools.get_fwhm(670, 1.42) / 120
        self.kernel = tools.kernel(self.fwhm)
Example #2
0
    def __init__(self,
                 image,
                 fit_par=None,
                 dt=0,
                 fw=None,
                 win_size=None,
                 kernel=None,
                 xkernel=None,
                 bkg_image=None):

        self.image = image
        self.bkg_image = bkg_image

        # Noise removal by convolving with a null sum gaussian. Its FWHM
        # has to match the one of the objects we want to detect.
        try:
            self.fwhm = fw
            self.win_size = win_size
            self.kernel = kernel
            self.xkernel = xkernel
            self.image_conv = convolve(self.image.astype(float), self.kernel)
        except RuntimeError:
            # If the kernel is None, I assume all the args must be calculated
            self.fwhm = tools.get_fwhm(670, 1.42) / 120
            self.win_size = int(np.ceil(self.fwhm))
            self.kernel = tools.kernel(self.fwhm)
            self.xkernel = tools.xkernel(self.fwhm)
            self.image_conv = convolve(self.image.astype(float), self.kernel)

        # TODO: FIXME
        if self.bkg_image is None:
            self.bkg_image = self.image_conv

        self.fit_par = fit_par
        self.dt = dt
Example #3
0
    def __init__(self, filename=None, imagename='data'):

        if filename is None:
            filename = ask_file('Select hdf5 file')

        self.file = hdf.File(filename, 'r')

        # Loading of measurements (i.e., images) in HDF5 file
        self.imageData = self.file[imagename].value
        self.nframes = len(self.imageData)

        # Attributes loading as attributes of the stack
        self.attrs = self.file[imagename].attrs
        try:
            self.lambda_em = self.attrs['lambda_em']
        except:
            self.lambda_em = 670

        try:
            self.NA = self.attrs['NA']
        except:
            self.NA = 1.42

        try:
            self.nm_per_px = 1000 * self.attrs['element_size_um'][2]
        except:
            self.nm_per_px = 120

        self.frame = 0
        self.fwhm = tools.get_fwhm(self.lambda_em, self.NA) / self.nm_per_px
        self.win_size = int(np.ceil(self.fwhm))

        self.kernel = tools.kernel(self.fwhm)
        self.xkernel = tools.xkernel(self.fwhm)
    def __init__(self, mainWidget, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.main = mainWidget
        self.npoints = 200

        self.setAntialiasing(True)

        # First plot for the number of molecules
        self.plot1 = self.plotItem
        self.plot1.setLabels(bottom=('Tiempo', 's'),
                             left=('Number of single molecules'))
        self.plot1.showGrid(x=True, y=True)
        self.curve1 = self.plot1.plot(pen='y')
        self.plot1.vb.setLimits(yMin=-0.5)

        # Second plot for the number of overlaps
        self.plot2 = pg.ViewBox()
        self.ax2 = pg.AxisItem('right')
        self.plot1.layout.addItem(self.ax2, 2, 3)
        self.plot1.setLimits(yMin=-0.5)
        self.plot1.scene().addItem(self.plot2)
        self.ax2.linkToView(self.plot2)
        self.plot2.setXLink(self.plot1)
        self.ax2.setLabel('Number of overlaps')
        self.curve2 = pg.PlotCurveItem(pen='r')
        self.plot2.addItem(self.curve2)
        self.plot2.setLimits(yMin=-0.5)

        # Handle view resizing
        self.updateViews()
        self.plot1.vb.sigResized.connect(self.updateViews)

        self.fwhm = tools.get_fwhm(670, 1.42) / 120
        self.kernel = tools.kernel(self.fwhm)
Example #5
0
    def __init__(self, image, fit_par=None, dt=0, fw=None, win_size=None,
                 kernel=None, xkernel=None, bkg_image=None):

        self.image = image
        self.bkg_image = bkg_image

        # Noise removal by convolving with a null sum gaussian. Its FWHM
        # has to match the one of the objects we want to detect.
        try:
            self.fwhm = fw
            self.win_size = win_size
            self.kernel = kernel
            self.xkernel = xkernel
            self.image_conv = convolve(self.image.astype(float), self.kernel)
        except RuntimeError:
            # If the kernel is None, I assume all the args must be calculated
            self.fwhm = tools.get_fwhm(670, 1.42) / 120
            self.win_size = int(np.ceil(self.fwhm))
            self.kernel = tools.kernel(self.fwhm)
            self.xkernel = tools.xkernel(self.fwhm)
            self.image_conv = convolve(self.image.astype(float), self.kernel)

        # TODO: FIXME
        if self.bkg_image is None:
            self.bkg_image = self.image_conv

        self.fit_par = fit_par
        self.dt = dt