<div dir="ltr">Thank you, this is very kind again. How did you convert it?<div><br></div><div>I would expect that a reader that did not read a file properly would issue an error message. But perhaps I should modify those expectations.</div><div><br></div><div>Thank you,</div><div><br></div><div><div> -Tom</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 6, 2018 at 8:21 PM, kenichiro yoshimi <span dir="ltr"><<a href="mailto:rccm.kyoshimi@gmail.com" target="_blank">rccm.kyoshimi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Tom,<br>
<br>
At last I can replicate your problem. This may be caused by not<br>
selecting an appropriate reader.<br>
<br>
vtkParticleReader can't read output_p40.vtk you upload since the<br>
expected format is something like:<br>
 x, y, z, scalar<br>
It also allows for x\ty\tz\tscalar or x y z scalar. See the<br>
documentation about vtkParticleReader.<br>
<a href="https://www.vtk.org/doc/nightly/html/classvtkParticleReader.html#details" rel="noreferrer" target="_blank">https://www.vtk.org/doc/<wbr>nightly/html/<wbr>classvtkParticleReader.html#<wbr>details</a><br>
<br>
The correct way to read output_p40.vtk is to use vtkPolyDataReader<br>
rather than vtkParticleReader.<br>
<br>
I hope this will be of some help.<br>
Thanks,<br>
<div class="HOEnZb"><div class="h5"><br>
2018-04-07 3:30 GMT+09:00 Sgouros, Thomas <<a href="mailto:thomas_sgouros@brown.edu">thomas_sgouros@brown.edu</a>>:<br>
> Thank you, you are very kind to have taken this time. My original program<br>
> does indeed work with your data and your data is the same as mine, but the<br>
> data files are in different formats, even though they are both ASCII and<br>
> contain the same data. The top of my file looks like this:<br>
><br>
> # vtk DataFile Version 2.0<br>
> particlePositions<br>
> ASCII<br>
> DATASET POLYDATA<br>
> POINTS 5111 float<br>
> 13.451000 37.225000 0.417060<br>
> 14.771000 10.352000 17.837000<br>
> 18.511000 32.313000 12.778000<br>
> 0.644430 21.956000 50.414000<br>
> 12.346000 22.660000 50.371000<br>
> 7.361000 7.991100 45.339000<br>
> 24.999000 16.144000 27.909000 ...<br>
><br>
> There are 5,111 data points in this file, followed by a few thousand 1.0's.<br>
><br>
> The top of the file you sent back to me looks like this, and this one works<br>
> fine.<br>
><br>
> 13.451000 37.225000 0.417060 1.0<br>
> 14.771000 10.352000 17.837000 1.0<br>
> 18.511000 32.313000 12.778000 1.0<br>
> 0.644430 21.956000 50.414000 1.0<br>
> 12.346000 22.660000 50.371000 1.0<br>
> 7.361000 7.991100 45.339000 1.0<br>
> 24.999000 16.144000 27.909000 1.0 ...<br>
><br>
> Both files read without obvious error, but only one of them shows data. Can<br>
> anyone explain this to me? Or is there somewhere I should be looking for<br>
> errors? (And what did you use to convert it?)<br>
><br>
> Many thanks,<br>
><br>
>  -Tom<br>
><br>
><br>
> On Fri, Apr 6, 2018 at 10:49 AM, kenichiro yoshimi <<a href="mailto:rccm.kyoshimi@gmail.com">rccm.kyoshimi@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hello Tom,<br>
>><br>
>> Your code and data work without any problem and display glyphs. The<br>
>> testing data is attached.<br>
>> There is some doubt whether the problem always occurs.<br>
>><br>
>> Thanks,<br>
>><br>
>> 2018-04-04 5:54 GMT+09:00 Sgouros, Thomas <<a href="mailto:thomas_sgouros@brown.edu">thomas_sgouros@brown.edu</a>>:<br>
>> > "It is often some unexpected minor thing that causes the failure."<br>
>> ><br>
>> > I'm certain of that.<br>
>> ><br>
>> > Here's the code, mostly pinched straight from the Glyph3D example. (And<br>
>> > I've<br>
>> > tried swapping the endianness, just for giggles.) The data is an ASCII<br>
>> > vtk<br>
>> > file that you can get from <a href="http://sgouros.com/output_p40.vtk" rel="noreferrer" target="_blank">sgouros.com/output_p40.vtk</a>.<br>
>> ><br>
>> > Thank you,<br>
>> ><br>
>> >  -Tom<br>
>> ><br>
>> ><br>
>> > #include <vtkVersion.h><br>
>> > #include <vtkSmartPointer.h><br>
>> > #include <vtkCubeSource.h><br>
>> > #include <vtkPolyData.h><br>
>> > #include <vtkPoints.h><br>
>> > #include <vtkGlyph3D.h><br>
>> > #include <vtkCellArray.h><br>
>> > #include <vtkPolyDataMapper.h><br>
>> > #include <vtkActor.h><br>
>> > #include <vtkRenderWindow.h><br>
>> > #include <vtkRenderer.h><br>
>> > #include <vtkRenderWindowInteractor.h><br>
>> > #include <vtkParticleReader.h><br>
>> > #include <vtkPolyDataMapper.h><br>
>> ><br>
>> ><br>
>> > int main(int argc, char* argv[]) {<br>
>> ><br>
>> >   std::string filePath = argv[1];<br>
>> >   vtkSmartPointer<<wbr>vtkParticleReader> reader =<br>
>> >     vtkSmartPointer<<wbr>vtkParticleReader>::New();<br>
>> ><br>
>> >   reader->SetFileName ( filePath.c_str() );<br>
>> >   // if nothing gets displayed or totally wrong, swap the endianness<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>
>> ><br>
>> >   glyph3D->SetSourceConnection(<wbr>cubeSource->GetOutputPort());<br>
>> >   glyph3D->SetInputConnection(<wbr>reader->GetOutputPort());<br>
>> ><br>
>> >   glyph3D->Update();<br>
>> ><br>
>> >   std::cout << *(reader->GetOutput()) << std::endl;<br>
>> ><br>
>> >   // Visualize<br>
>> >   vtkSmartPointer<<wbr>vtkPolyDataMapper> mapper =<br>
>> >     vtkSmartPointer<<wbr>vtkPolyDataMapper>::New();<br>
>> >   mapper->SetInputConnection(<wbr>glyph3D->GetOutputPort());<br>
>> ><br>
>> >   vtkSmartPointer<vtkActor> actor =<br>
>> >     vtkSmartPointer<vtkActor>::<wbr>New();<br>
>> >   actor->SetMapper(mapper);<br>
>> ><br>
>> >   vtkSmartPointer<vtkRenderer> renderer =<br>
>> >     vtkSmartPointer<vtkRenderer>::<wbr>New();<br>
>> >   vtkSmartPointer<<wbr>vtkRenderWindow> renderWindow =<br>
>> >     vtkSmartPointer<<wbr>vtkRenderWindow>::New();<br>
>> >   renderWindow->AddRenderer(<wbr>renderer);<br>
>> >   vtkSmartPointer<<wbr>vtkRenderWindowInteractor> renderWindowInteractor =<br>
>> >     vtkSmartPointer<<wbr>vtkRenderWindowInteractor>::<wbr>New();<br>
>> >   renderWindowInteractor-><wbr>SetRenderWindow(renderWindow);<br>
>> ><br>
>> >   renderer->AddActor(actor);<br>
>> >   renderer->SetBackground(.3, .6, .3); // Background color green<br>
>> ><br>
>> >   renderWindow->Render();<br>
>> >   renderWindowInteractor->Start(<wbr>);<br>
>> ><br>
>> >   return EXIT_SUCCESS;<br>
>> > }<br>
>> ><br>
>> ><br>
>> > On Tue, Apr 3, 2018 at 4:46 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> 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>
>> >> <<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<br>
>> >> > points).<br>
>> >> ><br>
>> >> > How do you render the glyph3d filter? Using a polydata mapper? I'm<br>
>> >> > guessing<br>
>> >> > no issue on that end?<br>
>> >> ><br>
>> >> > Ideally you should use the glyph mapper instead of the filter. But if<br>
>> >> > 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<br>
>> >> > <<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<br>
>> >> >> spheres,<br>
>> >> >> not little flat rectangles and I thought I could just redirect that<br>
>> >> >> 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<br>
>> >> >>> 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,<br>
>> >> >>>> and<br>
>> >> >>>> reader->Update() is called before I use its GetOutput().  In situ,<br>
>> >> >>>> it<br>
>> >> >>>> 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<br>
>> >> >>>> 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<br>
>> >> >>>> of<br>
>> >> >>>> the dataset directly.<br>
>> >> >>>><br>
>> >> >>>> Is there a way to peek inside glyph3D and see what it thinks it<br>
>> >> >>>> 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<br>
>> >> >>>>> 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<br>
>> >> >>>>>> shows all<br>
>> >> >>>>>> the data points. But I want to see them as glyphs, not little<br>
>> >> >>>>>> squares. I<br>
>> >> >>>>>> seem to be misunderstanding something fundamental, but not<br>
>> >> >>>>>> seeing<br>
>> >> >>>>>> 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:<br>
>> >> >>>>>> <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>
>> >> --<br>
>> >> Unpaid intern in BillsParadise at noware dot com<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>
</div></div></blockquote></div><br></div>