<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div></div><div><br></div><div><br></div><div><div>On Dec 2, 2010, at 3:55 PM, Sara Rolfe wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I did clear this error up, I needed to define the sample classifier as:<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><span style="color: #aa0d91">typedef</span> itk::Statistics::SampleClassifier< AdaptorType > ClassifierType; </div><div><br></div><div>instead of:</div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><span style="color: rgb(170, 13, 145); "><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;">        <span class="Apple-tab-span" style="white-space:pre">        </span></span></font></span></span></span></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><span style="color: rgb(170, 13, 145); "><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-tab-span" style="white-space:pre"></span></span></font></span><span class="Apple-tab-span" style="white-space:pre">        </span>typedef</span></span><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "> itk::Statistics::SampleClassifier< SampleType > ClassifierType; </span></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><br></span></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">Since I'm using the ImageToListAdaptor to get the samples from my image.</span></span></font></div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><br></div></div></div></div><div><div>On Dec 2, 2010, at 2:30 PM, Sara Rolfe wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks for the additional example. I have not yet gotten it to run, since I think I'm dealing with some version issues (I'm using itk-3.14). RIght now it's not recognizing itkMinimumDecisionRule2, itkSampleClassifierFilter, etc. I will let you know when I'm able to get this working. Is it possible that using older versions of these filters is part of my problem?<div><br></div><div>In the meantime, with my code, the estimated mean vectors are calculated correctly, but when I add the classification I getting the following error:</div><div><br></div><div><div>error: no matching function for call to ‘itk::Statistics::SampleClassifier<main(int,char**)::SampleType>::SetSample(itk::SmartPointer<itk::Statistics::ImageToListAdaptor<main(int, char**)::ImageType, main(int, char**)::PixelType> >&)’</div><div><br></div><div>...itkSampleClassifier.txx:56: note: candidates are: void itk::Statistics::SampleClassifier<TSample>::SetSample(const TSample*) [with TSample = main(int, char**)::SampleType]</div></div><div><br></div><div><br></div><div>So there's a problem when I set my classifier sample. My full code is below. </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; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkKdTree.h"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkKdTreeBasedKmeansEstimator.h"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkWeightedCentroidKdTreeGenerator.h"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkImageToListAdaptor.h"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkImageFileReader.h"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkImage.h"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkMinimumDecisionRule.h"<span style="color: #643820"> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkEuclideanDistance.h"<span style="color: #643820"> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkSampleClassifier.h"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkVector.h"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkListSample.h"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #643820">#include </span>"itkDistanceToCentroidMembershipFunction.h"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: #aa0d91">int</span> main( <span style="color: #aa0d91">int</span> argc, <span style="color: #aa0d91">char</span> * argv[] )</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">{</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><span style="color: #aa0d91">if</span>( argc < <span style="color: #1c00cf">5</span> )</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> {</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>std::cerr << <span style="color: #c41a16">"Usage: "</span> << std::endl;</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>std::cerr << argv[<span style="color: #1c00cf">0</span>];</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                </span>std::cerr << </span>" inputVectorImage.vtk outputLabeledImage.vtk"<span style="color: #000000">;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                </span>std::cerr << </span>" numberOfClasses numberOfComponents "<span style="color: #000000"> << std::endl;</span></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><span style="color: #aa0d91">return</span> EXIT_FAILURE;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></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><span style="color: #aa0d91">typedef</span> itk::Vector< <span style="color: #aa0d91">unsigned</span> <span style="color: #aa0d91">char</span>, <span style="color: #1c00cf">2</span> ><span class="Apple-tab-span" style="white-space:pre">        </span>PixelType;</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><span style="color: #aa0d91">typedef</span> itk::Image< PixelType, <span style="color: #1c00cf">3</span> > ImageType;</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><span style="color: #aa0d91">typedef</span> itk::ImageFileReader< ImageType > ReaderType;</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><span style="color: #aa0d91">typedef</span> itk::Statistics::ImageToListAdaptor< ImageType > AdaptorType;</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><span style="color: #aa0d91">typedef</span> itk::Statistics::WeightedCentroidKdTreeGenerator<AdaptorType > TreeGeneratorType;</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><span style="color: #aa0d91">typedef</span> TreeGeneratorType::KdTreeType TreeType;</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><span style="color: #aa0d91">typedef</span> itk:: Statistics:: KdTreeBasedKmeansEstimator< TreeType > EstimatorType;</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><span style="color: #aa0d91">typedef</span> itk::Vector< PixelType, <span style="color: #1c00cf">3</span> > MeasurementVectorType;</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><span style="color: #aa0d91">typedef</span> itk::Statistics::EuclideanDistance< MeasurementVectorType > MembershipFunctionType; </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><span style="color: #aa0d91">typedef</span> itk::MinimumDecisionRule DecisionRuleType;</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><span style="color: #aa0d91">typedef</span> itk::Statistics::ListSample< MeasurementVectorType > SampleType;</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><span style="color: #aa0d91">typedef</span> itk::Statistics::SampleClassifier< SampleType > ClassifierType; </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></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><span style="color: #aa0d91">const</span> <span style="color: #aa0d91">char</span> * inputImageFileName = argv[<span style="color: #1c00cf">1</span>];</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><span style="color: #aa0d91">const</span> <span style="color: #aa0d91">char</span> * outputImageFileName = argv[<span style="color: #1c00cf">2</span>];</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><span style="color: #aa0d91">int</span> numberOfClasses = atoi( argv[<span style="color: #1c00cf">3</span>] );</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><span style="color: #aa0d91">int</span> numberOfComponents = atoi( argv[<span style="color: #1c00cf">4</span>] );</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></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>ReaderType::Pointer reader = ReaderType::New();</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>reader->SetFileName( inputImageFileName );</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>reader->Update();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></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>AdaptorType::Pointer adaptor = AdaptorType::New();</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>adaptor->SetImage( reader->GetOutput() );</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></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>TreeGeneratorType::Pointer treeGenerator = TreeGeneratorType::New();</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>treeGenerator->SetSample( adaptor );</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>treeGenerator->SetBucketSize( <span style="color: #1c00cf">16</span> );</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>treeGenerator->Update();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></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>EstimatorType::Pointer estimator = EstimatorType::New();</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>EstimatorType::ParametersType initialMeans( numberOfClasses * numberOfComponents );</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>estimator->SetParameters( initialMeans );</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>estimator->SetKdTree( treeGenerator->GetOutput() );</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>estimator->SetMaximumIteration( <span style="color: #1c00cf">200</span> );</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>estimator->SetCentroidPositionChangesThreshold(<span style="color: #1c00cf">0.0</span>);</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>estimator->StartOptimization();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></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>EstimatorType::ParametersType estimatedMeans = estimator->GetParameters();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></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><span style="color: #aa0d91">for</span> ( <span style="color: #aa0d91">int</span> i = <span style="color: #1c00cf">0</span> ; i < numberOfClasses ; ++i )</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> {</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>std::cout << <span style="color: #c41a16">"cluster["</span> << i << <span style="color: #c41a16">"] "</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(196, 26, 22); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                </span>std::cout << </span>" estimated mean : "<span style="color: #000000">;</span></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><span style="color: #aa0d91">for</span> ( <span style="color: #aa0d91">int</span> j = <span style="color: #1c00cf">0</span> ; j < numberOfComponents ; ++j )</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>{</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>std::cout << <span style="color: #c41a16">" "</span> << estimatedMeans[ i * numberOfComponents + j ];</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>}</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>std::cout << std::endl;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>//classification using estimated means - this is the part that is not working correctly </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>DecisionRuleType::Pointer decisionRule = DecisionRuleType::New(); </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></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>ClassifierType::Pointer classifier = ClassifierType::New(); </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>classifier->SetDecisionRule( (itk::DecisionRuleBase::Pointer) decisionRule); </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>classifier->SetSample( adaptor ); </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>classifier->SetNumberOfClasses( <span style="color: #1c00cf">7</span> ); </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></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>std::vector< <span style="color: #aa0d91">unsigned</span> <span style="color: #aa0d91">int</span> > classLabels; </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>classLabels.resize( numberOfClasses ); </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><span style="color: #aa0d91">for</span> ( <span style="color: #aa0d91">int</span> i = <span style="color: #1c00cf">0</span> ; i < numberOfClasses ; ++i )</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> {</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>classLabels[i] = i; </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>}</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>classifier->SetMembershipFunctionClassLabels( classLabels ); </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">}</div></div><div><br></div><div><div><div>On Dec 1, 2010, at 6:32 PM, Luis Ibanez wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Voila !<br><br><a href="http://www.itk.org/Wiki/ITK/Examples/Statistics/KdTreeBasedKMeansClustering_3D">http://www.itk.org/Wiki/ITK/Examples/Statistics/KdTreeBasedKMeansClustering_3D</a><br><br>Thanks for pointing to these examples David.<br><br><br>Sara,<br><br>when running the example above,<br>the code seems to behave correctly.<br><br>Please give it a try and let us know<br>if you see anything out of order.<br><br><br> Thanks<br><br><br> Luis<br><br><br>-----------------------------------------<br>On Wed, Dec 1, 2010 at 8:31 PM, David Doria <<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>> wrote:<br><blockquote type="cite">On Wed, Dec 1, 2010 at 8:16 PM, Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>> wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">Hi Sara,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The KdTree should work in N-D.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">We tend to do 2D test just because they are<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">easier to debug, but we probably should add<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">a 3D one in this case.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Could you tell us more about the behavior of<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">this class that lead you to believe that is doing<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">something incorrect ?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">A minimal example will be greatly appreciated...<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Are these the examples you were looking at?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><a href="http://www.vtk.org/Wiki/ITK/Examples/Statistics/KdTreeBasedKMeansClustering_1D">http://www.vtk.org/Wiki/ITK/Examples/Statistics/KdTreeBasedKMeansClustering_1D</a><br></blockquote><blockquote type="cite"><a href="http://www.vtk.org/Wiki/ITK/Examples/Statistics/KdTreeBasedKMeansClustering_2D">http://www.vtk.org/Wiki/ITK/Examples/Statistics/KdTreeBasedKMeansClustering_2D</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">If not, maybe they will help. If so, please add<br></blockquote><blockquote type="cite"><a href="http://www.vtk.org/Wiki/ITK/Examples/Statistics/KdTreeBasedKMeansClustering_3D">http://www.vtk.org/Wiki/ITK/Examples/Statistics/KdTreeBasedKMeansClustering_3D</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">and we can work on it there.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">David<br></blockquote><blockquote type="cite"><br></blockquote></div></blockquote></div><br></div></div>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">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">http://www.kitware.com/products/protraining.html</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></div></div></blockquote></div><br></div></body></html>