Exemplo n.º 1
0
    def circleDistance(self):
        """
        **SUMMARY**

        Compare the hull mask to an ideal circle and count the number of pixels
        that deviate as a fraction of total area of the ideal circle.

        **RETURNS**

        The difference, as a percentage, between the hull of our blob and an idealized
        circle of our blob. 

        """
        w = self.mHullMask.width
        h = self.mHullMask.height

        idealcircle = Image((w, h))
        radius = min(w, h) / 2
        idealcircle.dl().circle((w / 2, h / 2), radius, filled=True, color=Color.WHITE)
        idealcircle = idealcircle.applyLayers()
        print self.mHullMask
        print idealcircle
        print self.mHullMask.width
        print self.mHullMask.height
        print idealcircle.width
        print idealcircle.height
        netdiff = (idealcircle - self.mHullMask) + (self.mHullMask - idealcircle)
        numblack, numwhite = netdiff.histogram(2)
        return float(numwhite) / (radius * radius * np.pi)
Exemplo n.º 2
0
    def circleDistance(self):
        """
        **SUMMARY**

        Compare the hull mask to an ideal circle and count the number of pixels
        that deviate as a fraction of total area of the ideal circle.

        **RETURNS**

        The difference, as a percentage, between the hull of our blob and an idealized
        circle of our blob. 

        """
        w = self.mHullMask.width
        h = self.mHullMask.height
        
        idealcircle = Image((w,h))
        radius = min(w,h) / 2
        idealcircle.dl().circle((w/2, h/2), radius, filled= True, color=Color.WHITE)
        idealcircle = idealcircle.applyLayers()
        print self.mHullMask
        print idealcircle
        print self.mHullMask.width
        print self.mHullMask.height
        print idealcircle.width
        print idealcircle.height
        netdiff = (idealcircle - self.mHullMask) + (self.mHullMask - idealcircle)
        numblack, numwhite = netdiff.histogram(2)
        return float(numwhite) / (radius * radius * np.pi)
Exemplo n.º 3
0
 def circleDistance(self):
     """
     Compare the hull mask to an ideal circle and count the number of pixels
     that deviate as a fraction of total area of the ideal circle
     """
     idealcircle = Image((self.width(), self.height()))
     radius = min(self.width(), self.height()) / 2
     idealcircle.dl().circle((self.width()/2, self.height()/2), radius, filled= True, color=Color.WHITE)
     idealcircle = idealcircle.applyLayers()
     
     netdiff = (idealcircle - self.mHullMask) + (self.mHullMask - idealcircle)
     numblack, numwhite = netdiff.histogram(2)
     return float(numwhite) / (radius * radius * np.pi)
Exemplo n.º 4
0
    def circleDistance(self):
        """
        Compare the hull mask to an ideal circle and count the number of pixels
        that deviate as a fraction of total area of the ideal circle
        """
        idealcircle = Image((self.width(), self.height()))
        radius = min(self.width(), self.height()) / 2
        idealcircle.dl().circle((self.width() / 2, self.height() / 2),
                                radius,
                                filled=True,
                                color=Color.WHITE)
        idealcircle = idealcircle.applyLayers()

        hullmask = Image(self.mHullMask)

        netdiff = (idealcircle - hullmask) + (hullmask - idealcircle)
        numblack, numwhite = netdiff.histogram(2)
        return float(numwhite) / (radius * radius * np.pi)