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

Add voronoi_tessellation tool #108

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

kostrykin
Copy link
Member

For the contributor:

  • - I have read the CONTRIBUTING.md document.
  • - License permits unrestricted use (educational + commercial).
  • - This PR adds or updates a tool or tool collection.
  • - This PR does something else (explain below).

The added tool takes an image with labels as input and yields an image with the corresponding Voronoi tessellation (aka Voronoi diagram, Dirichlet tessellation). This mimics the behavior of the ImageJ function Process ‣ Binary ‣ Voronoi: https://bioimagebook.github.io/chapters/2-processing/6-transforms/imagej.html#voronoi

xref #105

Squashed commit of the following:

commit 3cf5e31
Author: Leonid Kostrykin <[email protected]>
Date:   Sat Mar 9 19:04:19 2024 +0100

    Fix test results

commit c7c193a
Author: Leonid Kostrykin <[email protected]>
Date:   Sat Mar 9 18:29:04 2024 +0100

    Fix bugs

commit e67e183
Author: Leonid Kostrykin <[email protected]>
Date:   Sat Mar 9 17:19:02 2024 +0000

    Fix bug

commit 91c0f8b
Author: Leonid Kostrykin <[email protected]>
Date:   Sat Mar 9 17:15:47 2024 +0000

    Fix citation

commit 6d96123
Author: Leonid Kostrykin <[email protected]>
Date:   Sat Mar 9 17:05:34 2024 +0000

    Add tests

commit c2531b3
Author: Leonid Kostrykin <[email protected]>
Date:   Sat Mar 9 17:54:11 2024 +0100

    Fix XML

commit a0a9b16
Author: Leonid Kostrykin <[email protected]>
Date:   Sat Mar 9 16:20:50 2024 +0000

    Implement `voronoi_tessellation` tool

commit 05b5849
Author: Leonid Kostrykin <[email protected]>
Date:   Sat Mar 9 16:02:43 2024 +0000

    Add `voronoi_tesselation` tool
Copy link
Collaborator

@bgruening bgruening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand much about images, but are both images included here supposed to be black and the same size?

@kostrykin
Copy link
Member Author

I don't understand much about images, but are both images included here supposed to be black and the same size?

Short answer: The images are fine, I just double-checked them.

Long answer: They are not really black :)

In [1]: import skimage.io

In [2]: skimage.io.imread('input1.tiff')
Out[2]: 
array([[0, 0, 0, 0, 0, 0, 3, 3, 3, 3],
       [0, 1, 1, 0, 0, 0, 3, 3, 3, 3],
       [0, 1, 1, 0, 0, 0, 3, 3, 3, 3],
       [0, 0, 0, 0, 0, 0, 3, 3, 3, 3],
       [0, 0, 0, 0, 0, 0, 3, 3, 3, 3],
       [0, 0, 0, 0, 0, 0, 3, 3, 3, 3],
       [0, 0, 0, 0, 0, 0, 0, 4, 4, 4],
       [0, 2, 2, 0, 0, 0, 0, 4, 4, 4],
       [0, 2, 2, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)

In [3]: skimage.io.imread('input1_result.tiff')
Out[3]: 
array([[1, 1, 1, 1, 3, 3, 3, 3, 3, 3],
       [1, 1, 1, 1, 1, 3, 3, 3, 3, 3],
       [1, 1, 1, 1, 1, 3, 3, 3, 3, 3],
       [1, 1, 1, 1, 3, 3, 3, 3, 3, 3],
       [1, 1, 1, 1, 3, 3, 3, 3, 3, 3],
       [2, 2, 2, 2, 3, 3, 3, 3, 3, 3],
       [2, 2, 2, 2, 2, 3, 3, 4, 4, 4],
       [2, 2, 2, 2, 2, 4, 4, 4, 4, 4],
       [2, 2, 2, 2, 2, 4, 4, 4, 4, 4],
       [2, 2, 2, 2, 2, 2, 4, 4, 4, 4]], dtype=uint8)

The pixel values just all are very close to 0, which makes it look black, but in fact it's very dark gray. The exact values do not really matter, they are just arbitrary labels for distinct image regions.

@bgruening
Copy link
Collaborator

Ok, as I said, I have no clue about images ;)

@bgruening bgruening merged commit 43f036e into BMCV:master Mar 9, 2024
10 checks passed
@kostrykin kostrykin deleted the add-voronoi-tool/upstream branch March 9, 2024 22:19
kostrykin added a commit that referenced this pull request Mar 10, 2024
Add new tools from #106, #107, #108
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