[Insight-users] Mean shift clustering example

Luis Ibanez luis.ibanez at kitware.com
Tue Mar 16 19:09:55 EDT 2010


Hi David,


               It is great to see you contributing
               to the InsightClopedia !!


--

I don't quite have a detailed answer to your specific question,
but here are some hints that may be useful.

The MeahShift classes are part of the Statistics framework.

As such, (just as all other classes in that framework) they are
designed to work on a data abstraction that is independent
of image: The Sample.

When putting together an image filter that uses classes from
the statistics framework, it is common to find that a significant
number of components have to be put together.

We usually do so by creating a new Image filter that internally
contains the necessary statistical classes and the proper
image-to-sample adaptors.

A good reference could be to look at the Kmeans image filter.

If you look under the hood, you will find how it puts together
statistical classes and adaptors.

I'm guessing that you are confronting that phase the precedes
the creation of an image filter, hence, the surprising level of
complication.

In summary:

Once the example is put together for an image, we probably
should package it as a self-contained image filter, with a
proper API and add it to the toolkit.


Note that you are currently looking at one of the corners with
not-so-frequently-used classes in ITK, therefore, you are right
in keeping a very critical eye. It is not unlikely that we will find
things that can be improved there.


    Hope that helps,


          Luis


---------------------------------------------------------------------
On Tue, Mar 16, 2010 at 6:52 PM, David Doria <daviddoria+itk at gmail.com> wrote:
> I am trying to make an example out of the Test for
> SampleMeanShiftClusteringFilter
>
> http://www.itk.org/Wiki/ITK/InsightClopedia/MeanShiftClustering
>
> Can anyone comment on what the KdTreeGenerator is doing? and the
> HypersphereKernelMeanShiftModeSeeker? and MeanShiftModeCacheMethod?
> and this:
>
>  while ( fo_iter != fo_end )
>    {
>    io_iter.Set( (PixelType) fo_iter.GetMeasurementVector()[0]) ;
>    ++fo_iter ;
>    ++io_iter ;
>    }
>
> I understand that the image needs to be blurred before running any
> segmentation, but can this filter be used in a simple way like:
>
>  typedef itk::Statistics::SampleMeanShiftBlurringFilter< TreeType >
>    FilterType ;
>  FilterType::Pointer filter = FilterType::New() ;
>  filter->SetInputSample( tree ) ;
>  filter->Update() ;
>
>  typedef itk::Statistics::SampleMeanShiftClusteringFilter< TreeType >
>    ClusteringMethodType ;
>
>  ClusteringMethodType::Pointer clusteringMethod =
>    ClusteringMethodType::New() ;
>  clusteringMethod->SetInputSample( treeGenerator2->GetOutput() ) ;
>  clusteringMethod->SetThreshold( 0.5 ) ;
>  clusteringMethod->SetMinimumClusterSize( 16 ) ;
>  clusteringMethod->Update() ;
>
> It seems like 150 lines to run this filter is a bit outrageous, no?
>
> Thanks,
>
> David
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list