<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"><<a href="mailto:john.drozd@gmail.com">john.drozd@gmail.com</a>></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"><<a href="mailto:soheilghafurian@yahoo.com" target="_blank">soheilghafurian@yahoo.com</a>></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("Pick the fixed dicom Image", "*.dcm", ".");<br>
if(fName == NULL) return 0;<br>
<br>
typedef itk::Image< 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>
<br>
<br>
vtkSmartPointer<vtkImageActor> actor =<br>
vtkSmartPointer<vtkImageActor>::New();<br>
// actor->SetInput(connector->GetOutput());<br>
actor->SetInput(connector->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-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>