From: xiong on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <a9d90a0d-940f-423e-804a-4cdc8a4de047(a)30g2000yqu.googlegroups.com>...
> You didn't say what to do if there were a local max (like with a value
> of 3) that was NOT within a certain distance of your "4" cluster. Do
> you keep the one with value 3 in that case, or throw it out because it
> doesn't have the max value of 4? That gets a little complicated (but
> not very hard at all if you have the Image Processing Toolbox - just
> compare distances between centroids and throw out clusters that are
> too close to a bigger cluster). Otherwise to simply find what you
> gave as your desired, final output:
>
> a = [1 1 1 1 1 1 1 1 1 2 2 3 4 3 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 3
> 2 2 3 4 3 2 3 2 1 1 1 1 1]
> maxIndexes = find(a == max(a))
> b = zeros(1, length(a));
> b(maxIndexes) = a(maxIndexes)
Thank you very much!
From: xiong on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <a9d90a0d-940f-423e-804a-4cdc8a4de047(a)30g2000yqu.googlegroups.com>...
> You didn't say what to do if there were a local max (like with a value
> of 3) that was NOT within a certain distance of your "4" cluster. Do
> you keep the one with value 3 in that case, or throw it out because it
> doesn't have the max value of 4? That gets a little complicated (but
> not very hard at all if you have the Image Processing Toolbox - just
> compare distances between centroids and throw out clusters that are
> too close to a bigger cluster). Otherwise to simply find what you
> gave as your desired, final output:
>
> a = [1 1 1 1 1 1 1 1 1 2 2 3 4 3 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 3
> 2 2 3 4 3 2 3 2 1 1 1 1 1]
> maxIndexes = find(a == max(a))
> b = zeros(1, length(a));
> b(maxIndexes) = a(maxIndexes)

if there were a local max (like with a value
of 3) that was NOT within a certain distance of your "4" cluster. I will keep the one with value 3 in that case.
From: ImageAnalyst on
Then that method won't work. You'll have to identify clusters, for
example threshold for >=2, and locate centroids. You can calculate
centroids manually with the usual formula, or get it from
regionprops. Then you'll have to calculate the distance from each
centroid to the two nearest centroids and decide which to throw away
if the distances are too small.

Maybe you're just interested in a peak finder, such as this one
http://billauer.co.il/peakdet.html
or any number of ones in the File Exchange. Look for one where you
can specify how much noise you'll tolerate. Maybe your close peaks
are really like small side/noisy peaks on a larger peak rather than
completely separate isolated peaks on their own. Some peak finders
can handle that kind of situation (and some don't).
From: xiong on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <e7106553-94bf-4959-bc83-d9ed4f84eda2(a)j14g2000yqm.googlegroups.com>...
> Then that method won't work. You'll have to identify clusters, for
> example threshold for >=2, and locate centroids. You can calculate
> centroids manually with the usual formula, or get it from
> regionprops. Then you'll have to calculate the distance from each
> centroid to the two nearest centroids and decide which to throw away
> if the distances are too small.
>
> Maybe you're just interested in a peak finder, such as this one
> http://billauer.co.il/peakdet.html
> or any number of ones in the File Exchange. Look for one where you
> can specify how much noise you'll tolerate. Maybe your close peaks
> are really like small side/noisy peaks on a larger peak rather than
> completely separate isolated peaks on their own. Some peak finders
> can handle that kind of situation (and some don't).

Thank you for your kindness and patiience.Now I can identify clusters and locate centroids.
But I can not tell the matlab to calculate the distance from each
> centroid to the two nearest centroids and decide which to throw away
> if the distances are too small.
Look forward to your patient teaching.
Thank you.
From: ImageAnalyst on
On Jan 21, 1:27 pm, "xiong " <xionglei092...(a)sina.com> wrote:

> But  I can not  tell the matlab to calculate the distance from each
> centroid to the two nearest centroids and decide which to throw away
> > if the distances are too small.
>
> Look forward to your patient teaching.
> Thank you.

-----------------------------------------------------------------------
The distance is merely the difference between the indexes where the
centroids are. For example if one has a centroid at element 5 and
another had a centroid at element 15 then they are 10 elements apart.
It's up to you to decide how close is "too close."