troutpy.tl.image_intensities_per_transcript#
- troutpy.tl.image_intensities_per_transcript(sdata, image_key, scale, transcript_key, extracellular=False, copy=True, gene_key='gene')#
Extracts image intensities at transcript locations and adds them as a new layer in the SpatialData object.
- Args:
- sdata
The input SpatialData object.
- image_key
The key for the image layer in sdata.images.
- scale
The scale of the image to use.
- transcript_key
The key for the transcript points in sdata.points.
- extracellular
Whether to include only extracellular transcripts (default: False). If True, only transcripts where
extracellularis True are used. If false, all transcripts are used.- copy
Whether to create a copy of the SpatialData object (default: True).
- Return type:
- Returns:
A SpatialData object with the added ‘transcripts_image_intensities’ layer. If copy=True, a new SpatialData object is returned. Otherwise, the original sdata object is modified and returned.
- Raises:
KeyError – If the specified image or transcript key is not found in the SpatialData object.: