Which can be obtained via
from skimage.data import human_mitosis
image = human_mitosis()
I want to turn this image of multiple cells into multiple images for each individual cell through automatically cropping each single cell into its own image (ideally the size of the cropping is the same size/shape for each cell). So, for example, these would be some of the expected images:
Although scikit has some code for segmenting cells, how do you use this segmentation (or some other potentially easier method) to separate single cells into their own images or objects?
Here is some code for segmenting the cells (taken from scikit's tutorial with this image https://scikit-image.org/docs/dev/auto_examples/applications/plot_human_mitosis.html#sphx-glr-auto-examples-applications-plot-human-mitosis-py):
import matplotlib.pyplot as plt
import numpy as np
from scipy import ndimage as ndi
from skimage import (
color, feature, filters, measure, morphology, segmentation, util
)
thresholds = filters.threshold_multiotsu(image, classes=3)
cells = image > thresholds[0]
distance = ndi.distance_transform_edt(cells)
local_max_coords = feature.peak_local_max(distance, min_distance=7)
local_max_mask = np.zeros(distance.shape, dtype=bool)
local_max_mask[tuple(local_max_coords.T)] = True
markers = measure.label(local_max_mask)
segmented_cells = segmentation.watershed(-distance, markers, mask=cells)
fig, ax = plt.subplots(ncols=2, figsize=(10, 5))
ax[0].imshow(cells, cmap='gray')
ax[0].set_title('Overlapping nuclei')
ax[0].axis('off')
ax[1].imshow(color.label2rgb(segmented_cells, bg_label=0))
ax[1].set_title('Segmented nuclei')
ax[1].axis('off')
plt.show()



