Preprocessing to improve segmentation

Hi all,

I am trying to segment the dark spots in the attached SEM image, but thresholding is not working in its current state because the spots are not of a uniform pixel range and many of the spots have portion that match other portions of the image. I have tried mean and median filters, gaussian blurs to smooth out the image, background subtraction, and artificial flat field subtraction without achieving good thresholding results. Does anybody have any other preprocessing suggestions?

Thanks,
Gus

1100C_cropped|nullxnull

Hey @cgusbecker

Well… I tried a couple things… but best results were when I ran a Kuwhara Filter first (with a sampling window width of 9). Then I followed that with a Minimum Filter with radius of 4 pixels. This was just a quick test… but then running an automatic Threshold using the default method - I got some decent segmentation of your dark spots:

It’s not ideal yet - but getting there, so you can play a bit more with it to test things out. You can also look at some helpful segmentation tools:

Hope this helps!

eta :slight_smile:

4 Likes

Hi Gus,
I can’t see you image; is it not available anymore or it is just me?
Ilya

Ilya,

it is a 16bit image with a strange histogram. Maybe it was already pre-processed or converted (which makes analyses not easier …).

Histogram%20of%206a7ba13e8c0188a220a047e1e733218cff66e580

I think Ellen did quite a good job.

I reached a similar result with Minimum-filtering (radius = 3).

Regards

Herbie

1 Like

Hi Herbie,
thank you for the image, the histogram looks like the image was converted to 8bit, and after that back to 16bit with stretch of the contrast.
Btw, do can you see the original image still now? I think I had this issue before, some of the attached images are not displayed:

Blockquote screenshot

Ilya

1 Like

@anon96376101,
thanks for the tip!

@cgusbecker,
Laplacian filtering may be an alternative solution to Kuwahara filter:

  1. Remove noise (I used BM3D filter, any edge preserving filter should work)
  2. Apply laplacian filter (I used fast local laplacian filtering in Matlab, I believe there should be something similar in Fiji)
    img = locallapfilt(img, .1, 5, 3);
  3. Threshold

Best regards,
Ilya

2 Likes

Thanks for your comments, Herbie. I noticed the issue with the TIF image only downloading and not displaying, do members of this community prefer PNG images?

The histogram is quite strange. The only preprocessing performed was some cropping to remove a caption the instrument used to capture this image included as part of the original image itself. The original 16-bit image had a continuous histogram, with the caption containing pixel values at each end of the spectrum:

image

I assume the cropping affected the histogram in the way it did because not all of the pixel values remained in the image after it was cropped. Is there something I should be doing to maintain a continuous histogram?

@cgusbecker
Cropping should not affect the discretization of the histogram unless it is done via temp uint8 variable, but I can’t imagine that it might be the case. So, cropping is a safe procedure in this sense, the shape of the histogram will be changed of course.
When doing the cropping next time, just check how the histogram looks before and after.
TIF vs PNG: I think it does not matter, they are quite similar in possiblities to mess-up the original image: i.e. lossy compression or indexing :wink:
BR, Ilya

1 Like