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

refine_post_merge_boundaries() could remove double-counted pixels #1

Open
jni opened this issue Aug 7, 2011 · 0 comments
Open

refine_post_merge_boundaries() could remove double-counted pixels #1

jni opened this issue Aug 7, 2011 · 0 comments

Comments

@jni
Copy link
Owner

jni commented Aug 7, 2011

refine_post_merge_boundaries in agglo.py was created for the purpose of maintaining the integrity of 0-labeled boundaries in cases such as the following:

1 0 2 0
1 0 0 3
0 4 0 3

When we have a merge of body 3 into body 2, a new pixel is added to the boundary between 1 and 2. If this addition is not noted, when 1 and 4 are merged, that pixel will be removed and the boundary between 1 and 2 will have a leak.

However, it turns out that this function could be used to detect when boundary pixels are double-counted during a merge and correct the double counting.

    idxs = set(boundaries_to_edit[(u,v)])                            
    if self.has_edge(u, v):                                          
        idxs = idxs - self[u][v]['boundary']                         
        self[u][v]['boundary'].update(idxs)                          
        self.feature_manager.pixelwise_update_edge_cache(self, u, v, 
                            self[u][v]['feature-cache'], list(idxs)) 

Find the intersection of idxs and self[u][v]['boundary'] and use the feature_manager to pixelwise_update with remove=True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant