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

inconsistent number of cells between the output files #15

Closed
MobiTobi opened this issue Jun 14, 2021 · 7 comments
Closed

inconsistent number of cells between the output files #15

MobiTobi opened this issue Jun 14, 2021 · 7 comments

Comments

@MobiTobi
Copy link

The number of cell boundaries in segmentation_polygons.json far exceeds the number of cells in segmentation.csv
and segmentation_cell_stats.csv.
For example one of my runs produced 4013 polygons but only 2430 cells.

I would like to filter the boundaries that I plot with the diagnostics information in segmentation_cell_stats.csv, but due to the different numbers of elements they contain I cannot match the diagnostics information with the cell boundaries :(

The expected behaviour would be one polygon for each cell that baysor finds.

@VPetukhov
Copy link
Collaborator

In the current version, polygons only roughly correspond to cells, unfortunately. The task of drawing polygons based on a set of points is ill-defined, and all solutions that I checked require some amount of parameter tuning. So in the current version, polygons may be drawn around empty holes in cells (showing their "inner boundaries"), or in rare cases one cell may have several polygons attached to it. There is a fix, which I'm going to implement in the next release, so each cell should only have the best-matching polygon, though I'm not sure if the solution would work as intended.

@jameswm2
Copy link

@VPetukhov
Hi, If the polygons do not correspond to cells, how did you draw boundaries in your publication?

@VPetukhov
Copy link
Collaborator

Note for myself: after estimating KDE boundaries, need to replace my custom MST-based algorithm with Marching squares, maybe from Contour.jl

@teng-gao
Copy link

Hi @VPetukhov, is this fixed in the current release? (Apologies for raising so many issues)

@MobiTobi
Copy link
Author

Hi @teng-gao,

I made a stand-alone python module to generate "cell-borders" from the Baysor clusters.
It reimplements the approach from Petukhov, but has a few quality of life improvements.
I wanted to publish it on github anyway but never got around to it.
Are you interested?

  • parallelized so much shorter wall time
  • direct control over parameters (grid size, threshold etc)
  • polygon estimation decoupled from baysor clustering

@VPetukhov
Copy link
Collaborator

Hi @MobiTobi , that would be very useful! I'm currently working on a tool set for spatial analysis in Python (baysorpy), which also will wrap julia calls to Baysor. If it's fine with you, it would be very cool to add your method to the package. Or it can be a stand-alone app, then I would reference it and use as a dependency for baysorpy.

@VPetukhov
Copy link
Collaborator

Regarding the main issue, I just released v0.6, which resolves it, and also has a much faster triangulation-based method for polygon estimation (similar to ideas from here).

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

No branches or pull requests

4 participants