<div dir="ltr">Try<br><br>color-&gt;SetInputConnection(connector-&gt;GetOutput<b style="color: rgb(255, 0, 0);">Port</b>());<br><br>Jothy<br><br><div class="gmail_quote">On Mon, Jul 18, 2011 at 4:08 PM, soheilghafurian <span dir="ltr">&lt;<a href="mailto:soheilghafurian@yahoo.com">soheilghafurian@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Thank you very much, I tried to use your code, but it seems I&#39;m doing<br>
something wrong here. I get this error at line<br>
color-&gt;SetInputConnection(connector-&gt;GetOutput());<br>
<br>
could you do me a favor and tell me what I&#39;m doing wrong here? the new code<br>
is:<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; itk::RGBPixel&lt;unsigned char&gt;, 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>
  vtkSmartPointer&lt;vtkLookupTable&gt; table =<br>
           vtkSmartPointer&lt;vtkLookupTable&gt;::New();<br>
         table-&gt;SetRange(-600,900); // image intensity range<br>
         table-&gt;SetValueRange(0.0, 1.0); // from black to white<br>
         table-&gt;SetSaturationRange(0.0, 0.0); // no color saturation<br>
         table-&gt;SetRampToLinear();<br>
         table-&gt;Build();<br>
         // Map the image through the lookup table<br>
  vtkSmartPointer&lt;vtkImageMapToColors&gt; color =<br>
           vtkSmartPointer&lt;vtkImageMapToColors&gt;::New();<br>
         color-&gt;SetLookupTable(table);<br>
         color-&gt;SetInputConnection(connector-&gt;GetOutput());<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
  vtkSmartPointer&lt;vtkImageActor&gt; actor =<br>
    vtkSmartPointer&lt;vtkImageActor&gt;::New();<br>
  actor-&gt;SetInput(color-&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-tp6593222p6595116.html" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/How-to-show-dicoms-with-vtk-ImageToVTKImageFilter-tp6593222p6595116.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></div>