<font size="2"><font face="verdana,sans-serif">Check out this example: </font></font><font size="2"><font face="verdana,sans-serif"><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/VolumeRendering/itkVtkImageConvert">http://www.vtk.org/Wiki/VTK/Examples/Cxx/VolumeRendering/itkVtkImageConvert</a><br>

</font></font><div><font class="Apple-style-span" face="verdana, sans-serif">You can also check out the other examples too: </font><font class="Apple-style-span" face="verdana, sans-serif"><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx#Volume_Rendering">http://www.vtk.org/Wiki/VTK/Examples/Cxx#Volume_Rendering</a><br>

</font></div><div><div class="gmail_quote"><br></div><div class="gmail_quote">HTH,</div><div class="gmail_quote">Dženan</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Tue, Jul 19, 2011 at 04:02, John Drozd <span dir="ltr">&lt;<a href="mailto:john.drozd@gmail.com">john.drozd@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>Hi,</div><div> </div><div>When I am unsure about the pixel type, I load the dicom image into 3D Slicer (freely available at <a href="http://www.slicer.org" target="_blank">www.slicer.org</a>), and click the Display and Info Tab which shows the pixel type.  Then when I code in ITK, I use that pixel type.  I hope this helps you.  Slicer will display the dicom image using the correct pixel type and tell you what the pixel type is.</div>


<div> </div><div>Take care,</div><div>John<br><br></div><div><div></div><div class="h5"><div class="gmail_quote">On Sun, Jul 17, 2011 at 10:25 PM, soheilghafurian <span dir="ltr">&lt;<a href="mailto:soheilghafurian@yahoo.com" target="_blank">soheilghafurian@yahoo.com</a>&gt;</span> wrote:<br>


<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204, 204, 204);border-left-width:1px;border-left-style:solid" class="gmail_quote">My problem is I load a dicom file and I try to show it through vtk by<br>



ImageToVTKImageFilter. But the result is kind of distorted. I think the<br>
problem is because the pixeltype is not good, but when I use another type, I<br>
get this message when the program is running:<br>
<br>
ERROR: In ..\..\Rendering\vtkImageActor.cxx, line 267<br>
vtkOpenGLImageActor (058C5340): This filter requires unsigned char scalars<br>
as input<br>
<br>
Could anyone help me on how I should solve this problem? here is the code:<br>
<br>
int main()<br>
{<br>
        char *fName = fl_file_chooser(&quot;Pick the fixed dicom Image&quot;, &quot;*.dcm&quot;, &quot;.&quot;);<br>
      if(fName == NULL) return 0;<br>
<br>
          typedef itk::Image&lt; unsigned char, 2&gt; ImageType;<br>
  typedef itk::ImageFileReader&lt;ImageType&gt;             ReaderType;<br>
  typedef itk::ImageToVTKImageFilter&lt;ImageType&gt;       ConnectorType;<br>
<br>
  ReaderType::Pointer reader = ReaderType::New();<br>
  ConnectorType::Pointer connector = ConnectorType::New();<br>
<br>
  reader-&gt;SetFileName(fName);<br>
  reader-&gt;Update();<br>
  connector-&gt;SetInput(reader-&gt;GetOutput());<br>
<br>
<br>
<br>
  vtkSmartPointer&lt;vtkImageActor&gt; actor =<br>
    vtkSmartPointer&lt;vtkImageActor&gt;::New();<br>
//  actor-&gt;SetInput(connector-&gt;GetOutput());<br>
  actor-&gt;SetInput(connector-&gt;GetOutput());<br>
<br>
  vtkSmartPointer&lt;vtkRenderer&gt; renderer =<br>
    vtkSmartPointer&lt;vtkRenderer&gt;::New();<br>
  renderer-&gt;AddActor(actor);<br>
  renderer-&gt;ResetCamera();<br>
<br>
  vtkSmartPointer&lt;vtkRenderWindow&gt; renderWindow =<br>
    vtkSmartPointer&lt;vtkRenderWindow&gt;::New();<br>
  renderWindow-&gt;AddRenderer(renderer);<br>
<br>
  vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; renderWindowInteractor =<br>
    vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;::New();<br>
  vtkSmartPointer&lt;vtkInteractorStyleImage&gt; style =<br>
    vtkSmartPointer&lt;vtkInteractorStyleImage&gt;::New();<br>
<br>
  renderWindowInteractor-&gt;SetInteractorStyle(style);<br>
<br>
  renderWindowInteractor-&gt;SetRenderWindow(renderWindow);<br>
  renderWindowInteractor-&gt;Initialize();<br>
<br>
  renderWindowInteractor-&gt;Start();<br>
<br>
  return EXIT_SUCCESS;<br>
}<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://itk-insight-users.2283740.n2.nabble.com/How-to-show-dicoms-with-vtk-ImageToVTKImageFilter-tp6593222p6593222.html" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/How-to-show-dicoms-with-vtk-ImageToVTKImageFilter-tp6593222p6593222.html</a><br>



Sent from the ITK Insight 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<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br><div>John Drozd<br></div>
<div>Post-Doctoral Fellow, Robarts Research Institute</div>
<div>The University of Western Ontario</div>
<div>London, ON, Canada</div><div><a href="http://publish.uwo.ca/~jdrozd2/index.htm" target="_blank">http://publish.uwo.ca/~jdrozd2/index.htm</a></div>
<div> </div><br>
</font><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<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>