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