[Insight-users] ImageKmeansModelEstimator crashes on GetClassLabel()

David Doria daviddoria at gmail.com
Tue Nov 22 11:53:01 EST 2011


I tried making an example of this class:

http://www.itk.org/Wiki/ITK/Examples/Statistics/ImageKmeansModelEstimator

However, when I try to get the class labels at the end of the procedure:

 int classLabel = membershipIterator.GetClassLabel();

the program crashes.

There are 3 classes as reported by:
  const ClassifierType::MembershipSampleType* membershipSample =
classifier->GetOutput();
  std::cout << "Number of classes: " <<
membershipSample->GetNumberOfClasses() << std::endl;

so then I'm not sure why this would crash?
  ClassifierType::MembershipSampleType::ConstIterator
membershipIterator = membershipSample->Begin();
  int testClassLabel = membershipIterator.GetClassLabel();

Any suggestions?

Thanks,

David


More information about the Insight-users mailing list