<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I agree. I also think that the example on the wiki might be more helpful if it showed this method of accessing the means. <div><br></div><div>However, I'm still having some trouble accessing the first block of the k-means output, when I use: </div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>vtkTable* tab = vtkTable::SafeDownCast( kMeansStatistics->GetOutputDataObject( <span style="color: #1c00cf">1</span> ).GetBlock( <span style="color: #1c00cf">0</span> ) );</div><div><br></div><div>or just </div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><span class="Apple-tab-span" style="white-space:pre">        </span>kMeansStatistics->GetOutputDataObject(</span><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "> </span><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><span style="color: rgb(28, 0, 207); ">1</span></span><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "> </span><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; ">).GetBlock(</span><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "> </span><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><span style="color: rgb(28, 0, 207); ">0</span></span><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "> </span><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; ">)</span></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><br></span></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><div><div style="font-family: Helvetica; font-size: medium; ">I'm getting the following error: </div></div><div><br></div><div>error: request for member ‘GetBlock’ in ‘kMeansStatistics. vtkSmartPointer<T>::operator-> [with T = vtkKMeansStatistics]()->vtkKMeansStatistics::<anonymous>.vtkStatisticsAlgorithm::<anonymous>.vtkTableAlgorithm::<anonymous>.vtkAlgorithm::GetOutputDataObject(1)’, which is of non-class type ‘vtkDataObject*’</div><div><br></div><div><div style="font-family: Helvetica; font-size: medium; ">Does anyone know what might cause this?</div></div><div style="font-family: Helvetica; font-size: medium; "><br></div><div style="font-family: Helvetica; font-size: medium; ">Thanks,</div><div style="font-family: Helvetica; font-size: medium; ">Sara</div><div><br></div></span></div><div><div>On Mar 16, 2011, at 5:32 PM, David Doria wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Wed, Mar 16, 2011 at 4:07 PM, Sara Rolfe <<a href="mailto:smrolfe@u.washington.edu">smrolfe@u.washington.edu</a>> wrote:<br><blockquote type="cite"><br></blockquote><blockquote type="cite">Hi David,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">It's not a difficult fix, I mainly found it awkward since I thought I was missing something simple. I understand how it works better now and can certainly implement it this way. I appreciate your clarification.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Sara<br></blockquote><br>If you recall, I had the same sort of "it feels awkward" issues a<br>while back. I think the problem is that the suite is very very capable<br>and able to hand very large and serious problems, but many users just<br>want the "very basic" functionality ("which points belong to which<br>cluster?", and "what are the cluster means?"), which is hard to get<br>at. There are many layers of complexity above that that a user must<br>understand (i.e. this "Learn" and "Derive" that you mentioned) that<br>are not concepts in a standard textbook explanation of kmeans<br>clustering. Providing a "simple" interface to do this "one pass" type<br>of thing would definitely be a nice addition.<br><br>That is, replace:<br><br> kMeansStatistics->SetLearnOption( 1 ); // This is on by default.<br> kMeansStatistics->SetMaxNumIterations( 1 );<br> vtkTable* tab = vtkTable::SafeDownCast(<br>kMeansStatistics->GetOutputDataObject( 1 ).GetBlock( 0 ) );<br> double xc = tab->GetValueByName( label, "x" ).ToDouble();<br><br>with<br><br>double mean0[3];<br>kMeans->GetMean(0,mean0);<br><br>See the difference :) ?<br><br>David D.<br></div></blockquote></div><br></div></body></html>