[vtkusers] minimum size of scalar glyph

Eric E. Monson emonson at cs.duke.edu
Tue Apr 20 11:56:01 EDT 2010


Hey Adam,

Okay, after looking at the source code again I understand now how it works, and it seems screwy to me. I think the documentation and/or naming of the methods is misleading, and although I'm sure there is some reason behind the way it was written, I can't picture what the use case would be that would lead to this algorithm (or naming of the Clamping method).

Here goes: When you turn ClampingOn, then the algorithm uses the two Range values that you set (Range[0] and Range[1] for min and max). Let's say you are scaling by a scalar value or vector magnitude (vector_components works the same but this calculation is done separately for each x,y,z direction). To determine the eventual scale of your data on the screen, the algorithm calculates this:

1. scale = (scalar value of that particular data index);
2. denominator = Range[1] - Range[0];
3. scale = (scale < Range[0] ? Range[0] : (scale > Range[1] ? Range[1] : scale));
4. scale = (scale - Range[0]) / denominator;
5. scale *= scaleFactor;

If step 4 was left out, then I think this would work how you want it to and how intuitively you would think it should work given the documentation of SetClamping() and SetRange(). In my code I commented out this line, so that's why I felt it was easy to set a minimum glyph size.

With the way it is written, if you have a scalar that ranges from 0 to 1, and you set the Range as [0.5, 1.0], then anything 0.5 or below in your data gets mapped to 0, and top of the range still maps to 1. This may be why your points were "disappearing".

You _can_ set a minimum size with this algorithm by setting the bottom of the Range below your actual minimum value (e.g. if your data went from 0 to 1, you could set Range[0] as -0.5), it's just that the calculation becomes a bit screwy as to how to set the range to get a certain result if your minimum scalar values are not close to zero.

I think I'll fire off a note to the developer's list and see if anyone thinks we could change this behavior to eliminate Step 4 so that it would be more intuitive, or maybe someone can clarify it for me if I'm just not imagining the common usage case that it was written for.

Here's the example code I was playing around with:

http://www.vtk.org/Wiki/VTK/Examples/Python/Visualization/ClampGlyphSizes

Actually, if you have ParaView compiled from source it's not too hard to make a glyph filter which exposes these clamping options and load it as a plugin. (That's what I was finally doing to speed up my playing process.)

Talk to you later,
-Eric


On Apr 19, 2010, at 12:32 PM, Adam Bruss wrote:

> Hi Eric thanks for the response,
>  
> When I turn clamping on all my particles disappear. Changing the range affects the color of particles that are above or below the changed range. The particle sizes are unaffected.
>  
> I’m not seeing a way to affect the size of the scalars except with the scale factor which of course changes all the glyphs.
>  
> Could you investigate how you had it working?
>  
> Thanks,
> Adam
>  
> From: Eric E. Monson [mailto:emonson at cs.duke.edu] 
> Sent: Friday, April 09, 2010 2:27 PM
> To: Adam Bruss
> Cc: vtkusers at vtk.org
> Subject: Re: [vtkusers] minimum size of scalar glyph
>  
> Hey Adam,
>  
> I'm pretty sure there is a way to do this. Look at the combination of ClampingOn() and SetRange(min,max). I think I've used this to do exactly what you're talking about: making sure that the glyphs don't go under a minimum size or over a max size.
>  
> If you have trouble getting it to work I can try it again to make sure it works. (I was using a modified version of the glyph filter that only scaled glyphs along the direction of a vector, not in the other two directions, so I don't remember whether I had also altered this scale clamping functionality...)
>  
> Talk to you later,
> -Eric
>  
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>  
>  
> On Apr 9, 2010, at 11:39 AM, Adam Bruss wrote:
> 
> 
> Hello,
>  
> We’re using vtkglyph3d to represent scalar data. Some of the scalars show up as very small spheres. We would like to set a minimum size that the spheres can be. One can set the PointSize property of an actor to control size. Is there a way to set a minimum size for scalar data rendered with vtkglyph3d? Sort of like anything smaller than x gets the size of x.
>  
> Thanks,
> Adam
> _______________________________________________
> 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
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100420/af3fe9a4/attachment.htm>


More information about the vtkusers mailing list