quadbin_grid
Fit a quadbin
rectangular grid on top of a geopandas.GeoDataFrame
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gdf
|
GeoDataFrame
|
GeoDataFrame to fit grid to. |
required |
resolution
|
int
|
Quadbin resolution, by default 17. |
17
|
to_lonlat
|
bool
|
Whether to convert to lonlat coordinates, by default True. |
True
|
Returns:
Type | Description |
---|---|
GeoDataFrame
|
gpd.GeoDataFrame: Fitted Quadbin quad grid. |
Examples:
>>> from histolytics.spatial_ops.quadbin import quadbin_grid
>>> from histolytics.data import cervix_tissue
>>>
>>> # get the stromal tissue
>>> tis = cervix_tissue()
>>> stroma = tis[tis["class_name"] == "stroma"]
>>>
>>> # Fit a quadbin grid to the stromal tissue
>>> quad_grid = quadbin_grid(stroma, resolution=17)
>>> print(quad_grid.head(3))
geometry
5271089524171866111 POLYGON ((6581.37043 761.23896, 6581.36916 608...
5271089524172062719 POLYGON ((6734.64415 761.23754, 6734.64288 608...
5271089524171931647 POLYGON ((6734.64571 913.48504, 6734.64415 761...
>>> ax = tis.plot(column="class_name", figsize=(5, 5), aspect=1, alpha=0.5)
>>> quad_grid.plot(ax=ax, edgecolor="black", facecolor="none", lw=1)
>>> ax.set_axis_off()