https://github.com/kaczmarj/geojson2tif
Convert GeoJSON of polygons to pyramical TIF images
https://github.com/kaczmarj/geojson2tif
image-segmentation machine-learning tiff whole-slide-imaging
Last synced: 7 months ago
JSON representation
Convert GeoJSON of polygons to pyramical TIF images
- Host: GitHub
- URL: https://github.com/kaczmarj/geojson2tif
- Owner: kaczmarj
- Created: 2022-08-05T19:24:28.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-06T21:56:59.000Z (almost 3 years ago)
- Last Synced: 2025-03-22T16:03:06.896Z (7 months ago)
- Topics: image-segmentation, machine-learning, tiff, whole-slide-imaging
- Language: Python
- Homepage:
- Size: 2.36 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GeoJSON to TIFF
[](https://hub.docker.com/r/kaczmarj/geojson2tif)

An entirely non-general tool to convert a GeoJSON set of polygons into a multi-resolution TIF image.
This code was written to convert polygons of nuclear segmentations (https://doi.org/10.1038/s41597-020-0528-1)
to TIF images. It may need to be tweaked to work with other datasets.The original polygons were converted to GeoJSON with the [`scidata-to-geojson.py`](scidata-to-geojson.py) script.
# Example
Here I demonstrate using this within an Apptainer (formerly Singularity) container.
1. First, get the container. Feel free to swap out the `apptainer` command for `singularity`.
```
apptainer pull docker://kaczmarj/geojson2tif:latest
```2. Run the tool. You will need a GeoJSON file with the labels and the corresponding whole slide image.
```
apptainer exec --pwd $(pwd) geojson2tif_latest.sif \
--wsi image.tif --geojson polygons.json --output mask.tif
```# Installation
Use the Docker image for a hassle-free experience.
Otherwise, please install [ASAP](https://github.com/computationalpathologygroup/ASAP) version 2.1
and [wholeslidedata](https://github.com/DIAGNijmegen/pathology-whole-slide-data) from
commit [247c2429f90a47e42493d43d6bb94316b1179aa7](https://github.com/DIAGNijmegen/pathology-whole-slide-data/tree/247c2429f90a47e42493d43d6bb94316b1179aa7).If you need to use `scidata-to-geojson.py`, please install `shapely` as well.