get_interfaces
Get the interfaces b/w the polygons defined in a areas
and buffer_area
.
Note
Identifies the interface regions between polygons in areas
and in buffer_area
by buffering the buffer_area
polygons and finding their intersections with areas
.
The width of the interface is controlled by the buffer_dist
parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buffer_area
|
GeoDataFrame
|
The area or region of interest that is buffered on top of polygons in gdf. |
required |
areas
|
GeoDataFrame
|
A geodataframe containing polygons (tissue areas) that might intersect
with the |
required |
buffer_dist
|
int
|
The radius (in pixels) of the buffer. |
200
|
Returns:
Type | Description |
---|---|
GeoDataFrame
|
gpd.GeoDataFrame: A geodataframe containing the intersecting polygons including the buffer. |
Examples:
>>> from histolytics.spatial_ops import get_interfaces
>>> from histolytics.data import cervix_tissue
>>> # load the tissue data
>>> tis = cervix_tissue()
>>>
>>> # get the stromal and CIN tissue
>>> stroma = tis[tis["class_name"] == "stroma"]
>>> cin_tissue = tis[tis["class_name"] == "cin"]
>>>
>>> # get the interface between cin lesion and stroma
>>> interface = get_interfaces(cin_tissue, stroma, buffer_dist=300)
>>> print(interface.head(3))
class_name geometry
0 stroma POLYGON ((1588.71 4829.03, 1591.18 4828.83, 15...
1 stroma POLYGON ((743.07 5587.48, 743.63 5589, 744.07 ...
2 stroma POLYGON ((1151 7566, 1150 7567, 1148.2 7568.2,...
>>> # plot the tissue and the interface
>>> ax = tis.plot(column="class_name", figsize=(5, 5), aspect=1, alpha=0.5)
>>> interface.plot(ax=ax, color="blue", lw=1, alpha=0.3)
>>> ax.set_axis_off()