[Insight-users] View of a Mesh and Image data.

Luis Ibanez luis.ibanez@kitware.com
Tue, 24 Sep 2002 20:30:38 -0400


Hi Samuel,


ITK itself does not provide any visualization functionalities.



One possible option is to take advantage of the connection
between ITK and VTK.


You can connect the ITK image (produced as output of any itk
filter) into a VTK filter. This is done using the classes:

    - itk::VTKImageExporter
    - vtkImageImporter

An example illustrating how to this is available at

              Insight/Auxiliary/vtk/

in the file:

               itkVTKtoITKtoVTK.cxx


The image is connected by code similar to the following.

typedef itk::Image<float, 3> ImageType;
typedef itk::VTKImageExport<ImageType> ImageExportType;

ImageExportType::Pointer itkexporter =3D ImageExportType::New();
itkexporter->SetInput( ....the last filter in the ITK pipeline....);

vtkImageImport* vtkimporter =3D vtkImageImport::New();
=20
vtkimporter->SetUpdateInformationCallback(itkexporter->GetUpdateInformati=
onCallback());
vtkimporter->SetPipelineModifiedCallback(itkexporter->GetPipelineModified=
Callback());
vtkimporter->SetWholeExtentCallback(itkexporter->GetWholeExtentCallback()=
);
vtkimporter->SetSpacingCallback(itkexporter->GetSpacingCallback());
vtkimporter->SetOriginCallback(itkexporter->GetOriginCallback());
vtkimporter->SetScalarTypeCallback(itkexporter->GetScalarTypeCallback());=

vtkimporter->SetNumberOfComponentsCallback(itkexporter->GetNumberOfCompon=
entsCallback());
vtkimporter->SetPropagateUpdateExtentCallback(itkexporter->GetPropagateUp=
dateExtentCallback());
vtkimporter->SetUpdateDataCallback(itkexporter->GetUpdateDataCallback());=

vtkimporter->SetDataExtentCallback(itkexporter->GetDataExtentCallback());=

vtkimporter->SetBufferPointerCallback(itkexporter->GetBufferPointerCallba=
ck());
vtkimporter->SetCallbackUserData(itkexporter->GetCallbackUserData());



This will allow you to use any of the VTK means for visualizing the
volume data set. An Update() in the VTK pipeline will trigger an update
on the ITK pipeline and image data will be transfer between the two.




For visualizing the Mesh, you can map the ITK Mesh into a VTK mesh
by following the example in


             Insight/Auxiliary/vtk2itk.cxx


The itk::Mesh is mapped here into a vtkUnstructuredGrid, that you can
then render using VTK filters.

If you render both objects in the same vtkRenderWindow you can manage
to overlap them in space.



Please let us know if you need additional details for doing this
visualization.



Thanks


    Luis


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
Samuel Rodr=EDguez Bescos wrote:

> Hello again,
>=20
> =20
>=20
> Could everybody tell me how can I represent the Mesh resulted of the=20
> DeformableMeshFilter and the initial data in the same view.
>=20
> =20
>=20
> Thanks in advance,
>=20
> =20
>=20
> Sam
>=20