Skip to content

Conversation

@minnerbe
Copy link
Collaborator

This PR adds a simple inpainting algorithm for the narrow gaps between tiles present in the wafer 60/61 data. It inpaints by:

  • For each non-masked pixel, check if the pixels [+/- n in x-direction] or [+/- n in y-direction] are masked. If yes, were probably in a narrow gap that needs inpainting.
  • Inpaint these pixels by averaging the values +/- 1 in z-direction. If either does not exist, only take the one that does exist, and return 0 if neither exists.

Generally, I tested the following cases:

  • Gaps completely surrounded by image tiles
  • Gaps that are connected to the boundary of the tiled area on one side
  • Chunks that either have tiles but no gaps, or no tiles at all (those won't be re-written)
  • Chunks at the boundary of the image that have sizes smaller than the nominal chunk size

Let me know if you think I overlooked a particular case that's important enough to test before applying this to real data.

@trautmane The arguments to launch this are the following:

--n5Path <path to n5>
--dataset <dataset to inpaint from n5 root (multi-level pyramid)>
--mask <mask dataset from n5 root (single full-res dataset)>
[--output <inpainted dataset from n5 root>]
--inpaintingSize <the approximate size of the gaps, i.e., n above>

I've ran my tests with --inpaintingSize 20 so far, which seemed sufficient, but we might want to set it higher to not miss larger gaps. If the output dataset is not given, input blocks are overwritten. I'd suggest running it with a dedicated output dataset once to see if it works before omitting that argument to overwrite blocks.

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.

2 participants