<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">David,<div><br></div><div>If you are still having problems with the<span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: small; line-height: 15px; "> ImageToListSampleAdaptor you can</span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: small; line-height: 15px; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: small; line-height: 15px; ">create an image with pixel intensity values to be correlated with the pixel label </span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: small; line-height: 15px; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif;
font-size: small; line-height: 15px; ">identified using the classifier, that is a colored image with intensity values </span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: small; line-height: 15px; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: small; line-height: 15px; ">which distinguish different pixel classes then iterate over that image and get </span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: small; line-height: 15px; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: small; line-height: 15px; ">the coordinates of any pixel knowing its label (i.e. class which is represented </span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica,
clean, sans-serif; font-size: small; line-height: 15px; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: small; line-height: 15px; ">with a color). The code for that would be pretty simple as follows:</span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: small; line-height: 15px; "><br></span></div><div><font class="Apple-style-span" face="arial, helvetica, clean, sans-serif"><span class="Apple-style-span" style="line-height: 15px; font-size: small;"><div>int ClassLabel = 0;</div><div><br></div><div>for ( iterator.GoToBegin(); !iterator.IsAtEnd(); ++iterator )</div><div><br></div><div> {</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> int intensity = interator.Get();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">
        </span> if ( intensity == ClassLabel )</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>{</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>index = iterator.GetIndex();</div><div><br></div><div> std::cout << " Class 1 Pixel Index = " << index << std::endl;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>}</div><div><br></div><div> }</div><div><br></div><div>Regards,</div><div><br></div><div>Dawood</div></span></font><br>--- On <b>Fri, 11/12/10, David Doria <i><daviddoria@gmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: David Doria
<daviddoria@gmail.com><br>Subject: Re: [Insight-users] Applying labels from KmeansModelEstimator toinput image pixels<br>To: "Magnotta, Vincent A" <vincent-magnotta@uiowa.edu><br>Cc: "Dawood Masslawi" <davoud_zzz@yahoo.com>, insight-users@itk.org<br>Date: Friday, November 12, 2010, 10:15 AM<br><br><div class="plainMail">On Thu, Nov 11, 2010 at 10:25 PM, Magnotta, Vincent A<br><<a ymailto="mailto:vincent-magnotta@uiowa.edu" href="/mc/compose?to=vincent-magnotta@uiowa.edu">vincent-magnotta@uiowa.edu</a>> wrote:<br>> I would suggest that you look at itkScalarImageKmeansImageFilter.txx. This<br>> is essentially performing this classification using scalar images. A<br>> ListSampleAdaptor is used to classify the image. The algorithm then iterates<br>> over the Samples setting the image. Since this is a Adaptor class, it is<br>> assumed that the ordering of the samples is the same as the image.<br>><br>>
Vince<br><br>Thanks Vince. I think I have the big picture structure now, but I must<br>still be doing something incorrectly.<br><br>Here is my current attempt:<br><a href="http://www.itk.org/Wiki/ITK/Examples/Broken/Statistics/ImageKmeansModelEstimator" target="_blank">http://www.itk.org/Wiki/ITK/Examples/Broken/Statistics/ImageKmeansModelEstimator</a><br><br>It segfaults on the first call to<br><br>membershipIterator.GetClassLabel();<br><br>Any ideas why that would happen?<br><br>Thanks,<br><br>David<br></div></blockquote></div></td></tr></table><br>