7
$\begingroup$

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"]

Mathematica graphics Mathematica graphics

At first I apply a TotalVariationFilter:

imgtv = TotalVariationFilter[img, 0.05, MaxIterations -> 100]
ImageResize[%, {1024, 265}, Resampling -> "Quadratic"]

Mathematica graphics Mathematica graphics

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]]

Mathematica graphics

imgdec = ImageDeconvolve[imgtv, gmat, Method -> {"SteepestDescent", "Preconditioned" -> False}, MaxIterations -> 15]
imgdec2 = ImageResize[%, {1024, 265}, Resampling -> "Quadratic"]

Mathematica graphics Mathematica graphics

For the final step I use LocalAdaptiveBinarize, Closing and FillingTransform:

imgbin = FillingTransform[Closing[LocalAdaptiveBinarize[imgdec2, 150], DiskMatrix[2]]]

Mathematica graphics

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]

Mathematica graphics

Following the request by Rahul I have performed resizing prior to all image processing steps. The result is worse as I pointed out above:

Mathematica graphics

Update

Following an idea by halirutan I have put an unidirectional GaussianFilterbefore the TotalVariationFilterto get rid of the spikes. The result still could be better:

img = GaussianFilter[img, {{0, 4}}]

Mathematica graphics

$\endgroup$
9
  • $\begingroup$ Why are you not satisfied with the result and what are you expecting to be improved? You could maybe try smoothening the final shapes, or fit some splines on the, etc. $\endgroup$
    – anderstood
    Jun 29, 2016 at 16:06
  • $\begingroup$ What happens if you resize the image to the correct aspect ratio before applying all those steps, rather than after? $\endgroup$
    – user484
    Jun 29, 2016 at 17:30
  • $\begingroup$ @Rahul: I have provided an answer to your request in my post. $\endgroup$
    – Kardashev3
    Jun 30, 2016 at 11:47
  • $\begingroup$ @anderstood: The problem here is the poor quality of the original images. Resizing these images also "resizes" and thereby intensifies the noise in z-direction. Before deconvolution I perform a TotalVariationFilter to remove the noise, but maybe another procedure should be employed instead. I expect to produce more rounded objects that correspond to the original structures more strictly. I have put an unidirectional GaussianFilter before the TotalVariationFilter (see the post update) to get rid of the spikes. The result is somewhat better but far from perfect due to the additional blurring. $\endgroup$
    – Kardashev3
    Jun 30, 2016 at 12:15
  • $\begingroup$ @anderstood: Could you please elaborate on smoothening the final shapes while keeping the actual structure's shape? $\endgroup$
    – Kardashev3
    Jun 30, 2016 at 12:16

1 Answer 1

4
+25
$\begingroup$

Basically following the outline of the OPs processing:

img = Import["http://i.imgur.com/kIratE9.png"];
imR = ImageResize[%, {1024, 265}, Resampling -> "Quadratic"];
imM = MeanShiftFilter[imR, 1, 0.1, MaxIterations -> 20];
imL = LocalAdaptiveBinarize[imM, 66, {0.7, 0, 0.1}];
imgF = DeleteSmallComponents[FillingTransform[imL], 20];
HighlightImage[imR, imgF]

enter image description here

This replaces the TotalVariation and the deconvolution with a Meanshift filter, and shuffles around a few of the other commands.

$\endgroup$
1
  • $\begingroup$ For some structures this works quite well, but in the top left something went wrong. Maybe the result could benefit from some local adaptive contrast enhancement of the original image (just a guess)? $\endgroup$
    – Kardashev3
    Jul 4, 2016 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.