[vtkusers] Map double scalar values to grayscale

Dominik Szczerba domi at vision.ee.ethz.ch
Wed Apr 12 11:38:56 EDT 2006


try this:

	 double range[2];
    input->GetCellData()->GetScalars(vname.c_str())->GetRange(range);
 	 double scaleFactor = 256.0/(range[1] - range[0]);
 	 inputMapper->SetScalarRange(range);

Dominik

Michnay Balázs wrote:
> Dear VTK Users,
> 
> I have a vtkDoubleArray which holds scalar data of an image. These 
> values can be even negative.
> I need to visualize this image so I need to map these values ranging 
> from  x-y (x can be negative...) to 0-255.
> So the final image should be a 8-bit grayscale image.
> I tried to look at previous threads but I found no solution to this. I tried 
> vtkLookupTable but I could not find out how to use it to achieve this (it 
> may not even be able to perform such thing...).
> 
> Any help would be greatly appreciated.
> 
> Thanks  lot,
> 
> MB.
> 
> _______________________________________________________________________
> Rövid és hosszú távú befektetések interneten keresztül! Számlavezetési díj már 125 Ft-tól!
> www.klikkbank.hu
> 
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-- 
Dominik Szczerba, Dr.
ETZ C110 CO-ME/BIWI CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi



More information about the vtkusers mailing list