AW: [Insight-users] how to connect ITK and VTK?
Felix Schwenk
felix.schwenk at nme.at
Fri, 20 Feb 2004 19:02:48 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_0016_01C3F7E4.22185510
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello Nicolas,
if you download the InsightApplications from the itk page and=20
take a look at \Auxiliary\vtk directory you may find some examples=20
that are of use.
=20
felix.
=20
-----Urspr=FCngliche Nachricht-----
Von: insight-users-admin at itk.org [mailto:insight-users-admin at itk.org] Im
Auftrag von Nicolas DUMONT
Gesendet: Freitag, 20. Februar 2004 17:30
An: insight-users at itk.org; vtkusers at vtk.org
Betreff: [Insight-users] how to connect ITK and VTK?
Hello users !=20
=20
I'm a student, novice with itk/vtk. I'm trying to connect Itk to Vtk
along the lines of 'getting started with vtk+itk , Luis Ibanez - William
Schroeder'.
The problem is I cannot find the filter 'ItkImageToVTKImagefilter.h'.=20
=20
I saw that It is also possible to do it using 'itkVtkImageExport' at the
end of the itk pipeline and 'vtkImageImport' at the beginning of the vtk
pipeline.=20
But i cant manage to use 'vtkImageImport': I read the doxygen
documentation about it but I cant figure out which method to use....
=20
Help ! Does someone have a C++ example ?
=20
Thanks in advance,=20
Nicolas Dumont.
=20
I tried to adapt the code found in 'getting started with vtk+itk', here
is it:=20
=20
*****************************************************************
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkVTKImageExport.h"
=20
#include "vtkImageImport.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkImageViewer.h"
=20
int main (int argc, char **argv) {
typedef itk::Image<unsigned short,2> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::VTKImageExport<ImageType> ConnectorType;
=20
ReaderType::Pointer reader =3D ReaderType::New();
ConnectorType::Pointer connector =3D ConnectorType::New();
=20
reader->SetFileName(argv[1]);
connector->SetInput(reader->GetOutput());
=20
vtkImageImport ?????????????????????;
vtkImageViewer * viewer =3D vtkImageViewer::New();
=20
vtkRenderWindowInteractor * renderWindowInteractor =3D
vtkRenderWindowInteractor::New();
=20
viewer->SetupInteractor(renderWindowInteractor);
viewer->SetInput( ???????? );
=20
viewer->Render();
viewer->SetColorWindow(255);
viewer->SetColorLevel(128);
renderWindowInteractor->Start();
=20
return 0;
}
************************************************************************
**
------=_NextPart_000_0016_01C3F7E4.22185510
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<TITLE>Nachricht</TITLE>
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><SPAN class=3D791165817-20022004><FONT face=3DArial color=3D#0000ff =
size=3D2>Hello=20
Nicolas,</FONT></SPAN></DIV>
<DIV><SPAN class=3D791165817-20022004><FONT face=3DArial color=3D#0000ff =
size=3D2>if you=20
download the InsightApplications from the itk page and =
</FONT></SPAN></DIV>
<DIV><SPAN class=3D791165817-20022004><FONT face=3DArial color=3D#0000ff =
size=3D2>take a=20
look at \Auxiliary\vtk directory you may find some examples =
</FONT></SPAN></DIV>
<DIV><SPAN class=3D791165817-20022004><FONT face=3DArial color=3D#0000ff =
size=3D2>that=20
are of use.</FONT></SPAN></DIV>
<DIV><SPAN class=3D791165817-20022004><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D791165817-20022004><FONT face=3DArial color=3D#0000ff =
size=3D2>felix.</FONT></SPAN></DIV>
<DIV><SPAN class=3D791165817-20022004><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV></DIV>
<DIV><FONT face=3DTahoma size=3D2>-----Urspr=FCngliche =
Nachricht-----<BR><B>Von:</B>=20
insight-users-admin at itk.org [mailto:insight-users-admin at itk.org] <B>Im =
Auftrag=20
von </B>Nicolas DUMONT<BR><B>Gesendet:</B> Freitag, 20. Februar 2004=20
17:30<BR><B>An:</B> insight-users at itk.org; =
vtkusers at vtk.org<BR><B>Betreff:</B>=20
[Insight-users] how to connect ITK and VTK?<BR><BR></DIV></FONT>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial size=3D2>Hello users ! </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm a student, novice with itk/vtk. =
I'm trying to=20
connect Itk to Vtk along the lines of 'getting started with vtk+itk , =
Luis=20
Ibanez - William Schroeder'.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The problem is I cannot find the =
filter=20
'ItkImageToVTKImagefilter.h'. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I saw that It is also possible to do=20
it using 'itkVtkImageExport' at the end of the itk pipeline and=20
'vtkImageImport' at the beginning of the vtk pipeline. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>But i cant manage to use =
'vtkImageImport': I read=20
the doxygen documentation about it but I cant figure out which method =
to=20
use....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Help ! Does someone have a C++ =
example=20
?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance, </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Nicolas Dumont.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I tried to adapt the code found in =
'getting=20
started with vtk+itk', here is it: </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV><FONT face=3DArial =
size=3D2>
=
<DIV>*****************************************************************<BR=
>#include=20
"itkImage.h"<BR>#include "itkImageFileReader.h"<BR>#include=20
"itkVTKImageExport.h"</DIV>
<DIV> </DIV>
<DIV>#include "vtkImageImport.h"<BR>#include=20
"vtkRenderWindowInteractor.h"<BR>#include "vtkImageViewer.h"</DIV>
<DIV> </DIV>
<DIV>int main (int argc, char **argv) {<BR> typedef=20
itk::Image<unsigned short,2> ImageType;<BR> typedef=20
=
itk::ImageFileReader<ImageType> ReaderType;<BR> typedef=20
itk::VTKImageExport<ImageType> ConnectorType;</DIV>
<DIV> </DIV>
<DIV> ReaderType::Pointer reader =3D=20
ReaderType::New();<BR> ConnectorType::Pointer connector =3D=20
ConnectorType::New();</DIV>
<DIV> </DIV>
=
<DIV> reader->SetFileName(argv[1]);<BR> connector->SetInp=
ut(reader->GetOutput());</DIV>
<DIV> </DIV>
<DIV>vtkImageImport ?????????????????????;</DIV>
<DIV><BR> vtkImageViewer * viewer =3D =
vtkImageViewer::New();</DIV>
<DIV> </DIV>
<DIV> vtkRenderWindowInteractor * renderWindowInteractor =3D=20
vtkRenderWindowInteractor::New();</DIV>
<DIV> </DIV>
=
<DIV> viewer->SetupInteractor(renderWindowInteractor);<BR> v=
iewer->SetInput(=20
???????? );</DIV>
<DIV> </DIV>
=
<DIV> viewer->Render();<BR> viewer->SetColorWindow(255);<=
BR> viewer->SetColorLevel(128);<BR> renderWindowInteractor-&=
gt;Start();</DIV>
<DIV> </DIV>
<DIV> return 0;<BR>}</FONT></DIV>
<DIV><FONT face=3DArial=20
=
size=3D2>****************************************************************=
**********</FONT></DIV></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0016_01C3F7E4.22185510--