[vtkusers] Uniform Grid with Vectors and Scalars
David E DeMarle
dave.demarle at kitware.com
Thu Dec 1 10:16:44 EST 2011
SetScalarComponentFromDouble internally calls GetArrayPointer(data
array, int coordinate) to do the 3d (ijk) to 1d (tuple) coordinate
lookup. You can use it too.
David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909
On Thu, Dec 1, 2011 at 10:01 AM, Dan Barker <djb_ro at hotmail.co.uk> wrote:
> Hi David,
>
> I think I understand how to set up the vtkPointData so it is associated with
> the vtkDoubleArrays I need. However I'm slightly confused as to what the
> equivalent of
>
> vtkImageData::SetScalarComponentFromDouble(int x,int y,int z,int
> component,double val)
>
> would be. I could insert the values into the vtkDoubleArrays linearly but
> how do I ensure they match the correct vtkImageData index?
>
> Thanks,
> Dan
>
>> From: dave.demarle at kitware.com
>> Date: Thu, 1 Dec 2011 08:56:59 -0500
>> Subject: Re: [vtkusers] Uniform Grid with Vectors and Scalars
>> To: djb_ro at hotmail.co.uk
>> CC: vtkusers at vtk.org
>
>>
>> Call myImageData->Get[Point/Cell]Data() to get a hold of the container
>> (vtkDataSetAttributes) for the point/cell associated arrays. The
>> container can hold any number of arrays and they can have any number
>> of components. Each array (vtkAbstractArray) has a SetName(const char
>> *) and GetName method too.
>> The API for vtkImageData that exposes only one scalar array is a
>> legacy from the days before that container existed. It works simply by
>> finding the one array in the container that has been marked as the
>> "active" scalars.
>>
>>
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 21 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-881-4909
>>
>>
>>
>> On Thu, Dec 1, 2011 at 6:41 AM, Dan Barker <djb_ro at hotmail.co.uk> wrote:
>> > Dear all,
>> >
>> > I have several fields, some of which are vector quantities and others
>> > scalar, that I wish to store at points on a regular grid, i.e. cubic
>> > lattice.
>> >
>> > I have some code working using the 'vtkImageData' class. This is okay
>> > except
>> > it can only seem to store scalars (unless I'm missing something) and
>> > further
>> > I can't see a way to label the scalar components of the vtkImageData
>> > with
>> > meaningful names.
>> >
>> > So my question is: What class is best used to store mixed scalar/vector
>> > quantities on a regular grid?
>> >
>> > Kind regards,
>> > Dan
>> >
>> > _______________________________________________
>> > 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