<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><br>Hi Brad,<br><br> Thanks. It worked just fine. After i am done doing what i am actually trying to do:), i will sure put my example online on the wiki page.<br>Cheers,<br> Ella<br>--- Bradley Lowekamp <i><blowekamp@mail.nih.gov></i> schrieb am <b>Mo, 28.3.2011:<br></b><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><b><br>Von: Bradley Lowekamp <blowekamp@mail.nih.gov><br>Betreff: Re: [Insight-users] How to create a LabelImage from RelabelComponentImageFilter<br>An: "Ella Maria Kadas" <ella_kadas@yahoo.com><br>CC: "insight-users@itk.org" <insight-users@itk.org><br>Datum: Montag, 28. März, 2011 17:20 Uhr<br><br></b><div id="yiv409167058"><b>Hello Ella,</b><div><b><br></b></div><div><b>After a quick read, I suggest the
following:</b></div><div><b><br></b></div><div><b>typedef itk::LabelImageToLabelMapFilter< LabelImageType, LableMapType> I2Type;</b></div><div><b><br></b></div><div><b>hope this helps,</b></div><div><b>Brad</b></div><div><b><br></b><div><div><b>On Mar 28, 2011, at 10:08 AM, Ella Maria Kadas wrote:</b></div><b><br class="yiv409167058Apple-interchange-newline"></b><blockquote type="cite"><table style="" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top"><br><br>Hi all,<div><br></div><div> I am trying to use compute some morphological operations on a binary image. </div><div>i first used BinaryThresholdImageFilter, then got the connected components with ConnectedComponentImageFilter, and then relabeled them with RelabelComponentImageFilter </div><div> Now i was trying to use LabelImageToLabelMapFilter but i don't know how to create this LabelImage. In the Examples
from the Gaetan Lehmann the LabelImage is always read from input. </div><div> I just want somehow to use the output from the RelabeloComponentImageFilter to create a LabelMapFilter.</div><div><br></div><div><br></div><div> Part of the code is:</div><div><br></div><div><br></div><div><p style="margin: 0px; font: 11px Menlo; color: rgb(184, 48, 161);"><font class="yiv409167058Apple-style-span" face="arial" size="3"><span class="yiv409167058Apple-style-span" style="font-size: 13px;"><font class="yiv409167058Apple-style-span" color="#b830a1" face="Menlo" size="3"><span class="yiv409167058Apple-style-span" style="font-size: 11px;"></span></font></span></font></p><font class="yiv409167058Apple-style-span" face="arial" size="3"><font class="yiv409167058Apple-style-span" color="#b830a1" face="Menlo" size="3"><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span">typedef unsigned long
LabelPixelType;</font></div><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span">typedef itk::Image< LabelPixelType, Dimension > LabelImageType;</font></div><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span">typedef itk::ConnectedComponentImageFilter <OutputType, LabelImageType > ConnectedComponentImageFilterType;</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">ConnectedComponentImageFilterType::Pointer labelFilter</font><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">        </font></span><font class="yiv409167058Apple-style-span">= ConnectedComponentImageFilterType::New ();</font></div><div style="margin: 0px; font: 11px Menlo;"><span
class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">labelFilter->SetInput(filter->GetOutput());</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">labelFilter->Update();</font></div><p style="margin: 0px; font: 11px Menlo; min-height: 13px;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><br class="yiv409167058webkit-block-placeholder"></p><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">        </font></span><font class="yiv409167058Apple-style-span">typedef
itk::RelabelComponentImageFilter<LabelImageType,LabelImageType></font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">RelabelImageFilter;</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">RelabelImageFilter::Pointer relabel = RelabelImageFilter::New();</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">relabel->SetInput(labelFilter->GetOutput());</font></div><div style="margin: 0px; font: 11px Menlo;"><span
class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">relabel->Update();</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">typedef unsigned long LabelType;</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">typedef itk::AttributeLabelObject<unsigned long, Dimension, double> LabelObjectType;</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font
class="yiv409167058Apple-style-span">typedef itk::LabelMap<LabelObjectType> LabelMapType;</font></div><p style="margin: 0px; font: 11px Menlo; min-height: 13px;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><br class="yiv409167058webkit-block-placeholder"></p><p style="margin: 0px; font: 11px Menlo; min-height: 13px;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><br class="yiv409167058webkit-block-placeholder"></p><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">typedef itk::LabelImageToLabelMapFilter<LabelType, LabelMapType> I2LType;</font></div><div style="margin: 0px; font: 11px Menlo;"><span
class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">I2LType::Pointer i2l = I2LType::New();</font></div><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span">//!!!!! This is the part where i can't figure out the proper input, because using relabel->GetOutput() is defenetely wrong</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">i2l->SetInput(relabel->GetOutput());</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">i2l->SetBackgroundValue(0);</font></div><div
style="margin: 0px; font: 11px Menlo;"><span class="yiv409167058Apple-tab-span" style="white-space: pre;"><font class="yiv409167058Apple-style-span">                </font></span><font class="yiv409167058Apple-style-span">i2l->Update();</font></div><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span"><br></font></div><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span"><br></font></div><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span">Thanks in advance,</font></div><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span"> Ella</font></div></font></font><div><br class="yiv409167058webkit-block-placeholder"></div></div></td></tr></tbody></table><span><b><ATT00001..txt></b></span></blockquote><div style="margin: 0px; font: 11px Menlo;"><table style="" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td
style="font: inherit;" valign="top"><div><font class="yiv409167058Apple-style-span" face="arial" size="3"><font class="yiv409167058Apple-style-span" color="#b830a1" face="Menlo" size="3"><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span"><br></font></div><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span"><br></font></div></font></font></div></td></tr></tbody></table></div><div style="margin: 0px; font: 11px Menlo;"></div></div><b><font class="yiv409167058Apple-style-span" color="#b830a1"><br></font></b><div>
<span class="yiv409167058Apple-style-span" style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px;"><span class="yiv409167058Apple-style-span" style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px;"><p style="margin: 0px;"><b><font style="font: 12px Helvetica;" face="Helvetica" size="3">========================================================</font></b></p><p style="margin: 0px;"><b><font style="font: 12px Helvetica;"
face="Helvetica" size="3">Bradley Lowekamp<span class="yiv409167058Apple-converted-space"> </span><span class="yiv409167058Apple-converted-space"> </span></font></b></p><p style="margin: 0px;"><b><font class="yiv409167058Apple-style-span" face="Arial"><span class="yiv409167058Apple-style-span" style="font-family: Arial;"><span class="yiv409167058Apple-style-span" style="font-family: Arial;">Lockheed Martin </span></span></font><font style="font: 12px Helvetica;" face="Helvetica" size="3">Contractor for</font></b></p><p style="margin: 0px;"><b><font style="font: 12px Helvetica;" face="Helvetica" size="3">Office of High Performance Computing and Communications</font></b></p><p style="margin: 0px;"><b><font style="font: 12px Helvetica;" face="Helvetica" size="3">National Library of Medicine<span class="yiv409167058Apple-converted-space"> </span></font></b></p><p style="margin: 0px;"><b><font style="font: 12px Helvetica;"
face="Helvetica" size="3"><a rel="nofollow" ymailto="mailto:blowekamp@mail.nih.gov" target="_blank" href="/mc/compose?to=blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a></font></b></p><b><br class="yiv409167058Apple-interchange-newline"></b></span></span>
</div>
<b><br></b></div></div></blockquote></td></tr></table>