[vtkusers] Help with ITK and vtkTensorGlyph

Gonza Barrio gnzbar at gmail.com
Wed Dec 2 14:17:43 EST 2009


Hello,

I have been trying to create a pipeline to visualize *ITK* data with *
vtkTensorGlyph* in the same way defined in the example *TestPlaneWidget*.cxx.


But it seems *ITK* creates conflict with the *vtkProbeFilter* class, and I'm
wondering what will be best way to convert the *ITK* data so I can feed it
into *vtkTensorGlyph*.

This is my code:

[...]
*// ITK to VTK code*
     vtkImageImport* vtkImporter = vtkImageImport::New();
     typedef itk::Image< TensorPixelType, 3 >    Vector3DImageType;
     typedef itk::VTKImageExport<Vector3DImageType > VTKexporterVectorType;
     VTKexporterVectorType::Pointer VTKexporterVector =
VTKexporterVectorType::New();
     VTKexporterVector->SetInput ( ITK_image );
     ConnectPipelines(VTKexporterVector, vtkImporter);
     vtkImporter->GetOutput()->Update();
     vtkImageData* data = vtkImporter->GetOutput();

*//Glyph and probe filter*
            vtkPolyData* plane=vtkPolyData::New();
            vtkTensorGlyph* g3d=vtkTensorGlyph::New();
            vtkProbeFilter* probe=vtkProbeFilter::New();
            probe->SetSource((vtkDataSet*)data);
            probe->SetInput (plane);
            probe->SpatialMatchOn();
            probe->Update();
            g3d->SetInput(probe->GetOutput());
            g3d->SetSource( cone->GetOutput());

        GCallback* glyphCallback=GCallback::New();
        glyphCallback->PolyData=plane;
        glyphCallback->Actor=m_Actor;
        m_planeWidget->SetInteractor(mRen->GetInteractor());
        m_planeWidget->SetInput(data);
        m_planeWidget->PlaceWidget();
        m_planeWidget->On();
[...]

*//Calback for filtering*
class GCallback : public vtkCommand
{
    public:

    static GCallback *New()
    {return new GCallback;}

    virtual void Execute (vtkObject* caller, unsigned long, void*)
    {
        vtkPlaneWidget*
planeWidget=reinterpret_cast<vtkPlaneWidget*>(caller);
        planeWidget->GetPolyData(this->PolyData);
        this->Actor->VisibilityOn();
    }

    GCallback():PolyData(0),Actor(0){}
    vtkPolyData* PolyData;
    vtkActor* Actor;
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091202/009e8cd9/attachment.htm>


More information about the vtkusers mailing list