[vtkusers] color mapping

John Platt jcplatt at lineone.net
Wed Mar 24 17:17:05 EST 2004


Philippe,

Are you sure that the visualization pipeline has executed before you try
to extract the elevation. You can force an update using

colorIt->Update();

Your code works OK in the MFC sample vtkSDI/vtkSDIView.cpp

	...
  	this->sphereMapper->SetScalarRange(-1,1);

	// Insert.start
   	this->sphereMapper->Update();
   	float dist0 = sphereMapper->GetInput()->GetPointData()-
>GetScalars("Elevation")->GetTuple1(0);
	// Insert.end

  	// Link the actor


John.

-----Original Message-----
From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] On Behalf
Of Philippe Pouletaut
Sent: 24 March 2004 14:09
To: vtkusers at vtk.org
Subject: [vtkusers] color mapping



Hi all,

I'm using vtk4.2 in c++ on Windows for color mapping.
I actually use the ElevationFilter and would like to copy the output of 
distance map into a float array.

The distance data are stored in a DataSet object called colorIt, 
with the scalars name "Elevation".
The method colorIt->GetInput()->GetPointData()->GetScalars() 
returns a DataArray object.

If I write:
	float dist0;
	dist0 =
colorIt->GetInput()->GetPointData()->GetScalars("Elevation")->GetTuple1(
0);
I get memory problem.

How does I read the scalars "Elevation" ?

Many thanks for your help,

Philippe

_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list