<!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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><SPAN class=245364714-11102006><FONT size=2>
<P>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</P>
<P>iren-&gt;SetRenderWindow(renWin);</P>
<P>
<P></FONT><FONT size=2>renWin-&gt;Render();</FONT></P></P>
<P><FONT size=2>iren-&gt;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>&nbsp;</DIV>
<DIV><SPAN class=245364714-11102006><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</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>&nbsp;</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-&gt;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 
  &lt;strstream&gt;<BR>#include &lt;string&gt;<BR>#include &lt;iostream&gt;</P>
  <P>void showSphere();<BR>void readAFile();</P>
  <P>int main( int , char * argv[])<BR>{<BR>&nbsp;typedef unsigned char 
  PixelType;<BR>&nbsp;const unsigned int Dimension=3;<BR>&nbsp;<BR>&nbsp;typedef 
  itk::Image&lt;PixelType,Dimension&gt; ImageType;<BR>&nbsp;typedef 
  itk::ImageFileReader&lt;ImageType&gt; ReaderType; <BR>&nbsp;typedef 
  itk::ImageToVTKImageFilter&lt;ImageType&gt; ConnectorType;</P>
  <P>&nbsp;ReaderType::Pointer reader = 
  ReaderType::New();<BR>&nbsp;ConnectorType::Pointer connector = 
  ConnectorType::New();<BR>&nbsp;<BR>&nbsp;reader-&gt;SetFileName("D:\\skole\\thesis\\Data\\KDIGWKFN\\ANALYZE\\KDIGWKFN_mpr_pip.img"); 
  <BR>&nbsp;connector-&gt;SetInput(reader-&gt;GetOutput());//In connector lies 
  now the imagedata. Retrieve it by calling 
  GetOutput()<BR>&nbsp;<BR>&nbsp;vtkStructuredPointsReader 
  *vtkReader=vtkStructuredPointsReader::New();<BR>&nbsp;</P>
  <P>&nbsp;//Create transfer mapping scalar value to 
  color<BR>&nbsp;vtkPiecewiseFunction 
  *opacityTransferfunction=vtkPiecewiseFunction::New();<BR>&nbsp;opacityTransferfunction-&gt;AddPoint(20.,0.0);<BR>&nbsp;opacityTransferfunction-&gt;AddPoint(255., 
  0.2);</P>
  <P>&nbsp;vtkColorTransferFunction 
  *colorTransferFunction=vtkColorTransferFunction::New();<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(0.0,0.0,0.0,0.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(64.0,1.0,0.0,0.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint( 
  128.0,0.0,0.0,1.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(192.0,0.0,1.0,0.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(255.0,0.0,0.2,0.0);</P>
  <P>&nbsp;vtkVolumeProperty 
  *volumeProperty=vtkVolumeProperty::New();<BR>&nbsp;volumeProperty-&gt;SetColor(colorTransferFunction);<BR>&nbsp;volumeProperty-&gt;SetScalarOpacity(opacityTransferfunction);</P>
  <P>&nbsp;vtkVolumeRayCastCompositeFunction *compositeFunction = 
  vtkVolumeRayCastCompositeFunction::New();<BR>&nbsp;vtkVolumeRayCastMapper 
  *volumeMapper=vtkVolumeRayCastMapper::New();<BR>&nbsp;volumeMapper-&gt;SetVolumeRayCastFunction(compositeFunction); 
  <BR>&nbsp;volumeMapper-&gt;SetInput(connector-&gt;GetOutput());<BR>&nbsp;<BR>&nbsp;vtkVolume 
  *volume=vtkVolume::New();<BR>&nbsp;volume-&gt;SetMapper(volumeMapper);<BR>&nbsp;volume-&gt;SetProperty(volumeProperty);</P>
  <P>&nbsp;// A renderer and render window<BR>&nbsp;vtkRenderer *ren1 = 
  vtkRenderer::New();<BR>&nbsp;vtkRenderWindow *renWin = 
  vtkRenderWindow::New();<BR>&nbsp;ren1-&gt;AddProp(volume);<BR>&nbsp;renWin-&gt;AddRenderer(ren1);<BR>&nbsp;renWin-&gt;Render(); 
  <BR>&nbsp;return 0;<BR>}</P><BR><BR>&nbsp;</DIV>
  <DIV><SPAN class=gmail_quote>2006/10/11, Erbacher, Markus &lt;<A 
  href="mailto:Markus.Erbacher@med.uni-heidelberg.de">Markus.Erbacher@med.uni-heidelberg.de</A>&gt;:</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>&nbsp;</DIV>
    <DIV><SPAN>vtkVolumeRayCastMapper-&gt;SetInput( ...)</SPAN></DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN>&nbsp;</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&nbsp; ImageToVTKImageFilter-&gt;GetOutput(...) returns 
      a vtkImageData, and </DIV>
      <DIV>vtkVolumeRayCastMapper-&gt;SetInputConnection(...) only accepts a 
      vtkAlgorithmOutput object.</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>So how do i do the final mapping? I really hope you can help me, or 
      any others can. </DIV>
      <DIV>&nbsp;</DIV>
      <DIV>Many regards</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>Here is the code:</DIV>
      <DIV>
      <P>int main( int , char * argv[])<BR>{<BR>&nbsp;typedef unsigned char 
      PixelType;<BR>&nbsp;const unsigned int 
      Dimension=3;<BR>&nbsp;<BR>&nbsp;typedef 
      itk::Image&lt;PixelType,Dimension&gt; ImageType;<BR>&nbsp;typedef 
      itk::ImageFileReader&lt;ImageType&gt; ReaderType; <BR>&nbsp;typedef 
      itk::ImageToVTKImageFilter&lt;ImageType&gt; ConnectorType;</P>
      <P>&nbsp;ReaderType::Pointer reader = 
      ReaderType::New();<BR>&nbsp;ConnectorType::Pointer connector = 
      ConnectorType::New();<BR>&nbsp;<BR>&nbsp;reader-&gt;SetFileName("D:\\skole\\thesis\\Data\\KDIGWKFN\\ANALYZE\\KDIGWKFN_mpr_pip.img"); 
      <BR>&nbsp;connector-&gt;SetInput(reader-&gt;GetOutput());//In connector 
      lies now the imagedata. Retrieve it by calling 
      GetOutput()<BR>&nbsp;<BR>&nbsp;vtkStructuredPointsReader 
      *vtkReader=vtkStructuredPointsReader::New();<BR>&nbsp;</P>
      <P>&nbsp;//Create transfer mapping scalar value to 
      color<BR>&nbsp;vtkPiecewiseFunction 
      *opacityTransferfunction=vtkPiecewiseFunction::New();<BR>&nbsp;opacityTransferfunction-&gt;AddPoint(20.,0.0);<BR>&nbsp;opacityTransferfunction-&gt;AddPoint(255., 
      0.2);</P>
      <P>&nbsp;vtkColorTransferFunction 
      *colorTransferFunction=vtkColorTransferFunction::New();<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(0.0,0.0,0.0,0.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(64.0,1.0,0.0,0.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint( 
      128.0,0.0,0.0,1.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(192.0,0.0,1.0,0.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(255.0,0.0,0.2,0.0);</P>
      <P>&nbsp;vtkVolumeProperty 
      *volumeProperty=vtkVolumeProperty::New();<BR>&nbsp;volumeProperty-&gt;SetColor(colorTransferFunction);<BR>&nbsp;volumeProperty-&gt;SetScalarOpacity(opacityTransferfunction);</P>
      <P>&nbsp;vtkVolumeRayCastCompositeFunction 
      *compositeFunction=vtkVolumeRayCastCompositeFunction::New();<BR>&nbsp;vtkVolumeRayCastMapper 
      *volumeMapper=vtkVolumeRayCastMapper::New();<BR>&nbsp;volumeMapper-&gt;SetVolumeRayCastFunction(compositeFunction); 
      <BR>&nbsp;<BR>&nbsp;volumeMapper-&gt;SetInputConnection(connector-&gt;GetOutput()); 
      //This i cannot do. What should i do instead?</P></DIV>
      <DIV>&nbsp;</DIV>
      <DIV><SPAN class=gmail_quote>2006/10/11, Brian Chacko &lt;<A 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="mailto:brianchacko@yahoo.com" 
      target=_blank>brianchacko@yahoo.com</A>&gt;:</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>&nbsp;</DIV>
        <DIV>[P.N The header file itkImageToVTKImageFilter.h is not available as 
        it is, when you download the ITK software source.&nbsp;Download&nbsp;<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\&nbsp; (or any sub folder of vtk 5.0 which contains&nbsp;headers 
        and source files). Remember to include the appropriate library file in 
        your CMakeLists.txt)].</DIV>
        <DIV>&nbsp;</DIV>
        <DIV>To&nbsp; visualize volume view, try out the volume example in VTK 
        folder </DIV>
        <DIV>Directory path is&nbsp;&nbsp;&nbsp;&nbsp; "\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>&nbsp;</DIV>
        <DIV><B><I></I></B>&nbsp;</DIV>
        <DIV><B><I>Prename Surname &lt;<A 
        onclick="return top.js.OpenExtLink(window,event,this)" 
        href="mailto:bsd.diverse@gmail.com" 
        target=_blank>bsd.diverse@gmail.com</A>&gt;</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&nbsp; 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>&nbsp;</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>