Exemplo n.º 1
0
    def _findLocalMax(self):
        """Find the centers of particles by thresholding and dilating."""
        dilationKernel = im.makeCircularKernel(self._dilationRadius)

        self._maxed = im.createImageArray(self, "morphMax",
                                          dtype=np.bool,
                                          shape = self._morphed[0].shape,
                                          expectedrows=len(self._morphed))
        for image in self._morphed:
            # set pixels below morph thresh to 0
            threshed = stats.threshold(image, self._morphThreshold, newval=0.0)
            dilated = cv2.dilate(threshed, dilationKernel)
            # expThreshold is so named because the original algorithm 
            # originally exponentiated and then thresholded, which is the same
            # as flipping the sign and exponentiating the threshold.
            binary = (dilated - threshed) >= self._expThreshold
            self._maxed.append([binary])
        self._maxed.flush()
Exemplo n.º 2
0
    def run(self):
        images = self._import(im.RemoveBackground, "images")
        self._seedImages = [] #debug

        perFrame = self._param(EXPECTED_ELLIPSES_PER_FRAME)
        self._table = self.context.createTable("ellipsesViaEdges", EllipseTable,
                                               expectedrows=perFrame*images.nrows)
        self._seedImages = im.createImageArray(self, "edgesSeedImages",
                                               dtype=np.bool, 
                                               shape=images[0].shape,
                                               expectedrows=len(images))

        for i, image in enumerate(images):
            particles = self._seedParticles(image)
            particles = self._refineParticles(particles, image)
            self._render(i, particles)

        self._table.flush()
        self._seedImages.flush()