[vtkusers] how to read UNSTRUCTURED_GRID?
Eric E. Monson
emonson at cs.duke.edu
Mon Mar 15 18:14:55 EDT 2010
Hey Jeonggyu,
Both in ParaView (and VTK on which it's based), as you say, the inner points are there, but the mapper just doesn't show them. This isn't something you have to do anything about, the mapper just does it automatically (probably to make the rendering faster for large data sets). Here is the end of a ParaView thread from a couple months ago that talks about this:
http://www.mail-archive.com/paraview@paraview.org/msg06138.html
As the email says, if you _want_ to see all the points, then you can apply a 2d vertex glyph to each point and they'll all be rendered.
So, just put the point coordinates into your file in the correct order and the VTK structured grid reader should be able to read it and render it just like ParaView does.
Talk to you later,
-Eric
On Mar 15, 2010, at 5:34 PM, 이정규 wrote:
> Dear Dr.Eirc E. Monson,
>
> Thank you for the reply. I'll definitely look for the book.
> I have one doubt though, from the result of paraview it seems like paraview does not takes interior polygons into account, such that only outer lines/polygons are rendered. I double checked to see if there are missing points but they are still there, just not being rendered in paraview. Since I'm taking paraview as the standard and the official .vtk viewer, I think I must follow this principle..
>
> --
> Jeonggyu Lee
>
> 2010/3/15 Eric E. Monson <emonson at cs.duke.edu>
> There are two books about VTK:
>
> http://www.vtk.org/VTK/help/book.html
>
> This first one listed there talks about the principles behind the data structures. On page 144, it talks about vtkStructuredGrid. You can also look at the class documentation:
>
> http://www.vtk.org/doc/nightly/html/classvtkStructuredGrid.html
>
> Since the topology is that of a regular grid, if you give the point coordinates in the correct order, thus specifying the "geometry", the connectivity is implied and you don't have to worry about which way you travel around faces, etc.
>
> All of the people on this list are also busy trying to do their own work, so please don't assume that just because you don't get a satisfactory reply right away that the information isn't out there. You need to be patient sometimes.
>
> -Eric
>
>
> On Mar 15, 2010, at 4:46 PM, 이정규 wrote:
>
>> Hi all,
>>
>> First of all, I think this e-mail thread should be corrected to "HOW OT READ STRUCTURED_GRID?" and I apologize for this.
>> Second, I'm surprised that I couldn't find any further information regarding this. I've been thinking of reverse-engineering it from the source code but anyhow I've figured it out.
>> DIMENSIONS gives us information how it should be indexed.
>> It have to be something like
>> {1,0,20,21},{2,1,21,22}..............
>> if we assume it has counter-clockwise orientation and x dimension is 20. And indeed, each face shares two vertices(in the above example, 1 and 21). If we were to triangulate them it won't be that hard because they are just rectangles. If you are someone at Kitware, would you please, please somehow make this kind of information accessible to people? Or if this have been stated some book, would you please tell me which book it is? Or maybe I'm doing unsolicited thing that Kitware merely suggest to use vtkStructuredGridReader but I have my reason for getting to details of every single piece.. Maybe I should consider posting this to VTK wiki..
>>
>> 2010/3/15 이정규 <glazex2 at naver.com>
>> Sorry I've found that there's one more line with directive "DIMENSIONS"
>>
>> # vtk DataFile Version 3.0
>> vtk output
>> ASCII
>> DATASET STRUCTURED_GRID
>> DIMENSIONS 20 30 40
>> POINTS 24000 float
>>
>> .............
>>
>> and obviously, 20*30*40 == 24,000. Given this, how should I arrange those points to get the exact same result as paraview?
>>
>> If I have to do it manually, maybe I should start working with smaller model, but is there really no documentation on this?????(to Kitware : if it's NDA please let me know)
>>
>> On Mon, Mar 15, 2010 at 10:45 AM, 이정규 <glazex2 at naver.com> wrote:
>> Hi David,
>>
>> Thank you for your reply and the suggestion, however the file I'm working on is so-called a legacy VTK file that does not have the newer XML structure. But from the wiki page that you suggested, I found more information.
>>
>> Structured Grid
>>
>> Regular topology and irregular geometry. That is, every point has a left, right, up, down, front, back neighbor. The points, however, do not lie on a grid! You must explicitly indicate the coordinates of each point.
>> This data structure is common in finite difference analysis.
>>
>> This information gives me food for thought, but is not clear enough that which goes which.
>> For example, if I have
>> x1,y2,z3,x2,y2,z3,x3,y3,z3,x4,y4,z4,x5,y5,z5,x6,y6,z6,x7,y7,z7,x8,y8,z8
>> I guess it would be something like
>> (x1,y1,z1),(x2,y2,z2),(x3,y3,z3),(x4,y4,z4)
>> for the first face.. but what about the next face?? If it have to share some points(maybe 2, if it have to) with the first face, what would it be like?
>> Also, if it indeed share some points with its neighboring grids, how many grid should I expect from n points?
>>
>> Truly yours,
>> --
>> Jeonggyu Lee
>>
>> On Mon, Mar 15, 2010 at 10:22 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
>> On Mon, Mar 15, 2010 at 11:19 AM, 이정규 <glazex2 at naver.com> wrote:
>> Hi all,
>>
>> I am trying to parse a .VTK file with UNSTRUCTURED_GRID but this just have data of points.
>> I've looked for more information for this but all I found is
>>
>> The Visualization Toolkit supports five different dataset formats: structured points, structured grid, rectilinear
>> grid, unstructured grid, and polygonal data. Data with implicit topology (structured data such as vtkImageData and
>> vtkStructuredGrid) are ordered with x increasing fastest, then y, then z. These formats are as follows.
>>
>> So I guess somehow I have to infer the topology from these points. I've tried Paraview and it renders it as a set of rectangles(I've tired to render surface with wireframes and so on)..
>> I see some hint there that points are ordered with x-ascending order, but how the index is consists up is not mentioned in any documents.....
>> Anybody done this before? or have more information for this?
>>
>> PS : If you are someone at Kitware, would you please, please direct me to the right information?????
>>
>> --
>> Jeonggyu Lee
>>
>> Do you have an existing .vtk file that you need to read? If not, I would suggest using the XML .vtu format - then you can use:
>>
>> http://www.vtk.org/Wiki/VTK/Examples/IO/ReadUnstructuredGrid
>>
>> Thanks,
>>
>> David
>>
>>
>>
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100315/c5286549/attachment.htm>
More information about the vtkusers
mailing list