imjoy-team / imjoy-interactive-segmentation

MIT License
13 stars 6 forks source link

Support exporting geojson #34

Closed oeway closed 3 years ago

oeway commented 3 years ago

This PR enables converting from a mask image (with pixel number corresponds to the object id) to a geojson string.

See usage below:

from imjoy_interactive_trainer.data_utils import mask_to_geojson
import imageio

image = imageio.imread("/my_label_file.png")

geojson = mask_to_geojson(image)

with open("my_geojson.json", "w") as f:
    f.write(geojson)