<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.32.2">
</HEAD>
<BODY>
I see that vtkImageData class permits to set the scalar component using the SetScalarComponentFrom* methods. Those methods require position (as integers values) of the voxel for which i want to set the scalar value (and id of scalar component too). <BR>
Does anybody know if it is possible to set the scalar component using only the point id?<BR>
<BR>
I mean:<BR>
<BR>
i have my vtkImageData 'image' and i want to set as scalar component a random number for every voxel, i was wondering if i could write code like that:<BR>
<BR>
scalar_component_id = 0<BR>
for point_id in range(image.GetNumberOfPoints()):<BR>
        image.SetScalarComponentFromFloat(point_id, scalar_component_id, randn())<BR>
<BR>
<BR>
This problem has occuoured trying to write a function for converting an UnstructuredGrid to vtkImage.<BR>
<BR>
<BR>
A function of this type would, for every point/voxel in the image:<BR>
- take the voxel position using xyz = image.GetPoint(point_id)<BR>
- determinate the nearest neighbor for those coordinates in another DataSet (the vtkUnstructuredGrid)<BR>
- and then populate the ScalarComponent of the image with the value of an array of the unstructured grid, taking the nearest neighbor point.<BR>
<BR>
the problem is that when i have the value which i want to use as scalar component i dont know how to set it into my image, using only the point ID.<BR>
Is there a way to get the voxel coordinates (as image's coordinates - integers -)?
</BODY>
</HTML>