I have some confocal laser scanning microscopy data sets that I want to binarize for further analyses. Due to the fast bleaching dyes and the general scanning duration we established a setup which results in data sets of 1024x1024x50 voxels. The spacing is 0.1µm x 0.1µm x 0.53µm, which means that the total imaged volume is about 102µm x 102µm x 27µm.
Image quality could be better and unfortunately, the exact PSF is not known. I have put together some image processing steps ranging from de-noising to binarization (segmentation correction via object separation etc. will happen afterwards). For better results I have saved rescaling of the processed image to the actual image aspect ratio until binarization (although I show a rescaled image after every step). Quadratic Resampling
seemed to produce the best result. For demonstration I will show the procedure in 2d only, extension to 3d can easily be done.
I am not yet satisfied with the current result, maybe someone comes up with a better idea how to tackle this problem.
Here is an exemplary z-slice of a volume:
img = Import["http://i.imgur.com/kIratE9.png"]
ImageResize[%, {1024, 265}, Resampling -> "Quadratic"]
At first I apply a TotalVariationFilter
:
imgtv = TotalVariationFilter[img, 0.05, MaxIterations -> 100]
ImageResize[%, {1024, 265}, Resampling -> "Quadratic"]
Then an ImageDeconvolve
is performed. I selected this specific kernel since it yielded the best visual result:
gmat = GaussianMatrix[{{5, 5}, {1.5, 2.5}}];
ImageAdjust[Image[gmat]]
imgdec = ImageDeconvolve[imgtv, gmat, Method -> {"SteepestDescent", "Preconditioned" -> False}, MaxIterations -> 15]
imgdec2 = ImageResize[%, {1024, 265}, Resampling -> "Quadratic"]
For the final step I use LocalAdaptiveBinarize
, Closing
and FillingTransform
:
imgbin = FillingTransform[Closing[LocalAdaptiveBinarize[imgdec2, 150], DiskMatrix[2]]]
The poor image quality (influence of the PSF, noise, etc.) in conjuction with the rescaling results in spiky object borders in z-direction. An extra processing step would be needed to counter this problem adequately. Here is an overlay of the original image and the result:
HighlightImage[ImageResize[img, {1024, 265}, Resampling -> "Quadratic"], imgbin]
Following the request by Rahul I have performed resizing prior to all image processing steps. The result is worse as I pointed out above:
Update
Following an idea by halirutan I have put an unidirectional GaussianFilter
before the TotalVariationFilter
to get rid of the spikes. The result still could be better:
img = GaussianFilter[img, {{0, 4}}]