<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Nachricht</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=245364714-11102006><FONT face=Arial color=#0000ff size=2>You
are missing the vtkRenderWindowInteractor.</FONT></SPAN></DIV>
<DIV><SPAN class=245364714-11102006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=245364714-11102006><FONT face=Arial color=#0000ff size=2>The
way you are creating the window just opens the window, renders the scence once
and then the function returns and the programm ends.</FONT></SPAN></DIV>
<DIV><SPAN class=245364714-11102006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=245364714-11102006><FONT face=Arial color=#0000ff size=2>Use is
like this:</FONT></SPAN></DIV>
<DIV><SPAN class=245364714-11102006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=245364714-11102006><FONT size=2>
<P>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</P>
<P>iren->SetRenderWindow(renWin);</P>
<P>
<P></FONT><FONT size=2>renWin->Render();</FONT></P></P>
<P><FONT size=2>iren->Start();<SPAN class=245364714-11102006> // this starts
the interactor, and only returns if ypu close the
window</SPAN></FONT></P></SPAN></DIV>
<DIV><SPAN class=245364714-11102006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=245364714-11102006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=de dir=ltr align=left><FONT face=Tahoma
size=2>-----Ursprüngliche Nachricht-----<BR><B>Von:</B> Prename Surname
[mailto:bsd.diverse@gmail.com] <BR><B>Gesendet:</B> Mittwoch, 11. Oktober 2006
16:40<BR><B>An:</B> Erbacher, Markus; vtkusers@vtk.org<BR><B>Betreff:</B> Re:
[vtkusers] How do i port an image from ITK to VTK<BR><BR></FONT></DIV>
<DIV>Hmmm yes, now i can compile.</DIV>
<DIV>But the output just looks very strange...</DIV>
<DIV>A small window with green noise just flashes, and then the program ends.
Maybe i am missing something?</DIV>
<DIV>Thank you very much.</DIV>
<DIV>This is my whole code:</DIV>
<DIV> </DIV>
<DIV>
<P>//Used for the analyze reader<BR>#include "itkImage.h"<BR>#include
"itkImageFileReader.h"<BR>#include "itkImageFileWriter.h"//</P>
<P>#include "itkImageToVTKImageFilter.h"//Makes ITK->VTK pipeline (remember
to set path in CMakeLists.txt firs)</P>
<P>#include "vtkImageViewer.h"//Makes 2D images in VTK</P>
<P>//Use for volumerendering<BR>#include
"vtkStructuredPointsReader.h"<BR>#include "vtkPiecewiseFunction.h"<BR>#include
"vtkColorTransferFunction.h"<BR>#include "vtkVolumeProperty.h" <BR>#include
"vtkVolumeRayCastCompositeFunction.h"<BR>#include
"vtkVolumeRayCastMapper.h"<BR>#include "vtkVolume.h"</P>
<P><BR>//Used for the vtk examples<BR>#include "vtkSphereSource.h"<BR>#include
"vtkPolyDataMapper.h"<BR>#include "vtkActor.h"<BR>#include
"vtkRenderWindow.h"<BR>#include "vtkRenderer.h "<BR>#include
"vtkRenderWindowInteractor.h"</P>
<P>#include "itkVTKImageExport.h"<BR>#include "vtkImageImport.h"</P>
<P>//Used for string manipulation in c++<BR>#include
<strstream><BR>#include <string><BR>#include <iostream></P>
<P>void showSphere();<BR>void readAFile();</P>
<P>int main( int , char * argv[])<BR>{<BR> typedef unsigned char
PixelType;<BR> const unsigned int Dimension=3;<BR> <BR> typedef
itk::Image<PixelType,Dimension> ImageType;<BR> typedef
itk::ImageFileReader<ImageType> ReaderType; <BR> typedef
itk::ImageToVTKImageFilter<ImageType> ConnectorType;</P>
<P> ReaderType::Pointer reader =
ReaderType::New();<BR> ConnectorType::Pointer connector =
ConnectorType::New();<BR> <BR> reader->SetFileName("D:\\skole\\thesis\\Data\\KDIGWKFN\\ANALYZE\\KDIGWKFN_mpr_pip.img");
<BR> connector->SetInput(reader->GetOutput());//In connector lies
now the imagedata. Retrieve it by calling
GetOutput()<BR> <BR> vtkStructuredPointsReader
*vtkReader=vtkStructuredPointsReader::New();<BR> </P>
<P> //Create transfer mapping scalar value to
color<BR> vtkPiecewiseFunction
*opacityTransferfunction=vtkPiecewiseFunction::New();<BR> opacityTransferfunction->AddPoint(20.,0.0);<BR> opacityTransferfunction->AddPoint(255.,
0.2);</P>
<P> vtkColorTransferFunction
*colorTransferFunction=vtkColorTransferFunction::New();<BR> colorTransferFunction->AddRGBPoint(0.0,0.0,0.0,0.0);<BR> colorTransferFunction->AddRGBPoint(64.0,1.0,0.0,0.0);<BR> colorTransferFunction->AddRGBPoint(
128.0,0.0,0.0,1.0);<BR> colorTransferFunction->AddRGBPoint(192.0,0.0,1.0,0.0);<BR> colorTransferFunction->AddRGBPoint(255.0,0.0,0.2,0.0);</P>
<P> vtkVolumeProperty
*volumeProperty=vtkVolumeProperty::New();<BR> volumeProperty->SetColor(colorTransferFunction);<BR> volumeProperty->SetScalarOpacity(opacityTransferfunction);</P>
<P> vtkVolumeRayCastCompositeFunction *compositeFunction =
vtkVolumeRayCastCompositeFunction::New();<BR> vtkVolumeRayCastMapper
*volumeMapper=vtkVolumeRayCastMapper::New();<BR> volumeMapper->SetVolumeRayCastFunction(compositeFunction);
<BR> volumeMapper->SetInput(connector->GetOutput());<BR> <BR> vtkVolume
*volume=vtkVolume::New();<BR> volume->SetMapper(volumeMapper);<BR> volume->SetProperty(volumeProperty);</P>
<P> // A renderer and render window<BR> vtkRenderer *ren1 =
vtkRenderer::New();<BR> vtkRenderWindow *renWin =
vtkRenderWindow::New();<BR> ren1->AddProp(volume);<BR> renWin->AddRenderer(ren1);<BR> renWin->Render();
<BR> return 0;<BR>}</P><BR><BR> </DIV>
<DIV><SPAN class=gmail_quote>2006/10/11, Erbacher, Markus <<A
href="mailto:Markus.Erbacher@med.uni-heidelberg.de">Markus.Erbacher@med.uni-heidelberg.de</A>>:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>I think you can use
</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN>vtkVolumeRayCastMapper->SetInput( ...)</SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Regards</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Markus</FONT></SPAN></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV lang=de dir=ltr align=left><FONT face=Tahoma
size=2>-----Ursprüngliche Nachricht-----<BR><B>Von:</B>
vtkusers-bounces+markus.erbacher=<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:med.uni-heidelberg.de@vtk.org" target=_blank>
med.uni-heidelberg.de@vtk.org</A> [mailto:<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:vtkusers-bounces+markus.erbacher=med.uni-heidelberg.de@vtk.org"
target=_blank>vtkusers-bounces+markus.erbacher=med.uni-heidelberg.de@vtk.org
</A>] <B>Im Auftrag von </B>Prename Surname<BR><B>Gesendet:</B> Mittwoch,
11. Oktober 2006 16:08<BR><B>An:</B> Brian Chacko; <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:vtkusers@vtk.org"
target=_blank>vtkusers@vtk.org</A><BR><B>Betreff:</B> Re: [vtkusers] How
do i port an image from ITK to VTK<BR><BR></FONT></DIV>
<DIV>Hello Brian.</DIV>
<DIV>I have tried to do what you said, and it makes good sense. I think i
almost got i working, but i still have a doubt about how exactly i can
connect the </DIV>
<DIV>itk::ImageToVTKImageFilter to the vtkVolumeRayCastMapper.</DIV>
<DIV>It seems that ImageToVTKImageFilter->GetOutput(...) returns
a vtkImageData, and </DIV>
<DIV>vtkVolumeRayCastMapper->SetInputConnection(...) only accepts a
vtkAlgorithmOutput object.</DIV>
<DIV> </DIV>
<DIV>So how do i do the final mapping? I really hope you can help me, or
any others can. </DIV>
<DIV> </DIV>
<DIV>Many regards</DIV>
<DIV> </DIV>
<DIV>Here is the code:</DIV>
<DIV>
<P>int main( int , char * argv[])<BR>{<BR> typedef unsigned char
PixelType;<BR> const unsigned int
Dimension=3;<BR> <BR> typedef
itk::Image<PixelType,Dimension> ImageType;<BR> typedef
itk::ImageFileReader<ImageType> ReaderType; <BR> typedef
itk::ImageToVTKImageFilter<ImageType> ConnectorType;</P>
<P> ReaderType::Pointer reader =
ReaderType::New();<BR> ConnectorType::Pointer connector =
ConnectorType::New();<BR> <BR> reader->SetFileName("D:\\skole\\thesis\\Data\\KDIGWKFN\\ANALYZE\\KDIGWKFN_mpr_pip.img");
<BR> connector->SetInput(reader->GetOutput());//In connector
lies now the imagedata. Retrieve it by calling
GetOutput()<BR> <BR> vtkStructuredPointsReader
*vtkReader=vtkStructuredPointsReader::New();<BR> </P>
<P> //Create transfer mapping scalar value to
color<BR> vtkPiecewiseFunction
*opacityTransferfunction=vtkPiecewiseFunction::New();<BR> opacityTransferfunction->AddPoint(20.,0.0);<BR> opacityTransferfunction->AddPoint(255.,
0.2);</P>
<P> vtkColorTransferFunction
*colorTransferFunction=vtkColorTransferFunction::New();<BR> colorTransferFunction->AddRGBPoint(0.0,0.0,0.0,0.0);<BR> colorTransferFunction->AddRGBPoint(64.0,1.0,0.0,0.0);<BR> colorTransferFunction->AddRGBPoint(
128.0,0.0,0.0,1.0);<BR> colorTransferFunction->AddRGBPoint(192.0,0.0,1.0,0.0);<BR> colorTransferFunction->AddRGBPoint(255.0,0.0,0.2,0.0);</P>
<P> vtkVolumeProperty
*volumeProperty=vtkVolumeProperty::New();<BR> volumeProperty->SetColor(colorTransferFunction);<BR> volumeProperty->SetScalarOpacity(opacityTransferfunction);</P>
<P> vtkVolumeRayCastCompositeFunction
*compositeFunction=vtkVolumeRayCastCompositeFunction::New();<BR> vtkVolumeRayCastMapper
*volumeMapper=vtkVolumeRayCastMapper::New();<BR> volumeMapper->SetVolumeRayCastFunction(compositeFunction);
<BR> <BR> volumeMapper->SetInputConnection(connector->GetOutput());
//This i cannot do. What should i do instead?</P></DIV>
<DIV> </DIV>
<DIV><SPAN class=gmail_quote>2006/10/11, Brian Chacko <<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:brianchacko@yahoo.com"
target=_blank>brianchacko@yahoo.com</A>>:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV>Hello! </DIV>
<DIV>I suggest you go through the link given below. It gives basics of
using ITK and visualizing in VTK.</DIV>
<DIV><A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf"
target=_blank>http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf</A><BR> </DIV>
<DIV>[P.N The header file itkImageToVTKImageFilter.h is not available as
it is, when you download the ITK software source. Download <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://prdownloads.sourceforge.net/itk/InsightApplications-2.8.1.zip?download"
target=_blank> InsightApplications-2.8.1.zip</A>. It is available in the
ITK download page. Include the header file with the .cxx file in the VTK
5.0\IO\ (or any sub folder of vtk 5.0 which contains headers
and source files). Remember to include the appropriate library file in
your CMakeLists.txt)].</DIV>
<DIV> </DIV>
<DIV>To visualize volume view, try out the volume example in VTK
folder </DIV>
<DIV>Directory path is "\VTK
5.0\Examples\VolumeRendering\Tcl\SimpleRayCast.tcl".</DIV>
<DIV><BR>Regards</DIV>
<DIV>Brian</DIV><SPAN><B><I></I></B>
<DIV><B><I></I></B> </DIV>
<DIV><B><I></I></B> </DIV>
<DIV><B><I>Prename Surname <<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:bsd.diverse@gmail.com"
target=_blank>bsd.diverse@gmail.com</A>></I></B> wrote:</DIV></SPAN>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<DIV><SPAN>
<DIV>
<DIV>Hello</DIV>
<DIV>I am reading files from ANALYZE format in ITK. I do processing of
the image, and then i want to visualize it in VTK.</DIV>
<DIV>So my question is how i get the data fra ITK to VTK, and is
it then difficult to show a volumne view of the data in VTK?</DIV>
<DIV>A codeexample would be very nice. Thank you very much</DIV>
<DIV> </DIV>
<DIV>Best of
regards</DIV></DIV></SPAN></DIV><SPAN>_______________________________________________<BR>This
is the private VTK discussion list. <BR>Please keep messages on-topic.
Check the FAQ at: <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.vtk.org/Wiki/VTK_FAQ"
target=_blank>http://www.vtk.org/Wiki/VTK_FAQ</A><BR>Follow this link
to subscribe/unsubscribe:<BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.vtk.org/mailman/listinfo/vtkusers"
target=_blank>http://www.vtk.org/mailman/listinfo/vtkusers
</A><BR></SPAN></BLOCKQUOTE><SPAN><BR>
<P>
<HR SIZE=1>
How low will we go? Check out Yahoo! Messenger's low <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://us.rd.yahoo.com/mail_us/taglines/postman8/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com"
target=_blank>PC-to-Phone call rates. </A>
<P></P>
<P></P>
<P></P>
<P></P></SPAN></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></DIV></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>