<div dir="ltr">Hi luis,<br>Thank you for your help. Now I got another problem, I already read the analyze image the way that you explain to me. The problem is that i can not visualize em 3D. the following is my code. Thanks again for your help.<br>
<br><br> typedef short PixelType;<br> const unsigned int Dimension = 3;<br> typedef itk::Image< PixelType, Dimension > ImageType;<br> typedef itk::ImageFileReader< ImageType > ReaderType;<br>
typedef itk::ImageFileWriter< ImageType > WriterType;<br> ReaderType::Pointer reader = ReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br> typedef itk::ImageToVTKImageFilter< ImageType> ConnectorType;<br>
<br> std::cout << "Open clicked." << std::endl;<br> <br> //Notice that this is a std::string, not a Glib::ustring.<br> std::string strFolderPath = "/home/jihan/Desktop/projeto3/src/Fatias/s9.hdr";//dialog.get_filename();//<br>
// std::cout << "File selected: " << strFolderPath << std::endl;<br> std::cout << "Open clicked....2." << std::endl;<br> <br> //vtkRenderer *renderer = renArea->get_vtk_renderer();<br>
//vtkRenderer *renderer2 = renArea2->get_vtk_renderer();<br> //vtkRenderer *renderer3 = renArea3->get_vtk_renderer();
<br> // Removes any object that was there before
<br> renderer->RemoveAllViewProps();<br> //renderer2->RemoveAllViewProps();<br> //renderer3->RemoveAllViewProps();<br><br><br> reader->SetFileName( strFolderPath );<br> writer->SetFileName("outputImage.hdr");<br>
writer->SetInput( reader->GetOutput() );<br> writer->Update(); <br><br> <br> std::cout << "Open clicked....3." << std::endl;<br> ConnectorType::Pointer connector = ConnectorType::New();<br>
connector->SetInput( reader->GetOutput() ); <br> vtkImageViewer * viewer = vtkImageViewer::New();<br> vtkRenderWindowInteractor * renderWindowInteractor = vtkRenderWindowInteractor::New();<br> viewer->SetupInteractor( renderWindowInteractor );<br>
<br> viewer->SetInput( connector->GetOutput() );<br> viewer->SetZSlice(10);<br> viewer->Render();<br> viewer->SetColorWindow( 255 );<br> viewer->SetColorLevel( 128 );<br>
renderWindowInteractor->Start();<br> <br><br><div class="gmail_quote">2008/9/24 Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
Hi Jihan,<div class="Ih2E3d"><br>
<br>
The error message says:<br>
<br>
"Couldn't open file: /home/jihan/projeto3/src/Fatias"<br>
<br>
<br></div>
As you can see,<br>
you are not passing the correct image filename to the reader.<br>
<br>
<br>
The name should be<br>
<br>
"/home/jihan/projeto3/src/Fatias.hdr"<br>
<br>
<br>
That is,<br>
the filename *extension* ".hdr" must be included as part<br>
of the image filename.<div class="Ih2E3d"><br>
<br>
<br>
Regards,<br>
<br>
<br>
Luis<br>
<br>
<br>
=====================<br>
Jihan Zoghbi wrote:<br>
</div><div><div></div><div class="Wj3C7c"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Luiz,<br>
<br>
thank for your help, I tried to do what exactly you told me. My program try to read and visualize Analyze image file reading these two types of files(.hdr and .img) . Actually, the program is reading the .hdr and .img, but how can the program get the information from .hdr file and use to read the .img file? After running the program I can not visualize my image and I got the following errors:<br>
<br>
Couldn't open file: /home/jihan/projeto3/src/Fatias<br>
ERROR: In /usr/local/VTK/Imaging/vtkImageImport.cxx, line 324<br>
vtkImageImport (0x9fb3f48): Calling UpdateInformationCallback: /usr/local/include/InsightToolkit/IO/itkImageFileReader.txx:144:<br>
Could not create IO object for file /home/jihan/projeto3/src/Fatias<br>
The file doesn't exist.<br>
<br>
</blockquote>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Jihan Zoghbi<br>
</div>