saalfeldlab / render

Render transformed image tiles
GNU General Public License v2.0
34 stars 32 forks source link

Alternating block solve #160

Closed minnerbe closed 10 months ago

minnerbe commented 11 months ago

Changes

I added a client that does a couple of rounds of the distributed block solver with alternating layouts to ensure that every tile is in the "interior" of a block at least once. More specifically, the algorithm looks like this:

  1. solve blocks with overlap
  2. instead of interpolating transforms on overlapping regions, choose transform randomly from all candidates
  3. save blocks to database with coherent naming scheme (_runN)
  4. change parameters:
    • change stack to pull data from to target stack of previous iteration
    • shift block layout by half a block (before expanding, i.e., by 1/4 of an expanded block)
  5. go to 1.

Test

I tested this on a small toy stack (1 mFOV):

Results

Using the error comparison tool, we see that the iterative solution only deviates from the exact one by more than 1.5 px for a handful of tile pairs, all of which contain more or less only resin. Otherwise, the iterative solve looks pretty good to me. In particular, the global coarse block solve has errors well below 1px after the first two runs.

Interestingly, the exact solve seems to have a very visible (and probably wrong) drift in the last few layers, which the iterative solve doesn't.

minnerbe commented 11 months ago

Thanks for the review! I'll try to incorporate your suggestions later today, but if I don't get around to do it and it's time critical, feel free to edit the code yourself.

minnerbe commented 10 months ago

Thanks for applying the changes yourself, @trautmane ! I was completely swamped the last days...