[vtkusers] Inverse image

David Lee Lambert as4109 at wayne.edu
Sat Dec 31 12:23:52 EST 2005


On Thursday 29 December 2005 12:41 pm, Ravi Samala wrote:

> Can anyone please let me know if there is a method that can inverse an
> image, i.e., given an image of pixel range (0-255), I want the image with
> pixel of value 255 to be changed to 0 and 0 to be changed to 255 and
> similarly for the rest of the pixels.

You don't say what class you're using to hold the image;  is it a subclass of 
vtkImageData?  or something else?

My guess is that the class vtkImageMapToColors will do what you're asking for,  
but there might be other ways as well;  for instance,  if you're creating the 
image from a C array data[],  just write

  for (int i=0; i<data_len; i++)
    data[i] = 255-data[i];

-- 
PGP key posted on website ... http://www.lmert.com/people/davidl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051231/cbecc7b5/attachment.pgp>


More information about the vtkusers mailing list