I am trying to use watershed algorithm to separate overlapping cells.
This is my image, and when I used ImageJ, it works quite well as below: my image ImageJ result
However, when I used skimage watershed in python, some cells are missing (e.g. top right and bottom right). And I found it's because feature.peak_local_max didn't detect local maxima in these regions:
python output
This is the code I used in python. I would like to know how can I get the same results as ImageJ. Thanks a lot in advance!
distance = ndi.distance_transform_edt(img)
local_max_coords = feature.peak_local_max(distance, min_distance=7,labels = ndi.label(img)[0])
local_max_mask = np.zeros(distance.shape, dtype=bool)
local_max_mask[tuple(local_max_coords.T)] = True
markers = measure.label(local_max_mask)
labels = watershed(-distance, markers, mask=img,watershed_line=True)