<div dir="ltr">Try<br><br>color->SetInputConnection(connector->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"><<a href="mailto:soheilghafurian@yahoo.com">soheilghafurian@yahoo.com</a>></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'm doing<br>
something wrong here. I get this error at line<br>
color->SetInputConnection(connector->GetOutput());<br>
<br>
could you do me a favor and tell me what I'm doing wrong here? the new code<br>
is:<br>
<br>
int main()<br>
{<br>
char *fName = fl_file_chooser("Pick the fixed dicom Image", "*.dcm", ".");<br>
if(fName == NULL) return 0;<br>
<br>
typedef itk::Image< itk::RGBPixel<unsigned char>, 2> ImageType;<br>
typedef itk::ImageFileReader<ImageType> ReaderType;<br>
typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;<br>
<br>
ReaderType::Pointer reader = ReaderType::New();<br>
ConnectorType::Pointer connector = ConnectorType::New();<br>
<br>
reader->SetFileName(fName);<br>
reader->Update();<br>
connector->SetInput(reader->GetOutput());<br>
<br>
vtkSmartPointer<vtkLookupTable> table =<br>
vtkSmartPointer<vtkLookupTable>::New();<br>
table->SetRange(-600,900); // image intensity range<br>
table->SetValueRange(0.0, 1.0); // from black to white<br>
table->SetSaturationRange(0.0, 0.0); // no color saturation<br>
table->SetRampToLinear();<br>
table->Build();<br>
// Map the image through the lookup table<br>
vtkSmartPointer<vtkImageMapToColors> color =<br>
vtkSmartPointer<vtkImageMapToColors>::New();<br>
color->SetLookupTable(table);<br>
color->SetInputConnection(connector->GetOutput());<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
vtkSmartPointer<vtkImageActor> actor =<br>
vtkSmartPointer<vtkImageActor>::New();<br>
actor->SetInput(color->GetOutput());<br>
<br>
vtkSmartPointer<vtkRenderer> renderer =<br>
vtkSmartPointer<vtkRenderer>::New();<br>
renderer->AddActor(actor);<br>
renderer->ResetCamera();<br>
<br>
vtkSmartPointer<vtkRenderWindow> renderWindow =<br>
vtkSmartPointer<vtkRenderWindow>::New();<br>
renderWindow->AddRenderer(renderer);<br>
<br>
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =<br>
vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
vtkSmartPointer<vtkInteractorStyleImage> style =<br>
vtkSmartPointer<vtkInteractorStyleImage>::New();<br>
<br>
renderWindowInteractor->SetInteractorStyle(style);<br>
<br>
renderWindowInteractor->SetRenderWindow(renderWindow);<br>
renderWindowInteractor->Initialize();<br>
<br>
renderWindowInteractor->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>