<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><br>Hi Brad,<br><br>&nbsp;&nbsp; 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>&nbsp; Ella<br>--- Bradley Lowekamp <i>&lt;blowekamp@mail.nih.gov&gt;</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 &lt;blowekamp@mail.nih.gov&gt;<br>Betreff: Re: [Insight-users] How to create a LabelImage from RelabelComponentImageFilter<br>An: "Ella Maria Kadas" &lt;ella_kadas@yahoo.com&gt;<br>CC: "insight-users@itk.org" &lt;insight-users@itk.org&gt;<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&lt; LabelImageType, LableMapType&gt; 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>&nbsp;&nbsp;I am trying to use compute some morphological operations on a binary image.&nbsp;</div><div>i first used BinaryThresholdImageFilter, then got the connected components with ConnectedComponentImageFilter, and then relabeled them with RelabelComponentImageFilter&nbsp;</div><div>&nbsp;&nbsp; &nbsp;Now i was trying to &nbsp;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.&nbsp;</div><div>&nbsp;&nbsp; I just want somehow to use the output from the RelabeloComponentImageFilter to create a LabelMapFilter.</div><div><br></div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; 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&lt; LabelPixelType, Dimension &gt; LabelImageType;</font></div><div style="margin: 0px; font: 11px Menlo;"><font class="yiv409167058Apple-style-span">typedef itk::ConnectedComponentImageFilter &lt;OutputType, LabelImageType &gt; 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-&gt;SetInput(filter-&gt;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-&gt;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&lt;LabelImageType,LabelImageType&gt;</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-&gt;SetInput(labelFilter-&gt;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-&gt;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&lt;unsigned long, Dimension, double&gt; 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&lt;LabelObjectType&gt; 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&lt;LabelType, LabelMapType&gt; 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-&gt;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-&gt;SetInput(relabel-&gt;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-&gt;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-&gt;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">&nbsp;&nbsp; Ella</font></div></font></font><div><br class="yiv409167058webkit-block-placeholder"></div></div></td></tr></tbody></table><span><b>&lt;ATT00001..txt&gt;</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">&nbsp;</span><span class="yiv409167058Apple-converted-space">&nbsp;</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&nbsp;</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">&nbsp;</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>