[vtkusers] lookup table with imageviewer and floatarray (2)

Xianjin Yang Yang at AGIUSA.COM
Tue Oct 21 18:21:49 EDT 2003


Hi Alan,
 
To become an expert vtkuser, Check out this post
http://public.kitware.com/pipermail/vtkusers/2003-September/020191.html
<http://public.kitware.com/pipermail/vtkusers/2003-September/020191.html> 
 
As a beginning vtkuser, I rendered colored points with this kind of pipeline.
 
......

  vtkPoints * pts = vtkPoints::New();
  vtkCellArray * ca = vtkCellArray::New();
  vtkPolyData * pd = vtkPolyData::New();
  vtkFloatArray * scalars = vtkFloatArray ::New();
vtkPolyDataMapper * m = vtkPolyDataMapper::New();
 vtkLookupTable *lut = vtkLookupTable::New();
vtkRenderer* ren = vtkRenderer::New();
  vtkActor  * a = vtkActor::New();

    lut->SetNumberOfColors(N);
    lut->Build();
    for (i=0; i<N; ++i)  lut->SetTableValue(i, R[i], G[i], B[i], A[i]);


  for (i=0;i<n;i++)
  {
      pts->InsertNextPoint(x[i], y[i], z[i]);
      ca->InsertNextCell(1);
      ca->InsertCellPoint(i);
      scalars->InsertNextTuple1(f[i]);
  }
  pd->SetPoints(pts);
  pd->SetVerts(ca);
  pd->GetPointData()->SetScalars(scalars);

   m->SetLookupTable(lut);
  m->SetInput(pd);
  m->SetScalarRange(ScalarMin, ScalarMax);

    a->SetMapper(m);
  a->GetProperty()->SetPointSize(8);
  ren->AddActor(a);
....

HTH
 
Yang
 
 
 
-----Original Message-----
From: alan . [mailto:lost_bits1110 at hotmail.com] 
Sent: Tuesday, October 21, 2003 4:59 PM
To: vtkusers at vtk.org
Subject: [vtkusers] lookup table with imageviewer and floatarray (2)


Or if theres another way to execute the pipeline..
 
At the moment I use vtkFloatArray ->  vtkImageData -> vtkImageViewer..
(and FloatArray sets up the lookup table)
 
but maybe the vtkImageViewer is the problem, so i can create a vtkDataSetMapper,
which takes in the vtkImageData
but then how do I render this..? I dont have any actors - just a bunch of points
(which came from a file of numbers)
 
okay thank u again vtkusers
 
one day i'll be the expert..!
 
-alan.

  _____  

Never get a busy signal because  <http://g.msn.com/8HMAENUS/2728??PS=> you are
always connected with high-speed Internet access. Click here to comparison-shop
providers. _______________________________________________ This is the private
VTK discussion list. Please keep messages on-topic. Check the FAQ at: Follow
this link to subscribe/unsubscribe: http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031021/a10fd832/attachment.htm>


More information about the vtkusers mailing list