<div dir="ltr">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>// generated 2008/9/11 11:12:04 BRT by talita@shafrira.(none)<br>// using glademm V2.6.0<br>//<br>// newer (non customized) versions of this file go to window1.cc_new<br>
<br>// This file is for your program, I won't touch it again!<br>#include <vtkRenderWindowInteractor.h><br>#include <itkImage.h><br>#include <itkImageFileReader.h><br>#include <itkImageFileWriter.h><br>
#include <itkImageToVTKImageFilter.h><br>#include <vtkImageViewer.h><br>#include <gtkmm/stock.h><br>#include <gtkmm/filechooserdialog.h><br>#include <vtkPolyDataMapper.h><br>#include <vtkRenderer.h>
<br>#include <vtkRenderWindow.h>
<br>#include <vtkRenderWindowInteractor.h>
<br>#include <vtkPolyDataMapper.h>
<br>#include <vtkActor.h>
<br>#include <vtkOutlineFilter.h>
<br>#include <vtkCamera.h>
<br>#include <vtkStripper.h>
<br>#include <vtkLookupTable.h>
<br>#include <vtkImageDataGeometryFilter.h>
<br>#include <vtkProperty.h>
<br>#include <vtkPolyDataNormals.h>
<br>#include <vtkContourFilter.h>
<br>#include <vtkImageData.h>
<br>#include <vtkImageMapToColors.h>
<br>#include <vtkImageActor.h>
<br>#include <vtkDICOMImageReader.h>
<br>#include <vtkImageGaussianSmooth.h><br><br>#include <vtkVolume16Reader.h>
<br>#include "vtkmm.h"<br>#include "config.h"<br>#include "window1.hh"<br><br>window1::window1() : window1_glade()<br>{<br> this->signal_check_resize().connect(sigc::mem_fun(*this, &window1::checkResize));<br>
// Creates a widget for VTK rendering
<br> renArea = new class Gtk::Vtk::RenderingArea();
<br> renderer = renArea->get_vtk_renderer();
<br> renderer->SetBackground(0,0,0);<br><br> renArea2 = new class Gtk::Vtk::RenderingArea();
<br> renderer2 = renArea2->get_vtk_renderer();
<br> renderer2->SetBackground(0,0,0);<br><br> renArea3 = new class Gtk::Vtk::RenderingArea();<br> <br> renderer3 = renArea3->get_vtk_renderer();<br> renderer3->SetBackground(0,0,0);<br> // Reserves 200 pixels for the VTK widget
<br> hpaned1->set_position(800);<br><br> fixed1->set_size_request(400,(this->get_height())/2);<br> fixed2->set_size_request(400,(this->get_height())/2);<br> fixed3->set_size_request(400,(this->get_height())/2);<br>
<br><br> // Passes it to the startButton
<br> //selectButton->setRenderArea(renArea);
<br> <br> // Adds the VTK widget to its reserved area
<br> fixed1->add(*renArea);
<br> fixed2->add(*renArea2);<br> fixed3->add(*renArea3);<br> renArea->show();<br> renArea2->show();<br> renArea3->show();<br> this->maximize();<br>}<br><br>void window1::on_analyze1_activate()<br>
{ <br><br>}<br><br>void window1::on_dicom1_activate()<br>{<br> //Gtk::FileChooserDialog dialog("Please choose a file",Gtk::FILE_CHOOSER_ACTION_OPEN);<br> //dialog.set_transient_for(*this);<br><br> //Add response buttons the the dialog:<br>
//dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);<br> //dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);<br><br> //Add filters, so that only certain file types can be selected:<br><br> //Gtk::FileFilter filter_dicom;<br>
//filter_dicom.set_name("DICOM images");<br> //filter_dicom.add_pattern("*");<br> //dialog.add_filter(filter_dicom); <br> //int result = dialog.run();<br> int result = 0;<br> //Handle the response:<br>
switch(result)<br> {<br> case(0)://case(Gtk::RESPONSE_OK):<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/projeto3/src/Fatias";//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> <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 =<br>
vtkRenderWindowInteractor::New();<br> viewer->SetupInteractor( renderWindowInteractor );<br> viewer->SetInput( connector->GetOutput() );<br> viewer->Render();<br> viewer->SetColorWindow( 255 );<br>
viewer->SetColorLevel( 128 );<br> renderWindowInteractor->Start();<br><br> <br> //writer->SetFileName(strFolderPath );<br> //writer->SetInput( reader->GetOutput() );<br><br> // vtkDICOMImageReader *reader = vtkDICOMImageReader::New();<br>
//vtkImageViewer *viewer = vtkImageViewer::New(); <br> <br> //viewer->SetInput(reader->GetOutput());<br> //reader->SetDirectoryName("/home/jihan/projeto3/src/Fatias");<br> //reader->Update(); <br>
<br> // int VolData_Images = viewer->GetWholeZMax (); <br> <br> <br> //for (int i=0;i<=VolData_Images;i++)<br> /*{<br> viewer->SetZSlice(10);<br> viewer->GetRenderer()->ResetCameraClippingRange();<br>
viewer->SetColorWindow(400);<br> viewer->SetColorLevel(128); <br> <br> <br> viewer->Render();<br> //}*/ <br> <br> //reader->Delete();<br> //viewer->Delete(); <br><br> break;<br>
}<br> case(Gtk::RESPONSE_CANCEL):<br> {<br> std::cout << "Cancel clicked." << std::endl;<br> break;<br> }<br> default:<br> {<br> std::cout << "Unexpected button clicked." << std::endl;<br>
break;<br> }<br> } <br>}<br><br>void window1::on_abrir1_activate()<br>{ <br>}<br><br>void window1::on_salvar1_activate()<br>{ <br>}<br><br>void window1::on_sair1_activate()<br>{<br> this->hide(); <br>
}<br><br>void window1::on_sobre1_activate()<br>{ <br>}<br><br>void window1::checkResize()<br>{<br> renArea->set_size_request(fixed1->get_width(), (this->get_height())/2);<br> //renArea2->set_size_request(fixed2->get_width(), (this->get_height())/2);<br>
//renArea3->set_size_request(fixed3->get_width(), (this->get_height())/2);<br>}<br><br><br>The following is my code :<br><br><br><div class="gmail_quote">2008/9/10 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;">Hi Jihan,<br>
<br>
<br>
Welcome to ITK !<br>
<br>
Please read the ITK Software Guide<br>
<br>
<a href="http://www.itk.org/ItkSoftwareGuide.pdf" target="_blank">http://www.itk.org/ItkSoftwareGuide.pdf</a><br>
<br>
in partiular, you should read the Chapter<br>
<br>
"Reading and Writing Images"<br>
<br>
<br>
You will find in that text, that the way of<br>
reading this Analyze image is described in<br>
the Example:<br>
<br>
Insight/Examples/IO/ImageReadWrite.cxx<br>
<br>
and that you only need to change line 95, from:<br>
<br>
const unsigned int Dimension = 2;<br>
<br>
to:<br>
<br>
const unsigned int Dimension = 3;<br>
<br>
<br>
Please give it a try at this example.<br>
<br>
<br>
Regards,<br>
<br>
<br>
Luis<br>
<br>
<br>
------------------<br>
Jihan Zoghbi wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">
Hi Everybody,<br>
IŽam a itk new users and I want to read to know how does Itk read images of type anaylize (the files are of extensions .hdr and .img )with the following features:<br>
# Contraste: T1<br>
# Matriz: 512 x 512 x 232<br>
# Space resolution: 0.469 x 0.469 x 0.8mm<br>
# 16 bits/voxel<br>
# cut orientation: Axial-plane<br>
Somebody can help me?<br>
Best Regards...<br>
_______________<br>
<br>
<br>
Jihan Zoghbi<br>
"Desire for others what you desire for yourself, and you will be the most just of men"<br>
<br>
<br></div></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Insight-users mailing list<br>
<a href="mailto:Insight-users@itk.org" target="_blank">Insight-users@itk.org</a><br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote>
</blockquote></div><br><br clear="all"><br>-- <br>Jihan Zoghbi<br>
</div>