[Insight-users] How to create a LabelImage from RelabelComponentImageFilter

Ella Maria Kadas ella_kadas at yahoo.com
Mon Mar 28 15:54:23 EDT 2011


Hi Brad,

   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.
Cheers,
  Ella
--- Bradley Lowekamp <blowekamp at mail.nih.gov> schrieb am Mo, 28.3.2011:

Von: Bradley Lowekamp <blowekamp at mail.nih.gov>
Betreff: Re: [Insight-users] How to create a LabelImage from RelabelComponentImageFilter
An: "Ella Maria Kadas" <ella_kadas at yahoo.com>
CC: "insight-users at itk.org" <insight-users at itk.org>
Datum: Montag, 28. März, 2011 17:20 Uhr

Hello Ella,
After a quick read, I suggest the following:
typedef itk::LabelImageToLabelMapFilter< LabelImageType, LableMapType> I2Type;
hope this helps,Brad
On Mar 28, 2011, at 10:08 AM, Ella Maria Kadas wrote:


Hi all,
  I am trying to use compute some morphological operations on a binary image. i first used BinaryThresholdImageFilter, then got the connected components with ConnectedComponentImageFilter, and then relabeled them with RelabelComponentImageFilter     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.    I just want somehow to use the output from the RelabeloComponentImageFilter to create a LabelMapFilter.

       Part of the code is:

typedef unsigned long LabelPixelType;typedef itk::Image< LabelPixelType, Dimension > LabelImageType;typedef itk::ConnectedComponentImageFilter <OutputType, LabelImageType > ConnectedComponentImageFilterType;		ConnectedComponentImageFilterType::Pointer labelFilter	= ConnectedComponentImageFilterType::New ();		labelFilter->SetInput(filter->GetOutput());		labelFilter->Update();		
	typedef itk::RelabelComponentImageFilter<LabelImageType,LabelImageType>		RelabelImageFilter;		RelabelImageFilter::Pointer relabel = RelabelImageFilter::New();		relabel->SetInput(labelFilter->GetOutput());		relabel->Update();		typedef unsigned long LabelType;		typedef itk::AttributeLabelObject<unsigned long, Dimension, double> LabelObjectType;		typedef itk::LabelMap<LabelObjectType> LabelMapType;		
		
		typedef itk::LabelImageToLabelMapFilter<LabelType, LabelMapType> I2LType;		I2LType::Pointer i2l = I2LType::New();//!!!!! This is the part where i can't figure out the proper input, because using relabel->GetOutput() is defenetely wrong		i2l->SetInput(relabel->GetOutput());		i2l->SetBackgroundValue(0);		i2l->Update();

Thanks in advance,   Ella
<ATT00001..txt>



========================================================Bradley Lowekamp  Lockheed Martin Contractor forOffice of High Performance Computing and CommunicationsNational Library of Medicine blowekamp at mail.nih.gov



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110328/54b553e4/attachment.htm>


More information about the Insight-users mailing list