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

Enable stitching of non-sequentially ordered tiles #358

Open
federico-carrara opened this issue Jan 17, 2025 · 1 comment
Open

Enable stitching of non-sequentially ordered tiles #358

federico-carrara opened this issue Jan 17, 2025 · 1 comment
Labels
bug Something isn't working feature New feature or request
Milestone

Comments

@federico-carrara
Copy link
Collaborator

federico-carrara commented Jan 17, 2025

Problem

Currently, CAREamics only allows to perform either stitching of tiles belonging to a single image (stitch_prediction_single()), or of sequentially-sorted tiles from different images (stitch_prediction()).
However, there are many instances in which tiles may not come in sequential order. For example, think about any multi-processing scenario, in which tiles processed by different workers can be then gathered in different orders.

Potential solution

A possible and not too complicated solution would be to stitch tiles not based on their order, like it now happens, but based on the sample_id attribute of the corresponding TileInformation object. The only thing to carefully decide here is how to assign unique IDs to sample, considering that they may come in different ways. In fact, I see these 3 scenarios to differentiate:

  1. tiles coming from a sample coming from a single file,
  2. tiles coming from an array of samples loaded in memory, or
  3. tiles coming from an array of sample coming from a single file).
    That's why we'd probably need both a sample_id and a file_id (or a unified hash) to make sure every tile is uniquely assigned to an image.
    Moreover, we also need to make sure that these IDs are "uniquely sortable", so that images returned by the stitching function are in the same order of the images provided, e.g., for evaluation (this would avoid troubles in computation of metrics and so on).
@jdeschamps
Copy link
Member

jdeschamps commented Jan 20, 2025

Do you have an implementation of the solution or just a quick fix? Just wondering whether it is worth a PR before we refactor all the datasets.

@jdeschamps jdeschamps added the bug Something isn't working label Jan 20, 2025
@jdeschamps jdeschamps added this to the v0.1.0 milestone Jan 20, 2025
@jdeschamps jdeschamps moved this to Backlog in v0.1.0 Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants