smurf.spatial_object.spatial_object¶
- class smurf.spatial_object.spatial_object(image, df, df_temp, start_row_spot, end_row_spot, start_col_spot, end_col_spot, row_left, row_right, col_up, col_down, pixels, image_format)¶
A class to represent and manage spatial data, including images, spot information, and cell segmentation.
This class encapsulates spatial data and provides methods to manipulate and analyze the data, such as cropping images, adding segmentation results, and generating cell and spot information.
- Parameters:
image (numpy.ndarray) – The full-resolution tissue image as a NumPy array.
df (pandas.DataFrame) – A pandas DataFrame containing spot position data.
df_temp (pandas.DataFrame) – A temporary pandas DataFrame with spot data within specified ranges.
start_row_spot (int) – The starting index of the row for spots in tissue.
end_row_spot (int) – The ending index of the row for spots in tissue.
start_col_spot (int) – The starting index of the column for spots in tissue.
end_col_spot (int) – The ending index of the column for spots in tissue.
row_left (int) – The left boundary (row index) for cropping the image.
row_right (int) – The right boundary (row index) for cropping the image.
col_up (int) – The upper boundary (column index) for cropping the image.
col_down (int) – The lower boundary (column index) for cropping the image.
pixels (numpy.ndarray) – A NumPy array representing pixel assignments, initialized with -1.
image_format (str) – The format of the image, either ‘HE’ or ‘DAPI’.
- __init__(image, df, df_temp, start_row_spot, end_row_spot, start_col_spot, end_col_spot, row_left, row_right, col_up, col_down, pixels, image_format)¶
Methods
__init__
(image, df, df_temp, start_row_spot, ...)add_segmentation
(segmentation_results, ...)Adds segmentation results to the spatial object.
generate_cell_spots_information
([max_spot, ...])Generates cells and spots information and creates a nearest neighbor network.
Returns the cropped image based on the specified boundaries.