Example #1
0
 def testTranslatedEllipse(self):
     args = [0, 0, 20, 10]
     expected_rows, expected_cols = shapes.ellipse_fill(*args)
     args = [10, 50, 20, 10]
     rows, cols = shapes.ellipse_fill(*args)
     numpy.testing.assert_allclose(rows, expected_rows + 10)
     numpy.testing.assert_allclose(cols, expected_cols + 50)
Example #2
0
 def testTranslatedEllipse(self):
     args = [0, 0, 20, 10]
     expected_rows, expected_cols = shapes.ellipse_fill(*args)
     args = [10, 50, 20, 10]
     rows, cols = shapes.ellipse_fill(*args)
     numpy.testing.assert_allclose(rows, expected_rows + 10)
     numpy.testing.assert_allclose(cols, expected_cols + 50)
Example #3
0
 def testEllipse(self):
     args = [0, 0, 20, 10]
     rows, cols = shapes.ellipse_fill(*args)
     self.assertEqual(len(rows), 617)
     self.assertEqual(rows.mean(), 0)
     self.assertAlmostEqual(rows.std(), 10.025575, places=3)
     self.assertEqual(len(cols), 617)
     self.assertEqual(cols.mean(), 0)
     self.assertAlmostEqual(cols.std(), 4.897325, places=3)
Example #4
0
 def testEllipse(self):
     args = [0, 0, 20, 10]
     rows, cols = shapes.ellipse_fill(*args)
     self.assertEqual(len(rows), 617)
     self.assertEqual(rows.mean(), 0)
     self.assertAlmostEqual(rows.std(), 10.025575, places=3)
     self.assertEqual(len(cols), 617)
     self.assertEqual(cols.mean(), 0)
     self.assertAlmostEqual(cols.std(), 4.897325, places=3)
Example #5
0
    def updateEllipse(self, level, crow, ccol, radius_r, radius_c, mask=True):
        """Mask/Unmask an ellipse of the given mask level.

        :param int level: Mask level to update.
        :param int crow: Row of the center of the ellipse
        :param int ccol: Column of the center of the ellipse
        :param float radius_r: Radius of the ellipse in the row
        :param float radius_c: Radius of the ellipse in the column
        :param bool mask: True to mask (default), False to unmask.
        """
        rows, cols = shapes.ellipse_fill(crow, ccol, radius_r, radius_c)
        self.updatePoints(level, rows, cols, mask)
Example #6
0
 def testTranslatedPoint(self):
     args = [10, 10, 1, 1]
     result = shapes.ellipse_fill(*args)
     expected = numpy.array(([10], [10]))
     numpy.testing.assert_array_equal(result, expected)
Example #7
0
 def testTranslatedPoint(self):
     args = [10, 10, 1, 1]
     result = shapes.ellipse_fill(*args)
     expected = numpy.array(([10], [10]))
     numpy.testing.assert_array_equal(result, expected)