<div dir="ltr">Hi Luiz,<br><br>thank for your help, I tried to do what exactly you told me. My program try&nbsp; 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?&nbsp; After running the program I can not visualize my image and I&nbsp; got the following errors:<br>
<br>Couldn&#39;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>
&nbsp;Could not create IO object for file /home/jihan/projeto3/src/Fatias<br>The file doesn&#39;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&#39;t touch it again!<br>#include &lt;vtkRenderWindowInteractor.h&gt;<br>#include &lt;itkImage.h&gt;<br>#include &lt;itkImageFileReader.h&gt;<br>#include &lt;itkImageFileWriter.h&gt;<br>
#include &lt;itkImageToVTKImageFilter.h&gt;<br>#include &lt;vtkImageViewer.h&gt;<br>#include &lt;gtkmm/stock.h&gt;<br>#include &lt;gtkmm/filechooserdialog.h&gt;<br>#include &lt;vtkPolyDataMapper.h&gt;<br>#include &lt;vtkRenderer.h&gt;
<br>#include &lt;vtkRenderWindow.h&gt;
<br>#include &lt;vtkRenderWindowInteractor.h&gt;
<br>#include &lt;vtkPolyDataMapper.h&gt;
<br>#include &lt;vtkActor.h&gt;
<br>#include &lt;vtkOutlineFilter.h&gt;
<br>#include &lt;vtkCamera.h&gt;
<br>#include &lt;vtkStripper.h&gt;
<br>#include &lt;vtkLookupTable.h&gt;
<br>#include &lt;vtkImageDataGeometryFilter.h&gt;
<br>#include &lt;vtkProperty.h&gt;
<br>#include &lt;vtkPolyDataNormals.h&gt;
<br>#include &lt;vtkContourFilter.h&gt;
<br>#include &lt;vtkImageData.h&gt;
<br>#include &lt;vtkImageMapToColors.h&gt;
<br>#include &lt;vtkImageActor.h&gt;
<br>#include &lt;vtkDICOMImageReader.h&gt;
<br>#include &lt;vtkImageGaussianSmooth.h&gt;<br><br>#include &lt;vtkVolume16Reader.h&gt;
<br>#include &quot;vtkmm.h&quot;<br>#include &quot;config.h&quot;<br>#include &quot;window1.hh&quot;<br><br>window1::window1() : window1_glade()<br>{<br>&nbsp; this-&gt;signal_check_resize().connect(sigc::mem_fun(*this, &amp;window1::checkResize));<br>
&nbsp; // Creates a widget for VTK rendering
<br>&nbsp; renArea = new class Gtk::Vtk::RenderingArea();
<br>&nbsp; renderer = renArea-&gt;get_vtk_renderer();
<br>&nbsp; renderer-&gt;SetBackground(0,0,0);<br><br>&nbsp; renArea2 = new class Gtk::Vtk::RenderingArea();
<br>&nbsp; renderer2 = renArea2-&gt;get_vtk_renderer();
<br>&nbsp; renderer2-&gt;SetBackground(0,0,0);<br><br>&nbsp; renArea3 = new class Gtk::Vtk::RenderingArea();<br>&nbsp;<br>&nbsp; renderer3 = renArea3-&gt;get_vtk_renderer();<br>&nbsp; renderer3-&gt;SetBackground(0,0,0);<br>&nbsp; // Reserves 200 pixels for the VTK widget
<br>&nbsp; hpaned1-&gt;set_position(800);<br><br>&nbsp; fixed1-&gt;set_size_request(400,(this-&gt;get_height())/2);<br>&nbsp; fixed2-&gt;set_size_request(400,(this-&gt;get_height())/2);<br>&nbsp; fixed3-&gt;set_size_request(400,(this-&gt;get_height())/2);<br>
<br><br>&nbsp; // Passes it to the startButton
<br>&nbsp; //selectButton-&gt;setRenderArea(renArea);
<br>&nbsp;<br>&nbsp; // Adds the VTK widget to its reserved area
<br>&nbsp; fixed1-&gt;add(*renArea);
<br>&nbsp; fixed2-&gt;add(*renArea2);<br>&nbsp; fixed3-&gt;add(*renArea3);<br>&nbsp; renArea-&gt;show();<br>&nbsp; renArea2-&gt;show();<br>&nbsp; renArea3-&gt;show();<br>&nbsp; this-&gt;maximize();<br>}<br><br>void window1::on_analyze1_activate()<br>
{&nbsp; <br><br>}<br><br>void window1::on_dicom1_activate()<br>{<br>&nbsp;&nbsp; //Gtk::FileChooserDialog dialog(&quot;Please choose a file&quot;,Gtk::FILE_CHOOSER_ACTION_OPEN);<br>&nbsp;&nbsp; //dialog.set_transient_for(*this);<br><br>&nbsp;&nbsp; //Add response buttons the the dialog:<br>
&nbsp;&nbsp; //dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);<br>&nbsp;&nbsp; //dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);<br><br>&nbsp;&nbsp; //Add filters, so that only certain file types can be selected:<br><br>&nbsp;&nbsp; //Gtk::FileFilter filter_dicom;<br>
&nbsp;&nbsp; //filter_dicom.set_name(&quot;DICOM images&quot;);<br>&nbsp;&nbsp; //filter_dicom.add_pattern(&quot;*&quot;);<br>&nbsp;&nbsp; //dialog.add_filter(filter_dicom);&nbsp; <br>&nbsp;&nbsp; //int result = dialog.run();<br>&nbsp;&nbsp;&nbsp; int result = 0;<br>&nbsp;&nbsp; //Handle the response:<br>
&nbsp;&nbsp; switch(result)<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp; case(0)://case(Gtk::RESPONSE_OK):<br>&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef short&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PixelType;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const&nbsp;&nbsp; unsigned int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dimension = 3;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef itk::Image&lt; PixelType, Dimension &gt;&nbsp;&nbsp;&nbsp; ImageType;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef itk::ImageFileReader&lt; ImageType &gt;&nbsp; ReaderType;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef itk::ImageFileWriter&lt; ImageType &gt;&nbsp; WriterType;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReaderType::Pointer reader = ReaderType::New();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WriterType::Pointer writer = WriterType::New();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef itk::ImageToVTKImageFilter&lt; ImageType&gt; ConnectorType;<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;Open clicked.&quot; &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Notice that this is a std::string, not a Glib::ustring.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::string strFolderPath = &quot;/home/jihan/projeto3/src/Fatias&quot;;//dialog.get_filename();//<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;File selected: &quot; &lt;&lt;&nbsp; strFolderPath &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;Open clicked....2.&quot; &lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkRenderer *renderer = renArea-&gt;get_vtk_renderer();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //vtkRenderer *renderer2 = renArea2-&gt;get_vtk_renderer();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //vtkRenderer *renderer3 = renArea3-&gt;get_vtk_renderer();
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Removes any object that was there before
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; renderer-&gt;RemoveAllViewProps();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //renderer2-&gt;RemoveAllViewProps();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //renderer3-&gt;RemoveAllViewProps();<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader-&gt;SetFileName( strFolderPath&nbsp; );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;Open clicked....3.&quot; &lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ConnectorType::Pointer connector = ConnectorType::New();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connector-&gt;SetInput( reader-&gt;GetOutput() );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkImageViewer * viewer = vtkImageViewer::New();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor * renderWindowInteractor =<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor::New();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetupInteractor( renderWindowInteractor );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetInput( connector-&gt;GetOutput() );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;Render();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetColorWindow( 255 );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetColorLevel( 128 );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; renderWindowInteractor-&gt;Start();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //writer-&gt;SetFileName(strFolderPath );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //writer-&gt;SetInput( reader-&gt;GetOutput() );<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // vtkDICOMImageReader *reader = vtkDICOMImageReader::New();<br>
&nbsp;&nbsp;&nbsp; //vtkImageViewer&nbsp;&nbsp;&nbsp;&nbsp; *viewer = vtkImageViewer::New(); <br>&nbsp;<br>&nbsp;&nbsp;&nbsp; //viewer-&gt;SetInput(reader-&gt;GetOutput());<br>&nbsp;&nbsp;&nbsp; //reader-&gt;SetDirectoryName(&quot;/home/jihan/projeto3/src/Fatias&quot;);<br>&nbsp;&nbsp;&nbsp; //reader-&gt;Update(); <br>
&nbsp;<br>&nbsp;&nbsp; // int VolData_Images = viewer-&gt;GetWholeZMax (); <br>&nbsp;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp; //for (int i=0;i&lt;=VolData_Images;i++)<br>&nbsp;&nbsp;&nbsp;&nbsp; /*{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetZSlice(10);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;GetRenderer()-&gt;ResetCameraClippingRange();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetColorWindow(400);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;SetColorLevel(128); <br>&nbsp;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;Render();<br>&nbsp;&nbsp;&nbsp; //}*/ <br>&nbsp;<br>&nbsp;&nbsp;&nbsp; //reader-&gt;Delete();<br>&nbsp;&nbsp;&nbsp; //viewer-&gt;Delete(); <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp; case(Gtk::RESPONSE_CANCEL):<br>&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;Cancel clicked.&quot; &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp; default:<br>&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;Unexpected button clicked.&quot; &lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; <br>}<br><br>void window1::on_abrir1_activate()<br>{&nbsp; <br>}<br><br>void window1::on_salvar1_activate()<br>{&nbsp; <br>}<br><br>void window1::on_sair1_activate()<br>{<br>&nbsp;&nbsp;&nbsp; this-&gt;hide();&nbsp;&nbsp; <br>
}<br><br>void window1::on_sobre1_activate()<br>{&nbsp; <br>}<br><br>void window1::checkResize()<br>{<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renArea-&gt;set_size_request(fixed1-&gt;get_width(), (this-&gt;get_height())/2);<br>&nbsp;&nbsp;&nbsp; //renArea2-&gt;set_size_request(fixed2-&gt;get_width(), (this-&gt;get_height())/2);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //renArea3-&gt;set_size_request(fixed3-&gt;get_width(), (this-&gt;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">&lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>&gt;</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>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Welcome to ITK !<br>
<br>
Please read the ITK Software Guide<br>
<br>
 &nbsp; <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>
 &nbsp; &nbsp; &nbsp; &nbsp; &quot;Reading and Writing Images&quot;<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>
 &nbsp; &nbsp;Insight/Examples/IO/ImageReadWrite.cxx<br>
<br>
and that you only need to change line 95, from:<br>
<br>
 &nbsp; &nbsp;const unsigned int Dimension = 2;<br>
<br>
to:<br>
<br>
 &nbsp; &nbsp;const unsigned int Dimension = 3;<br>
<br>
<br>
Please give it a try at this example.<br>
<br>
<br>
 &nbsp; Regards,<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp;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>
&nbsp;IŽam a itk new users and I want to read to know how does Itk read &nbsp;images of type anaylize (the files are of extensions .hdr and .img &nbsp;)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>
&quot;Desire for others what you desire for yourself, and you will be the most just of men&quot;<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>