예제 #1
0
def synthetic_cycles():
    """Creation of synthetic skeleton."""
    np.random.seed(1)
    # create synthetic binary skeleton
    synthetic = np.zeros((15, 10))
    synthetic[0, 7] = 1
    synthetic[1, 6] = 1
    synthetic[2, 5] = 1
    synthetic[2, 3] = 1
    synthetic[3, 3:6] = 1
    synthetic[4, 2:4] = 1
    synthetic[4, 5:7] = 1
    synthetic[5, 1:3] = 1
    synthetic[5, 6:8] = 1
    synthetic[6, 1:3] = 1
    synthetic[6, 6:8] = 1
    synthetic[7, 2:4] = 1
    synthetic[7, 5:7] = 1
    synthetic[8, 3:6] = 1
    synthetic[9:, 4] = 1

    # visualize synthetic case as a png to look at and a tif to use
    plt.imshow(synthetic)
    plt.savefig(
        os.path.join(basepath, 'tests/data/SyntheticCycle/skeleton.png'))
    plt.close()
    skimage.io.imsave(
        os.path.join(basepath, 'tests/data/SyntheticCycle/skeleton.tif'),
        synthetic)

    # create and return rivgraph.delta object
    return delta(
        'synthetic_cycles',
        os.path.join(basepath, 'tests/data/SyntheticCycle/skeleton.tif'),
        os.path.join(basepath, 'tests/results/synthetic_cycles/'))
예제 #2
0
def synthetic_cycles():
    """Creation of synthetic skeleton."""
    np.random.seed(1)
    # create synthetic binary skeleton
    synthetic = np.zeros((15, 10))
    synthetic[0, 7] = 1
    synthetic[1, 6] = 1
    synthetic[2, 5] = 1
    synthetic[2, 3] = 1
    synthetic[3, 3:6] = 1
    synthetic[4, 2:4] = 1
    synthetic[4, 5:7] = 1
    synthetic[5, 1:3] = 1
    synthetic[5, 6:8] = 1
    synthetic[6, 1:3] = 1
    synthetic[6, 6:8] = 1
    synthetic[7, 2:4] = 1
    synthetic[7, 5:7] = 1
    synthetic[8, 3:6] = 1
    synthetic[9:, 4] = 1

    # create and return rivgraph.delta object
    return delta(
        'synthetic_cycles',
        os.path.normpath('tests/integration/data/SyntheticCycle/skeleton.tif'),
        os.path.normpath('tests/integration/results/synthetic_cycles/'))
예제 #3
0
def test_net(tmp_path_factory):
    """Define the test network."""
    np.random.seed(1)
    return delta(
        "colville",
        os.path.normpath(
            "tests/integration/data/Colville/Colville_islands_filled.tif"),
        os.path.join(tmp_path_factory.mktemp('colville')))
예제 #4
0
def test_net():
    """Define the test network."""
    np.random.seed(1)
    return delta(
        "colville",
        os.path.join(
            basepath,
            os.path.normpath(
                "tests/data/Colville/Colville_islands_filled.tif")),
        os.path.join(basepath, os.path.normpath("tests/results/colville")))
예제 #5
0
def known_net(tmp_path_factory):
    """Define the known network to test against."""
    np.random.seed(1)
    known_net = delta(
        'known',
        os.path.normpath(
            'tests/integration/data/Colville/Colville_islands_filled.tif'),
        os.path.join(tmp_path_factory.mktemp('known')))
    known_net.load_network(path=os.path.normpath(
        'tests/integration/data/Colville/Colville_network.pkl'))
    return known_net
예제 #6
0
def known_net():
    """Define the known network to test against."""
    np.random.seed(1)
    known_net = delta(
        'known',
        os.path.join(
            basepath,
            os.path.normpath(
                'tests/data/Colville/Colville_islands_filled.tif')),
        os.path.join(basepath, os.path.normpath('tests/results/known/')))
    known_net.load_network(path=os.path.join(
        basepath, os.path.normpath(
            'tests/data/Colville/Colville_network.pkl')))
    return known_net