I'm currently working on an algorithm for automatic nuclei segmentation described in this* paper. I already preprocess my image and have implemented the FRST, which output (if I'm understanding it properly) should be the marker for the watershed.
I perform some morphological operations to preprocess the image, then I compute the Fast Radial-Simmetry Transform (FRST) over this preprocessed image. Then, I calculate the extended regional minima of the FRST:
img = io.imread("test.png", True)
# To range 0-1
img = sk.util.img_as_ubyte(img)
# Morphological operations described in the paper
# the output is a B/W image
n = 10
morp_img = morphological_operations(img, n)
# For the Gaussian used in the frst
kernelSize = 21
sigma = 0.5 * kernelSize
# determines how strictly radial the radial symmetry must be
alpha = 2
# the frst will calculate the mean of all radius
radii = np.arange( n, n*2, 1)
# ignore small values
beta = 0.1
# Orientation-based FRST (ignore the magnitude)
S = frst.obfrst(morp_img, radii, alpha, kernelSize, sigma, beta)
# The extended regional minima of S are calculated as the regional minima of the h-minima transformation of S
h = 0.4 * 255
Sh = S + h
marker = morp.reconstruction(Sh, S, 'erosion')
# Calculate the watershed with markers
label = watershed(img, marker)
# Visualizacion
fig, ax = plt.subplots(2,2)
ax = ax.ravel()
ax[0].imshow(img, cmap='gray')
ax[0].set_title("Original")
ax[1].imshow(morp_img, cmap='gray')
ax[1].set_title("After morphologic operations")
ax[2].imshow(S, cmap='gray')
ax[2].set_title("After FRST")
ax[3].imshow(img, cmap=plt.cm.gray)
ax[3].imshow(label, cmap=plt.cm.nipy_spectral, alpha=.7)
ax[3].set_title("Segmented")
My results until now are:
and I'd like to achive something like this:
I have to mark the background aswell, and the paper sais that I should use the skeletonize operation over the background map, but I don't know what is that or how to calculate it.(clearly I'm misunderstanding something).
By the way, the functions I've show are from scikimage, and the FRST is in Dark mode (only uses the negatively afected pixels) and it's orientation-based (without using magnitude).
EDIT : Okay... Looks like it's almost solved. I've been told that it's probably a problem of the data range, and it was. The problem was that I was working with the image in the range [0-1], but as long as markers have to be type int, when I computed the watershed everything was being round to the nearest integer. I removed the img_as_float function and add a img_as_ubyte, and seems to work.
Now I want to mark the background, how should I do it? The thing is that I don't undertand how to combine the bg markers and the foreground markers.
I'd be pleased if someone could help me. Ask me for more details if need.
*Veta M, van Diest PJ, Kornegoor R, Huisman A, Viergever MA, et al. (2013) Automatic Nuclei Segmentation in H&E Stained Breast Cancer Histopathology Images