scverse / squidpy

Spatial Single Cell Analysis in Python
https://squidpy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
442 stars 82 forks source link

Add parameter to `sliding_window` to end up with windows of (approximately) same number of cells #908

Open timtreis opened 3 weeks ago

timtreis commented 3 weeks ago

Could add a heuristic that tries to optimise the number of cells per window (and unassigned cells) so that on average, most windows have a number of cells assigned that is as close as possible to what the user specified.

FrancescaDr commented 1 week ago

Hi Tim, I agree this would be a really useful feature. More specifically, we could add the following parameters:

Considering that given multiple library_key's the FOVs have different sizes or densities we could introduce a separate parameter that differentiates between whether the window sizes should be equal across all library_key's or not. For example:

mossishahi commented 1 week ago

Hi @timtreis and @FrancescaDr , I'll work on this.