<html><div style='background-color:'><DIV>
<P>okay so I just realized that by using vtkFloatArray, vtkImageData and vtkImageViewer to view my 2D data, it automatically seems to scale the numbers to gray scale intensity (provided that i set my imageViewer's SetColorWindow( ) to something non-zero).&nbsp; So for the below example, what it would do is:</P>
<P>1 1&nbsp;1 </P>
<P>0 0 0</P>
<P>0.2 0.5 0.7 </P>
<P>it will give darkness in the center, brightness at the top, and gradually go dark to bright on the bottom...</P>
<P>But still, when I try to use the lookuptable to show actual color (instead of black/white/gray), it doesnt work =( </P>
<P>sigh.......!&nbsp; here is part of the code.......</P>
<P>vtkImageViewer *viewer = vtkImageViewer::New();<BR>vtkImageData *imageData = vtkImageData::New();<BR>vtkFloatArray *fltarray = vtkFloatArray::New();<BR>vtkLookupTable *lut=vtkLookupTable::New();</P>
<P>fltarray-&gt;SetNumberOfComponents(80*3); <BR>fltarray-&gt;SetNumberOfTuples(70);&nbsp; </P>
<P>lut-&gt;SetHueRange(0.0, 1.0);<BR>lut-&gt;SetSaturationRange(0.0, 1.0);<BR>lut-&gt;SetValueRange(1.0, 1.0);<BR>lut-&gt;SetRange(0.0,1.0);<BR>lut-&gt;SetAlphaRange(1.0, 1.0);<BR>lut-&gt;SetNumberOfColors(256);</P>
<P>lut-&gt;Build();</P>
<P>fltarray-&gt;SetLookupTable(lut);</P>
<P>imageData-&gt;GetPointData()-&gt;SetScalars(fltarray); <BR>imageData-&gt;SetDimensions(80*3,70,1);&nbsp; <BR>imageData-&gt;SetScalarType(VTK_FLOAT);</P>
<P>viewer-&gt;SetInput(imageData);<BR>viewer-&gt;SetColorWindow(50.0);<BR>viewer-&gt;SetColorLevel(0.0);<BR>viewer-&gt;SetSize(240,100);</P>
<P>&nbsp;viewer-&gt;Render();<BR><BR>shouldnt i see at least some color??&nbsp; and i cant SetScalarRange anywhere because ImageViewer doesnt contain this method... </P>
<P>Or is there another way to represent this 2D data which will wokr better with the lookuptable..? there must be a way..!</P>
<P>thank u vtkusers for your responses....</P>
<P>=)</P></DIV>
<DIV></DIV>&gt;From: Xianjin Yang <YANG@AGIUSA.COM>
<DIV></DIV>&gt;To: "'alan .'" <LOST_BITS1110@HOTMAIL.COM>
<DIV></DIV>&gt;Subject: RE: [vtkusers] lookup table with imageviewer and floatarray (2) 
<DIV></DIV>&gt;Date: Tue, 21 Oct 2003 18:07:59 -0500 
<DIV></DIV>&gt;MIME-Version: 1.0 
<DIV></DIV>&gt;Received: from exchngsvr.agiusa.com ([209.194.230.204]) by mc5-f20.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Tue, 21 Oct 2003 16:12:36 -0700 
<DIV></DIV>&gt;Received: by mail.exchngsvr.agiusa.com with Internet Mail Service (5.5.2653.19)id <VL3B3272>; Tue, 21 Oct 2003 18:08:11 -0500 
<DIV></DIV>&gt;X-Message-Info: JGTYoYF78jF4KkBuPcVLyPfJe4vxU+dS 
<DIV></DIV>&gt;Message-ID: &lt;6AC51773FA304E469DEE9569AF903E5B16882C@mail.exchngsvr.agiusa.com&gt; 
<DIV></DIV>&gt;X-Mailer: Internet Mail Service (5.5.2653.19) 
<DIV></DIV>&gt;Return-Path: Yang@AGIUSA.COM 
<DIV></DIV>&gt;X-OriginalArrivalTime: 21 Oct 2003 23:12:37.0587 (UTC) FILETIME=[D167F230:01C39828] 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;You did not set the scalar range which is critical for color mapping using 
<DIV></DIV>&gt;lookup table. Your points may have the background color of your imageviewer. 
<DIV></DIV>&gt;change the image viewer color from black to white or from white to black to 
<DIV></DIV>&gt;prove it. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Yang 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;-----Original Message----- 
<DIV></DIV>&gt;From: alan . [mailto:lost_bits1110@hotmail.com] 
<DIV></DIV>&gt;Sent: Tuesday, October 21, 2003 6:05 PM 
<DIV></DIV>&gt;To: Yang@AGIUSA.COM 
<DIV></DIV>&gt;Subject: RE: [vtkusers] lookup table with imageviewer and floatarray (2) 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Hi..!! 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Thanks so much for your response, 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Your code makes sense, and thank u for the link.. However in my code, i am using 
<DIV></DIV>&gt;imageViewer - the reason is because I have 2D image data, (a double subscripted 
<DIV></DIV>&gt;array of floats) and I want to map the value of these numbers to a gray scale 
<DIV></DIV>&gt;value (i.e. the higher the number the brighter - the lower the number, the 
<DIV></DIV>&gt;darker) 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;So my code is very very simple, here is part of it below: 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;But the lookup table doesnt seem to have any affect... do u see anything i'm 
<DIV></DIV>&gt;missing? Do u think maybe its not possible with this pipeline i'm using? How 
<DIV></DIV>&gt;else can i display this array of numbers then so that i can use a lookup table?? 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;thanks again!!!!!!!! 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;------------------------------------------------------------------------------- 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;vtkImageViewer *viewer = vtkImageViewer::New(); 
<DIV></DIV>&gt;vtkImageData *imageData = vtkImageData::New(); 
<DIV></DIV>&gt;vtkFloatArray *fltarray = vtkFloatArray::New(); 
<DIV></DIV>&gt;vtkLookupTable *lut=vtkLookupTable::New(); 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;fltarray-&gt;SetNumberOfComponents(80*3); 
<DIV></DIV>&gt;fltarray-&gt;SetNumberOfTuples(70); 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;lut-&gt;SetHueRange(0.0, 0.0); 
<DIV></DIV>&gt;lut-&gt;SetSaturationRange(0.0, 0.0); 
<DIV></DIV>&gt;lut-&gt;SetValueRange(0.0, 1.0); 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;fltarray-&gt;SetLookupTable(lut); 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;imageData-&gt;GetPointData()-&gt;SetScalars(fltarray); 
<DIV></DIV>&gt;imageData-&gt;SetDimensions(80*3,70,1); 
<DIV></DIV>&gt;imageData-&gt;SetScalarType(VTK_FLOAT); 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;imageData-&gt;SetSpacing(1, 1, 1); 
<DIV></DIV>&gt;imageData-&gt;SetOrigin(0.0, 0.0, 0.0); 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;viewer-&gt;SetInput(imageData); 
<DIV></DIV>&gt; viewer-&gt;Render(); 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; &gt;From: Xianjin Yang 
<DIV></DIV>&gt; &gt;To: vtkusers@vtk.org 
<DIV></DIV>&gt; &gt;CC: "'alan .'" 
<DIV></DIV>&gt; &gt;Subject: RE: [vtkusers] lookup table with imageviewer and floatarray (2) 
<DIV></DIV>&gt; &gt;Date: Tue, 21 Oct 2003 17:21:49 -0500 
<DIV></DIV>&gt; &gt;MIME-Version: 1.0 
<DIV></DIV>&gt; &gt;Received: from mc3-f36.hotmail.com ([64.4.50.172]) by mc3-s14.hotmail.com with 
<DIV></DIV>&gt;Microsoft SMTPSVC(5.0.2195.6713); Tue, 21 Oct 2003 15:32:32 -0700 
<DIV></DIV>&gt; &gt;Received: from public.kitware.com ([24.97.130.19]) by mc3-f36.hotmail.com with 
<DIV></DIV>&gt;Microsoft SMTPSVC(5.0.2195.6713); Tue, 21 Oct 2003 15:32:09 -0700 
<DIV></DIV>&gt; &gt;Received: from public.kitware.com (localhost [127.0.0.1])by public.kitware.com 
<DIV></DIV>&gt;(Postfix) with ESMTPid B1F9E1ACA8; Tue, 21 Oct 2003 18:28:05 -0400 (EDT) 
<DIV></DIV>&gt; &gt;Received: from exchngsvr.agiusa.com (unknown [209.194.230.204])by 
<DIV></DIV>&gt;public.kitware.com (Postfix) with ESMTP id 23AD01AAE9for ; Tue, 21 Oct 2003 
<DIV></DIV>&gt;18:27:02 -0400 (EDT) 
<DIV></DIV>&gt; &gt;Received: by mail.exchngsvr.agiusa.com with Internet Mail Service 
<DIV></DIV>&gt;(5.5.2653.19)id ; Tue, 21 Oct 2003 17:22:41 -0500 
<DIV></DIV>&gt; &gt;X-Message-Info: o8IIVuzO8A1vIokZwM2wZaK5XIw4RzjZ2ZKB4CpIVko= 
<DIV></DIV>&gt; &gt;Delivered-To: vtkusers@vtk.org 
<DIV></DIV>&gt; &gt;Message-ID: &lt;6AC51773FA304E469DEE9569AF903E5B16882B@mail.exchngsvr.agiusa.com&gt; 
<DIV></DIV>&gt; &gt;X-Mailer: Internet Mail Service (5.5.2653.19) 
<DIV></DIV>&gt; &gt;Sender: vtkusers-admin@vtk.org 
<DIV></DIV>&gt; &gt;Errors-To: vtkusers-admin@vtk.org 
<DIV></DIV>&gt; &gt;X-BeenThere: vtkusers@vtk.org 
<DIV></DIV>&gt; &gt;X-Mailman-Version: 2.0.11 
<DIV></DIV>&gt; &gt;Precedence: bulk 
<DIV></DIV>&gt; &gt;List-Help: 
<DIV></DIV>&gt; &gt;List-Post: 
<DIV></DIV>&gt; &gt;List-Subscribe: , 
<DIV></DIV>&gt; &gt;List-Id: 
<DIV></DIV>&gt; &gt;List-Unsubscribe: , 
<DIV></DIV>&gt; &gt;List-Archive: 
<DIV></DIV>&gt; &gt;Return-Path: vtkusers-admin@vtk.org 
<DIV></DIV>&gt; &gt;X-OriginalArrivalTime: 21 Oct 2003 22:32:10.0193 (UTC) 
<DIV></DIV>&gt;FILETIME=[2A910410:01C39823] 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;Hi Alan, 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;To become an expert vtkuser, Check out this post 
<DIV></DIV>&gt; &gt;http://public.kitware.com/pipermail/vtkusers/2003-September/020191.html 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;As a beginning vtkuser, I rendered colored points with this kind of pipeline. 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;...... 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; vtkPoints * pts = vtkPoints::New(); 
<DIV></DIV>&gt; &gt; vtkCellArray * ca = vtkCellArray::New(); 
<DIV></DIV>&gt; &gt; vtkPolyData * pd = vtkPolyData::New(); 
<DIV></DIV>&gt; &gt; vtkFloatArray * scalars = vtkFloatArray ::New(); 
<DIV></DIV>&gt; &gt;vtkPolyDataMapper * m = vtkPolyDataMapper::New(); 
<DIV></DIV>&gt; &gt; vtkLookupTable *lut = vtkLookupTable::New(); 
<DIV></DIV>&gt; &gt;vtkRenderer* ren = vtkRenderer::New(); 
<DIV></DIV>&gt; &gt; vtkActor * a = vtkActor::New(); 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; lut-&gt;SetNumberOfColors(N); 
<DIV></DIV>&gt; &gt; lut-&gt;Build(); 
<DIV></DIV>&gt; &gt; for (i=0; iSetTableValue(i, R[i], G[i], B[i], A[i]); 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; for (i=0;i&gt; { 
<DIV></DIV>&gt; &gt; pts-&gt;InsertNextPoint(x[i], y[i], z[i]); 
<DIV></DIV>&gt; &gt; ca-&gt;InsertNextCell(1); 
<DIV></DIV>&gt; &gt; ca-&gt;InsertCellPoint(i); 
<DIV></DIV>&gt; &gt; scalars-&gt;InsertNextTuple1(f[i]); 
<DIV></DIV>&gt; &gt; } 
<DIV></DIV>&gt; &gt; pd-&gt;SetPoints(pts); 
<DIV></DIV>&gt; &gt; pd-&gt;SetVerts(ca); 
<DIV></DIV>&gt; &gt; pd-&gt;GetPointData()-&gt;SetScalars(scalars); 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; m-&gt;SetLookupTable(lut); 
<DIV></DIV>&gt; &gt; m-&gt;SetInput(pd); 
<DIV></DIV>&gt; &gt; m-&gt;SetScalarRange(ScalarMin, ScalarMax); 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; a-&gt;SetMapper(m); 
<DIV></DIV>&gt; &gt; a-&gt;GetProperty()-&gt;SetPointSize(8); 
<DIV></DIV>&gt; &gt; ren-&gt;AddActor(a); 
<DIV></DIV>&gt; &gt;.... 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;HTH 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;Yang 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;-----Original Message----- 
<DIV></DIV>&gt; &gt;From: alan . [mailto:lost_bits1110@hotmail.com] 
<DIV></DIV>&gt; &gt;Sent: Tuesday, October 21, 2003 4:59 PM 
<DIV></DIV>&gt; &gt;To: vtkusers@vtk.org 
<DIV></DIV>&gt; &gt;Subject: [vtkusers] lookup table with imageviewer and floatarray (2) 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;Or if theres another way to execute the pipeline.. 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;At the moment I use vtkFloatArray -&gt; vtkImageData -&gt; vtkImageViewer.. 
<DIV></DIV>&gt; &gt;(and FloatArray sets up the lookup table) 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;but maybe the vtkImageViewer is the problem, so i can create a 
<DIV></DIV>&gt;vtkDataSetMapper, 
<DIV></DIV>&gt; &gt;which takes in the vtkImageData 
<DIV></DIV>&gt; &gt;but then how do I render this..? I dont have any actors - just a bunch of 
<DIV></DIV>&gt;points 
<DIV></DIV>&gt; &gt;(which came from a file of numbers) 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;okay thank u again vtkusers 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;one day i'll be the expert..! 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;-alan. 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt; _____ 
<DIV></DIV>&gt; &gt; 
<DIV></DIV>&gt; &gt;Never get a busy signal because you are 
<DIV></DIV>&gt; &gt;always connected with high-speed Internet access. Click here to comparison-shop 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; &gt;providers. _______________________________________________ This is the private 
<DIV></DIV>&gt; &gt;VTK discussion list. Please keep messages on-topic. Check the FAQ at: Follow 
<DIV></DIV>&gt; &gt;this link to subscribe/unsubscribe: 
<DIV></DIV>&gt;http://www.vtk.org/mailman/listinfo/vtkusers 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; _____ 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Surf and talk on the phone at the <HTTP: 8HMAENUS g.msn.com 2731??PS="">same 
<DIV></DIV>&gt;time with broadband Internet access. Get high-speed for as low as $29.95/month.* 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;*Depending on the local service providers in your area. 
<DIV></DIV></div><br clear=all><hr> <a href="http://g.msn.com/8HMBENUS/2728??PS=">Never get a busy signal because you are always connected  with high-speed Internet access. Click here to comparison-shop providers.</a> </html>