<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'><div style="text-align: left;">Well, I'd say there would definately be an error because you called your vtkVolumeProperty "property" when that is a reserved name (it is blue text).<br><br><br>Also, if you're having problems with your colours or opacity try this....<br><br>&nbsp; vtkPiecewiseFunction *opacityTransferFunction = vtkPiecewiseFunction::New();<br>&nbsp; opacityTransferFunction-&gt;AddPoint( 70.0, 0.0 );<br>&nbsp; opacityTransferFunction-&gt;AddPoint( 100.0, 0.2 );<br>&nbsp; opacityTransferFunction-&gt;AddPoint( 50000.0, 0.2 );<br>&nbsp; opacityTransferFunction-&gt;AddPoint( 50005.0, 0.0 );<br><br>&nbsp; vtkColorTransferFunction* colorTransferFunction = vtkColorTransferFunction::New();<br>&nbsp; colorTransferFunction-&gt;AddRGBPoint( 0.0, 1.0, 0.0, 0.0 );<br>&nbsp; colorTransferFunction-&gt;AddRGBPoint( 300.0, 1.0, 1.0, 0.0 );<br>&nbsp; colorTransferFunction-&gt;AddRGBPoint( 600.0, 0.0, 1.0, 0.0 );<br>&nbsp; colorTransferFunction-&gt;AddRGBPoint( 900.0, 1.0, 1.0, 1.0 );<br>&nbsp; colorTransferFunction-&gt;AddRGBPoint( 1200.0, 0.0, 0.0, 1.0 );<br>&nbsp; colorTransferFunction-&gt;AddRGBPoint( 1500.0, 1.0, 0.0, 1.0 );<br>&nbsp; colorTransferFunction-&gt;AddRGBPoint( 1800.0, 0.0, 0.0, 0.0 );<br><br><br>I have absolutely NO idea how to obtain these points, but I guess it works fine. Maybe try changing the numbers to see what it does.<br></div><br><div></div><br><br><blockquote><hr id="EC_stopSpelling">From: cocorim@hotmail.fr<br>To: ahs@cfdrc.com<br>Date: Wed, 21 May 2008 23:39:41 +0200<br>CC: vtkusers@vtk.org<br>Subject: Re: [vtkusers] 3d reconstruction<br><br>

<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<style>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass body.EC_hmmessage
{font-size:10pt;font-family:Tahoma;}
</style>

Hi again !<br>
&nbsp;<br>
Sorry to bother you again, but I have one problem remaining with the vtkRendererWindow.<br>
&nbsp;<br>
Here's my code :<br>
&nbsp;<br>
//code<br>
&nbsp;<br><font size="2">
vtkVolumeRayCastMapper *mapper = vtkVolumeRayCastMapper::New();<br>
mapper-&gt;SetInput(connector-&gt;GetOutput());<br>
&nbsp;<br>
vtkVolume *volume = vtkVolume::New();<br>
volume-&gt;SetMapper(mapper);<br>
&nbsp;<br>
vtkColorTransferFunction *colors = vtkColorTransferFunction::New();<br>
colors-&gt;SetAlpha(1.0);<br>
&nbsp;<br>
vtkPiecewiseFunction *opacities = vtkPiecewiseFunction::New();<br>
opacities-&gt;SetMaximumNumberOfPieces(-1);<br>
&nbsp;<br>
vtkVolumeProperty *</font><font color="#0000ff" face="" size="2">property</font><font face="" size="2"> = volume-&gt;GetProperty();<br>
</font><font color="#0000ff" face="" size="2">property</font><font face="" size="2">-&gt;SetColor(colors);<br>
</font><font color="#0000ff" face="" size="2">property</font><font face="" size="2">-&gt;SetScalarOpacity(opacities);</font><br>
<font face="" size="2">&nbsp;<br>
vtkRenderer *ren = vtkRenderer::New();<br>
ren-&gt;AddViewProp(volume);<br>
&nbsp;<br>
vtkRenderWindow *triDView = vtkRenderWindow::New();<br>
triDView-&gt;AddRenderer(ren);<br>
triDView-&gt;Render();<br>
</font>&nbsp;<br>
//end code<br>
&nbsp;<br>
And the problems comes when the vtkRendere is added to the windows. VC++ throws an writing violation exception at a memory bloc. I don't understand why it's doing that.<br>
Maybe, my use of the window is incorrect. I'm waiting for my User's Guide book, but i'd like to have a 3d visualisation of my dicom before :).<br>
&nbsp;<br>
Tranks<br><br>

<hr id="EC_stopSpelling">
<br>
&gt; Date: Wed, 21 May 2008 11:21:38 -0500<br>&gt; From: ahs@cfdrc.com<br>&gt; To: cocorim@hotmail.fr<br>&gt; CC: vtkusers@vtk.org<br>&gt; Subject: Re: [vtkusers] 3d reconstruction<br>&gt; <br>&gt; Create a vtkVolume <br>&gt; (http://www.vtk.org/doc/nightly/html/classvtkVolume.html); this is the <br>&gt; volume rendering equivalent of a vtkActor. Set the mapper on the <br>&gt; vtkVolume, and add the volume to the render window. You will also need <br>&gt; to set up color and opacity transfer functions (see <br>&gt; http://www.vtk.org/doc/nightly/html/classvtkColorTransferFunction.html <br>&gt; and http://www.vtk.org/doc/nightly/html/classvtkPiecewiseFunction.html) <br>&gt; indicating how values in your dataset map to color and opacity for <br>&gt; rendering. In c++, do something like the following.<br>&gt; <br>&gt; vtkVolumeRayCastMapper *mapper = vtkVolumeRayCastMapper::New();<br>&gt; ...<br>&gt; <br>&gt; vtkColorTransferFunction *colors = vtkColorTransferFunction::New();<br>&gt; ...<br>&gt; <br>&gt; vtkPiecewiseFunction *opacities = vtkPiecewiseFunction::New();<br>&gt; ...<br>&gt; <br>&gt; vtkVolume *volume = vtkVolume::New();<br>&gt; volume-&gt;SetMapper(mapper);<br>&gt; vtkVolumeProperty *property = volume-&gt;GetProperty();<br>&gt; property-&gt;SetColor(colors);<br>&gt; property-&gt;SetScalarOpacity(opacities);<br>&gt; <br>&gt; vtkRenderer *ren = new vtkRenderer();<br>&gt; ren-&gt;AddViewProp(volume);<br>&gt; <br>&gt; <br>&gt; - Amy<br>&gt; <br>&gt; Alosha [Dread_Lord] wrote:<br>&gt; &gt; Thanks, it works properly now.<br>&gt; &gt; <br>&gt; &gt; Now I have my vtkVolumeRayCastMapper and I have put the vtkImageData <br>&gt; &gt; as input.<br>&gt; &gt; <br>&gt; &gt; So have I my 3D object or am I dreaming :P ?<br>&gt; &gt; <br>&gt; &gt; I know I'm not far, but there are some last steps I don't understand yet.<br>&gt; &gt; <br>&gt; &gt; Do you or anyone knows how to display it in my 3D View ?<br>&gt; &gt; <br>&gt; &gt; I must admit that I'm new in VTK and I don't understand well all this <br>&gt; &gt; stuff yet.<br>&gt; &gt; I don't know for example if vtkVolumeRayCastMapper gerate a 3D model <br>&gt; &gt; that I can display.<br>&gt; &gt; <br>&gt; &gt; If my questions seem stupid, forgive me.<br>&gt; &gt;<br>&gt; &gt; There's the function I've made and at the end, I have my vtkImageData <br>&gt; &gt; in my vtkVolumeRayCastMapper. Still, I don't know what to do with it <br>&gt; &gt; to display a 3D model.<br>&gt; &gt; <br>&gt; &gt; //code<br>&gt; &gt; <br>&gt; &gt; typedef signed short PixelType;<br>&gt; &gt; const unsigned int Dimension = 3;<br>&gt; &gt; typedef itk::Image&lt; PixelType, Dimension &gt; ImageType;<br>&gt; &gt; typedef itk::ImageToVTKImageFilter&lt; ImageType &gt; ConnectorType;<br>&gt; &gt; typedef itk::ImageSeriesReader&lt; ImageType &gt; ReaderType;<br>&gt; &gt; <br>&gt; &gt; ReaderType::Pointer reader = ReaderType::New();<br>&gt; &gt; <br>&gt; &gt; typedef itk::GDCMImageIO ImageIOType;<br>&gt; &gt; <br>&gt; &gt; ImageIOType::Pointer dicomIO = ImageIOType::New();<br>&gt; &gt; reader-&gt;SetImageIO( dicomIO );<br>&gt; &gt; <br>&gt; &gt; typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>&gt; &gt; <br>&gt; &gt; NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<br>&gt; &gt; nameGenerator-&gt;SetUseSeriesDetails( true );<br>&gt; &gt; nameGenerator-&gt;SetDirectory("C:/Dicoms/PHENIX/dicoms/OS/");<br>&gt; &gt; <br>&gt; &gt; typedef std::vector&lt; std::string &gt; SeriesIdContainer;<br>&gt; &gt; <br>&gt; &gt; const SeriesIdContainer &amp; seriesUID = nameGenerator-&gt;GetSeriesUIDs();<br>&gt; &gt; SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br>&gt; &gt; SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<br>&gt; &gt; <br>&gt; &gt; while( seriesItr != seriesEnd )<br>&gt; &gt; {<br>&gt; &gt; std::cout &lt;&lt; seriesItr-&gt;c_str() &lt;&lt; "caca" &lt;&lt; std::endl;<br>&gt; &gt; seriesItr++;<br>&gt; &gt; }<br>&gt; &gt; <br>&gt; &gt; std::string seriesIdentifier;<br>&gt; &gt; seriesIdentifier = seriesUID.begin()-&gt;c_str();<br>&gt; &gt; typedef std::vector&lt; std::string &gt; FileNamesContainer;<br>&gt; &gt; <br>&gt; &gt; FileNamesContainer fileNames;<br>&gt; &gt; fileNames = nameGenerator-&gt;GetFileNames( seriesIdentifier );<br>&gt; &gt; reader-&gt;SetFileNames( fileNames );<br>&gt; &gt; <br>&gt; &gt; cout &lt;&lt; "updating the reader" &lt;&lt; endl;<br>&gt; &gt; <br>&gt; &gt; try<br>&gt; &gt; {<br>&gt; &gt; reader-&gt;Update();<br>&gt; &gt; }<br>&gt; &gt; catch (itk::ExceptionObject &amp;ex)<br>&gt; &gt; {<br>&gt; &gt; std::cout &lt;&lt; ex &lt;&lt; std::endl;<br>&gt; &gt; }<br>&gt; &gt; <br>&gt; &gt; ConnectorType::Pointer connector = ConnectorType::New();<br>&gt; &gt; <br>&gt; &gt; vtkVolumeRayCastMapper *mapper = vtkVolumeRayCastMapper::New();<br>&gt; &gt; mapper-&gt;SetInput(connector-&gt;GetOutput());<br>&gt; &gt; <br>&gt; &gt; //end code<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; <br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt;<br>&gt; &gt; &gt; Date: Wed, 21 May 2008 10:20:08 -0500<br>&gt; &gt; &gt; From: ahs@cfdrc.com<br>&gt; &gt; &gt; To: cocorim@hotmail.fr<br>&gt; &gt; &gt; CC: vtkusers@vtk.org<br>&gt; &gt; &gt; Subject: Re: [vtkusers] 3d reconstruction<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Are you linking against the vtkVolumeRendering library? You would need<br>&gt; &gt; &gt; to do that in order to use vtkVolumeRayCastMapper (or any other volume<br>&gt; &gt; &gt; rendering mapper).<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; - Amy<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Alosha [Dread_Lord] wrote:<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Thank you for your answer.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; The vtkDicomImageReader actually works, but I have some LINK error<br>&gt; &gt; &gt; &gt; while instantiating vtkVolumeRayCastMapper.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; ( vtkVolumeRayCastMapper *mapper = vtkVolumeRayCastMapper::New() )<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Anyway, is the vtkDicomImageReader build a 3D mesh using the 2D dicom<br>&gt; &gt; &gt; &gt; serie, or just generate a data set ?<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; In this last case, how can I display it in my igstk::View3D ? I<br>&gt; &gt; &gt; &gt; suppose I have to build a mesh with it ?<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; I guess there is a VTK class which takes a volume VTK data set and<br>&gt; &gt; &gt; &gt; build a mesh with it, but I don't know which class :S.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Anyway, thanks for your answer, and I'm all ears if anyone knows how<br>&gt; &gt; &gt; &gt; to generate a 3D object from my 2D Dicom series for displaying in a<br>&gt; &gt; &gt; &gt; igstk::View3D<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; <br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt; &gt; &gt; From: w_e_b_m_a_s_t_e_r_6_9@hotmail.com<br>&gt; &gt; &gt; &gt; To: cocorim@hotmail.fr<br>&gt; &gt; &gt; &gt; CC: vtkusers@vtk.org<br>&gt; &gt; &gt; &gt; Subject: RE: [vtkusers] 3d reconstruction<br>&gt; &gt; &gt; &gt; Date: Thu, 22 May 2008 00:44:50 +1000<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; You can actually read in a DICOM file as a 3D object just using VTK.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; vtkDICOMImageReader *dicomReader = vtkDICOMImageReader::New();<br>&gt; &gt; &gt; &gt; dicomReader-&gt;SetDirectoryName( "C:\\dicomfolder\\");<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Have a look at Ray Cast Mapping as well (vtkVolumeRayCastMapper).<br>&gt; &gt; &gt; &gt; I'm not sure if there is a better way though. With this approach,<br>&gt; &gt; &gt; &gt; the image has to reduce its image quality (goes a bit blurry)<br>&gt; &gt; &gt; &gt; while you move the camera. Then once you are finished moving<br>&gt; &gt; &gt; &gt; around it will return to its original quality.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Alternatively you can read it in using ITK, and then convert it<br>&gt; &gt; &gt; &gt; back to VTK. I haven't tried this, so maybe someone can let you<br>&gt; &gt; &gt; &gt; know the best way to do it.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Regards,<br>&gt; &gt; &gt; &gt; Cameron.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; <br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt; &gt; &gt; From: cocorim@hotmail.fr<br>&gt; &gt; &gt; &gt; To: vtkusers@vtk.org<br>&gt; &gt; &gt; &gt; Date: Wed, 21 May 2008 13:48:12 +0200<br>&gt; &gt; &gt; &gt; Subject: [vtkusers] 3d reconstruction<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Hi all !<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Maybe the problem has already been exposed, and I'm sorry if<br>&gt; &gt; &gt; &gt; it was.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; I've managed to made a basic DICOM Viewer. It has 4 views ; 3<br>&gt; &gt; &gt; &gt; views to axial, coronal ans sagittal orientation, and a<br>&gt; &gt; &gt; &gt; tridimentionnal view for 3d reconstruction.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; I'm using igstk::View2D and igstk::View3D.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; I instantiate a CTImageSpatialObject in which I put the CT<br>&gt; &gt; &gt; &gt; Image from the CTImageReader.<br>&gt; &gt; &gt; &gt; Then I put the CTImageSpatialObject into a<br>&gt; &gt; &gt; &gt; CTImageSpatialObjectRepresentation and I give it to the<br>&gt; &gt; &gt; &gt; igstk::View2D.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; It's working properly and I can navigate into slides in the<br>&gt; &gt; &gt; &gt; three 2D views.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; My problems is now how to perform a 3D reconstruction of the<br>&gt; &gt; &gt; &gt; DICOM and display it in the 3D View.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; I've search on the net and on the mailing list for some help,<br>&gt; &gt; &gt; &gt; but all this is still a little unclear to me.<br>&gt; &gt; &gt; &gt; I just know that ITK and VTK has to be used, but I have no<br>&gt; &gt; &gt; &gt; idea of how.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; If you can help me on that or at least show me the way for<br>&gt; &gt; &gt; &gt; begin, I would be very greatfull.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Thanks a lot !<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; <br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt; &gt; &gt; Discutez gratuitement avec vos amis en vidéo ! Téléchargez<br>&gt; &gt; &gt; &gt; Messenger, c'est gratuit ! &lt;http://www.windowslive.fr/messenger/&gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; <br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt; &gt; &gt; Click here Search for local singles online @ Lavalife.<br>&gt; &gt; &gt; &gt; <br>&gt; &gt; &lt;http://a.ninemsn.com.au/b.aspx?URL=http://lavalife9.ninemsn.com.au/clickthru/clickthru.act?id%3Dninemsn%26context%3Dan99%26locale%3Den_AU%26a%3D30290&amp;_t=764581033&amp;_r=email_taglines_Search_OCT07&amp;_m=EXT&gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; <br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt; &gt; &gt; Centralisez tous vos comptes mails dans Hotmail ! Créez un compte<br>&gt; &gt; &gt; &gt; Hotmail, c'est gratuit ! &lt;http://www.windowslive.fr/hotmail/&gt;<br>&gt; &gt; &gt; &gt; <br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; _______________________________________________<br>&gt; &gt; &gt; &gt; This is the private VTK discussion list.<br>&gt; &gt; &gt; &gt; Please keep messages on-topic. Check the FAQ at: <br>&gt; &gt; http://www.vtk.org/Wiki/VTK_FAQ<br>&gt; &gt; &gt; &gt; Follow this link to subscribe/unsubscribe:<br>&gt; &gt; &gt; &gt; http://www.vtk.org/mailman/listinfo/vtkusers<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; --<br>&gt; &gt; &gt; Amy Squillacote Phone: (256) 726-4839<br>&gt; &gt; &gt; Computer Scientist Fax: (256) 726-4806<br>&gt; &gt; &gt; CFD Research Corporation Web: http://www.cfdrc.com<br>&gt; &gt; &gt; 215 Wynn Drive, Suite 501<br>&gt; &gt; &gt; Huntsville, AL 35805<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt; Avec Windows Live Messenger restez en contact avec tous vos amis ! <br>&gt; &gt; Téléchargez Messenger, c'est gratuit ! <br>&gt; &gt; &lt;http://www.windowslive.fr/messenger/&gt;<br>&gt; <br>&gt; -- <br>&gt; Amy Squillacote Phone: (256) 726-4839<br>&gt; Computer Scientist Fax: (256) 726-4806<br>&gt; CFD Research Corporation Web: http://www.cfdrc.com<br>&gt; 215 Wynn Drive, Suite 501<br>&gt; Huntsville, AL 35805<br>&gt; <br>&gt; <br><br><br><hr>Tous vos amis discutent sur Messenger, et vous ?  <a href="http://www.windowslive.fr/messenger/" target="_blank">Téléchargez Messenger, c'est gratuit !</a>
</blockquote><br /><hr />at CarPoint.com.au <a href='http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT' target='_new'>It's simple! Sell your car for just $30 </a></body>
</html>