object_based_segmentation¶
-
pysmFISH.object_based_segmentation.
IntersectionCouples
(couple, TotalDataDict)[source]¶ Function to consolidate the overlapping couples. Identify if there are multiple overlapping, merge the coords together and keep only one label
- couple: list
- List of tuples with the labels of the overlapping objects. If contains more than one repeat of the same object, the repeats are removed.
- TotalDataDict: dict
- Dictionary with the labels and the coords of the identified objects after merging the result of the segmentation on the different image chunks.
- SaveLab: list
- List of saved labels.
- RemoveLabs: list
- List of the remove labels.
- NewCoords: list
- Merged obj coords.
-
pysmFISH.object_based_segmentation.
OverlappingCouples
(chunk_coords, TotalDataDict)[source]¶ Calculate all the intersecting objects
- chunk_coords: list
- List of np.array with the coords of the images with padding
- TotalDataDict: dict
- Dictionary with the labels and the coords of the identified objects after merging the result of the segmentation on the different image chunks.
- Intersecting_cpl: list
- List of tuples with all the overlapping labels [(Obj1,Obj12),(Obj2, Obj3)].
-
pysmFISH.object_based_segmentation.
image_chunking
(img, chunk_size, percent_padding)[source]¶ Function used to generate the coords of the images according to the chunking
- stitched_file_hdl: pointer
- Handle of the hdf5 file that contains the stitched image.
- gene: str
- Processed gene (‘Nuclei’).
- PercentPadding: float
- Percent of overlapping between the different images (Ex. 0.2).
- ChunkSize: int
- Dimension of the Chunks.
- Coords_Chunks_list: list
- List of np.array with the coords of the images without padding
- Coords_Padded_Chunks_list: list
- List of np.array with the coords of the images with padding
For both lists each np.array contains the coords in the following order: [row_tl,row_br,col_tl,col_br]
-
pysmFISH.object_based_segmentation.
image_chunks_calculator
(dimension, chunk_size)[source]¶ Helper function to calculate the size of the chunks created according the length of the vector and the chunk size.
- dimension: int
- Length of the vector to Chunk
- chunkSize: int
- Dimension of the Chunks
- chunks_sizes: np.array
- Array of the sizes of the created chunks. It deals with conditions when the expected chunks size do not fit an even number of times in the dimension
-
pysmFISH.object_based_segmentation.
obj_properties_calculator
(obj)[source]¶ Calculate the morphological properties of the object (connected component).
- obj: dict
- Dictionary with the object label and the coords.
- obj_prop_dict: dict
- Dictionary with the calculated properties of the object
-
pysmFISH.object_based_segmentation.
polyT_segmentation
(Img, min_object_size, min_distance, disk_radium_rank_filer, threshold_rel, trimming)[source]¶ Function that runs the polyT segmentation on an image
- Img: np.array
- 2D image to be segmented
- min_object_size: int
- Minimum size of a connected component in order to be considered a cell.
- min_distance: int
- Minimum distance between peaks for the creation of the markers for the first round of watershed.
- disk_radium_rank_filer: int
- Size of the filter for preprocessing the image in order to calculate the Thr.
- threshold_rel: float
- relative threshold between the markers for the first round of watershed.
- trimming: int
- Define the trimming point for the selection of the Thr for image processing.
- Objects_dict: dict
- Dictionary with the labels and their coords.