[Insight-users] KdTreeBasedKMeansClustering for 3D vector image

Sara Rolfe smrolfe at u.washington.edu
Tue Dec 7 17:50:50 EST 2010


Thanks, that's working for me now.  Sorry for the string of questions,  
but I'm now back to my original problem, with the assignment of the  
membership functions, in line 127.  I am guessing it's a problem with  
the data type, but it seems like this generalized version of k-means  
should support clustering vectors, since k-means is frequently used on  
color images.  The error message is below and my code is attached.   
Please let me know if you have any advice.

/Users/smrolfe/build/KdTreeBasedKMeansClustering.cxx: In function ‘int  
main(int, char**)’:
/Users/smrolfe/build/KdTreeBasedKMeansClustering.cxx:129: error: no  
matching function for call to ‘std::vector<itk::SmartPointer<const  
itk::Statistics::MembershipFunctionBase<main(int, char**)::PixelType>  
 >, std::allocator<itk::SmartPointer<const  
itk::Statistics::MembershipFunctionBase<main(int, char**)::PixelType>  
 > >  
 > 
::push_back 
(itk::Statistics::DistanceToCentroidMembershipFunction<main(int,  
char**)::MeasurementVectorType>*)’
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/stl_vector.h: 
602: note: candidates are: void std::vector<_Tp,  
_Alloc>::push_back(const _Tp&) [with _Tp = itk::SmartPointer<const  
itk::Statistics::MembershipFunctionBase<main(int, char**)::PixelType>  
 >, _Alloc = std::allocator<itk::SmartPointer<const  
itk::Statistics::MembershipFunctionBase<main(int, char**)::PixelType>  
 > >]
/Users/smrolfe/build/KdTreeBasedKMeansClustering.cxx:59: warning:  
unused variable ‘outputImageFileName’
/Users/smrolfe/ITK-Sandbox/ITK/Code/Numerics/Statistics/ 
itkEuclideanDistanceMetric.txx: In member function ‘double  
itk::Statistics::EuclideanDistanceMetric<TVector>::Evaluate(const  
typename  
itk::Statistics::DistanceMetric<TVector>::MeasurementVectorType&)  
const [with TVector = main(int, char**)::MeasurementVectorType]’:
/Users/smrolfe/build/KdTreeBasedKMeansClustering.cxx:133:    
instantiated from here
/Users/smrolfe/ITK-Sandbox/ITK/Code/Numerics/Statistics/ 
itkEuclideanDistanceMetric.txx:44: error: no match for ‘operator-’ in  
‘(+#‘obj_type_ref’ not supported by dump_expr#<expression  
error>((&((const itk::Statistics::EuclideanDistanceMetric<main(int,  
char**)::MeasurementVectorType>*)this)- 
 >itk::Statistics::EuclideanDistanceMetric<main(int,  
char**)::MeasurementVectorType>::<anonymous>)))- 
 >itk::Array<double>::<anonymous>.vnl_vector<T>::operator[] [with T =  
double](i) - (+ x)->itk::Vector<main(int, char**)::PixelType,  
3u>::<anonymous>.itk::FixedArray<TValueType, VLength>::operator[]  
[with TValueType = main(int, char**)::PixelType, unsigned int VLength  
= 3u](i)’
/Users/smrolfe/ITK-Sandbox/ITK/Code/Numerics/Statistics/ 
itkEuclideanDistanceMetric.txx: In member function ‘double  
itk::Statistics::EuclideanDistanceMetric<TVector>::Evaluate(const  
typename  
itk::Statistics::DistanceMetric<TVector>::MeasurementVectorType&,  
const typename  
itk::Statistics::DistanceMetric<TVector>::MeasurementVectorType&)  
const [with TVector = main(int, char**)::MeasurementVectorType]’:
/Users/smrolfe/build/KdTreeBasedKMeansClustering.cxx:133:    
instantiated from here
/Users/smrolfe/ITK-Sandbox/ITK/Code/Numerics/Statistics/ 
itkEuclideanDistanceMetric.txx:69: error: cannot convert  
‘itk::Vector<double, 2u>’ to ‘const double’ in initialization
make[2]: *** [CMakeFiles/KdTreeBasedKMeansClustering.dir/ 
KdTreeBasedKMeansClustering.cxx.o] Error 1
make[1]: *** [CMakeFiles/KdTreeBasedKMeansClustering.dir/all] Error 2


On Dec 7, 2010, at 2:19 PM, David Doria wrote:

> On Tue, Dec 7, 2010 at 5:14 PM, Sara Rolfe  
> <smrolfe at u.washington.edu> wrote:
>> Ok, I've decided that it's worth the trouble to reinstall the  
>> newest version
>> of ITK.  Now I'm having trouble finding/replacing the filters I was  
>> using.
>>
>> Does someone know what happened with the ImageToListAdaptor?  And  
>> if there's
>> something similar I can replace it with?
>>
>> Also, is there a webpage where I can see what was discontinued and  
>> what was
>> replaced?  I didn't see the info I'm looking for on this wiki page:
>> http://www.itk.org/Wiki/ITK_Release_3.18_Changed_From_Previous
>
> Good choice :)
>
> It is now called ImageToListSampleAdaptor
> http://www.itk.org/Doxygen/html/classitk_1_1ImageToListSampleAdaptor.html
> (the documentation seems to be down at the moment, check that link  
> later)
>
> Here is an example:
> http://www.itk.org/Wiki/ITK/Examples/Statistics/ImageToListSampleAdaptor
>
> David



More information about the Insight-users mailing list