[vtkusers] Re: vtkusers digest, Vol 1 #1946 - 10 msgs

Michael S. Vaz gte631d at mail.gatech.edu
Thu Jul 10 14:19:32 EDT 2003


Hi,
I think the following should work (example code in python - '#' denotes
comments)

colormap = vtkLookupTable)_
colormap.SetSaturationRange(0,0)
colormap.SetHueRange(0,0) # this will build a grayscale colormap.
colormap.SetValueRange(0,1)
colormap.SetTableRange(8,56) #this will set gray levels between 8 and 56
			     # every scalar below 8 will show as black
			     # and every scalar above 56 will show as
			     # white
colormap.Build()

## This is the part I am totally extrapolating on

Now let's say that you wanted pixels with scalar value 44 to be RED
colormap.SetTableValue(44,1,0,0,1) #(index,R,G,B,?)-> so set R = 1
colormap.Update()

Hope this atleast gives you some ideas.

Later,
Sarju

Michael S. Vaz
324607 Georgia Tech Station
Atlanta Georgia, 30332
Internet: gte631d at prism.gatech.edu
SMS 	: sarju at voicestream.net



> Message: 6
> From: oliveira at alumni.deec.uc.pt
> Date: Thu, 10 Jul 2003 17:09:06 +0100 (WEST)
> To: <vtkusers at vtk.org>
> Subject: [vtkusers] Color over Grayscale Image?
>
> 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