Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Growcut #736

Closed
wants to merge 2 commits into from
Closed

Growcut #736

wants to merge 2 commits into from

Conversation

marcdk
Copy link

@marcdk marcdk commented Sep 21, 2013

Stéfans GrowCut code. I've checked that the number of changes does go down to zero.

@ahmadia
Copy link

ahmadia commented Sep 21, 2013

I've written some tests in https://www.wakari.io/sharing/bundle/aron/Accelerating_Python_Libraries_with_Numba_-_Part_2

You're free to reuse them with attribution.

@ahmadia
Copy link

ahmadia commented Sep 21, 2013

Specifically, this hunk of code:

def test_kernel(kernel):

    # Cython creates a built-in function that is not modifiable and does not possess the func_name attribute
    if hasattr(kernel, 'func_name'):
        name = kernel.func_name
    else:
        name = kernel.__name__ 

    image = np.zeros((3, 3, 3))
    state = np.zeros((3, 3, 2))
    state_next = np.empty_like(state)

    # colony 1 is strength 1 at position 0,0
    # colony 0 is strength 0 at all other positions
    state[0, 0, 0] = 1
    state[0, 0, 1] = 1

    # window_size 1, colony 1 should propagate to three neighbors
    changes = kernel(image, state, state_next, 1)
    assert(3 == changes)
    npt.assert_array_equal(state_next[0:2, 0:2], 1)
    npt.assert_array_equal(state_next[2, :], 0)
    npt.assert_array_equal(state_next[2, :], 0)

    # window_size 2, colony 1 should propagate to entire image
    changes = kernel(image, state, state_next, 2)
    assert(8 == changes)
    npt.assert_array_equal(state_next, 1)

    print "PASS", name

@alexdesiqueira
Copy link
Member

Hey @stefanv, are you interested in this one? Thanks!

@stefanv stefanv closed this Feb 18, 2021
@stefanv stefanv deleted the branch scikit-image:master February 18, 2021 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants