[Insight-users] Applying labels from KmeansModelEstimator toinput image pixels
Dawood Masslawi
masslawi at gmail.com
Fri Nov 12 19:31:49 EST 2010
David,
If you are still having problems with the ImageToListSampleAdaptor you can
create an image with pixel intensity values to be correlated with the pixel label
identified using the classifier, that is a colored image with intensity values
which distinguish different pixel classes then iterate over that image and get
the coordinates of any pixel knowing its label (i.e. class which is represented
with a color). The code for that would be pretty simple as follows:
int ClassLabel = 0;
for ( iterator.GoToBegin(); !iterator.IsAtEnd(); ++iterator )
{
int intensity = interator.Get();
if ( intensity == ClassLabel )
{
index = iterator.GetIndex();
std::cout << " Class 1 Pixel Index = " << index << std::endl;
}
}
Regards,
Dawood
--- On Fri, 11/12/10, David Doria <daviddoria at gmail.com> wrote:
From: David Doria <daviddoria at gmail.com>
Subject: Re: [Insight-users] Applying labels from KmeansModelEstimator toinput image pixels
To: "Magnotta, Vincent A" <vincent-magnotta at uiowa.edu>
Cc: "Dawood Masslawi" <masslawi at gmail.com>, insight-users at itk.org
Date: Friday, November 12, 2010, 10:15 AM
On Thu, Nov 11, 2010 at 10:25 PM, Magnotta, Vincent A
<vincent-magnotta at uiowa.edu> wrote:
> I would suggest that you look at itkScalarImageKmeansImageFilter.txx. This
> is essentially performing this classification using scalar images. A
> ListSampleAdaptor is used to classify the image. The algorithm then iterates
> over the Samples setting the image. Since this is a Adaptor class, it is
> assumed that the ordering of the samples is the same as the image.
>
> Vince
Thanks Vince. I think I have the big picture structure now, but I must
still be doing something incorrectly.
Here is my current attempt:
http://www.itk.org/Wiki/ITK/Examples/Broken/Statistics/ImageKmeansModelEstimator
It segfaults on the first call to
membershipIterator.GetClassLabel();
Any ideas why that would happen?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101112/826ba2fc/attachment.htm>
More information about the Insight-users
mailing list