Did I find the right examples for you? yes no

All Samples(0)  |  Call(0)  |  Derive(0)  |  Import(0)

src/c/e/CellProfiler-HEAD/cellprofiler/modules/tests/test_expandorshrinkobjects.py   CellProfiler(Download)
        for module, output_object_name, operation, has_outline in \
            ((modules[2], "ShrunkenNuclei", E.O_SHRINK_INF, False),
             (modules[3], "ExpandedOnceNuclei", E.O_EXPAND, True),
             (modules[4], "ShrunkenOnceNuclei", E.O_SHRINK, False),
             (modules[5], "ExpandedNuclei", E.O_EXPAND_INF, False),
        expected = np.zeros((10,10), int)
        expected[np.array([4,3,4,5,4],int),np.array([3,4,4,4,5],int)] = 1
        workspace, module = self.make_workspace(labels, E.O_EXPAND)
        module.run(workspace)
        objects = workspace.object_set.get_objects(OUTPUT_NAME)
        i,j = np.mgrid[0:10,0:10]-4
        expected = (i**2 + j**2 <=4).astype(int)
        workspace, module = self.make_workspace(labels, E.O_EXPAND, 2)
        module.run(workspace)
        objects = workspace.object_set.get_objects(OUTPUT_NAME)
        expected = (((i-2)**2 + (j-3)**2 <=1).astype(int) +
                    ((i-6)**2 + (j-5)**2 <=1).astype(int) * 2)
        workspace, module = self.make_workspace(labels, E.O_EXPAND, 1)
        module.run(workspace)
        objects = workspace.object_set.get_objects(OUTPUT_NAME)
        expected = (i**2 + j**2 <=4).astype(int)
        expected_outlines = outline(expected)
        workspace, module = self.make_workspace(labels, E.O_EXPAND, 2,
                                                wants_outlines = True)
        module.run(workspace)