我正在尝试量化大量图像数据。每个图像都有细胞和细胞核。必须做的以示意图形式表示为“我需要的”:
示例图像显示在“原始图像”中:
我找到了一个在线分水岭算法程序来计数细胞,但我无法计算细胞内部(和外部)的细胞核数量。
这是我用来从原始图像中计数细胞的程序
#import packages
import numpy as np
import matplotlib.pyplot as plt
from skimage import io, color, filters as filters
from scipy import ndimage
from skimage.morphology import watershed
from skimage.feature import peak_local_max
from skimage.measure import regionprops, label
import numpy as np
from scipy.ndimage import gaussian_filter
import matplotlib.pyplot as plt
from skimage import data
from skimage import img_as_float
from skimage.morphology import reconstruction
import skimage
from skimage import segmentation
%matplotlib inline
import matplotlib
#import image
from IPython.core.display import Image
Image(filename=('/Users/sasi/Desktop/image1.jpeg'))
# Find number of cells
image = color.rgb2gray(io.imread('/Users/sasi/Desktop/image1.jpeg'))
image = image < filters.threshold_otsu(image)
distance = ndimage.distance_transform_edt(image)
local_maxi = peak_local_max(distance, indices=False, footprint=np.ones((3, 3)), labels=image)
markers, num_features = ndimage.label(local_maxi)
labels = watershed(-distance, markers, mask=image)
regions = regionprops(labels)
regions = [r for r in regions if r.area > 60]
print('Number of cells:', len(regions) - 1)
我应该如何计算细胞内的细胞核以及整个图像中的细胞核数量?另外,如果你有另一个更好的细胞计数程序,请告诉我。