sopa._sdata
Note
These are convenient tools that operates on SpatialData
objects
sopa._sdata.get_boundaries(sdata, return_key=False, warn=False)
Gets the baysor boundaries or cellpose boundaries of a SpatialData object after running Sopa
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sdata |
SpatialData
|
A SpatialData object |
required |
return_key |
bool
|
Whether to return the key of the shapes or not. |
False
|
warn |
bool
|
If |
False
|
Returns:
Type | Description |
---|---|
GeoDataFrame | tuple[str, GeoDataFrame] | None
|
A |
Source code in sopa/_sdata.py
sopa._sdata.get_intrinsic_cs(sdata, element, name=None)
Gets the name of the intrinsic coordinate system of an element
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sdata |
SpatialData
|
A SpatialData object |
required |
element |
SpatialElement | str
|
|
required |
name |
str | None
|
Name to provide to the intrinsic coordinate system if not existing. By default, uses the element id. |
None
|
Returns:
Type | Description |
---|---|
str
|
Name of the intrinsic coordinate system |
Source code in sopa/_sdata.py
sopa._sdata.to_intrinsic(sdata, element, element_cs)
Transforms a SpatialElement
into the intrinsic coordinate system of another SpatialElement
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sdata |
SpatialData
|
A SpatialData object |
required |
element |
SpatialElement | str
|
|
required |
element_cs |
SpatialElement | str
|
|
required |
Returns:
Type | Description |
---|---|
SpatialElement
|
The |
Source code in sopa/_sdata.py
sopa._sdata.get_intensities(sdata)
Gets the intensity dataframe of shape n_obs x n_channels
Source code in sopa/_sdata.py
sopa._sdata.iter_scales(image)
Iterates through all the scales of a DataTree
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
DataTree
|
a |
required |
Yields:
Type | Description |
---|---|
DataArray
|
Each scale (as a |
Source code in sopa/_sdata.py
sopa._sdata.get_spatial_image(sdata, key=None, return_key=False, valid_attr=SopaAttrs.CELL_SEGMENTATION)
Gets a DataArray from a SpatialData object (if the image has multiple scale, the scale0
is returned)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sdata |
SpatialData
|
SpatialData object. |
required |
key |
str | None
|
Optional image key. If |
None
|
return_key |
bool
|
Whether to also return the key of the image. |
False
|
valid_attr |
str
|
Attribute that the image must have to be considered valid. |
CELL_SEGMENTATION
|
Returns:
Type | Description |
---|---|
DataArray | tuple[str, DataArray]
|
If |