<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Geneva;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
tt
        {font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor=white lang=EN-US link=blue vlink=blue id=compText>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>David,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I just ran into a problem with your
approach that I’m hoping you can help me with. Each of the spheres needs to
have a different color assigned to it. If I add each vtkSphereSource to a vtkAppendPolyData
object, is there any way I maintain the association between each sphere and its
assigned color? The only way I know of to do that is with vtkActor::GetProperty()::SetColor(…)
and with the vtkAppendPolyData approach, the whole vtkAppendPolyData object is associated
with a single actor, which means it gets just one color assignment. Is that correct?
If so, can you suggest a workaround? I can still display all the spheres individually
with their colors, I think,, but I can’t figure out how to keep the color associations
in the 2D slice. Thanks.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>-Steve<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=3 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Steve Chall
[mailto:steve.chall@earthlink.net] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, October 08, 2007
12:12 AM<br>
<b><span style='font-weight:bold'>To:</span></b> David.Pont@ensisjv.com; Steve
Chall<br>
<b><span style='font-weight:bold'>Cc:</span></b> 'Theresa-Marie Rhyne'; <st1:PersonName
w:st="on">vtkusers@vtk.org</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [vtkusers] Displaying
the intersection of a plane with a bunch of spheres</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=1 color=black
face=Geneva><span style='font-size:9.0pt;font-family:Geneva;color:black'>Thanks,
David, This looks eminently doable and makes plenty of sense. I'm
going to try it today.<br>
<br>
-Steve<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=black face=Geneva><span style='font-size:
9.0pt;font-family:Geneva;color:black'>-----Original Message----- <br>
From: David.Pont@ensisjv.com <br>
Sent: Oct 7, 2007 4:32 PM <br>
To: Steve Chall <br>
<stevec@renci.org>Cc: 'Theresa-Marie Rhyne' <tmrhyne@ncsu.edu>, <st1:PersonName
w:st="on">vtkusers@vtk.org</st1:PersonName> <br>
Subject: Re: [vtkusers] Displaying the intersection of a plane with a bunch of
spheres <br>
<br>
<br>
<o:p></o:p></span></font></p>
<zzzhtml><zzzbody></zzzbody></zzzhtml></tmrhyne@ncsu.edu></stevec@renci.org>
<p><tt><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
color:black'>"Steve Chall" <stevec@renci.org> wrote on
06/10/2007 07:35:07:</span></font></tt><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'><br>
<br>
<tt><font face="Courier New">> I want to generate a 3D rectangular volume of
~38,000 closely packed,</font></tt><br>
<tt><font face="Courier New">> sometimes overlapping "particles" -
initially spheres simply defined as a</font></tt><br>
<tt><font face="Courier New">> list of centroids and a parallel list of
radii, more complex objects later</font></tt><br>
<tt><font face="Courier New">> on - and interactively look at arbitrary
slices through the volume, with the</font></tt><br>
<tt><font face="Courier New">> particle intersections represented as disks
or circles in the 2D slice (down</font></tt><br>
<tt><font face="Courier New">> to a single pixel, of course, if the slice is
tangent to the surface of a</font></tt><br>
<tt><font face="Courier New">> "particle"). Due to the
number of "particles" I think performance scaling</font></tt><br>
<tt><font face="Courier New">> issues might also be a concern at some point.</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> I’ve been working with VTK now for some time
in pursuit of a solution and</font></tt><br>
<tt><font face="Courier New">> haven’t really come to a satisfactory
conclusion. I’ve tried the following</font></tt><br>
<tt><font face="Courier New">> two approaches thus far:</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> 1) Implicit booleans: I read in the
sphere positions and radii and</font></tt><br>
<tt><font face="Courier New">> construct a vtkSphere for each one. As
I do that I add each to a</font></tt><br>
<tt><font face="Courier New">> vtkImplicitBoolean object “sphereUnion” with
the operation type set to</font></tt><br>
<tt><font face="Courier New">> union. I then create a vtkPlane object
(right now I’m not worrying about</font></tt><br>
<tt><font face="Courier New">> interactively moving the plane around:
I’ve just got it set through the</font></tt><br>
<tt><font face="Courier New">> middle of the cluster of spheres so that I
know, because I can see it, that</font></tt><br>
<tt><font face="Courier New">> there’s a non-empty intersection between the
plane and some of the</font></tt><br>
<tt><font face="Courier New">> spheres). Then I create another
vtkImplicitBoolean called “slice” and add</font></tt><br>
<tt><font face="Courier New">> to it the sphereUnion and the plane with
operation type set to</font></tt><br>
<tt><font face="Courier New">> intersection. I run slice into a
vtkSampleFunction, that into a</font></tt><br>
<tt><font face="Courier New">> vtkContourFilter into a vtkPolyDataMapper
into a vtkActor and into a</font></tt><br>
<tt><font face="Courier New">> vtkRenderer (the standard textbook
sequence). I’ve tried looking at various</font></tt><br>
<tt><font face="Courier New">> subsets – just the sphereUnion, just the
plane, etc. – and I see what I</font></tt><br>
<tt><font face="Courier New">> expect. But I’d think that the
intersection of a bunch of spheres and a</font></tt><br>
<tt><font face="Courier New">> plane would look like calamari or sausage
slices: a cluster of rings or</font></tt><br>
<tt><font face="Courier New">> disks on a 2D surface. However, what
I’m seeing is a strange cluster of</font></tt><br>
<tt><font face="Courier New">> lumpy, irregular 3D objects scattered through
the 3D sample space that</font></tt><br>
<tt><font face="Courier New">> perhaps roughly correspond to some or all of
the original spheres. Thus far</font></tt><br>
<tt><font face="Courier New">> I haven't made any sense of it. So on
to the second approach:</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> 2) Polygons: I create the vtkSpheres,
but this time convert each into a</font></tt><br>
<tt><font face="Courier New">> vtkPolyData object (vtkSphere ->
vtkSampleFunction -> vtkContourFilter) and</font></tt><br>
<tt><font face="Courier New">> add the resulting polygonal sphere to a
vtkAppendPolyData object. I create</font></tt><br>
<tt><font face="Courier New">> a vtkPlaneSource object (the polygonal
equivalent to the vtkPlane implicit</font></tt><br>
<tt><font face="Courier New">> surface object in approach 1 above) and a
vtkProbeFilter. I set the probe’s</font></tt><br>
<tt><font face="Courier New">> input connection to the vtkPlaneSource and
its source connection to the</font></tt><br>
<tt><font face="Courier New">> vtkAppendPolydata object (the spheres) and
then from there into the usual</font></tt><br>
<tt><font face="Courier New">> pipeline to the renderer. Once again I
think the subunits are ok – I can</font></tt><br>
<tt><font face="Courier New">> display them and they look like I’d expect –
but I don’t see any probe’d</font></tt><br>
<tt><font face="Courier New">> data at all. </font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> Does either of these approaches look
promising, or is there an entirely</font></tt><br>
<tt><font face="Courier New">> different direction that’s more likely to
produce useful results? I’d</font></tt><br>
<tt><font face="Courier New">> appreciate any insights you might have.
I can provide source code if it</font></tt><br>
<tt><font face="Courier New">> would make it any clearer. Thanks for
any help you can provide.</font></tt></span></font><font size=1 color=black
face=Geneva><span style='font-size:9.0pt;font-family:Geneva;color:black'><br>
<br>
</span></font><tt><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;color:black'>You should try this: create your spheres
as polydata objects with vtkSphereSource (instead of implicit spheres with
vtkSphere) and merge into one data set with vtkAppendPolyData. Create an
implicit plane with vtkPlane (as before) and use vtkCutter to generate the 2D
slice through your polydata spheres. You should get 'circular' polylines
(and/or points), increase the resolution in vtkSphereSource to get better
approximation to circles (better calamari ;-).</span></font></tt><font size=1
color=black face=Geneva><span style='font-size:9.0pt;font-family:Geneva;
color:black'><br>
<br>
</span></font><tt><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;color:black'>You can also cut more complex shapes this
way, so long as you can represent them as polydata. Performance with this
approach should be OK, unlike an approach based on vtkSampleFunction ->
vtkContourFilter which typically requires high sampling density to get
acceptable resolution. 38K particles is quite a few so vtkCutter will be busy
but using vtkSampleFunction on this problem would be an order of magnitude (or
2) slower.</span></font></tt><font size=1 color=black face=Geneva><span
style='font-size:9.0pt;font-family:Geneva;color:black'><br>
</span></font><tt><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;color:black'>If you really need to specify the
particles as implicit functions you would use vtkSampleFunction ->
vtkContour to turn them into polydata and then apply vtkCutter on the polydata,
that way if you want to move the cutting plane around you will not have to
re-execute vtkSampleFunction. </span></font></tt><font size=1 color=black
face=Geneva><span style='font-size:9.0pt;font-family:Geneva;color:black'><br>
<br>
</span></font><tt><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;color:black'> HTH, Dave P</span></font></tt><font
size=1 color=black face=Geneva><span style='font-size:9.0pt;font-family:Geneva;
color:black'><br>
</span></font><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> Steve</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> -Steve Chall</font></tt><br>
<tt><font face="Courier New">> Senior Research Software Developer</font></tt><br>
<tt><font face="Courier New">> Renaissance Computing Institute</font></tt><br>
<tt><font face="Courier New">> Phone: 919-515-0051</font></tt><br>
<tt><font face="Courier New">> Email: stevec@renci.org</font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> </font></tt><br>
<tt><font face="Courier New">> _______________________________________________</font></tt><br>
<tt><font face="Courier New">> This is the private VTK discussion list. </font></tt><br>
<tt><font face="Courier New">> Please keep messages on-topic. Check the FAQ
at: <a href="http://www.vtk" target="_blank">http://www.vtk</a>.</font></tt><br>
<tt><font face="Courier New">> org/Wiki/VTK_FAQ</font></tt><br>
<tt><font face="Courier New">> Follow this link to subscribe/unsubscribe:</font></tt><br>
<tt><font face="Courier New">> <a
href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a></font></tt></span></font><font
size=1 color=black face=Geneva><span style='font-size:9.0pt;font-family:Geneva;
color:black'><o:p></o:p></span></font></p>
</div>
</body>
</html>