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

Wagner Sales wsales at gmail.com
Wed Jun 15 14:45:29 EDT 2005


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>:
> 
> 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
> >http://www.itk.org/mailman/listinfo/insight-users
> >
> >
> 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20050615/107686b9/attachment.html


More information about the Insight-users mailing list