<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Kenichiro,</p>
<p style="margin-top:0;margin-bottom:0">Thank you so much for your example!</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I adjusted the values for the scale and translate and <span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">I
could extract what I wanted.</span></p>
<br>
Thanks! Have a nice day!<br>
<div style="color: rgb(0, 0, 0);">
<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> kenichiro yoshimi <rccm.kyoshimi@gmail.com><br>
<b>Sent:</b> Tuesday, August 14, 2018 9:11 AM<br>
<b>To:</b> polly_sukting@hotmail.com<br>
<b>Cc:</b> vtkusers<br>
<b>Subject:</b> Re: [vtkusers] How to extract a region using a box?</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hello Polly,<br>
<br>
It may be helpful to get the bounds of the polydata by GetBounds()<br>
method because vtkBox is defined with bounds. In the case that uses<br>
fran_cut.vtk, there is something like below.<br>
---<br>
double bounds[6];<br>
auto fran_cut = vtkPolyData::SafeDownCast(reader->GetOutput());<br>
fran_cut->GetBounds(bounds);<br>
<br>
vtkSmartPointer<vtkTransform> transform =<br>
vtkSmartPointer<vtkTransform>::New();<br>
transform->PreMultiply();<br>
transform->RotateZ(0.0);<br>
transform->RotateY(0.0);<br>
transform->RotateX(0.0);<br>
transform->Scale(1, 0.4, 1);<br>
transform->Translate(0, 0, 0);<br>
<br>
vtkSmartPointer<vtkBox> box =<br>
vtkSmartPointer<vtkBox>::New();<br>
box->SetBounds(bounds);<br>
box->SetTransform(transform);<br>
---<br>
<br>
Besides, if it is difficult for you to adjust the transform values<br>
that you applied in ParaView, you might as well use Python scripting<br>
in ParaView. In that case, you are more likely to get a better answer<br>
if you post to the ParaView discussion forum:<br>
<a href="https://discourse.paraview.org/" id="LPlnk251803" class="OWAAutoLink" previewremoved="true">https://discourse.paraview.org/</a>
<div id="LPBorder_GT_15342675537430.3388339596682315" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15342675537400.4913615661643018" role="presentation" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="ImageCell_15342675537400.9028799421222531" colspan="1" style="width: 250px; position: relative; display: table-cell; padding-right: 20px;">
<div id="LPImageContainer_15342675537400.21935801782807895" style="background-color: rgb(255, 255, 255); height: 225px; position: relative; margin: auto; display: table; width: 225px;">
<a id="LPImageAnchor_15342675537420.6481975728562994" href="https://discourse.paraview.org/" target="_blank" style="display: table-cell; text-align: center;"><img id="LPThumbnailImageID_15342675537420.8394014128561178" width="225" height="225" style="display: inline-block; max-width: 250px; max-height: 250px; height: 225px; width: 225px; border-width: 0px; vertical-align: bottom;" src="https://discourse.paraview.org/uploads/default/original/1X/be27a23ecc6207834f74337e6527d80bcc475188.png"></a></div>
</td>
<td id="TextCell_15342675537420.6141345080144993" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_15342675537420.2895518509702524"></div>
<div id="LPTitle_15342675537420.07519223159478305" style="top: 0px; color: rgb(220, 79, 173); font-weight: 400; font-size: 21px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_15342675537420.05499110909168192" href="https://discourse.paraview.org/" target="_blank" style="text-decoration: none;">ParaView</a></div>
<div id="LPMetadata_15342675537420.4509300642290899" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
discourse.paraview.org</div>
<div id="LPDescription_15342675537430.06139128298769303" style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
A place for questions about ParaView usage, building, and installation as well as general discussion about ParaView.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
<br>
Thanks<br>
2018年8月14日(火) 1:00 Polly Pui <polly_sukting@hotmail.com>:<br>
><br>
><br>
> Hi,<br>
> I tested using the values below with fran_cut.vtk but I failed to get the area.<br>
> Please advice. Thank you so much!<br>
><br>
> vtkSmartPointer<vtkTransform> transform =<br>
> vtkSmartPointer<vtkTransform>::New();<br>
> transform->PreMultiply();<br>
> transform->RotateZ(0.0);<br>
> transform->RotateY(0.0);<br>
> transform->RotateX(0.0);<br>
> transform->Translate(0.5, -10.0, -590.0);<br>
> transform->Scale(0.5, 0.2, 0.6);<br>
> vtkSmartPointer<vtkBox> box =<br>
> vtkSmartPointer<vtkBox>::New();<br>
> box->SetBounds(-1.0, 1.0, -1.0, 1.0, -0.6, 0.6);<br>
> box->SetTransform(transform);<br>
><br>
><br>
><br>
> ________________________________<br>
> From: kenichiro yoshimi <rccm.kyoshimi@gmail.com><br>
> Sent: Saturday, August 11, 2018 11:08 AM<br>
> To: polly_sukting@hotmail.com<br>
> Cc: vtkusers<br>
> Subject: Re: [vtkusers] How to extract a region using a box?<br>
><br>
> Hi,<br>
><br>
> The Filter>Extract Cells By Region in ParaView uses vtkExtractGeometry<br>
> class internally. So the following example may be helpful to automate<br>
> polygon extractions with a specified box.<br>
><br>
> --- ExtractGeometry.cxx ---<br>
> #include <vtkBox.h><br>
> #include <vtkCamera.h><br>
> #include <vtkDataSetMapper.h><br>
> #include <vtkExtractGeometry.h><br>
> #include <vtkProperty.h><br>
> #include <vtkRenderer.h><br>
> #include <vtkRenderWindow.h><br>
> #include <vtkRenderWindowInteractor.h><br>
> #include <vtkSmartPointer.h><br>
> #include <vtkSphereSource.h><br>
> #include <vtkTransform.h><br>
><br>
> int main (int, char *[])<br>
> {<br>
> vtkSmartPointer<vtkSphereSource> sphere =<br>
> vtkSmartPointer<vtkSphereSource>::New();<br>
> sphere->SetRadius(0.5);<br>
> sphere->SetPhiResolution(50);<br>
> sphere->SetThetaResolution(50);<br>
> sphere->Update();<br>
><br>
> vtkSmartPointer<vtkTransform> transform =<br>
> vtkSmartPointer<vtkTransform>::New();<br>
> transform->PreMultiply();<br>
> transform->RotateZ(30.0);<br>
> transform->Translate(0.5, 0.0, 0.0);<br>
><br>
> vtkSmartPointer<vtkBox> box =<br>
> vtkSmartPointer<vtkBox>::New();<br>
> box->SetBounds(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5);<br>
> box->SetTransform(transform);<br>
><br>
> vtkSmartPointer<vtkExtractGeometry> extractGeometry =<br>
> vtkSmartPointer<vtkExtractGeometry>::New();<br>
> extractGeometry->SetInputData(sphere->GetOutput());<br>
> extractGeometry->SetImplicitFunction(box);<br>
> extractGeometry->ExtractInsideOn();<br>
> extractGeometry->ExtractBoundaryCellsOn();<br>
><br>
> vtkSmartPointer<vtkDataSetMapper> mapper =<br>
> vtkSmartPointer<vtkDataSetMapper>::New();<br>
> mapper->SetInputConnection(extractGeometry->GetOutputPort());<br>
><br>
> vtkSmartPointer<vtkActor> actor =<br>
> vtkSmartPointer<vtkActor>::New();<br>
> actor->SetMapper(mapper);<br>
> actor->GetProperty()->SetColor(0.8900, 0.8100, 0.3400);<br>
><br>
> // Create graphics stuff<br>
> //<br>
> vtkSmartPointer<vtkRenderer> ren =<br>
> vtkSmartPointer<vtkRenderer>::New();<br>
> ren->SetBackground(.3, .4, .6);<br>
><br>
> vtkSmartPointer<vtkRenderWindow> renWin =<br>
> vtkSmartPointer<vtkRenderWindow>::New();<br>
> renWin->AddRenderer(ren);<br>
> renWin->SetSize(512,512);<br>
><br>
> vtkSmartPointer<vtkRenderWindowInteractor> iren =<br>
> vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
> iren->SetRenderWindow(renWin);<br>
><br>
> // Add the actors to the renderer, set the background and size<br>
> //<br>
> ren->AddActor(actor);<br>
><br>
> // Generate an interesting view<br>
> //<br>
> ren->ResetCamera();<br>
> ren->GetActiveCamera()->Azimuth(120);<br>
> ren->GetActiveCamera()->Elevation(30);<br>
> ren->GetActiveCamera()->Dolly(1.0);<br>
> ren->ResetCameraClippingRange();<br>
><br>
> iren->Initialize();<br>
> iren->Start();<br>
><br>
> return EXIT_SUCCESS;<br>
> }<br>
><br>
> --- CMakeLists.txt ---<br>
> cmake_minimum_required(VERSION 2.8)<br>
><br>
> PROJECT(ExtractGeometry)<br>
><br>
> find_package(VTK REQUIRED)<br>
> include(${VTK_USE_FILE})<br>
><br>
> add_executable(ExtractGeometry MACOSX_BUNDLE ExtractGeometry.cxx )<br>
><br>
> target_link_libraries(ExtractGeometry ${VTK_LIBRARIES})<br>
> ---<br>
><br>
> Regards<br>
> 2018年8月9日(木) 16:51 Polly Pui <polly_sukting@hotmail.com>:<br>
> ><br>
> > Hi,<br>
> ><br>
> > Can anyone please tell me how can I do extract a region by providing a box (which we can set the size of it) on a polydata?<br>
> ><br>
> > I could do it manually in Paraview by selecting the Filter>Extract Cells By Region.<br>
> ><br>
> > However, I have more than 1000 dataset. It is time consuming if I apply it manually for each dataset.<br>
> ><br>
> ><br>
> > Thanks!<br>
> ><br>
> ><br>
> > Best,<br>
> ><br>
> > Polly<br>
> ><br>
> > _______________________________________________<br>
> > Powered by <a href="http://www.kitware.com" id="LPlnk522763" class="OWAAutoLink" previewremoved="true">
www.kitware.com</a><br>
> ><br>
> > Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" id="LPlnk971228" class="OWAAutoLink" previewremoved="true">
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" id="LPlnk83241" class="OWAAutoLink" previewremoved="true">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
> ><br>
> > Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" id="LPlnk751923" class="OWAAutoLink" previewremoved="true">
http://markmail.org/search/?q=vtkusers</a><br>
> ><br>
> > Follow this link to subscribe/unsubscribe:<br>
> > <a href="https://public.kitware.com/mailman/listinfo/vtkusers" id="LPlnk665890" class="OWAAutoLink" previewremoved="true">
https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>