[Insight-users] using NeighborhoodConnectedImageFilter

Ravinder Singh rschauhan18 at yahoo.com
Tue Oct 10 16:05:44 EDT 2006


Hi,
   
  I am trying to remove the background of the 3D volume using NeighborhoodConnectedImageFilter. Here is what I am doing.
   
  I read the series of files by using ImageSeriesReader and write the files using Imageserieswirter. In between these, I am rescaling, binary thresholding and inverting the images. then I tried to use neighborhoodConnectedImage filter as follows:
   
   
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   
  typedef signed short InputPixelType;
  const unsigned int Dimension = 3;
  typedef itk::Image< InputPixelType, Dimension > ImageType;
   
  typedef itk::NeighborhoodConnectedImageFilter< ImageType, ImageType > ConnectedFilterType;
  ConnectedFilterType::Pointer neighborhoodConnected = ConnectedFilterType::New();
  
  neighborhoodConnected->SetInput( *inputImage ); 
  neighborhoodConnected->SetLower( 255 ); /*since the image is binary, I want to extract the white part */
  neighborhoodConnected->SetUpper( 255 ); 
  ImageType::SizeType radius; 
  
  radius[0] = 2; // two pixels along X 
  radius[1] = 2; // two pixels along Y 
  radius[2] = 0; 
   
  neighborhoodConnected->SetRadius( radius ); 
  ImageType::IndexType index;
  
  index[0] = value[0];
  index[1] = value[1];
  index[2] = value[2];  
   
  neighborhoodConnected->SetSeed( index ); 
  neighborhoodConnected->SetReplaceValue( 0 ); 
  neighborhoodConnected->Update(); 
  (*outputImage) = neighborhoodConnected->GetOutput(); 
  /////////////////////////////////////////////////////////////////////////////////////////////////////////////
   
  This piece of code is not working. Any suggestions.
  Thanks a lot.
  Ravi

 		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20061010/64c27db0/attachment.html


More information about the Insight-users mailing list