[vtkusers] Inverting image data

Steve Boyd skboyd at ucalgary.ca
Thu Jun 5 13:37:30 EDT 2003


Hi,

Is there a filter that will invert vtkImageData so that low values
become high, and vice-versa?  I couldn't find one.  I suppose I could do
the following for my VTK_CHAR data, but would rather use a filter if
it's available:

    // Flip the image values
    char *pData = (char *)imageFilter->GetOutput()->GetScalarPointer();
    for (i=0; i<imageFilter->GetOutput()->GetNumberOfPoints(); i++)
      pData[i] = -1-pData[i];

Thanks,

Steve

-- 
Steven Boyd, PhD

Assistant Professor
Department of Mechanical and Manufacturing Engineering
University of Calgary
2500 University Drive, N.W.
Calgary, Alberta, Canada, T2N 1N4

tel. 1.403.220.4173  fax. 1.403.282.8406  skboyd at ucalgary.ca
-------------------------------------------------------------------



More information about the vtkusers mailing list