[vtkusers] Visualizing a vector field from a vtkImageData

Eric E. Monson emonson at cs.duke.edu
Tue Sep 20 10:31:13 EDT 2011


I don't have time to play with it right now, but I suspect the extraction routine is expecting scalars and your "ImageScalars" is the vectors. You could try creating scalars which are the vector magnitudes and then threshold on that.

-Eric


On Sep 20, 2011, at 10:05 AM, David Doria wrote:

>> A (maybe) quick follow up -
>> 
>> The resulting scene is horribly slugglish to interact with, even
>> though it only appears to draw ~200 vectors. I assume this is because
>> it is still "trying" to draw the rest of the vectors, but they are
>> just invisible because they are scaled by the vector magnitude, which
>> is zero (if most of the pixels in the vtkImageData are (0,0,0) (zero
>> vectors) ). Is there a way to tell the Glyph filter to ignore these
>> zero vectors all together?
>> 
>> Thanks,
>> 
>> David
>> 
> 
> I suppose one way to do this is to extract the points based on their
> magnitude before glyphing. I tried to do that here (just extract the
> points, not the glyphing):
> 
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Broken/VectorFieldNonZeroExtraction
> 
> I am getting an error:
> "vtkExtractSelectedThresholds (0x9ba6a40): Could not figure out what
> array to threshold in."
> 
> I thought that's what this line:
> 
> extract->SetInputArrayToProcess(0,0,0,
> vtkDataObject::FIELD_ASSOCIATION_POINTS, "ImageScalars");
> 
> was specifying?
> 
> Any thoughts on how to do this?
> 
> Thanks,
> 
> David




More information about the vtkusers mailing list