[vtkusers] "Convert" output of vtkImageExtractComponents to a vector?

Cory Quammen cquammen at cs.unc.edu
Wed Aug 29 10:04:56 EDT 2012


David,

I just figured it out. I needed to slip in a vtkAssignAttribute filter
prior to the vtkGlyph3D filter like this:

vtkImageData -> vtkAssignAttribute -> vtkGlyph3D

For the vtkAssignAttribute filter, I call

vtkAssignAttribute::Assign( vtkDataSetAttributes::SCALARS,
vtkDataSetAttributes::VECTORS, vtkAssignAttribute::POINT_DATA );

- Cory

On Tue, Aug 28, 2012 at 5:26 PM, Cory Quammen <cquammen at cs.unc.edu> wrote:
> David,
>
> Thanks for your quick reply.
>
> I did try your suggestion, but it didn't work. I also tried
>
> imageData->GetPointData()->SetVectors(imageData->GetPointData()->GetScalars());
> imageData->SetActiveVectors(
> imageData->GetPointData()->GetScalars()->GetName() )
>
> Also, I'm working on a deep copy of the output of the
> vtkImageExtractComponents with the thought that the pipeline might
> have been clobbering my setting of the active vectors, but that
> doesn't seem to matter.
>
> Thanks,
> Cory
>
> On Tue, Aug 28, 2012 at 5:18 PM, David Doria <daviddoria at gmail.com> wrote:
>> On Tue, Aug 28, 2012 at 5:11 PM, Cory Quammen <cquammen at cs.unc.edu> wrote:
>>> Hi all,
>>>
>>> I am using vtkImageExtractComponents to produce an image with three
>>> components per pixel. I would like to treat these three components as
>>> a vector field to pass to vtkGlyph3D. However, the data coming out of
>>> vtkImageExtractComponents is treated as a scalar field rather than a
>>> vector field, so I can't orient the glyphs according to the vectors in
>>> this data array.
>>>
>>> What might I do to get vtkGlyph3D to recognize this three-component
>>> image data as a vector so that it can orient glyphs along the vector
>>> direction? I'm assuming it's something simple, but everything I've
>>> tried doesn't work.
>>>
>>> Thank you in advance,
>>> Cory
>>
>> Did you try:
>>
>> imageData->GetPointData()->SetVectors(imageData->GetPointData()->GetScalars());
>>
>> ? (I've never done this, but it seems worth a try).
>>
>> David
>
>
>
> --
> Cory Quammen
> Research Associate
> Department of Computer Science
> The University of North Carolina at Chapel Hill



-- 
Cory Quammen
Research Associate
Department of Computer Science
The University of North Carolina at Chapel Hill



More information about the vtkusers mailing list