<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks David for the tips. </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I try the first tip with following code, but it shows nothing on the window. Any comments about the missing objects?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span></span><span style="color: rgb(12, 100, 192);">vtkNew<vtkMultiBlockDataSet> mbds;</span><span><br>
</span>
<div><span style="color: rgb(12, 100, 192);">mbds->SetNumberOfBlocks(spheres.size() + 2);</span><br>
</div>
<div><br>
</div>
<div><span style="color: rgb(12, 100, 192);">// add small bubbles</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">std::cout << "totally " << spheres.size() << " small bubbles are identified" << std::endl;</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">for (auto i = 0; i < spheres.size(); i++) {</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);"> vtkSmartPointer<vtkSphereSource> sphereSource =</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">  vtkSmartPointer<vtkSphereSource>::New();</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);"> sphereSource->SetThetaResolution(100);</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);"> sphereSource->SetPhiResolution(50);</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);"> ... // set sphere here</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);"> mbds->SetBlock(i+1, sphereSource->GetOutput());</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">}</span><br>
</div>
<div><br>
</div>
<div><span style="color: rgb(12, 100, 192);">// Iso-surface using marching cubes</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">vtkSmartPointer<vtkMarchingCubes> contourFilter = vtkSmartPointer<vtkMarchingCubes>::New();</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">imageData->SetSpacing(pixelDim * scaleFactor, pixelDim * scaleFactor, pixelDim);</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">contourFilter->SetInputData(imageData);</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">contourFilter->ComputeNormalsOn();</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">contourFilter->SetValue(0, isoValue);
</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">mbds->SetBlock(spheres.size()+1, contourFilter->GetOutput());</span><br>
</div>
<div><br>
</div>
<div><span style="color: rgb(12, 100, 192);">vtkNew<vtkCompositePolyDataMapper2> mapper;</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">mapper->SetInputData((vtkPolyData*)mbds.Get());</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">vtkNew<vtkCompositeDataDisplayAttributes> cdsa;</span><br>
</div>
<div><br>
</div>
<div><span style="color: rgb(12, 100, 192);">mapper->SetCompositeDataDisplayAttributes(cdsa.Get());</span><br>
</div>
<div><br>
</div>
<div><span style="color: rgb(12, 100, 192);">vtkNew<vtkActor> actor;</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">actor->GetProperty()->SetColor(bubbleColor[0], bubbleColor[1], bubbleColor[2]);</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">actor->GetProperty()->SetOpacity(bubbleColor[3]);</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">actor->SetMapper(mapper.Get());</span><br>
</div>
<div><br>
</div>
<div><span style="color: rgb(12, 100, 192);">vtkNew<vtkRenderer> renderer;</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">renderer->SetBackground(1, 1, 1);</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">vtkNew<vtkRenderWindow> renderWindow;</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">renderWindow->SetSize(1200, 600);</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">renderWindow->SetWindowName("Bubble Visualisation");</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">renderWindow->AddRenderer(renderer.Get());</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;</span><br>
</div>
<div><span style="color: rgb(12, 100, 192);">renderWindowInteractor->SetRenderWindow(renderWindow.Get());</span><br>
</div>
<div><br>
</div>
<div><span style="color: rgb(12, 100, 192);">renderer->AddActor(actor.Get());</span><br>
</div>
<div><br>
</div>
<div><span style="color: rgb(12, 100, 192);">renderWindow->Render();</span><br>
</div>
<span style="color: rgb(12, 100, 192);">renderWindowInteractor->Start();</span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In addition, could you shed more light on the second one since I am quite new to VTK?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="signature">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Best wishes,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Chiang</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> David E DeMarle <dave.demarle@kitware.com><br>
<b>Sent:</b> 14 January 2019 19:41<br>
<b>To:</b> Q Wang<br>
<b>Cc:</b> vtkusers@vtk.org<br>
<b>Subject:</b> Re: [vtkusers] Cut a space with multiple objects</font>
<div> </div>
</div>
<div>
<div dir="ltr">2.5 strategies of the top of my head - 
<div>1) combine everything into a multiblock data set, rendered with the compositepolydatamapper and clip the multiblock.
<div>2) use one plane fed simultaneously into all of the clip filters (<--- try this first)</div>
<div>2.5) use events/observers to make all of the planes follow the actions of one master</div>
<div>
<div>
<div dir="ltr" class="x_gmail_signature">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div><br>
</div>
<div>hth</div>
<div><br>
</div>
<div>David E DeMarle</div>
<div>Kitware, Inc.<br>
Principal Engineer</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</div>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr">On Sat, Jan 12, 2019 at 6:55 PM Q Wang <<a href="mailto:wangq1979@outlook.com">wangq1979@outlook.com</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello vtkusers,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I use vtk to render a closed space, e.g. a cylinder, and there are numerous objects inside the cylinder, as in the attached figure. Every object inside the cylinder is rendered with its own actor and mapper, and so on. Now, I want to see the cross-sectional
 image of the cylinder at arbitary positions. I tried different ways, e.g. using a vtkplane to cut, but cannot get what I want since there are multiple objects at the cross-section. </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Any suggestion would be appreciated!</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div id="x_gmail-m_8082511820224055404signature">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Best wishes,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Chiang</div>
</div>
</div>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">
http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote>
</div>
</div>
</body>
</html>