[vtkusers] Convert vtkPointSet to vtkImageData using the scalar associated to each point as the intensity for each voxel

Liam Kurmos quantum.leaf at gmail.com
Wed Apr 27 12:13:37 EDT 2011


i set the image scalars like this:

for (int k = 0; k < oc->zDim; k++) {
        for (int j = 0; j < oc->yDim; j++) {
            for (int i = 0; i < oc->xDim; i++) {
                float val=getVoxelValue(i,j,k,step);//gets the value
                vtkVol->SetScalarComponentFromFloat(i, j, k, 0, val);
//0 is the scalar field index, just use 0 if only one field
            }
        }
    }

though ive just seen in the documentation it says that
SetScalarComponentFromFloat is 'For access to data from tcl '
so quite probably there is another way that is prefered. (maybe
through getpointdata() )

Liam


On Wed, Apr 27, 2011 at 3:14 PM, Federico Milano <fmilano at gmail.com> wrote:
> Yes, the points are arranged in a regular way forming an uniform grid. So I
> should try to convert it directly to a vtkImageData? Do you have a code
> fragment to do this?
>
> On Wed, Apr 27, 2011 at 10:57 AM, Liam Kurmos <quantum.leaf at gmail.com>
> wrote:
>>
>> Are your points already arranged in a regular array?
>>
>> vtkImageData usually uses the scalar values at the points anyway and
>> the cell value is commonly not used (this is the understanding i came
>> to anyway).
>>
>> Liam
>>
>>
>> On Tue, Apr 26, 2011 at 9:33 PM, Federico Milano <fmilano at gmail.com>
>> wrote:
>> > Hi,
>> >
>> > I would like to convert vtkPointSet to vtkImageData using the scalar
>> > associated to each point as the intensity for each voxel, that is
>> > keeping
>> > the scalar value associated with the correct voxel in the vtkImageData.
>> >
>> >
>> > Thanks in advance,
>> >
>> > Federico
>> >
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the VTK FAQ at:
>> > http://www.vtk.org/Wiki/VTK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.vtk.org/mailman/listinfo/vtkusers
>> >
>> >
>
>



More information about the vtkusers mailing list