[vtkusers] Color over Grayscale Image?

oliveira at alumni.deec.uc.pt oliveira at alumni.deec.uc.pt
Thu Jul 10 12:09:06 EDT 2003


Hi,

I'm using vtkImageReader to read some data and vtkImageViewer2 to display
the image (grayscaleimage).
The problem is that the image is in grayscale (as I want) but I also want
to put some pixels in color (pixels above some threshold value), is there
any way to do this? Or there is any method to do this that I forgot ?
A possible way to do this is to use a mapper, but vtkimageviewer2 doesn't
have a link to mapper, or I didn't found that. I have used a mapper with
lookuptable but this only gives a color image, i want gray image with some
pixels in red...

thanks

Next I show a part of my code, and this show my image as grayscale.

vtkImageReader *imagedata = vtkImageReader::New();
imagedata->SetFileName(leitura);
imagedata->SetDataOrigin(0,0,0);
imagedata->SetFileDimensionality(2);
imagedata->SetDataExtent(0,255,0,255,0,0);
imagedata->SetDataScalarTypeToUnsignedChar();
imagedata->Update();

vtkImageViewer2 *viewer=vtkImageViewer2::New();
viewer->SetInput(imagedata->GetOutput() );
viewer->SetColorLevel(70);
viewer->SetColorWindow(250);
viewer->Render();

vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(viewer->GetRenderWindow());
iren->Initialize();
iren->Start();








More information about the vtkusers mailing list