<div dir="ltr"><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><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">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><div> vtkSmartPointer<vtkParticleReader> reader =</div><div>  vtkSmartPointer<vtkParticleReader>::New();</div><div><br></div><div> reader->SetFileName ( filePath.c_str() );</div><div> // if nothing gets displayed or totally wrong, swap the endianness</div><div> reader->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>::New();</div><div> </div><div> vtkSmartPointer<vtkGlyph3D> glyph3D = </div><div>  vtkSmartPointer<vtkGlyph3D>::New();</div><div><br></div><div> glyph3D->SetSourceConnection(cubeSource->GetOutputPort());</div><div> glyph3D->SetInputConnection(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<vtkPolyDataMapper> mapper =</div><div>  vtkSmartPointer<vtkPolyDataMapper>::New();</div><div> mapper->SetInputConnection(glyph3D->GetOutputPort());</div><div> </div><div> vtkSmartPointer<vtkActor> actor = </div><div>  vtkSmartPointer<vtkActor>::New();</div><div> actor->SetMapper(mapper);</div><div> </div><div> vtkSmartPointer<vtkRenderer> renderer = </div><div>  vtkSmartPointer<vtkRenderer>::New();</div><div> vtkSmartPointer<vtkRenderWindow> renderWindow = </div><div>  vtkSmartPointer<vtkRenderWindow>::New();</div><div> renderWindow->AddRenderer(renderer);</div><div> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = </div><div>  vtkSmartPointer<vtkRenderWindowInteractor>::New();</div><div> renderWindowInteractor->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();</div><div> </div><div> return EXIT_SUCCESS;</div><div>}</div><div><br></div></div><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/<wbr>VTKExamples/site/</a><br>
<br>
<br>
On Tue, Apr 3, 2018 at 1:43 PM, Sebastien Jourdain<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.<wbr>com</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">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">sebastien.jourdain@kitware.<wbr>com</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()-><wbr>PrintSelf(cout, vtkIndent(2));<br>
>>><br>
>>> What I mean was<br>
>>><br>
>>> glyph3D->SetInputConnection(<wbr>reader->GetOutputPort());<br>
>>><br>
>>><br>
>>> On Tue, Apr 3, 2018 at 1:23 PM, Sgouros, Thomas<br>
>>> <<a href="mailto:thomas_sgouros@brown.edu">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<<wbr>vtkParticleReader> reader =<br>
>>>> vtkSmartPointer<<wbr>vtkParticleReader>::New();<br>
>>>>Â Â reader->SetFileName ( filePath.c_str() );<br>
>>>>Â Â reader-><wbr>SetDataByteOrderToBigEndian();<br>
>>>>Â Â reader->Update();<br>
>>>><br>
>>>>Â Â // Create anything you want here, we will use a cube for the demo.<br>
>>>>Â Â vtkSmartPointer<vtkCubeSource> cubeSource =<br>
>>>>Â Â Â Â vtkSmartPointer<vtkCubeSource><wbr>::New();<br>
>>>><br>
>>>>Â Â vtkSmartPointer<vtkGlyph3D> glyph3D =<br>
>>>> vtkSmartPointer<vtkGlyph3D>::<wbr>New();<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">sebastien.jourdain@kitware.<wbr>com</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">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>::<wbr>New();<br>
>>>>>>Â Â glyph3D->SetSourceConnection(<wbr>cubeSource->GetOutputPort());<br>
>>>>>>Â Â glyph3D->SetInputData(<wbr>polydata);<br>
>>>>>>Â Â glyph3D->Update();<br>
>>>>>><br>
>>>>>> And this does not (nothing displayed)?<br>
>>>>>><br>
>>>>>>Â Â vtkSmartPointer<vtkGlyph3D> glyph3D =<br>
>>>>>> vtkSmartPointer<vtkGlyph3D>::<wbr>New();<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/<wbr>Examples/Cxx/Filtering/Glyph3D</a><br>
>>>>>><br>
>>>>>> The 'reader' object is stolen from the ParticleReader example:<br>
>>>>>><br>
>>>>>>Â Â vtkSmartPointer<<wbr>vtkParticleReader> reader =<br>
>>>>>> vtkSmartPointer<<wbr>vtkParticleReader>::New();<br>
>>>>>>Â Â reader->SetFileName ( filePath.c_str() );<br>
>>>>>>Â Â reader-><wbr>SetDataByteOrderToBigEndian();<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/<wbr>opensource/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_<wbr>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=<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/<wbr>listinfo/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/<wbr>opensource/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_<wbr>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=<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/<wbr>listinfo/vtkusers</a><br>
><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Unpaid intern in BillsParadise at noware dot com<br>
</font></span></blockquote></div><br></div>