spatialdata.rasterize#
- spatialdata.rasterize(data, axes, min_coordinate, max_coordinate, target_coordinate_system, target_unit_to_pixels=None, target_width=None, target_height=None, target_depth=None)#
Rasterize a SpatialData object or a SpatialElement (image, labels, points, shapes).
- Parameters:
data (
Union
[SpatialData
,SpatialImage
,MultiscaleSpatialImage
,GeoDataFrame
,DataFrame
]) – The SpatialData object or SpatialElement to rasterize.axes (
tuple
[str
,...
]) – The axes that min_coordinate and max_coordinate refer to.min_coordinate (
Union
[list
[Union
[int
,float
]],ndarray
[Any
,dtype
[float64
]]]) – The minimum coordinates of the bounding box.max_coordinate (
Union
[list
[Union
[int
,float
]],ndarray
[Any
,dtype
[float64
]]]) – The maximum coordinates of the bounding box.target_coordinate_system (
str
) – The coordinate system in which we define the bounding box. This will also be the coordinate system of the produced rasterized image.target_unit_to_pixels (
Optional
[float
] (default:None
)) – The number of pixels per unit that the target image should have. It is mandatory to specify precisely one of the following options: target_unit_to_pixels, target_width, target_height, target_depth.target_width (
Optional
[float
] (default:None
)) – The width of the target image in units. It is mandatory to specify precisely one of the following options: target_unit_to_pixels, target_width, target_height, target_depth.target_height (
Optional
[float
] (default:None
)) – The height of the target image in units. It is mandatory to specify precisely one of the following options: target_unit_to_pixels, target_width, target_height, target_depth.target_depth (
Optional
[float
] (default:None
)) – The depth of the target image in units. It is mandatory to specify precisely one of the following options: target_unit_to_pixels, target_width, target_height, target_depth.
- Return type:
Union
[SpatialData
,SpatialImage
]- Returns:
: The rasterized SpatialData object or SpatialImage. Each SpatialElement will be rasterized into a SpatialImage. So if a SpatialData object with elements is passed, a SpatialData object with images will be returned.