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

Bradley Lowekamp blowekamp at mail.nih.gov
Mon Mar 28 10:20:30 EDT 2011


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 for
Office of High Performance Computing and Communications
National 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/68828488/attachment.htm>


More information about the Insight-users mailing list