<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><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: 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< LabelPixelType, Dimension > 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 <OutputType, LabelImageType > 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->SetInput(filter->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->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<LabelImageType,LabelImageType></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->SetInput(labelFilter->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->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<unsigned long, Dimension, double> 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<LabelObjectType> 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<LabelType, LabelMapType> 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->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->SetInput(relabel->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->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->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"> Ella</font></p></span></font></span></font></p></div></td></tr></table>