[vtkusers] existing filter to perform replace value on vtkImage

David Doria daviddoria+vtk at gmail.com
Tue Feb 16 14:47:35 EST 2010


On Tue, Feb 16, 2010 at 1:59 PM, Michael Jackson
<mike.jackson at bluequartz.net> wrote:
> Is there an existing filter where I can replace a value in the image if the
> value does not meet some criteria? Something like:
>
> if (value < 255 ) value = 0;
>
> Thanks
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net

Two things come to mind -

1) You can identify those regions with vtkImageThreshold:
http://www.vtk.org/Wiki/VTK/Examples/Images/ImageThreshold
http://www.vtk.org/doc/nightly/html/classvtkImageThreshold.html

2) Maybe you can set all the pixels found in (1) to some specific
value, and then you can use
vtkImageMathematics::SetOperationToReplaceCByK to replace that
specific value with 0 (as your original question suggested you want to
do).

Hope that helps,

David



More information about the vtkusers mailing list