spatiomic.data¶
Expose i/o functions from the data submodule.
Classes¶
Functions¶
|
Create an AnnData object from an image data array. |
|
Subset the data with the given channel names to the subset channel names in the given order. |
Package Contents¶
- spatiomic.data.anndata_from_array(data, channel_names, clusters=None, cluster_key='clusters', spatial_weights=None)¶
Create an AnnData object from an image data array.
- Parameters:
data (NDArray) – The image data array.
channel_names (List[str]) – The channel names.
clusters (Optional[NDArray], optional) – The clusters. Defaults to None.
cluster_key (str, optional) – The cluster key. Defaults to “clusters”.
spatial_weights (Optional[W], optional) – The spatial weights. Defaults to None.
- Returns:
The AnnData object
- Return type:
AnnData
- class spatiomic.data.read¶
A class to read in microscopy files.
- static get_czi_image_channels(image, image_shape, ubyte=True)¶
Get the channels of an .czi image.
- Parameters:
image (NDArray) – The read CziFile of an image.
image_shape (List[Tuple[str, int]]) – The shape of the CziFile. Example format of the image shape: [(‘B’, 1), (‘H’, 1), (‘T’, 1), (‘C’, 3), (‘Z’, 1), (‘Y’, 2048), (‘X’, 2048)]
ubyte (bool, optional) – Whether to interpret the data as np.uint8.. Defaults to True.
- Returns:
An array containing the channels of the .czi file
- Return type:
NDArray
- classmethod read_czi(file_path, input_dimension_order='XYC')¶
Read a single czi file on a given path and returns it.
- static read_lif(file_path, image_idx=0)¶
Read a single lif file on a given path and returns it.
- static read_tiff(file_path, input_dimension_order='XYC', precision='float32')¶
Read a single tiff file on a given path and returns it.
- Parameters:
- Returns:
An array containing the channels of the .tiff file in XYC dimension order.
- Return type:
NDArray
- class spatiomic.data.subsample¶
A class to subsample image data.
- static fit_transform(data, method='fraction', fraction=0.1, count=100000, *args, **kwargs)¶
Create a random subsample of some image data pixels, preserving channel dimensionality.
- Parameters:
data (NDArray) – Image data to take the subsample from.
method (Literal["fraction", "count"], optional) – The method to use. Defaults to “fraction”.
fraction (float, optional) – The fraction of pixels to take when using the “fraction” method. When this results in a non-integer number of pixels, the number of pixels is rounded down. Defaults to 0.1.
count (int, optional) – The number of pixels to take. Defaults to 10000 when using the “count” method. Defaults to 100,000.
seed (Optional[int], optional) – The seed to use for random number generation. Defaults to None.
args (Any)
kwargs (dict)
- Returns:
A flattened, random subsample of the pixels in the provided image data.
- Return type:
NDArray
- spatiomic.data.subset(data, channel_names_data, channel_names_subset)¶
Subset the data with the given channel names to the subset channel names in the given order.
- Parameters:
- Returns:
The subsetted data, with channel ordered according to the subset channel names.
- Return type:
NDArray