[Paraview] "pseudo" random glyphs

Williams, Sean J seanw at lanl.gov
Wed Feb 8 18:28:21 EST 2012


Well, here's one rather odd way of going about it...

Decide on a probability k to keep a point, which is to say, if you have n points, you want k*n glyphs.

In a python programmable filter, create a new variable "mask." For each point, seed a random number generator [1] with the grid point ID of the point, then generate a float f between 0 and 1 (i.e., the random.random() method). If f >= k, set mask to 1 for that point; otherwise, set mask to 0. (This works because the random number generator always produces the same sequence of numbers for the same seed value, so you'll consistently set the mask to the same value for the same point ID.)

After the programmable filter has run, take a threshold of 1 to 1 on the mask variable. Then just use a glyph filter with "mask points" off.

-Sean

[1] http://docs.python.org/library/random.html
________________________________________
From: paraview-bounces at paraview.org [paraview-bounces at paraview.org] on behalf of joseph insley [insley at mcs.anl.gov]
Sent: Wednesday, February 08, 2012 4:17 PM
To: David E DeMarle
Cc: ParaView
Subject: Re: [Paraview] "pseudo" random glyphs

Thanks, Dave,

That worked great for the case where I have a vtkUnstructeredGrid of tets, where the coordinates of the mesh does not change over time.

I also have a case where I have a grid of points (particle data), where the coordinates of the points change over time.  In this case I'd like to use the same particle (grid point) IDs for the glyphs for each time step.  Using the Resample with Data filter doesn't work in this case, since the coordinates of the particles are different for each time step.  Do you have any other tricks up your sleeve to resolve for this case?

Thanks a bunch,
joe.

On Feb 8, 2012, at 4:37 PM, David E DeMarle wrote:

> Strike that, I wasn't thinking clearly.
>
> Generate the seed points dataset as I said before.
> Now use that and the TVD as inputs to the probe with Resample with
> Dataset filter.
> Then glyph that.
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
>
>
> On Wed, Feb 8, 2012 at 5:33 PM, David E DeMarle
> <dave.demarle at kitware.com> wrote:
>> Not sure if the way the seed points move around over time with time
>> varying data is a bug or a feature.
>>
>> A work around is to use the glyph with custom source filter.
>>
>> To make the custom source that you will use for the seed points, glyph
>> the first time step as you are doing now, but make sure the output
>> type is points. Save that output as a vtk polydata file.
>>
>> Next read that file back in and use it as the source input the glyph
>> with custom source filter.
>>
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 21 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-881-4909
>>
>>
>>
>> On Wed, Feb 8, 2012 at 4:56 PM, joseph insley <insley at mcs.anl.gov> wrote:
>>> Hi,
>>>
>>> Is there a way to generate pseudo-random glyphs on an unstructured grid (or I guess any object for that matter), for time series data? That is, randomly select the points to use, but then use the same points for each time step.  If I understand it correctly, not checking the Random Mode box causes paraview to just select the first N points.  In my case (probably most cases), this concentrates all of the glyphs in one region of the mesh.  Instead, I would like to randomly distribute the glyphs across the mesh, and using the Random Mode for this works fine for a single time step.  But if I want to animate a time series, I would like to show glyphs on the same points for each time time step, rather than have the glyphs jump all over the place.  Is there currently a way of doing this?
>>>
>>> Thanks,
>>> joe.
>>> _______________________________________________
>>> 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.paraview.org/mailman/listinfo/paraview

_______________________________________________
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 ParaView Wiki at: http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview


More information about the ParaView mailing list