[Insight-users] How to replace all non-background pixels?

Luis Ibanez luis.ibanez at kitware.com
Wed Jun 15 17:46:49 EDT 2005


Hi Wagner,

You probably can do this by using the ConfidenceConnectedImageFilter
and providing a couple of seed points located in the background. This
will segment the background for you. Then you can invert the resulting
binary image in order to get the one that you need.

Instructions on how to use the Confidence Connected image filter are
available in the ITK Software Guide


               http://www.itk.org/ItkSoftwareGuide.pdf

along with descriptions of many other segmentation methods available
in ITK.



    Regards,


       Luis




-----------------------------------------------------------
Wagner Sales wrote:

> Hi Jordan,
> 
> Thank's by you help, but I think that's not solve completely the 
> problem. For example: the black background will not every time 0 value, 
> but 0,1,2.. and another low scalar values.
> That's will complicate this aproach. I think in use some algorithms to 
> make something like:
> 1 - How much are the gradient scalar change in this image?
> 2 - Where are the area with most relevant changes in gray scale values? 
> Of cource, this are will be the image area, not background.
> 3 - Replace this area using the high value of this grayscale. ( 4096 or 
> 255 ).
> 
> I think this approach are better, but I don't know the correct filters 
> and pipeline to make that.
> 
> Regards,
> 
> Wagner
> 
> 
> 2005/6/15, Jordan Soet <jds at interchange.ubc.ca 
> <mailto:jds at interchange.ubc.ca>>:
> 
>     I'm not sure about the correct way to do this, but I think that a pretty
>     simple way would just to be an image iterator and check each pixel to
>     see if it is a 0, and if not to set the value to 255 or 4096. You
>     should
>     look at section 11.3 for a good example that you could modify to make
>     your filter. I think you could just change this section of code:
> 
>     for ( inputIt.GoToBegin(), outputIt.GoToBegin(); !inputIt.IsAtEnd();
>     ++inputIt, ++outputIt)
>     {
>     outputIt.Set( inputIt.Get() );
>     }
> 
>     to something like this:
> 
>     for ( inputIt.GoToBegin(), outputIt.GoToBegin(); !inputIt.IsAtEnd();
>     ++inputIt, ++outputIt)
>     {
>         if( !( inputIt.Get () == 0 ) )
>         {
>            outputIt.Set(255);
>         }
>         else
>         {
>            outputIt.set(0);
>         }
>     }
> 
>     Hope that helps,
>     Jordan
> 
> 
>     Wagner Sales wrote:
> 
>      > Hi all,
>      >
>      > I need to replace every data in that's are NOT background ( black
>      > background ) in a 8 bit or 12 bin grayscale image by the higher
>      > grayscale scalar value ( 255 or 4096). The purpose to do that are to
>      > create an iso-surface of the object.
>      > I was searched in ITK filters, but I'm little confused.
>      > May be my explanation are confused ( :( ) and, because that, I was
>      > atached two images, before and after the desired operation. I was
>     erased
>      > the data manually, by using Gimp, just to show a before/after
>     example.
>      > If someone have an example, tips or steps to do that, tks in a
>     advance.
>      >
>      > Regards
>      >
>      > Wagner
>      >
>      >
>     ------------------------------------------------------------------------
>      >
>      >
>      >
>     ------------------------------------------------------------------------
>      >
>      >------------------------------------------------------------------------
>      >
>      >_______________________________________________
>      >Insight-users mailing list
>      >Insight-users at itk.org <mailto:Insight-users at itk.org>
>      >http://www.itk.org/mailman/listinfo/insight-users
>     <http://www.itk.org/mailman/listinfo/insight-users>
>      >
>      >
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users





More information about the Insight-users mailing list