<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> </div>
<div>Any suggestions? </div>
<div>Best of regards, and thank you<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">You are missing the vtkRenderWindowInteractor.</font></span></div>
<div><span><font face="Arial" color="#0000ff" size="2"></font></span> </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> </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> </div>
<div><span><font size="2">
<p>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</p>
<p>iren->SetRenderWindow(renWin);</p>
<p>
<p></p>
<p></p></p></font><font size="2">renWin->Render();</font>
<p><font size="2">iren->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> </div>
<div><span><font face="Arial" color="#0000ff" size="2"></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> 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> </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 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>>:</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>
<p></p></p></span></blockquote></div><br></blockquote></div></blockquote></div><br></span></div></blockquote></div></blockquote></div><br>