[Paraview] Bonds representation

Eric E. Monson emonson at cs.duke.edu
Thu Nov 18 09:31:43 EST 2010


Hey Jean-François,

Well, since you want to apply the Tube filter, you may want to define your data as POLYDATA instead of unstructured grid (since you have to turn the data into vtkPolyData to apply the Tube filter, anyway). Then, since the radius of the tube filter is based on point data rather than cell data, you'll have to run Cell Data to Point Data in ParaView at some point, but with the way your data is defined now you share points at the intersections of the line segments, and so the point data will end up as the average value of each of the neighboring cells. (Just run it on your data file and you'll see in the Inspector tab that all values are 15.) You can solve this by running the Shrink filter first with a Shrink Factor of 1.0 and it will duplicate the end points for you. (This will also create an Unstructured Grid out of your polydata, though.) So, you might want to just define the duplicate end points in your data file. With this you can just load it in, run cell data to point data, and then apply tubes. Of course, you can also just define point data in your data file, where you duplicate the cell data for each of the line segment end points instead of doing this with ParaView.

With separate cells you'll always get disconnected tubes (instead of one continuous tube with "nice" joined corners around the square, in this case) -- I don't think you can avoid this with the way you need to define your data on the edges.

Mainly it comes down to choices between how much you want to do with ParaView filters, and how much you want to pre-process and just store in your data file instead. I'll attach an alternate vtk file which does the extreme example of putting everything in the data file so all you have to do is load it in and apply the Tube filter. (But again, if you want to store minimal information in you data file, you can just use your original data file and apply the pipeline: file.vtk->Shrink->CellDatatoPointData->ExtractSurface->Tube.)

Hope this helps,
-Eric

-------------- next part --------------
A non-text attachment was scrubbed...
Name: file2.vtk
Type: application/octet-stream
Size: 486 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20101118/794a2634/attachment.obj>
-------------- next part --------------


On Nov 17, 2010, at 3:50 PM, Jerier Jean-François wrote:

> 
> Hello Eric,
> 
>   Thank you for your quick reply (very nice picture !!!), this is a good news for me and people who work on granular media. 
> However I saw the filter tube in Paraview, but I am a beginner and I don't know to write a correct data file to display this element.
> 
> I wrote a little file (see attached file) where I have the point positions (XYZ), the segments (2 Pt_i Pt_j) and the value of radius.
> How can I modifiy this file to see the tube instead of four segments
> 
> Please, can you help me once again ?
> 
> Many thanks
> JF
> 
> 
> ________________________________________
> From: Eric E. Monson [emonson at cs.duke.edu]
> Sent: Wednesday, November 17, 2010 8:09 PM
> To: Jerier Jean-François
> Cc: paraview at paraview.org
> Subject: Re: [Paraview] Bonds representation
> 
> Hey Jean-François,
> 
> You should be able to do it, but you'll have to have the right elements in your data to work with. (I'll attach a screen shot that I think is the type of thing you're referring to. You can see the pipeline I used to create it, too, where the Curvature filter is just used to generate some scalars for my cone.)
> 
> If you only have the points themselves, then it may be difficult to generate the correct lines between them. If you also have the lines between them as part of the geometry you're loading into ParaView, then you can use the Tube filter to represent those bonds with size and color proportional to the values _at the end points that define the lines_. I haven't used the Tube filter very much, but it looks like e.g. if you have two points which define a polydata line, it ignores "cell data", which would be defined on the line itself connecting the points, but it can use the "point data", which would be an attribute defined on the two points at the ends of the lines... (If you only have scalar attributes defined on the lines, you can always run the data through Cell Data to Point Data filter before creating the tubes.)
> 
> So, it may take a little playing around, but it should be quite possible. Just make sure you specify your data in a way that defines the connections between points, as well as the points themselves.
> 
> Good luck,
> -Eric
> 
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
> 
> 
> <file.vtk>_______________________________________________
> 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView
> 
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview



More information about the ParaView mailing list