Skip to content

Export Bin2cell segmentation to QuPath #73

Open

Description

@ChristelleBrest

Dear all,

Thank you very much for developing this wonderful tool!
I would like to export the final segmentation mask to QuPath. I have managed to convert the HE and GEX .npz files into GeoJSON files, but now I would like to export the label_joint data.
Is it possible to generate an .npz or geojson file from this metadata?

Thank you for your help!

Best regards,
Christelle

Activity

  1. ktpolanski commented on Dec 11, 2025

    @ktpolanski
    Contributor

    I don't have hands-on experience with GeoJSON, but based on the Wikipedia example you can specify a polygon by its four vertices, and also provide properties which should hopefully be able to hold the object name? So in principle you'd be able to specify multiple polygons for the same label.

    If that is the case, you can get the four vertices of the square bin i,j by computing the midpoint between its centroid (as reported in spatial coordinate space) and the centroids of bins i-1,j-1, i-1,j+1, i+1,j-1 and i+1,j+1.

  2. ChristelleBrest commented on Dec 11, 2025

    @ChristelleBrest
    Author

    Thank you very much for your quick reply!
    I was wondering whether it would be possible to obtain an NPZ file similar to those generated after segmentation with StarDist (he.npz and gex.npz).
    We could then convert it into GeoJSON.

  3. ktpolanski commented on Dec 11, 2025

    @ktpolanski
    Contributor

    The NPZ files contain a segmentation mask matching the size of the processed morphology image, as you know as you converted them. The easiest way to generate one would be to iteratively populate a blank mask via cv2.fillPoly(), providing the same vertices as what you'd export in the GeoJSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions