# ImageMorphology

This is what I want to achieve:

I start with a an algorithm that is similar to ImageAnalyzeParticles and results in a binary 2D wave where I get "Particles" and background.
Now I want remove all pixels along the perimeters of the particles, which do not share 8 identical neighbors.

I tried it with ImageMorphology, but it doesn't quite do what I want.
I'd appreciate any suggestions!

Cheers
Christian
Hello Christian,

If you run ImageAnalyzeParticles you can get the wave M_ParticlePerimeter (see /M=1). This wave would have 0 entries for the pixels that you want to eliminate and 64 elsewhere. If you divide this wave by 64 you can use the result to multiply your original image thus setting the boundary values to zero.

A.G.
WaveMetrics, Inc.

Hi A.G.

thanks for reply, but the boundary as such is not what I mean. Consider the following example:

Make/B/U/O/N=(6,6) ww
ww[0][0]= {0,0,1,0,1,0}
ww[0][1]= {1,1,1,1,0,0}
ww[0][2]= {0,1,1,1,1,0}
ww[0][3]= {0,1,1,1,0,1}
ww[0][4]= {1,0,1,1,1,0}
ww[0][5]= {0,1,0,0,0,1}
NewImage ww

from this image the only pixel I want to keep would be ww[2][2] because it is the only one with 8 identical neighbors.
ChrLie wrote:

from this image the only pixel I want to keep would be ww[2][2] because it is the only one with 8 identical neighbors.

So we need to re-adjust our terminology: I'd never regard ww[2][2] as being on the perimeter. In fact, any pixel that has 8 nearest neighbors that belong to the particle is NOT on the perimeter. If you want to only isolate your [2][2] pixel use:

ImageMorphology/E=6/L binaryerosion ww

A.G.
WaveMetrics, Inc.