k-means clustering question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

k-means clustering question

Aryeh Weiss
In the k-means clustering plugins, how can I know which cluster will be
assigned to which grey level? Or, for the option which generates a stack
of binary images, can I know which cluster will be assigned to a given
slice? When I automate this process, it helps if I know where a given
cluster will be?

--aryeh
--
Aryeh Weiss
School of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051
Reply | Threaded
Open this post in threaded view
|

Re: k-means clustering question

Gabriel Landini
On Thursday 29 Dec 2011 09:10:09 you wrote:
> In the k-means clustering plugins, how can I know which cluster will be
> assigned to which grey level? Or, for the option which generates a stack
> of binary images, can I know which cluster will be assigned to a given
> slice? When I automate this process, it helps if I know where a given
> cluster will be?

Hi Aryeh,
We've been wondering how to do this for some time too... In the k-means
clustering written by Jarek Sacha, you can't know in advance which cluster
will be which.
Something we played with was to extract the information of the phase
determined by each cluster from the original image and try to work it out from
there (let's say looking for the cluster with lowest luminance or with hues
between certain values, or based on the topology [eg the one that returns
certain kind or number of objects], etc).

However yesterday I saw Daniel Sage's plugin for colour segmentation for the
first time and in that one you can specify samples first. I am not sure how
that works because there is little information on what it does and no source
code. Maybe one specifies the initial centroid, but this is just a guess.

If you come up with a good solution, I would like to hear it too.
Best wishes

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: k-means clustering question

Aryeh Weiss
On 12/29/11 12:21 PM, Gabriel Landini wrote:

> On Thursday 29 Dec 2011 09:10:09 you wrote:
>> In the k-means clustering plugins, how can I know which cluster will be
>> assigned to which grey level? Or, for the option which generates a stack
>> of binary images, can I know which cluster will be assigned to a given
>> slice? When I automate this process, it helps if I know where a given
>> cluster will be?
>
> Hi Aryeh,
> We've been wondering how to do this for some time too... In the k-means
> clustering written by Jarek Sacha, you can't know in advance which cluster
> will be which.
> Something we played with was to extract the information of the phase
> determined by each cluster from the original image and try to work it out from
> there (let's say looking for the cluster with lowest luminance or with hues
> between certain values, or based on the topology [eg the one that returns
> certain kind or number of objects], etc).
>
> However yesterday I saw Daniel Sage's plugin for colour segmentation for the
> first time and in that one you can specify samples first. I am not sure how
> that works because there is little information on what it does and no source
> code. Maybe one specifies the initial centroid, but this is just a guess.
>
> If you come up with a good solution, I would like to hear it too.
> Best wishes
>

Hi Gabriel and thank you for your quick reply.

If you know where your object ranks in brightness (eg, if you know your
object is always brightest or if you know it will be second darkest or
whatever), then you can figure out which is which. I used the Spatial
Fuzzy C-means plugin that can produce a stack of binary images. Then I
ANDed that with the input image, to give a stack with 4 images, each of
which consists of grey levels that fall within one cluster. Then you can
use Analyze>Histogram to order them and find what you need. This sounds
like what you did.

I suppose you can extend this to let the user mark an object, and then
use that ROI to find the cluster that you want.

Best regards,
--aryeh
--
Aryeh Weiss
School of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051
Reply | Threaded
Open this post in threaded view
|

Re: k-means clustering question

Gabriel Landini
> If you know where your object ranks in brightness (eg, if you know your
> object is always brightest or if you know it will be second darkest or
> whatever), then you can figure out which is which.

Hi Aryeh,
Yes, that is right. Instead of ANDing you can also use "Create Selection" on
the binary image, then use the particle analyzer or Particles 8 plugin with
redirection to the original to extract the morphology or grey/colour
components of each region in that phase (for example to check if objects have
a particular size or shape).

If RGB is not enough, one can convert RGB to HSB and then load the H, S and B
channels as R, G and B with:
run("HSB Stack");
run("Stack to RGB");
This new image would look strange (HSB stack in an RGB container) but can be
used so Particles 8 returns the H S and B statistics of each region if
redirected to it.

As we are interested in reasoning about the segmentation results, one problem
is that we are trying to resolve both the clustering and the labelling. If the
former is wrong, then the latter cannot ever be correct. So in a sense, I
think such approaches might work with certain type of images but not with
others.

Best wishes

Gabriel