<div dir="ltr">Hi All:<div><br></div><div>Following up on this, can anyone advise me how to get the data out of a ParticleReader? I think my best option is just to build up data in a vtkPoints array by hand, as it were. But I can't find a ParticleReader::GetParticleData method or even anything that looks remotely like it. I tried converting it to a vtkTable, but that was rejected. The file is an ASCII vtk file, so I can always read it by hand, but that can't really be the right way to do this, can it?</div><div><br></div><div>Thank you,</div><div><br></div><div> -Tom</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 3, 2018 at 4:54 PM, Sgouros, Thomas <span dir="ltr"><<a href="mailto:thomas_sgouros@brown.edu" target="_blank">thomas_sgouros@brown.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div>"<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">It is often some unexpected </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">minor thing that causes the failure."  </span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div></span><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I'm certain of that.</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Here's the code, mostly pinched straight from the Glyph3D example. (And I've tried swapping the endianness, just for giggles.) The data is an ASCII vtk file that you can get from <a href="http://sgouros.com/output_p40.vtk" target="_blank">sgouros.com/output_p40.vtk</a>.</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Thank you,</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> -Tom</span></div><div><br></div><div><br></div><div>#include <vtkVersion.h></div><div>#include <vtkSmartPointer.h></div><div>#include <vtkCubeSource.h></div><div>#include <vtkPolyData.h></div><div>#include <vtkPoints.h></div><div>#include <vtkGlyph3D.h></div><div>#include <vtkCellArray.h></div><div>#include <vtkPolyDataMapper.h></div><div>#include <vtkActor.h></div><div>#include <vtkRenderWindow.h></div><div>#include <vtkRenderer.h></div><div>#include <vtkRenderWindowInteractor.h></div><div>#include <vtkParticleReader.h></div><div>#include <vtkPolyDataMapper.h></div><div><br></div><div><br></div><div>int main(int argc, char* argv[]) {</div><div>  </div><div>  std::string filePath = argv[1];</div><span class=""><div>  vtkSmartPointer<<wbr>vtkParticleReader> reader =</div><div>    vtkSmartPointer<<wbr>vtkParticleReader>::New();</div><div><br></div><div>  reader->SetFileName ( filePath.c_str() );</div></span><div>  // if nothing gets displayed or totally wrong, swap the endianness</div><span class=""><div>  reader-><wbr>SetDataByteOrderToBigEndian();</div><div>  reader->Update();</div><div>  </div><div>  // Create anything you want here, we will use a cube for the demo.</div><div>  vtkSmartPointer<vtkCubeSource> cubeSource = </div><div>      vtkSmartPointer<vtkCubeSource><wbr>::New();</div><div> </div><div>  vtkSmartPointer<vtkGlyph3D> glyph3D = </div><div>    vtkSmartPointer<vtkGlyph3D>::<wbr>New();</div><div><br></div><div>  glyph3D->SetSourceConnection(<wbr>cubeSource->GetOutputPort());</div></span><div>  glyph3D->SetInputConnection(<wbr>reader->GetOutputPort());</div><div><br></div><div>  glyph3D->Update();</div><div><br></div><div>  std::cout << *(reader->GetOutput()) << std::endl;</div><div>  </div><div>  // Visualize</div><div>  vtkSmartPointer<<wbr>vtkPolyDataMapper> mapper =</div><div>    vtkSmartPointer<<wbr>vtkPolyDataMapper>::New();</div><div>  mapper->SetInputConnection(<wbr>glyph3D->GetOutputPort());</div><div> </div><div>  vtkSmartPointer<vtkActor> actor = </div><div>    vtkSmartPointer<vtkActor>::<wbr>New();</div><div>  actor->SetMapper(mapper);</div><div> </div><div>  vtkSmartPointer<vtkRenderer> renderer = </div><div>    vtkSmartPointer<vtkRenderer>::<wbr>New();</div><div>  vtkSmartPointer<<wbr>vtkRenderWindow> renderWindow = </div><div>    vtkSmartPointer<<wbr>vtkRenderWindow>::New();</div><div>  renderWindow->AddRenderer(<wbr>renderer);</div><div>  vtkSmartPointer<<wbr>vtkRenderWindowInteractor> renderWindowInteractor = </div><div>    vtkSmartPointer<<wbr>vtkRenderWindowInteractor>::<wbr>New();</div><div>  renderWindowInteractor-><wbr>SetRenderWindow(renderWindow);</div><div> </div><div>  renderer->AddActor(actor);</div><div>  renderer->SetBackground(.3, .6, .3); // Background color green</div><div> </div><div>  renderWindow->Render();</div><div>  renderWindowInteractor->Start(<wbr>);</div><div> </div><div>  return EXIT_SUCCESS;</div><div>}</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 3, 2018 at 4:46 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Post a small compilable example, please. It is often some unexpected<br>
minor thing that causes the failure.<br>
<br>
Thanks,<br>
<br>
Bill<br>
<br>
BTW: The wiki examples have been replaced by VTKExamples here:<br>
<br>
<a href="https://lorensen.github.io/VTKExamples/site/" rel="noreferrer" target="_blank">https://lorensen.github.io/VTK<wbr>Examples/site/</a><br>
<br>
<br>
On Tue, Apr 3, 2018 at 1:43 PM, Sebastien Jourdain<br>
<div class="m_-255925562109907961HOEnZb"><div class="m_-255925562109907961h5"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.co<wbr>m</a>> wrote:<br>
> What you are doing seems correct and the data is valid (it has points).<br>
><br>
> How do you render the glyph3d filter? Using a polydata mapper? I'm guessing<br>
> no issue on that end?<br>
><br>
> Ideally you should use the glyph mapper instead of the filter. But if memory<br>
> is not a big deal, don't worry about it.<br>
><br>
> Seb<br>
><br>
> On Tue, Apr 3, 2018 at 1:47 PM, Sgouros, Thomas <<a href="mailto:thomas_sgouros@brown.edu" target="_blank">thomas_sgouros@brown.edu</a>><br>
> wrote:<br>
>><br>
>> This is reader->GetOutput()<br>
>><br>
>> vtkPolyData (0x7f8ce050dad0)<br>
>><br>
>>   Debug: Off<br>
>><br>
>>   Modified Time: 217<br>
>><br>
>>   Reference Count: 1<br>
>><br>
>>   Registered Events: (none)<br>
>><br>
>>   Information: 0x7f8ce050d9b0<br>
>><br>
>>   Data Released: False<br>
>><br>
>>   Global Release Data: Off<br>
>><br>
>>   UpdateTime: 218<br>
>><br>
>>   Field Data:<br>
>><br>
>>     Debug: Off<br>
>><br>
>>     Modified Time: 167<br>
>><br>
>>     Reference Count: 1<br>
>><br>
>>     Registered Events: (none)<br>
>><br>
>>     Number Of Arrays: 0<br>
>><br>
>>     Number Of Components: 0<br>
>><br>
>>     Number Of Tuples: 0<br>
>><br>
>>   Number Of Points: 10229<br>
>><br>
>>   Number Of Cells: 10229<br>
>><br>
>><br>
>> It goes on for quite a bit more. As I said, when I feed this to a<br>
>> vtkPolyDataMapper, it displays and works fine, but I want little spheres,<br>
>> not little flat rectangles and I thought I could just redirect that into the<br>
>> vtkGlyph3D object, but I must be misunderstanding something.<br>
>><br>
>> Thank you,<br>
>><br>
>>  -Tom<br>
>><br>
>> On Tue, Apr 3, 2018 at 3:26 PM, Sebastien Jourdain<br>
>> <<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.co<wbr>m</a>> wrote:<br>
>>><br>
>>> You can try to see what the GetOutput() contains as my assumption it<br>
>>> would be empty (No points => Number of Points: 0).<br>
>>><br>
>>> reader->GetOutput()->PrintSelf<wbr>(cout, vtkIndent(2));<br>
>>><br>
>>> What I mean was<br>
>>><br>
>>> glyph3D->SetInputConnection(re<wbr>ader->GetOutputPort());<br>
>>><br>
>>><br>
>>> On Tue, Apr 3, 2018 at 1:23 PM, Sgouros, Thomas<br>
>>> <<a href="mailto:thomas_sgouros@brown.edu" target="_blank">thomas_sgouros@brown.edu</a>> wrote:<br>
>>>><br>
>>>> Hi Sebastien:<br>
>>>><br>
>>>> Sorry if that was unclear. The third block of code comes first, and<br>
>>>> reader->Update() is called before I use its GetOutput().  In situ, it looks<br>
>>>> like this:<br>
>>>><br>
>>>>  ...<br>
>>>>   vtkSmartPointer<vtkParticleRe<wbr>ader> reader =<br>
>>>> vtkSmartPointer<vtkParticleRea<wbr>der>::New();<br>
>>>>   reader->SetFileName ( filePath.c_str() );<br>
>>>>   reader->SetDataByteOrderToBig<wbr>Endian();<br>
>>>>   reader->Update();<br>
>>>><br>
>>>>   // Create anything you want here, we will use a cube for the demo.<br>
>>>>   vtkSmartPointer<<wbr>vtkCubeSource> cubeSource =<br>
>>>>       vtkSmartPointer<<wbr>vtkCubeSource>::New();<br>
>>>><br>
>>>>   vtkSmartPointer<vtkGlyph3D> glyph3D =<br>
>>>> vtkSmartPointer<vtkGlyph3D>::N<wbr>ew();<br>
>>>>   glyph3D->SetSourceConnection(<wbr>cubeSource->GetOutputPort());<br>
>>>>   glyph3D->SetInputData(reader-<wbr>>GetOutput());<br>
>>>>   glyph3D->Update();<br>
>>>><br>
>>>>   ...<br>
>>>><br>
>>>> I don't think I understand what you mean by the connection instead of<br>
>>>> the dataset directly.<br>
>>>><br>
>>>> Is there a way to peek inside glyph3D and see what it thinks it has?<br>
>>>><br>
>>>> Thank you,<br>
>>>><br>
>>>>  -Tom<br>
>>>><br>
>>>><br>
>>>> On Tue, Apr 3, 2018 at 2:53 PM, Sebastien Jourdain<br>
>>>> <<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.co<wbr>m</a>> wrote:<br>
>>>>><br>
>>>>> Tom,<br>
>>>>><br>
>>>>> Just make sure that reader->Update(); was called before<br>
>>>>> glyph3D->SetInputData(reader-><wbr>GetOutput());<br>
>>>>> But it would be better to use the connection instead of the dataset<br>
>>>>> directly.<br>
>>>>><br>
>>>>> Seb<br>
>>>>><br>
>>>>> On Tue, Apr 3, 2018 at 12:27 PM, Sgouros, Thomas<br>
>>>>> <<a href="mailto:thomas_sgouros@brown.edu" target="_blank">thomas_sgouros@brown.edu</a>> wrote:<br>
>>>>>><br>
>>>>>> Hello all:<br>
>>>>>><br>
>>>>>> Can someone help me understand why this code works:<br>
>>>>>><br>
>>>>>>   vtkSmartPointer<vtkGlyph3D> glyph3D =<br>
>>>>>> vtkSmartPointer<vtkGlyph3D>::N<wbr>ew();<br>
>>>>>>   glyph3D->SetSourceConnection(<wbr>cubeSource->GetOutputPort());<br>
>>>>>>   glyph3D->SetInputData(polydat<wbr>a);<br>
>>>>>>   glyph3D->Update();<br>
>>>>>><br>
>>>>>> And this does not (nothing displayed)?<br>
>>>>>><br>
>>>>>>   vtkSmartPointer<vtkGlyph3D> glyph3D =<br>
>>>>>> vtkSmartPointer<vtkGlyph3D>::N<wbr>ew();<br>
>>>>>>   glyph3D->SetSourceConnection(<wbr>cubeSource->GetOutputPort());<br>
>>>>>>   glyph3D->SetInputData(reader-<wbr>>GetOutput());<br>
>>>>>>   glyph3D->Update();<br>
>>>>>><br>
>>>>>> The first clip is from<br>
>>>>>> <a href="https://www.vtk.org/Wiki/VTK/Examples/Cxx/Filtering/Glyph3D" rel="noreferrer" target="_blank">https://www.vtk.org/Wiki/VTK/E<wbr>xamples/Cxx/Filtering/Glyph3D</a><br>
>>>>>><br>
>>>>>> The 'reader' object is stolen from the ParticleReader example:<br>
>>>>>><br>
>>>>>>   vtkSmartPointer<vtkParticleRe<wbr>ader> reader =<br>
>>>>>> vtkSmartPointer<vtkParticleRea<wbr>der>::New();<br>
>>>>>>   reader->SetFileName ( filePath.c_str() );<br>
>>>>>>   reader->SetDataByteOrderToBig<wbr>Endian();<br>
>>>>>>   reader->Update();<br>
>>>>>><br>
>>>>>> The program compiles, but no data appears. It works fine (data<br>
>>>>>> appears) in the context of the ParticleReader example, where it shows all<br>
>>>>>> the data points. But I want to see them as glyphs, not little squares. I<br>
>>>>>> seem to be misunderstanding something fundamental, but not seeing what it<br>
>>>>>> could be.<br>
>>>>>><br>
>>>>>> Many thanks,<br>
>>>>>><br>
>>>>>>  -Tom<br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> ______________________________<wbr>_________________<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<br>
>>>>>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
>>>>>><br>
>>>>>> Please keep messages on-topic and check the VTK FAQ at:<br>
>>>>>> <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FA<wbr>Q</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=<wbr>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/listin<wbr>fo/vtkusers</a><br>
>>>>>><br>
>>>>><br>
>>>><br>
>>><br>
>><br>
><br>
><br>
> ______________________________<wbr>_________________<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<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FA<wbr>Q</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=<wbr>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/listin<wbr>fo/vtkusers</a><br>
><br>
<br>
<br>
<br>
</div></div><span class="m_-255925562109907961HOEnZb"><font color="#888888">--<br>
Unpaid intern in BillsParadise at noware dot com<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>