<div>Hi,</div> <div> </div> <div>I am trying to remove the background of the 3D volume using NeighborhoodConnectedImageFilter. Here is what I am doing.</div> <div> </div> <div>I read the series of files by using <FONT size=2>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:</FONT></div> <div><FONT size=2></FONT> </div> <div><FONT size=2></FONT> </div> <div><FONT size=2>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT></div> <div> </div><FONT color=#0000ff size=2> <div>typedef</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>signed</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>short</FONT><FONT size=2> InputPixelType;</div></FONT><FONT color=#0000ff size=2> <div>const</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> Dimension = 3;</div></FONT><FONT color=#0000ff size=2> <div>typedef</FONT><FONT size=2> itk::Image< InputPixelType, Dimension > ImageType;</div></FONT><FONT size=2><FONT color=#0000ff size=2> <div> </div> <div>typedef</FONT><FONT size=2> itk::NeighborhoodConnectedImageFilter< ImageType, ImageType > ConnectedFilterType;</div> <div>ConnectedFilterType::Pointer neighborhoodConnected = ConnectedFilterType::New();</div> <div></div> <div>neighborhoodConnected->SetInput( *inputImage ); </div> <div>neighborhoodConnected->SetLower( 255 ); /*since the image is binary, I want to extract the white part */</div> <div>neighborhoodConnected->SetUpper( 255 ); </div> <div>ImageType::SizeType radius; </div> <div></div> <div>radius[0] = 2; </FONT><FONT color=#008000 size=2>// two pixels along X </div></FONT><FONT size=2> <div>radius[1] = 2;
</FONT><FONT color=#008000 size=2>// two pixels along Y </div></FONT><FONT size=2> <div>radius[2] = 0; </div> <div> </div> <div>neighborhoodConnected->SetRadius( radius ); </div> <div>ImageType::IndexType index;</div> <div></div> <div>index[0] = value[0];</div> <div>index[1] = value[1];</div> <div>index[2] = value[2]; </div> <div></FONT><FONT color=#008000 size=2> </div></FONT><FONT size=2> <div>neighborhoodConnected->SetSeed( index ); </div> <div>neighborhoodConnected->SetReplaceValue( 0 ); </div> <div>neighborhoodConnected->Update(); </div> <div>(*outputImage) = neighborhoodConnected->GetOutput(); </div> <div></FONT><FONT size=2>/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT></div> <div> </div> <div>This piece of code is not working. Any suggestions.</div> <div>Thanks a lot.</div> <div>Ravi</FONT></div><p> 
                <hr size=1>How low will we go? Check out Yahoo! Messenger’s low <a href="http://us.rd.yahoo.com/mail_us/taglines/postman8/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com"> PC-to-Phone call rates.