<div id="RTEContent">wa alaykom assalam<br> plz read the <span style="font-weight: bold;">itk software guide.pdf </span>section <span style="font-style: italic;">7.12.3 Reading a 2D DICOM Series and Writing a Volume</span><br>and this is a part of code of file <span style="font-style: italic; text-decoration: underline;">Examples/IO/DicomSeriesReadImageWrite2.cxx :<br> <span style="font-style: italic;"><span style="text-decoration: underline;"><br> </span></span></span><span style="font-style: italic;"><span style="font-style: italic;">typedef itk::GDCMImageIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageIOType;<br> ImageIOType::Pointer dicomIO = ImageIOType::New();<br> reader-&gt;SetImageIO( dicomIO );<br> <br> typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<br> nameGenerator-&gt;SetUseSeriesDetails( true );<br> nameGenerator-&gt;SetDirectory( argv[1] );<br> <br> typedef std::vector&lt; std::string
 &gt;&nbsp;&nbsp;&nbsp; SeriesIdContainer;<br> const SeriesIdContainer &amp; seriesUID = nameGenerator-&gt;GetSeriesUIDs();<br> SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br> SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<br> <br> //here we browse all the series in the directory<br> <br> while( seriesItr != seriesEnd )<br> &nbsp; {<br> &nbsp; std::cout &lt;&lt; seriesItr-&gt;c_str() &lt;&lt; std::endl;<br> &nbsp; seriesItr++;<br> &nbsp; }<br> <br> // and here we choose one serie from the list by its ID given in the command line<br> //and if no ID specifies by user, we take the first serie in the list<br> <br> std::string seriesIdentifier;<br> if( argc &gt; 3 ) // If no optional series identifier<br> &nbsp; {<br> &nbsp; seriesIdentifier = argv[3];<br> &nbsp; }<br> else<br> {<br> seriesIdentifier = seriesUID.begin()-&gt;c_str();<br> }<br> <br> typedef std::vector&lt; std::string &gt;&nbsp;&nbsp; FileNamesContainer;<br> FileNamesContainer
 fileNames;<br> <br> //here we read list of files belonging&nbsp; to the serie we choose<br> &nbsp;<br> fileNames = nameGenerator-&gt;GetFileNames( seriesIdentifier );<br> <br> reader-&gt;SetFileNames( fileNames );<br> <br> try<br> &nbsp; {<br> &nbsp; reader-&gt;Update();<br> &nbsp; }<br> catch (itk::ExceptionObject &amp;ex)<br> &nbsp; {<br> &nbsp; std::cout &lt;&lt; ex &lt;&lt; std::endl;<br> &nbsp; return EXIT_FAILURE;<br> &nbsp; }<br> ***********************************************************************************<br> </span></span><span style="font-style: italic;"><span style="font-style: italic;">//so if u want to deal with every slice alone, u might write something like this<br> <br> </span></span><span style="font-style: italic;"><span style="font-style: italic;">SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br> SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<br> </span></span><span style="font-style: italic;"><span style="font-style:
 italic;"> std::string seriesIdentifier;<br> </span></span><span style="font-style: italic;"><span style="font-style: italic;"> typedef std::vector&lt; std::string &gt;&nbsp;&nbsp; FileNamesContainer;<br> FileNamesContainer fileNames;<br> <br> </span></span><span style="font-style: italic;"><span style="font-style: italic;"> //here we browse all the series in the directory<br> <br> while( seriesItr != seriesEnd )<br> &nbsp; {<br> &nbsp;&nbsp; </span></span><span style="font-style: italic;"><span style="font-style: italic;">seriesIdentifier = </span></span><span style="font-style: italic;"><span style="font-style: italic;">seriesItr-&gt;c_str()</span></span><span style="font-style: italic;"><span style="font-style: italic;">;</span></span><br> <span style="font-style: italic;"><span style="font-style: italic;">&nbsp; fileNames = nameGenerator-&gt;GetFileNames( seriesIdentifier );<br>&nbsp; reader-&gt;SetFileNames( fileNames );<br> </span></span><span style="font-style: italic;"><span
 style="font-style: italic;">&nbsp; reader-&gt;Update();</span></span><br> &nbsp;&nbsp; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-style: italic;">// here you write code to process each serie alone</span><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> <br> <span style="font-style: italic;"><span style="font-style: italic;"> &nbsp; seriesItr++;<br> &nbsp; }<br> <br>  </span></span><span style="font-style: italic;"><span style="font-style: italic;"><br> <br></span></span>For more comments plz read the ITK SOFTWARE GUIDE.PDF from page 298.<br> let me know if u resolve your problem, or didn't i understand what u need.<br> Amir.<br> Technology &amp; Medical Imaging Lab<br> Biophysics Departement<br> Faculty of Medecine Monastir-Tunisia<span style="font-style: italic; text-decoration: underline;"><span style="font-style: italic;"><span style="text-decoration: underline;"><span style="font-style: italic;"><span style="text-decoration:
 underline;"></span></span><br> <br> <br> </span></span></span><span style="text-decoration: underline;"></span><b><i>mahmoud ismail &lt;mahmoudtheleader2003@yahoo.com&gt;</i></b> a écrit&nbsp;:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> <div>salamo alikom</div>  <div>My problem is that i use vtkDicomReader class&nbsp;and&nbsp;it has a restriction which is</div>  <div>&nbsp;(the folder that contains the images must have images that belong to the same series and&nbsp;are &nbsp;ordered) . but in most cases the folder contain images that belongs to more than one series</div>  <div>so i want to deal with every series alone </div>  <div>is it clear</div>  <div>&nbsp;</div>  <div>Note my name is mahmoud mohamed Ahmed</div>  <div>and I am in fourth year systems &amp; and biomedical enginnering department Cairo university Egypt</div>  <div>what about u<br><br><b><i>charfeddine amir &lt;charfeddine_amir@yahoo.fr&gt;</i></b>
 wrote:</div>  <blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;">  <div id="RTEContent">salam <br>sorry i didn't understand your problem<br>i hope you finded a solution, if not, rewrite me and explain me your problem<br>because i think i can help u<br>i make  an application that read dicom series but don't show me all image...<br>regards,<br><br><b><i>mahmoud ismail &lt;mahmoudtheleader2003@yahoo.com&gt;</i></b> a écrit&nbsp;:  <blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;">  <div>hi Amir</div>  <div>first i have no answer to your question and hope that the message yuo have recieved </div>  <div>is enough but</div>  <div>I try to open Dicom Images using VTKDicomReader class</div>  <div>but it cann't distinguish between images that belong to different series</div>  <div>&nbsp;</div>  <div>so i used GDCM but i have some problems with it </div>  <div>Do u have
 any suggestions </div>  <div>Thanks<br><br><b><i>charfeddine amir &lt;charfeddine_amir@yahoo.fr&gt;</i></b> wrote:</div>  <blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;">  <div id="RTEContent">  <div id="RTEContent"><pre>hi All<br>I'm developping an application that<br> reads the first serie of<br>Dicom images from a directory, show each image and save it<br>in bmp format.<br>the problem is that image series is well readed, and image<br>  are well saved in bmp format, but image are not well showed<br>in the vtkrenderwindow used ( i get a black window with<br> two<br>white line on it and not the image readed).<br>this code in the main file :<br><br>this function is for reading first series from a given   <br>directory and showing it's first dicom image(invoked by <br>pushing the Read Directory button in the GUI)<br>void<br>migAppBase<br>::ReadImage()<br>{<br>  // Can only read an image once<br> 
 if(m_InputImage.IsNotNull())  <br>   return;<br>  <br>  char* chooserName = fl_dir_chooser("select a dicom directory", 0, 0);<br><br>  // Store the   filename<br>  strcpy( m_InputImageDirectoryname, chooserName );<br>  reader = ReaderType::New();  <br>  dicomIO =   ImageIOType::New();<br>  nameGenerator = NamesGeneratorType::New();<br> <br> reader-&gt;SetImageIO( dicomIO );<br>  nameGenerator-&gt;SetUseSeriesDetails( true );<br>  nameGenerator-&gt;SetDirectory( m_InputImageDirectoryname );  <br>  seriesUID = nameGenerator-&gt;GetSeriesUIDs();<br>    <br>  seriesIdentifier = seriesUID.begin()-&gt;c_str();<br>     <br>  fileNames =<br> nameGenerator-&gt;GetFileNames( seriesIdentifier );<br><br>  FileNamesItr = fileNames.begin  ();<br>  FileNamesEnd = fileNames.end();<br>    <br>    <br>  rescaler = RescaleFilterType::New();<br>  rescaler-&gt;SetOutputMinimum(   0 );<br>  rescaler-&gt;SetOutputMaximum( 255 );<br>  reader-&gt;SetFileName( FileNamesItr-&gt;c_str() );  <br><br>  try<br>  
    {<br>    rescaler-&gt;SetInput( reader-&gt;GetOutput() );<br>    reader-&gt;Update();<br>    m_InputImage = reader-&gt;GetOutput();<br>      m_InputImage-&gt;SetRequestedRegionToLargestPossibleRegion();  <br>    <br>    // Create the input image VTK pipeline<br>      this-&gt;CreateInputImageWindow();<br><br>  }<br>    catch<br> (itk::ExceptionObject &amp;ex)<br>      {<br>      }<br><br>  FileNamesItr++;<br>}<br><br>this function is for reading the next image in the serie  <br>(invoked by pushing the Read Next button in the GUI)<br><br> void<br>migAppBase<br>::ReadNext()<br>{<br><br><br>if ( FileNamesItr != FileNamesEnd<br> )<br>{<br><br>reader-&gt;SetFileName( FileNamesItr-&gt;c_str() );<br><br>    try<br>      {<br>    rescaler-&gt;SetInput( reader-&gt;GetOutput() );<br>    m_InputImage = reader-&gt;GetOutput();<br>    m_InputImage-&gt;SetRequestedRegionToLargestPossibleRegion();<br>    reader-&gt;Update();<br>    // Create the input image VTK pipeline  <br>   
 this-&gt;CreateInputImageWindow();<br><br>      }<br>    catch (itk::ExceptionObject &amp;ex)<br>      {<br>      }<br>FileNamesItr++;<br>}<br>}<br><br>this   function is for saving the actual image (that should<br>  be showed in the vtk window) in bmp format (invoked by <br>pushing the save   Image in the GUI)<br><br><br> void<br>migAppBase<br>::SaveImage()<br>{<br><br>Writer2Type::Pointer writer2 = Writer2Type::New();<br><br>std::string OutputFilename1 = FileNamesItr-&gt;c_str() + std::string(".bmp");  <br>writer2-&gt;SetFileName( OutputFilename1.c_str() );<br>writer2-&gt;SetInput( rescaler-&gt;GetOutput() );<br><br>  try<br>    {<br>   <br> writer2-&gt;Update();<br>    }<br>  catch (itk::ExceptionObject &amp; e)<br>    {<br>      }<br><br>}<br><br>this is the fuction for showing the actual image<br><br>void<br>migAppBase<br>::CreateInputImageWindow()<br>{<br>  // If this is the first time we've hit Image Suivante there's other stuff<br>  // that needs to happen  <br> 
 if(m_IsFirstUpdate)<br>  {<br>    // Display the output image<br>    CreateWindowWithRWI(m_InputInteractor, m_InputWindow, "Input Image");<br><br>  // these two steps are   VERY IMPORTANT, you have to show() the fltk window  <br>  // containing the vtkFlRenderWindowInteractor, and then the<br>  //   vtkFlRenderWindowInteractor<br> itself<br>  m_InputWindow-&gt;show();<br>  m_InputInteractor-&gt;show();<br>   <br>  // now we get to setup our VTK rendering pipeline  <br>  CreateInputImageVTKPipeline(m_InputInteractor);<br><br>    // No longer the first update<br>    m_IsFirstUpdate = false;<br>  }<br>  else<br>  {<br>    // Refresh the output window if not the<br> first update<br>    // NB: doing this on the first update on Windows causes a new  <br>    // renderwindow to spawn (not sure why)<br>   m_InputRenderWindow-&gt;Render();<br>  }<br>  <br>}<br><br>function(s) for fltk and vtk interaction( creation of the<br>vtkrenderwindow and integrating it to the fltk window)  
 <br><br>void<br>migAppBase<br>::CreateWindowWithRWI(vtkFlRenderWindowInteractor *&amp;flrwi, Fl_Window *&amp;flw, char *title)<br>{<br>   // set up main FLTK window<br>   flw = new   Fl_Window(300,330,title);<br>   <br>   // and instantiate vtkFlRenderWindowInteractor (here it acts like a  <br>   // FLTK window, i.e. you   could also<br> instantiate it as child of a<br>   // Fl_Group in a window)<br>   flrwi = new vtkFlRenderWindowInteractor(5,5,290,260,NULL);<br><br>   // this will result in a little message under the rendering  <br>   Fl_Box* box = new Fl_Box(5,261,290,34,<br>                             "3 = stereo, j = joystick, t = trackball, "<br>                           <br> "w = wireframe, s = surface, p = pick; "<br>                            "you can also resize the window");  <br>   box-&gt;labelsize(10);<br>   box-&gt;align(FL_ALIGN_WRAP);<br>   <br>   // we're done populating the flw<br>   flw-&gt;end();<br><br>   // if the main window gets resized, the vtk window
 should resize with it<br>   flw-&gt;resizable(flrwi);  <br>}<br><br>void<br>migAppBase<br>::CreateInputImageVTKPipeline(vtkFlRenderWindowInteractor *flrwi)<br>{<br>  // Abort if the user is   being stupid<br>  if(m_InputImage.IsNull()) <br>    return;<br><br>  // create a rendering window and renderer  <br>  m_InputRenderer =  <br> vtkRenderer::New();<br>  m_InputRenderer-&gt;SetBackground(0.0, 0.0, 0.0);<br>  <br>  m_InputRenderWindow = vtkRenderWindow::New();<br>  m_InputRenderWindow-&gt;AddRenderer(m_InputRenderer);<br>     <br>  // NB: here we treat the vtkFlRenderWindowInteractor just like any other<br>  // old vtkRenderWindowInteractor<br> <br> flrwi-&gt;SetRenderWindow(m_InputRenderWindow);<br><br>  // Hook the VTK pipeline up to the ITK pipeline  <br>  m_InputImageITKtoVTKexporter = itk::VTKImageExport&lt;InputImageType&gt;::New();<br>  m_InputImageVTKimporter = vtkImageImport::New();<br>  m_InputImageITKtoVTKexporter-&gt;SetInput( m_InputImage );<br> 
 ConnectPipelines(m_InputImageITKtoVTKexporter, m_InputImageVTKimporter);  <br><br>  // Need to update prior to creating the cutting planes<br>  m_InputImageITKtoVTKexporter-&gt;Update();<br>    m_InputImageVTKimporter-&gt;Update();<br><br>  // Create the image cutting planes<br>  m_InputImagePlaneX = vtkImagePlaneWidget::New();  <br>   <br> m_InputImagePlaneX-&gt;RestrictPlaneToVolumeOn();<br>  m_InputImagePlaneX-&gt;SetResliceInterpolateToCubic();<br>  m_InputImagePlaneX-&gt;SetInput( (vtkDataSet*) m_InputImageVTKimporter-&gt;GetOutput() );<br>  m_InputImagePlaneX-&gt;SetPlaneOrientationToXAxes();  <br>  m_InputImagePlaneX-&gt;SetSliceIndex( 0 );<br>  <br>  m_InputImagePlaneY =<br> vtkImagePlaneWidget::New();<br>  m_InputImagePlaneY-&gt;RestrictPlaneToVolumeOn();<br>  m_InputImagePlaneY-&gt;SetResliceInterpolateToCubic();  <br>  m_InputImagePlaneY-&gt;SetInput( (vtkDataSet*) m_InputImageVTKimporter-&gt;GetOutput() );<br>  m_InputImagePlaneY-&gt;SetPlaneOrientationToYAxes();<br> 
 m_InputImagePlaneY-&gt;SetSliceIndex( 0 );<br>  // Set the position of the image planes to the center of the volume  <br>  this-&gt;ResetInputImagePlaneWidgets();<br><br>  // Link the image planes to   the interactor<br>  m_InputImagePlaneX-&gt;SetInteractor( flrwi );<br>  m_InputImagePlaneY-&gt;SetInteractor( flrwi );<br><br>  // Turn on the<br> image   plane so they display  <br>  m_InputImagePlaneX-&gt;On();<br>  m_InputImagePlaneY-&gt;On();<br><br>  // just like with any other vtkRenderWindowInteractor(), you HAVE to call<br>  // Initialize() before the interactor will function.  See the docs in  <br>  // vtkRenderWindowInteractor.h<br>  // This must occur AFTER the image planes have<br> been added to the interactor<br>  flrwi-&gt;Initialize();<br><br>  // Clean up memory allocation (NB: not actually deleted until program returns)  <br>  m_InputRenderer-&gt;Delete();<br>  m_InputRenderWindow-&gt;Delete();<br>}<br><br>thx for help<br>any comment is
 welcome<br>Amir</pre></div></div>  <div>  <hr size="1"> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. <a href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.beta.messenger.yahoo.com">Téléchargez</a> la version beta._______________________________________________<br>This is  the private VTK discussion list. <br>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<br>Follow this link to subscribe/unsubscribe:<br>http://www.vtk.org/mailman/listinfo/vtkusers<br></div></blockquote>  <div><br></div>  <div></div>  <hr size="1">  Yahoo! Photos<br>Ring in the New Year with <a href="http://us.rd.yahoo.com/mail_us/taglines/photos/*http://pa.yahoo.com/*http://us.rd.yahoo.com/mail_us/taglines/photos/evt=38087/*http://pg.photos.yahoo.com/ph//page?.file=calendar_splash.html&amp;.dir=">Photo Calendars</a>. Add photos, events, holidays,
 whatever.</blockquote><br></div>  <div>  <hr size="1"> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. <a href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.beta.messenger.yahoo.com">Téléchargez</a> la version beta.</div></blockquote>  <div><br></div><div>   </div><hr size="1">Do you Yahoo!?<br>  With a free 1 GB, there's more in store with <a href="http://us.rd.yahoo.com/mail_us/taglines/mailstorage/*http://mail.yahoo.com/">Yahoo! Mail.</a></blockquote><br></div><p>
                <hr size=1> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
<a href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.beta.messenger.yahoo.com">Téléchargez</a> la version beta.