[Insight-users] using NeighborhoodConnectedImageFilter

Xabier Artaechevarria Artieda xabiarta at unav.es
Thu Oct 12 04:18:11 EDT 2006


Hi Ravi,
The neighborhood connected filter does not have such possibility. But  
it should be easy to implement a filter which changes all 0 values to  
any other, using an iterator, checking the value of each pixel and  
setting it to a different value if it is zero.
Good luck,
Xabi



Ravinder Singh <rschauhan18 at yahoo.com> ha escrito:

> Hi Xabi,
>   Thanks for the reply.
>   My understanding is the 0 is for 0 slice as the slice number   
> starts from 0. Well I got its solved, I am a fool....was giving   
> wrong seed point.
>
>   I have one more question:
>   In neighborhoodConnectedThresholdFilter, It fills the region which  
>  is outside the two threshold values with zero pixels by default. Is  
>  there a way to change this to a value specified by user, similar to  
>  the value specified for the region included within two threshold   
> values.
>
>   Regards
>   Ravi
>
> Xabier Artaechevarria Artieda <xabiarta at unav.es> wrote:
>   Hi Ravi,
> you are setting the radius to (2,2,0). Should not it be (2,2,1)?
> I hope that this helps.
> Regards,
> Xabi
>
> --
> Xabier Artaechevarria
> Cancer Imaging Laboratory
> Centre for Applied Medical Research
> www.cima.es
>
>
>
> Ravinder Singh ha escrito:
>
>> 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.
>
>
>
> ----------------------------------------------------------------
> Este mensaje ha sido enviado desde https://webmail.unav.es
>
>
>
>
> ---------------------------------
> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.    
> Great rates starting at 1¢/min.



----------------------------------------------------------------
Este mensaje ha sido enviado desde https://webmail.unav.es



More information about the Insight-users mailing list