I have a 3d image which is the segmentation result of a input volume, the system works fine except for when two cells are located very close to each other, then in that case the segmentation results come back as the two cells joined as shown in the image below:
The circled are are actually two cells but are joined combined due to being closely located. In CC counting these two come up as a single cell.
I tried using morphological opening but it does not seem to provide the result I want. With a single iteration I have no effect ad with enough iterations to break the gap, I lose the smaller blobs.
import imageio as io
import numpy as np
import skimage.morphology as morph
import scipy.ndimage as ndimage
img = io.volread('test_volumes/volume_4_1_predictions.tif')
bw_img = img > 0.5 # binrize image
bw_img = 1 - bw_img # this changes True False to 1 and 0
bw_img = 1 - bw_img # Make background black and foreground white
strel = morph.ball(1)
opened = ndimage.binary_opening(opened, strel, 5)
5 iterations of this opens the gap but i seem to lose a lot of information.
Erosion does not work either as it loses more information than opening.
What would be the best way to disconnect these two cells?
Here is the 3d image in.tif
format: https://app.box.com/s/9wcqf3qbn8d9jg8zfvw3ijz85baes8t4