<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><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: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color:
 #b830a1"><font class="Apple-style-span" color="#000000" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><font class="Apple-style-span" color="#B830A1" face="Menlo" size="3"><span class="Apple-style-span" style="font-size: 11px;"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font class="Apple-style-span" color="#000000">typedef unsigned long LabelPixelType;</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font class="Apple-style-span" color="#000000">typedef itk::Image&lt; LabelPixelType, Dimension &gt; LabelImageType;</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font class="Apple-style-span" color="#000000">typedef itk::ConnectedComponentImageFilter &lt;OutputType, LabelImageType &gt; ConnectedComponentImageFilterType;</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">ConnectedComponentImageFilterType::Pointer labelFilter</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">        </font></span><font class="Apple-style-span" color="#000000">= ConnectedComponentImageFilterType::New ();</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">labelFilter-&gt;SetInput(filter-&gt;GetOutput());</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">labelFilter-&gt;Update();</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">        </font></span><font class="Apple-style-span" color="#000000">typedef itk::RelabelComponentImageFilter&lt;LabelImageType,LabelImageType&gt;</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">RelabelImageFilter;</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">RelabelImageFilter::Pointer relabel = RelabelImageFilter::New();</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">relabel-&gt;SetInput(labelFilter-&gt;GetOutput());</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">relabel-&gt;Update();</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">typedef unsigned long LabelType;</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">typedef itk::AttributeLabelObject&lt;unsigned long, Dimension, double&gt; LabelObjectType;</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">typedef itk::LabelMap&lt;LabelObjectType&gt; LabelMapType;</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">typedef itk::LabelImageToLabelMapFilter&lt;LabelType, LabelMapType&gt; I2LType;</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">I2LType::Pointer i2l = I2LType::New();</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font class="Apple-style-span" color="#000000">//!!!!! This is the part where i can't figure out the proper input, because using relabel-&gt;GetOutput() is defenetely wrong</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">i2l-&gt;SetInput(relabel-&gt;GetOutput());</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">i2l-&gt;SetBackgroundValue(0);</font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" color="#000000">                </font></span><font class="Apple-style-span" color="#000000">i2l-&gt;Update();</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font class="Apple-style-span" color="#000000"><br></font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font class="Apple-style-span" color="#000000"><br></font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font class="Apple-style-span" color="#000000">Thanks in advance,</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font class="Apple-style-span" color="#000000">&nbsp;&nbsp; Ella</font></p></span></font></span></font></p></div></td></tr></table>