refine_post_merge_boundaries() could remove double-counted pixels
- Dominant language
- Python
- Stars
- 30
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
`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.
``` python
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`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.