[vtkusers] vtkParticleReader and vtkGlyph3D
Sgouros, Thomas
thomas_sgouros at brown.edu
Tue Apr 3 15:47:29 EDT 2018
This is reader->GetOutput()
vtkPolyData (0x7f8ce050dad0)
Debug: Off
Modified Time: 217
Reference Count: 1
Registered Events: (none)
Information: 0x7f8ce050d9b0
Data Released: False
Global Release Data: Off
UpdateTime: 218
Field Data:
Debug: Off
Modified Time: 167
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 10229
Number Of Cells: 10229
It goes on for quite a bit more. As I said, when I feed this to a
vtkPolyDataMapper, it displays and works fine, but I want little spheres,
not little flat rectangles and I thought I could just redirect that into
the vtkGlyph3D object, but I must be misunderstanding something.
Thank you,
-Tom
On Tue, Apr 3, 2018 at 3:26 PM, Sebastien Jourdain <
sebastien.jourdain at kitware.com> wrote:
> You can try to see what the GetOutput() contains as my assumption it would
> be empty (No points => Number of Points: 0).
>
> reader->GetOutput()->PrintSelf(cout, vtkIndent(2));
>
> What I mean was
>
> glyph3D->SetInputConnection(reader->GetOutputPort());
>
>
> On Tue, Apr 3, 2018 at 1:23 PM, Sgouros, Thomas <thomas_sgouros at brown.edu>
> wrote:
>
>> Hi Sebastien:
>>
>> Sorry if that was unclear. The third block of code comes first, and
>> reader->Update() is called before I use its GetOutput(). In situ, it looks
>> like this:
>>
>> ...
>> vtkSmartPointer<vtkParticleReader> reader =
>> vtkSmartPointer<vtkParticleReader>::New();
>> reader->SetFileName ( filePath.c_str() );
>> reader->SetDataByteOrderToBigEndian();
>> reader->Update();
>>
>> // Create anything you want here, we will use a cube for the demo.
>> vtkSmartPointer<vtkCubeSource> cubeSource =
>> vtkSmartPointer<vtkCubeSource>::New();
>>
>> vtkSmartPointer<vtkGlyph3D> glyph3D = vtkSmartPointer<vtkGlyph3D>::N
>> ew();
>> glyph3D->SetSourceConnection(cubeSource->GetOutputPort());
>> glyph3D->SetInputData(reader->GetOutput());
>> glyph3D->Update();
>>
>> ...
>>
>> I don't think I understand what you mean by the connection instead of the
>> dataset directly.
>>
>> Is there a way to peek inside glyph3D and see what it thinks it has?
>>
>> Thank you,
>>
>> -Tom
>>
>>
>> On Tue, Apr 3, 2018 at 2:53 PM, Sebastien Jourdain <
>> sebastien.jourdain at kitware.com> wrote:
>>
>>> Tom,
>>>
>>> Just make sure that reader->Update(); was called before
>>> glyph3D->SetInputData(reader->GetOutput());
>>> But it would be better to use the connection instead of the dataset
>>> directly.
>>>
>>> Seb
>>>
>>> On Tue, Apr 3, 2018 at 12:27 PM, Sgouros, Thomas <
>>> thomas_sgouros at brown.edu> wrote:
>>>
>>>> Hello all:
>>>>
>>>> Can someone help me understand why this code works:
>>>>
>>>> vtkSmartPointer<vtkGlyph3D> glyph3D = vtkSmartPointer<vtkGlyph3D>::N
>>>> ew();
>>>> glyph3D->SetSourceConnection(cubeSource->GetOutputPort());
>>>> glyph3D->SetInputData(polydata);
>>>> glyph3D->Update();
>>>>
>>>> And this does not (nothing displayed)?
>>>>
>>>> vtkSmartPointer<vtkGlyph3D> glyph3D = vtkSmartPointer<vtkGlyph3D>::N
>>>> ew();
>>>> glyph3D->SetSourceConnection(cubeSource->GetOutputPort());
>>>> glyph3D->SetInputData(reader->GetOutput());
>>>> glyph3D->Update();
>>>>
>>>> The first clip is from https://www.vtk.org/Wiki/
>>>> VTK/Examples/Cxx/Filtering/Glyph3D
>>>>
>>>> The 'reader' object is stolen from the ParticleReader example:
>>>>
>>>> vtkSmartPointer<vtkParticleReader> reader =
>>>> vtkSmartPointer<vtkParticleReader>::New();
>>>> reader->SetFileName ( filePath.c_str() );
>>>> reader->SetDataByteOrderToBigEndian();
>>>> reader->Update();
>>>>
>>>> The program compiles, but no data appears. It works fine (data appears)
>>>> in the context of the ParticleReader example, where it shows all the data
>>>> points. But I want to see them as glyphs, not little squares. I seem to be
>>>> misunderstanding something fundamental, but not seeing what it could be.
>>>>
>>>> Many thanks,
>>>>
>>>> -Tom
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>>
>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> https://vtk.org/mailman/listinfo/vtkusers
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180403/7dd998dd/attachment.html>
More information about the vtkusers
mailing list