<div>Ahhh yes, okay. This seems to show something now...But hmmm</div>
<div>This is only a cube full of noise. I know the image is correct, because i have viewed it in other programs, and it looks correct. So something must have gone wrong in the conversion.</div>
<div>It should be a brain, but it looks like this:</div>
<div><a href="http://www.coachkontakt.dk/rendered.jpg">http://www.coachkontakt.dk/rendered.jpg</a></div>
<div>&nbsp;</div>
<div>Any suggestions? </div>
<div>Best of regards, and thank you<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">You are missing the vtkRenderWindowInteractor.</font></span></div>
<div><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div><span><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><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div><span><font face="Arial" color="#0000ff" size="2">Use is like this:</font></span></div>
<div><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div><span><font size="2">
<p>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</p>
<p>iren-&gt;SetRenderWindow(renWin);</p>
<p>
<p></p>
<p></p></p></font><font size="2">renWin-&gt;Render();</font> 
<p><font size="2">iren-&gt;Start();<span> // this starts the interactor, and only returns if ypu close the window</span></font></p></span></div>
<div><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div><span><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</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> Prename Surname [mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:bsd.diverse@gmail.com" target="_blank">
bsd.diverse@gmail.com</a>] <br><b>Gesendet:</b> Mittwoch, 11. Oktober 2006 16:40<br><b>An:</b> Erbacher, Markus; <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org
</a> 
<div><span class="e" id="q_10e37dcc61801f82_1"><br><b>Betreff:</b> Re: [vtkusers] How do i port an image from ITK to VTK<br><br></span></div></font></div>
<div><span class="e" id="q_10e37dcc61801f82_3">
<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 &quot;itkImage.h&quot;<br>#include &quot;itkImageFileReader.h&quot;<br>#include &quot;itkImageFileWriter.h&quot;//</p>
<p>#include &quot;itkImageToVTKImageFilter.h&quot;//Makes ITK-&gt;VTK pipeline (remember to set path in CMakeLists.txt firs)</p>
<p>#include &quot;vtkImageViewer.h&quot;//Makes 2D images in VTK</p>
<p>//Use for volumerendering<br>#include &quot;vtkStructuredPointsReader.h&quot;<br>#include &quot;vtkPiecewiseFunction.h&quot;<br>#include &quot;vtkColorTransferFunction.h&quot;<br>#include &quot;vtkVolumeProperty.h&quot; 
<br>#include &quot;vtkVolumeRayCastCompositeFunction.h&quot;<br>#include &quot;vtkVolumeRayCastMapper.h&quot;<br>#include &quot;vtkVolume.h&quot;</p>
<p><br>//Used for the vtk examples<br>#include &quot;vtkSphereSource.h&quot;<br>#include &quot;vtkPolyDataMapper.h&quot;<br>#include &quot;vtkActor.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkRenderer.h
 &quot;<br>#include &quot;vtkRenderWindowInteractor.h&quot;</p>
<p>#include &quot;itkVTKImageExport.h&quot;<br>#include &quot;vtkImageImport.h&quot;</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(&quot;D:\\skole\\thesis\\Data\\KDIGWKFN\\ANALYZE\\KDIGWKFN_mpr_pip.img&quot;); 
<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 onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Markus.Erbacher@med.uni-heidelberg.de" target="_blank">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(&quot;D:\\skole\\thesis\\Data\\KDIGWKFN\\ANALYZE\\KDIGWKFN_mpr_pip.img&quot;); 
<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; &quot;\VTK 5.0\Examples\VolumeRendering\Tcl\SimpleRayCast.tcl&quot;.</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>
<p></p></p></span></blockquote></div><br></blockquote></div></blockquote></div><br></span></div></blockquote></div></blockquote></div><br>