Hmnn your code is not working for me, Im trying to do a volume render and it gives me the following error:<br><br>ERROR: In C:\Users\RODRIGO LOVERA\Documents\PUCP\Tesis\VTK 5.10\VTK\VolumeRendering\vtkVolumeRayCastMapper.cxx, line 326<br>
vtkVolumeRayCastMapper (04ADF0A8): Cannot volume render data of type double, only unsigned char or unsigned short.<br><br>ERROR: In C:\Users\RODRIGO LOVERA\Documents\PUCP\Tesis\VTK 5.10\VTK\VolumeRendering\vtkVolumeRayCastMapper.cxx, line 326<br>
vtkVolumeRayCastMapper (04ADF0A8): Cannot volume render data of type double, only unsigned char or unsigned short.<br><br>I think that is probably for the use of vtkImageData.<br><br>My code goes as follows:<br><br>vtkSmartPointer&lt; vtkDICOMImageReader &gt; reader =<br>
        vtkSmartPointer&lt; vtkDICOMImageReader &gt;::New();<br>    reader-&gt;SetDataByteOrderToLittleEndian();<br>    reader-&gt;SetDirectoryName(&quot;C:\\VTK5.10\\DATA\\DICOM&quot;);<br>    reader-&gt;SetDataSpacing(3.2, 3.2, 1.5);<br>
    reader-&gt;SetDataOrigin(0.0, 0.0, 0.0);<br>    reader-&gt;Update();<br><br>    vtkSmartPointer&lt; vtkImageCast &gt; readerImageCast =<br>        vtkSmartPointer&lt; vtkImageCast &gt;::New();<br>    readerImageCast-&gt;SetInput((vtkDataObject *)reader-&gt;GetOutput());<br>
    readerImageCast-&gt;SetOutputScalarTypeToUnsignedChar();<br>    readerImageCast-&gt;ClampOverflowOn();<br><br>    m_opacityFunction = vtkPiecewiseFunction::New();<br><br>    m_colorTransferFunction = vtkColorTransferFunction::New();<br>
<br>    vtkSmartPointer&lt; vtkVolumeProperty &gt; volumeProperty =<br>        vtkSmartPointer &lt;vtkVolumeProperty &gt;::New();<br>    volumeProperty-&gt;SetColor(m_colorTransferFunction);<br>    volumeProperty-&gt;SetScalarOpacity(m_opacityFunction);<br>
    volumeProperty-&gt;ShadeOn();<br>    volumeProperty-&gt;SetInterpolationTypeToLinear();<br><br>    vtkSmartPointer&lt; vtkVolumeRayCastCompositeFunction &gt; compositeFunction =<br>                vtkSmartPointer&lt; vtkVolumeRayCastCompositeFunction &gt;::New();<br>
    vtkSmartPointer&lt; vtkVolumeRayCastMapper &gt; volumeMapperMIP =<br>        vtkSmartPointer&lt; vtkVolumeRayCastMapper &gt;::New();<br>    volumeMapperMIP-&gt;SetVolumeRayCastFunction(compositeFunction);<br>    volumeMapperMIP-&gt;SetInput(readerImageCast-&gt;GetOutput());<br>
           <br>    vtkSmartPointer&lt; vtkVolume &gt; volume =<br>        vtkSmartPointer&lt; vtkVolume &gt;::New();<br>    volume-&gt;SetMapper(volumeMapperMIP);<br>    volume-&gt;SetProperty(volumeProperty);<br>    <br>
    vtkSmartPointer&lt; vtkRenderer &gt; renderer =<br>        vtkSmartPointer&lt; vtkRenderer &gt;::New();<br>    renderer-&gt;AddVolume(volume);<br>    renderer-&gt;ResetCamera();<br><br>    ui-&gt;mipvolume-&gt;GetRenderWindow()-&gt;AddRenderer(renderer);<br>
    connect(this-&gt;ui-&gt;updateMIP, SIGNAL(clicked()), this, SLOT(UpdateMIP()));<br><br>Hope you could help me , cuz im really in need of some segmentation method and image threshold seems to be the one for ir.<br><br>
Thx in advance.<br><br>Rodrigo<br><div class="gmail_extra"><br><br><div class="gmail_quote">2012/11/28 shinaji <span dir="ltr">&lt;<a href="mailto:t_shinaji@chiba-u.jp" target="_blank">t_shinaji@chiba-u.jp</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
I usually load CT data (dicom) to the vtkImageData.<br>
Then take threshold it by vtkImageThreshold as a following example.<br>
<br>
    reader = vtk.vtkDICOMImageReader()<br>
    reader.SetFileName(&#39;IM-0013-0399.dcm&#39;)<br>
    reader.Update();<br>
<br>
    src = vtk.vtkImageData()<br>
    src.DeepCopy(reader.GetOutput())<br>
<br>
    thresh = vtk.vtkImageThreshold()<br>
    thresh.SetInput(src)<br>
    thresh.SetInValue(32768)<br>
    thresh.ThresholdBetween(0, 200)<br>
<br>
    bwLut = vtk.vtkLookupTable()<br>
    bwLut.SetTableRange(0, 2000)<br>
    bwLut.SetSaturationRange(0, 0)<br>
    bwLut.SetHueRange(0, 0)<br>
    bwLut.SetValueRange(0, 1)<br>
    bwLut.Build()<br>
<br>
    imageMapToColor = vtk.vtkImageMapToColors()<br>
    imageMapToColor.SetInput(thresh.GetOutput())<br>
    imageMapToColor.SetLookupTable(bwLut)<br>
    imageMapToColor.Update()<br>
<br>
    writer = vtk.vtkPNGWriter()<br>
    writer.SetFileName(&#39;thresh.png&#39;)<br>
    writer.SetInput(imageMapToColor.GetOutput())<br>
    writer.Update()<br>
    writer.Write()<br>
<br>
Are these code giving you that you want to do?<br>
<br>
Shinaji<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Segmentation-for-3D-ultrasound-data-set-tp5717312p5717329.html" target="_blank">http://vtk.1045678.n5.nabble.com/Segmentation-for-3D-ultrasound-data-set-tp5717312p5717329.html</a><br>

Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><b><font face="&#39;comic sans ms&#39;, sans-serif" color="#000066">Rodrigo aka WarHearT</font></b><br>
</div>