[vtkusers] Cell ID (and vtkCellData)

Michal Szostakiewicz creed at icm.edu.pl
Tue Apr 9 06:54:26 EDT 2013


Thanks for the answer, I'll try to make myself clear this time.
(by the way I think I figured out one of the answers but I want to double
check)

Maybe it's best to illustrate my questions with a samples of code.
So what I do:

1. load some VTK file with vtkGenericDataObjectReader. Let's suppose I get
a vtkUnstructuredGrid* pGrid with that.
2. in this pGrid I call GetCellData() and that's where I get vtkCellData
(lets call it pCellData) from.
3. now there comes a tricky part. I use GetComponent() method to access
the data, so I would call it like this:
pCellData->GetArray(nArray)->GetComponent(nTuple, nComponent)

Piece of cake, but the problem is: what should be passed as a nTuple?
I believe it's the index of the cell, the same which is passed to:
pGrid->GetCell(nTuple)

Am I right?

And another question is: what is the proper way to access data from
vtkDataArray? GetComponent() works just fine, but it always converts to
double and I believe there should be some faster (and "native") method.


BTW is it just me, or did some pictures in the documentation broke?
(eg. http://www.vtk.org/doc/nightly/html/classvtkCellData.html)

Best regards,
Michał

> As for me there is no enough details to provide you with helpful advice.
> I am not sure I can follow what you said either.
> If you want just to be able to read some of the vtk file formats, start
> with file format (extension) you want to read.
> Google vtk file format. For example some details on forma can be found at:
> http://www.cacr.caltech.edu/~slombey/asci/vtk/vtk_formats.simple.html
>
>
> But in this case why would you ask questions about vtkCellData or other
> VTK
> classes?
> If you are going to use vtk classes give details on the dataset you are
> trying to work with.
>
> Regards,
>     Alex
>
>
>
>
>
> On Mon, Apr 8, 2013 at 10:30 AM, Michal Szostakiewicz
> <creed at icm.edu.pl>wrote:
>
>> Dear all!
>>
>> I'm not really a VTK user, but I just want to load a VTK file into my
>> software. I have a problem with reading cell data. As I couldn't find a
>> documentation on that, I thought it would be good idea to ask here, but
>> if
>> the answer to my question is written somewhere, please just give me the
>> link.
>>
>> If I understand correctly, the cell data is described in vtkCellData
>> class, which is collection of vtkDataArray-s. I currently access this
>> data
>> array with GetComponent method (I believe there is a better way, but I
>> don't know it) but for that I need to specify the cell's ID or the
>> cell's
>> index in the tuple.
>>
>> Is this the same ID I give in vtkPointSet's GetCell(int id) method?
>>
>> Because it sometimes works well, but other times produces some strange
>> results... And vtkCell does not have any GetID() method (and it looks
>> like
>> GetVTKid() is not the one I'm looking for)
>>
>>
>> Best regards,
>> Michał
>>
>> _______________________________________________
>> 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