Hi, Sara,<br> You need to make MeasurementVectorType consistent in your code.<br>Replace <span style="color: rgb(170, 13, 145);"><br>typedef</span> itk::Vector< PixelType, <span style="color: rgb(28, 0, 207);">3</span> > MeasurementVectorType;<br>
with <br><span style="color: rgb(170, 13, 145);">typedef</span> AdaptorType::MeasurementVectorType<span style="color: rgb(28, 0, 207);"></span> MeasurementVectorType;<br><br><br><br>wanlin<br><br><br><div class="gmail_quote">
On Wed, Dec 8, 2010 at 9:58 AM, Sara Rolfe <span dir="ltr"><<a href="mailto:smrolfe@u.washington.edu">smrolfe@u.washington.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Here is the code for the previous email.<br>
<br>
<br><br>
<br>
On Dec 7, 2010, at 2:50 PM, Sara Rolfe wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.<br>
<br>
/Users/smrolfe/build/KdTreeBasedKMeansClustering.cxx: In function ‘int main(int, char**)’:<br>
/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>*)’<br>
/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> > >]<br>
/Users/smrolfe/build/KdTreeBasedKMeansClustering.cxx:59: warning: unused variable ‘outputImageFileName’<br>
/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]’:<br>
/Users/smrolfe/build/KdTreeBasedKMeansClustering.cxx:133: instantiated from here<br>
/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)’<br>
/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]’:<br>
/Users/smrolfe/build/KdTreeBasedKMeansClustering.cxx:133: instantiated from here<br>
/Users/smrolfe/ITK-Sandbox/ITK/Code/Numerics/Statistics/itkEuclideanDistanceMetric.txx:69: error: cannot convert ‘itk::Vector<double, 2u>’ to ‘const double’ in initialization<br>
make[2]: *** [CMakeFiles/KdTreeBasedKMeansClustering.dir/KdTreeBasedKMeansClustering.cxx.o] Error 1<br>
make[1]: *** [CMakeFiles/KdTreeBasedKMeansClustering.dir/all] Error 2<br>
<br>
<br>
On Dec 7, 2010, at 2:19 PM, David Doria wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, Dec 7, 2010 at 5:14 PM, Sara Rolfe <<a href="mailto:smrolfe@u.washington.edu" target="_blank">smrolfe@u.washington.edu</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ok, I've decided that it's worth the trouble to reinstall the newest version<br>
of ITK. Now I'm having trouble finding/replacing the filters I was using.<br>
<br>
Does someone know what happened with the ImageToListAdaptor? And if there's<br>
something similar I can replace it with?<br>
<br>
Also, is there a webpage where I can see what was discontinued and what was<br>
replaced? I didn't see the info I'm looking for on this wiki page:<br>
<a href="http://www.itk.org/Wiki/ITK_Release_3.18_Changed_From_Previous" target="_blank">http://www.itk.org/Wiki/ITK_Release_3.18_Changed_From_Previous</a><br>
</blockquote>
<br>
Good choice :)<br>
<br>
It is now called ImageToListSampleAdaptor<br>
<a href="http://www.itk.org/Doxygen/html/classitk_1_1ImageToListSampleAdaptor.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1ImageToListSampleAdaptor.html</a><br>
(the documentation seems to be down at the moment, check that link later)<br>
<br>
Here is an example:<br>
<a href="http://www.itk.org/Wiki/ITK/Examples/Statistics/ImageToListSampleAdaptor" target="_blank">http://www.itk.org/Wiki/ITK/Examples/Statistics/ImageToListSampleAdaptor</a><br>
<br>
David<br>
</blockquote>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote>
<br>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>