<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hi Susan, thank you for your suggestions. It's exactly what I need.</div>
<div> </div>
<div>Now I have another question regarding the vtkClipPolyData.</div>
<div>I use it together with an implicitFunction, the vtkBox.</div>
<div>It works quite fine, unless I want to access the second output. If I set the flag GenerateClippedData on, it generates a second output.</div>
<div>Now, if I want to access this second output (or in this case even the first only) then I get the conjunction of second and first output.</div>
<div>Any idea what I am doing wrong?</div>
<div> </div>
<div>
<div> Instantiate(sphere, vtkSphereSource);<br/>
sphere->SetCenter(0.0,0.0,0.0);<br/>
sphere->SetRadius(5.0);<br/>
sphere->Update();</div>
<div> Instantiate(boundingBox, vtkBox);<br/>
boundingBox->SetBounds(4.0,6.0,-3.0,3.0,-3.0,3.0);</div>
<div> </div>
<div>
<div> Instantiate(clipCortex, vtkClipPolyData);<br/>
clipCortex->SetInputConnection(sphere->GetOutputPort());<br/>
clipCortex->SetClipFunction(boundingBox);<br/>
clipCortex->GenerateClippedOutputOn();<br/>
clipCortex->Update();</div>
<div> </div>
<div>
<div> cout << " Sphere has " <<sphere->GetOutput()->GetNumberOfPoints() << " Points" << endl;</div>
<div>
<div> cout << " Inside has " << clipCortex->GetOutput()->GetNumberOfPoints() << " Points" << endl;<br/>
cout << " Outside has " << clipCortex->GetClippedOutput()->GetNumberOfPoints() << " Points" << endl;</div>
<div> </div>
</div>
</div>
<div>Output is:</div>
<div>Sphere has 50 Points<br/>
Inside has 60 Points<br/>
Outside has 60 Points</div>
<div> </div>
<div>(The level set (where the impicit function = 0 ) is counted twice, hence the bigger number after the clipping)</div>
<div> </div>
</div>
</div>
<div> </div>
<div> </div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Samstag, 26. April 2014 um 01:00 Uhr<br/>
<b>Von:</b> 关红彦 <ghy@tellyes.com><br/>
<b>An:</b> "Susanne Schmalkalt" <Susanne.Schmalkalt@gmx.de><br/>
<b>Betreff:</b> Re:Re: [vtkusers] vtkGeometryFilter</div>
<div name="quoted-content">
<div style="line-height: 1.7;color: rgb(0,0,0);font-size: 14.0px;font-family: arial;"><span style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 19.2px;font-weight: bold;line-height: 20.0px;background-color: rgb(249,250,252);">vtkClipPolyData</span>
<div>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;">clip polygonal data with user-specified implicit function or input scalar data</p>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;"><a class="el" href="http://www.vtk.org/doc/release/6.0/html/classvtkClipPolyData.html" style="color: rgb(70,101,162);font-weight: bold;text-decoration: none;" target="_blank" title="clip polygonal data with user-specified implicit function or input scalar data">vtkClipPolyData</a> is a filter that clips polygonal data using either any subclass of <a class="el" href="http://www.vtk.org/doc/release/6.0/html/classvtkImplicitFunction.html" style="color: rgb(70,101,162);font-weight: bold;text-decoration: none;" target="_blank" title="abstract interface for implicit functions">vtkImplicitFunction</a>, or the input scalar data. Clipping means that it actually "cuts" through the cells of the dataset, returning everything inside of the specified implicit function (or greater than the scalar value) including "pieces" of a cell. (Compare this with <a class="el" href="http://www.vtk.org/doc/release/6.0/html/classvtkExtractGeometry.html" style="color: rgb(70,101,162);font-weight: bold;text-decoration: none;" target="_blank" title="extract cells that lie either entirely inside or outside of a specified implicit function">vtkExtractGeometry</a>, which pulls out entire, uncut cells.) The output of this filter is polygonal data.</p>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;">To use this filter, you must decide if you will be clipping with an implicit function, or whether you will be using the input scalar data. If you want to clip with an implicit function, you must: 1) define an implicit function 2) set it with the SetClipFunction method 3) apply the GenerateClipScalarsOn method If a ClipFunction is not specified, or GenerateClipScalars is off (the default), then the input's scalar data will be used to clip the polydata.</p>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;">You can also specify a scalar value, which is used to decide what is inside and outside of the implicit function. You can also reverse the sense of what inside/outside is by setting the InsideOut instance variable. (The cutting algorithm proceeds by computing an implicit function value or using the input scalar data for each point in the dataset. This is compared to the scalar value to determine inside/outside.)</p>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;">This filter can be configured to compute a second output. The second output is the polygonal data that is clipped away. Set the GenerateClippedData boolean on if you wish to access this output data.</p>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;"> </p>
<div><span style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 19.2px;font-weight: bold;line-height: 20.0px;background-color: rgb(249,250,252);">vtkCutter </span>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;">Cut <a class="el" href="http://www.vtk.org/doc/release/6.0/html/classvtkDataSet.html" style="color: rgb(70,101,162);font-weight: bold;text-decoration: none;" target="_blank" title="abstract class to specify dataset behavior">vtkDataSet</a> with user-specified implicit function.</p>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;"><a class="el" href="http://www.vtk.org/doc/release/6.0/html/classvtkCutter.html" style="color: rgb(70,101,162);font-weight: bold;text-decoration: none;" target="_blank" title="Cut vtkDataSet with user-specified implicit function.">vtkCutter</a> is a filter to cut through data using any subclass of <a class="el" href="http://www.vtk.org/doc/release/6.0/html/classvtkImplicitFunction.html" style="color: rgb(70,101,162);font-weight: bold;text-decoration: none;" target="_blank" title="abstract interface for implicit functions">vtkImplicitFunction</a>. That is, a polygonal surface is created corresponding to the implicit function F(x,y,z) = value(s), where you can specify one or more values used to cut with.</p>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;">In VTK, cutting means reducing a cell of dimension N to a cut surface of dimension N-1. For example, a tetrahedron when cut by a plane (i.e., <a class="el" href="http://www.vtk.org/doc/release/6.0/html/classvtkPlane.html" style="color: rgb(70,101,162);font-weight: bold;text-decoration: none;" target="_blank" title="perform various plane computations">vtkPlane</a> implicit function) will generate triangles. (In comparison, clipping takes a N dimensional cell and creates N dimension primitives.)</p>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;"><a class="el" href="http://www.vtk.org/doc/release/6.0/html/classvtkCutter.html" style="color: rgb(70,101,162);font-weight: bold;text-decoration: none;" target="_blank" title="Cut vtkDataSet with user-specified implicit function.">vtkCutter</a> is generally used to "slice-through" a dataset, generating a surface that can be visualized. It is also possible to use <a class="el" href="http://www.vtk.org/doc/release/6.0/html/classvtkCutter.html" style="color: rgb(70,101,162);font-weight: bold;text-decoration: none;" target="_blank" title="Cut vtkDataSet with user-specified implicit function.">vtkCutter</a> to do a form of volume rendering. <a class="el" href="http://www.vtk.org/doc/release/6.0/html/classvtkCutter.html" style="color: rgb(70,101,162);font-weight: bold;text-decoration: none;" target="_blank" title="Cut vtkDataSet with user-specified implicit function.">vtkCutter</a> does this by generating multiple cut surfaces (usually planes) which are ordered (and rendered) from back-to-front. The surfaces are set translucent to give a volumetric rendering effect.</p>
<p style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 12.8px;line-height: 12.8px;">Note that data can be cut using either 1) the scalar values associated with the dataset or 2) an implicit function associated with this class. By default, if an implicit function is set it is used to clip the data set, otherwise the dataset scalars are used to perform the clipping.</p>
<br/>
At 2014-04-25 20:44:28,"Susanne Schmalkalt" <Susanne.Schmalkalt@gmx.de> wrote:
<blockquote id="isReplyContent" style="PADDING-LEFT: 1.0ex;MARGIN: 0.0px 0.0px 0.0px 0.8ex;BORDER-LEFT: rgb(204,204,204) 1.0px solid;">
<div style="font-family: Verdana;font-size: 12.0px;">
<div>
<div>Thank you, but I fear that will only make my whole PolyData smaller.</div>
<div>I need the same size, but want to get rid of the cut-off part of the PolyData.</div>
<div> </div>
<div> </div>
<div>
<div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);">
<div style="margin: 0 0 10.0px 0;"><b>Gesendet:</b> Freitag, 25. April 2014 um 02:43 Uhr<br/>
<b>Von:</b> 关红彦 <<a href="ghy@tellyes.com" target="_parent">ghy@tellyes.com</a>><br/>
<b>An:</b> "Susanne Schmalkalt" <<a href="Susanne.Schmalkalt@gmx.de" target="_parent">Susanne.Schmalkalt@gmx.de</a>><br/>
<b>Betreff:</b> Re:[vtkusers] vtkGeometryFilter</div>
<div>
<div style="line-height: 1.7;color: rgb(0,0,0);font-size: 14.0px;font-family: arial;">Try this class: <span style="font-family: "Lucida Grande" , Verdana , Geneva , Arial , sans-serif;font-size: 18.0px;font-weight: bold;line-height: normal;background-color: rgb(249,250,252);">vtkShrinkPolyData </span><br/>
<br/>
Hope it will help.
<div> </div>
<div>Susan. <br/>
<br/>
At 2014-04-24 21:21:06,"Susanne Schmalkalt" <<a href="Susanne.Schmalkalt@gmx.de" target="_parent">Susanne.Schmalkalt@gmx.de</a>> wrote:
<blockquote id="isReplyContent" style="PADDING-LEFT: 1.0ex;MARGIN: 0.0px 0.0px 0.0px 0.8ex;BORDER-LEFT: rgb(204,204,204) 1.0px solid;">
<div style="font-family: Verdana;font-size: 12.0px;">
<div>Hallo vtkUsers,</div>
<div> </div>
<div>I have a general question regarding the vtkGeometryFilter.</div>
<div>I use this filter to make my vtkPolyData smaller.</div>
<div>But it seems that it only disables the clipped points, but keeps them in the polydata set.</div>
<div>I'll try to give an example here:</div>
<div> </div>
<div>
<div> vtkSmartPointer<vtkSphereSource> sphereSource =<br/>
vtkSmartPointer<vtkSphereSource>::New();<br/>
sphereSource->SetCenter(0.0, 0.0, 0.0);<br/>
sphereSource->SetRadius(5.0);<br/>
vtkSmartPointer<vtkPolyData> sphereSourcePD = vtkSmartPointer<vtkPolyData>::New();<br/>
sphereSourcePD = sphereSource->GetOutput();<br/>
vtkSmartPointer<vtkGeometryFilter> geometryFilter =<br/>
vtkSmartPointer<vtkGeometryFilter>::New();<br/>
geometryFilter->SetInput(sphereSourcePD);<br/>
geometryFilter->SetExtent(-5.0, 0.0, -5.0,0.0,-5.0,0.0);<br/>
geometryFilter->ExtentClippingOn();<br/>
geometryFilter->Update();</div>
<div> vtkSmartPointer<vtkPolyData> sphereSourceClipped = vtkSmartPointer<vtkPolyData>::New();<br/>
sphereSourceClipped = geometryFilter->GetOutput();</div>
<div> </div>
<div>cout << " NUmber of points in spheresource: " << sphereSourcePD->GetNumberOfPoints() << endl;<br/>
cout << " NUmber of points in clipped Polydata: " << sphereSourceClipped->GetNumberOfPoints() << endl;</div>
<div> </div>
</div>
<div> </div>
<div> </div>
<div>Output is:</div>
<div>NUmber of points in spheresource: 50</div>
<div>NUmber of points in clipped Polydata: 50</div>
<div> </div>
<div>Is there a way that I can use this filter (or any other one) to really clip my polydata and make it smaller?</div>
<div> </div>
<div>Any help would be much appreciated!</div>
<div>Best,</div>
<div>Susi</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>